27 #include <boost/optional.hpp>
29 #include <olp/dataservice/write/DataServiceWriteApi.h>
32 namespace dataservice {
36 typedef std::string IndexName;
39 enum class DATASERVICE_WRITE_API IndexType {
76 explicit IndexValue(IndexType type) : indexType_(type) {}
101 IndexType indexType_{IndexType::Unsupported};
117 bool booleanValue_{
false};
127 booleanValue_ = std::move(booleanValue);
135 const bool&
GetValue()
const {
return booleanValue_; }
149 void SetValue(
const bool& value) { this->booleanValue_ = value; }
154 int64_t intValue_{0};
164 intValue_ = std::move(intValue);
172 const int64_t&
GetValue()
const {
return intValue_; }
186 void SetValue(
const int64_t& value) { this->intValue_ = value; }
191 std::string stringValue_;
201 :
IndexValue(type), stringValue_{std::move(stringValue)} {}
208 std::string
GetValue()
const {
return stringValue_; }
222 void SetValue(
const std::string& value) { this->stringValue_ = value; }
227 int64_t timeWindowValue_{0};
237 :
IndexValue(type), timeWindowValue_{std::move(timeWindowValue)} {}
244 const int64_t&
GetValue()
const {
return timeWindowValue_; }
259 void SetValue(
const int64_t& value) { this->timeWindowValue_ = value; }
264 int64_t hereTileValue_{0};
274 :
IndexValue(type), hereTileValue_{std::move(hereTileValue)} {}
281 const int64_t&
GetValue()
const {
return hereTileValue_; }
296 void SetValue(
const int64_t& value) { this->hereTileValue_ = value; }
311 class DATASERVICE_WRITE_API
Index final {
323 std::map<IndexName, std::shared_ptr<IndexValue>> indexFields)
324 : id_(std::move(uuid)), indexFields_(std::move(indexFields)) {}
327 boost::optional<std::string> checksum_;
328 boost::optional<std::map<std::string, std::string>> metadata_;
329 boost::optional<int64_t> size_;
331 std::map<IndexName, std::shared_ptr<IndexValue>> indexFields_;
339 const boost::optional<std::string>&
GetCheckSum()
const {
return checksum_; }
353 void SetCheckSum(
const std::string& value) { this->checksum_ = value; }
360 const boost::optional<std::map<std::string, std::string>>&
GetMetadata()
379 void SetMetadata(
const std::map<std::string, std::string>& value) {
380 this->metadata_ = value;
388 const std::string&
GetId()
const {
return id_; }
402 void SetId(
const std::string& value) { this->id_ = value; }
429 const std::map<IndexName, std::shared_ptr<IndexValue>>& value) {
430 this->indexFields_ = value;
438 const boost::optional<int64_t>&
GetSize()
const {
return size_; }
452 void SetSize(
const int64_t& value) { this->size_ = value; }
Represents the index layer of the boolean type.
Definition: Index.h:116
bool & GetMutableValue()
Gets a mutable reference to the boolean value of the index layer.
Definition: Index.h:142
BooleanIndexValue(bool booleanValue, IndexType type)
Creates the BooleanIndexValue instance.
Definition: Index.h:126
void SetValue(const bool &value)
Sets the boolean value.
Definition: Index.h:149
const bool & GetValue() const
Gets the boolean value of the index layer.
Definition: Index.h:135
Represents the index layer with an empty index value.
Definition: Index.h:300
EmptyIndexValue(IndexType type)
Creates the EmptyIndexValue instance.
Definition: Index.h:307
Represents the index layer of the HERE tile type.
Definition: Index.h:263
HereTileIndexValue(int64_t hereTileValue, IndexType type)
Creates the HereTileIndexValue instance.
Definition: Index.h:273
void SetValue(const int64_t &value)
Sets the HERE tile value.
Definition: Index.h:296
int64_t & GetMutableValue()
Gets a mutable reference to the HERE tile value of the index layer.
Definition: Index.h:289
const int64_t & GetValue() const
Gets the HERE tile value of the index layer.
Definition: Index.h:281
Represents values supported by the HERE platform index layer.
Definition: Index.h:69
IndexValue & operator=(IndexValue &&)=default
A default move assignment operator.
IndexValue(const IndexValue &)=default
A default copy constructor.
IndexValue(IndexType type)
Creates the IndexValue instance.
Definition: Index.h:76
IndexValue(IndexValue &&)=default
A default move constructor.
IndexType getIndexType() const
Gets the index value type.
Definition: Index.h:98
virtual ~IndexValue()=default
A default virtual destructor.
IndexValue & operator=(const IndexValue &)=default
A default copy assignment operator.
Represents the index layer.
Definition: Index.h:311
void SetIndexFields(const std::map< IndexName, std::shared_ptr< IndexValue >> &value)
Sets the index value type.
Definition: Index.h:428
void SetId(const std::string &value)
Sets the index layer ID.
Definition: Index.h:402
boost::optional< std::map< std::string, std::string > > & GetMutableMetadata()
Gets a mutable reference to the metadata of the index layer.
Definition: Index.h:370
boost::optional< int64_t > & GetMutableSize()
Gets a mutable reference to the size of the index layer.
Definition: Index.h:445
const boost::optional< int64_t > & GetSize() const
Gets the size of the index layer.
Definition: Index.h:438
Index()=default
A default constructor.
void SetCheckSum(const std::string &value)
Sets the checksum.
Definition: Index.h:353
const std::string & GetId() const
Gets the index layer ID.
Definition: Index.h:388
std::map< IndexName, std::shared_ptr< IndexValue > > & GetMutableIndexFields()
Gets a mutable reference to the index value type.
Definition: Index.h:419
boost::optional< std::string > & GetMutableCheckSum()
Gets a mutable reference to the checksum of the index layer.
Definition: Index.h:346
const std::map< IndexName, std::shared_ptr< IndexValue > > & GetIndexFields() const
Gets the index value type.
Definition: Index.h:409
void SetSize(const int64_t &value)
Sets the size of the index layer.
Definition: Index.h:452
std::string & GetMutableId()
Gets a mutable reference to the index layer ID.
Definition: Index.h:395
const boost::optional< std::string > & GetCheckSum() const
Gets the checksum of the index layer.
Definition: Index.h:339
void SetMetadata(const std::map< std::string, std::string > &value)
Sets the metadata of the index layer.
Definition: Index.h:379
const boost::optional< std::map< std::string, std::string > > & GetMetadata() const
Gets the metadata of the index layer.
Definition: Index.h:360
Index(std::string uuid, std::map< IndexName, std::shared_ptr< IndexValue >> indexFields)
Creates the Index insatnce.
Definition: Index.h:322
Represents the index layer of the integer type.
Definition: Index.h:153
IntIndexValue(int64_t intValue, IndexType type)
Creates the IntIndexValue instance.
Definition: Index.h:163
int64_t & GetMutableValue()
Gets a mutable reference to the integer value of the index layer.
Definition: Index.h:179
const int64_t & GetValue() const
Gets the integer value of the index layer.
Definition: Index.h:172
void SetValue(const int64_t &value)
Sets the integer value.
Definition: Index.h:186
Represents the index layer of the string type.
Definition: Index.h:190
std::string & GetMutableValue()
Gets a mutable reference to the string value of the index layer.
Definition: Index.h:215
std::string GetValue() const
Gets the string value of the index layer.
Definition: Index.h:208
void SetValue(const std::string &value)
Sets the string value.
Definition: Index.h:222
StringIndexValue(std::string stringValue, IndexType type)
Creates the StringIndexValue instance.
Definition: Index.h:200
Represents the index layer of the time window type.
Definition: Index.h:226
void SetValue(const int64_t &value)
Sets the time window value.
Definition: Index.h:259
const int64_t & GetValue() const
Gets the time vindow value of the index layer.
Definition: Index.h:244
TimeWindowIndexValue(int64_t timeWindowValue, IndexType type)
Creates the TimeWindowIndexValue instance.
Definition: Index.h:236
int64_t & GetMutableValue()
Gets a mutable reference to the time window value of the index layer.
Definition: Index.h:252
Represents values that are not supported by the index layer.
Definition: Index.h:105
UnsupportedIndexValue(IndexType type)
Creates the UnsupportedIndexValue instance.
Definition: Index.h:112
Rules all the other namespaces.
Definition: AppleSignInProperties.h:24