olp-cpp-sdk  1.22.0
Partitions.h
1 /*
2  * Copyright (C) 2019-2023 HERE Europe B.V.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  * SPDX-License-Identifier: Apache-2.0
17  * License-Filename: LICENSE
18  */
19 
20 #pragma once
21 
22 #include <string>
23 #include <utility>
24 #include <vector>
25 
26 #include <boost/optional.hpp>
27 
28 #include <olp/dataservice/read/DataServiceReadApi.h>
29 
30 namespace olp {
31 namespace dataservice {
32 namespace read {
33 namespace model {
34 
38 class DATASERVICE_READ_API Partition {
39  public:
40  Partition() = default;
41  Partition(const Partition&) = default;
42  Partition(Partition&&) = default;
43  Partition& operator=(const Partition&) = default;
44  Partition& operator=(Partition&&) = default;
45  virtual ~Partition() = default;
46 
47  private:
48  boost::optional<std::string> checksum_;
49  boost::optional<int64_t> compressed_data_size_;
50  std::string data_handle_;
51  boost::optional<int64_t> data_size_;
52  boost::optional<std::string> crc_;
53  std::string partition_;
54  boost::optional<int64_t> version_;
55 
56  public:
69  const boost::optional<std::string>& GetChecksum() const { return checksum_; }
77  boost::optional<std::string>& GetMutableChecksum() { return checksum_; }
85  void SetChecksum(boost::optional<std::string> value) {
86  this->checksum_ = std::move(value);
87  }
88 
100  const boost::optional<int64_t>& GetCompressedDataSize() const {
101  return compressed_data_size_;
102  }
112  boost::optional<int64_t>& GetMutableCompressedDataSize() {
113  return compressed_data_size_;
114  }
123  void SetCompressedDataSize(boost::optional<int64_t> value) {
124  this->compressed_data_size_ = value;
125  }
126 
138  const std::string& GetDataHandle() const { return data_handle_; }
146  std::string& GetMutableDataHandle() { return data_handle_; }
154  void SetDataHandle(std::string value) {
155  this->data_handle_ = std::move(value);
156  }
157 
169  const boost::optional<int64_t>& GetDataSize() const { return data_size_; }
180  boost::optional<int64_t>& GetMutableDataSize() { return data_size_; }
189  void SetDataSize(boost::optional<int64_t> value) { this->data_size_ = value; }
190 
200  const boost::optional<std::string>& GetCrc() const { return crc_; }
208  boost::optional<std::string>& GetMutableCrc() { return crc_; }
216  void SetCrc(boost::optional<std::string> value) {
217  this->crc_ = std::move(value);
218  }
219 
230  const std::string& GetPartition() const { return partition_; }
238  std::string& GetMutablePartition() { return partition_; }
246  void SetPartition(std::string value) { this->partition_ = std::move(value); }
247 
258  const boost::optional<int64_t>& GetVersion() const { return version_; }
268  boost::optional<int64_t>& GetMutableVersion() { return version_; }
277  void SetVersion(boost::optional<int64_t> value) { this->version_ = value; }
278 };
279 
283 class Partitions {
284  public:
285  Partitions() = default;
286  Partitions(const Partitions&) = default;
287  Partitions(Partitions&&) = default;
288  Partitions& operator=(const Partitions&) = default;
289  Partitions& operator=(Partitions&&) = default;
290  virtual ~Partitions() = default;
291 
292  private:
293  std::vector<Partition> partitions_;
294 
295  public:
301  const std::vector<Partition>& GetPartitions() const { return partitions_; }
308  std::vector<Partition>& GetMutablePartitions() { return partitions_; }
314  void SetPartitions(std::vector<Partition> value) {
315  this->partitions_ = std::move(value);
316  }
317 };
318 
319 } // namespace model
320 } // namespace read
321 } // namespace dataservice
322 } // namespace olp
A model that represents a partition in a layer.
Definition: Partitions.h:38
const boost::optional< int64_t > & GetVersion() const
(Optional) Gets the version of the catalog when this partition was last changed.
Definition: Partitions.h:258
const boost::optional< int64_t > & GetDataSize() const
(Optional) Gets the uncompressed size of the partition data in bytes.
Definition: Partitions.h:169
boost::optional< int64_t > & GetMutableVersion()
(Optional) Gets a mutable reference to the version of the catalog when this partition was last change...
Definition: Partitions.h:268
const boost::optional< int64_t > & GetCompressedDataSize() const
(Optional) Gets the compressed size of the partition data in bytes when data compression is enabled.
Definition: Partitions.h:100
const std::string & GetPartition() const
Gets the partition key.
Definition: Partitions.h:230
std::string & GetMutableDataHandle()
Gets a mutable reference to the partition data handle.
Definition: Partitions.h:146
void SetCrc(boost::optional< std::string > value)
(Optional) Sets the partition crc.
Definition: Partitions.h:216
boost::optional< int64_t > & GetMutableCompressedDataSize()
(Optional) Gets a mutable reference to the compressed size of the partition data in bytes when data c...
Definition: Partitions.h:112
void SetPartition(std::string value)
Sets the partition key.
Definition: Partitions.h:246
void SetCompressedDataSize(boost::optional< int64_t > value)
(Optional) Sets the compressed size of the partition data.
Definition: Partitions.h:123
boost::optional< std::string > & GetMutableCrc()
(Optional) Gets a mutable reference to the partition crc.
Definition: Partitions.h:208
std::string & GetMutablePartition()
Gets a mutable reference to the partition key.
Definition: Partitions.h:238
boost::optional< int64_t > & GetMutableDataSize()
(Optional) Gets a mutable reference to the uncompressed size of the partition data in bytes.
Definition: Partitions.h:180
boost::optional< std::string > & GetMutableChecksum()
(Optional) Gets a mutable reference to the partition checksum.
Definition: Partitions.h:77
void SetDataHandle(std::string value)
Sets the partition data handle.
Definition: Partitions.h:154
const std::string & GetDataHandle() const
Get the partition data handle.
Definition: Partitions.h:138
void SetChecksum(boost::optional< std::string > value)
(Optional) Sets the partition checksum.
Definition: Partitions.h:85
const boost::optional< std::string > & GetCrc() const
Definition: Partitions.h:200
const boost::optional< std::string > & GetChecksum() const
(Optional) Gets the partition checksum.
Definition: Partitions.h:69
void SetVersion(boost::optional< int64_t > value)
(Optional) Sets the partition version.
Definition: Partitions.h:277
void SetDataSize(boost::optional< int64_t > value)
(Optional) Sets the uncompressed size of the partition data.
Definition: Partitions.h:189
A model that represents a collection of layer partitions.
Definition: Partitions.h:283
const std::vector< Partition > & GetPartitions() const
Gets the list of partitions for the given layer and layer version.
Definition: Partitions.h:301
std::vector< Partition > & GetMutablePartitions()
Gets a mutable reference to the list of partitions for the given layer and layer version.
Definition: Partitions.h:308
void SetPartitions(std::vector< Partition > value)
Sets the list of partitions.
Definition: Partitions.h:314
Rules all the other namespaces.
Definition: AppleSignInProperties.h:24