27#include <olp/core/porting/optional.h>
28#include <olp/dataservice/write/DataServiceWriteApi.h>
31namespace dataservice {
35typedef std::string IndexName;
38enum class DATASERVICE_WRITE_API IndexType {
75 explicit IndexValue(IndexType type) : indexType_(type) {}
100 IndexType indexType_{IndexType::Unsupported};
116 bool booleanValue_{
false};
126 booleanValue_ = std::move(booleanValue);
134 const bool&
GetValue()
const {
return booleanValue_; }
148 void SetValue(
const bool& value) { this->booleanValue_ = value; }
153 int64_t intValue_{0};
163 intValue_ = std::move(intValue);
171 const int64_t&
GetValue()
const {
return intValue_; }
185 void SetValue(
const int64_t& value) { this->intValue_ = value; }
190 std::string stringValue_;
200 :
IndexValue(type), stringValue_{std::move(stringValue)} {}
207 std::string
GetValue()
const {
return stringValue_; }
221 void SetValue(
const std::string& value) { this->stringValue_ = value; }
226 int64_t timeWindowValue_{0};
236 :
IndexValue(type), timeWindowValue_{std::move(timeWindowValue)} {}
243 const int64_t&
GetValue()
const {
return timeWindowValue_; }
258 void SetValue(
const int64_t& value) { this->timeWindowValue_ = value; }
263 int64_t hereTileValue_{0};
273 :
IndexValue(type), hereTileValue_{std::move(hereTileValue)} {}
280 const int64_t&
GetValue()
const {
return hereTileValue_; }
295 void SetValue(
const int64_t& value) { this->hereTileValue_ = value; }
310class DATASERVICE_WRITE_API
Index final {
322 std::map<IndexName, std::shared_ptr<IndexValue>> indexFields)
323 : id_(std::move(uuid)), indexFields_(std::move(indexFields)) {}
326 porting::optional<std::string> checksum_;
327 porting::optional<std::map<std::string, std::string>> metadata_;
328 porting::optional<int64_t> size_;
330 std::map<IndexName, std::shared_ptr<IndexValue>> indexFields_;
354 void SetCheckSum(
const std::string& value) { this->checksum_ = value; }
361 const porting::optional<std::map<std::string, std::string>>&
GetMetadata()
380 void SetMetadata(
const std::map<std::string, std::string>& value) {
381 this->metadata_ = value;
389 const std::string&
GetId()
const {
return id_; }
403 void SetId(
const std::string& value) { this->id_ = value; }
430 const std::map<IndexName, std::shared_ptr<IndexValue>>& value) {
431 this->indexFields_ = value;
439 const porting::optional<int64_t>&
GetSize()
const {
return size_; }
453 void SetSize(
const int64_t& value) { this->size_ = value; }
Represents the index layer of the boolean type.
Definition Index.h:115
BooleanIndexValue(bool booleanValue, IndexType type)
Creates the BooleanIndexValue instance.
Definition Index.h:125
void SetValue(const bool &value)
Sets the boolean value.
Definition Index.h:148
bool & GetMutableValue()
Gets a mutable reference to the boolean value of the index layer.
Definition Index.h:141
const bool & GetValue() const
Gets the boolean value of the index layer.
Definition Index.h:134
Represents the index layer with an empty index value.
Definition Index.h:299
EmptyIndexValue(IndexType type)
Creates the EmptyIndexValue instance.
Definition Index.h:306
Represents the index layer of the HERE tile type.
Definition Index.h:262
const int64_t & GetValue() const
Gets the HERE tile value of the index layer.
Definition Index.h:280
HereTileIndexValue(int64_t hereTileValue, IndexType type)
Creates the HereTileIndexValue instance.
Definition Index.h:272
void SetValue(const int64_t &value)
Sets the HERE tile value.
Definition Index.h:295
int64_t & GetMutableValue()
Gets a mutable reference to the HERE tile value of the index layer.
Definition Index.h:288
Represents values supported by the HERE platform index layer.
Definition Index.h:68
IndexValue & operator=(const IndexValue &)=default
A default copy assignment operator.
IndexValue(const IndexValue &)=default
A default copy constructor.
IndexValue(IndexType type)
Creates the IndexValue instance.
Definition Index.h:75
IndexValue(IndexValue &&)=default
A default move constructor.
IndexType getIndexType() const
Gets the index value type.
Definition Index.h:97
virtual ~IndexValue()=default
A default virtual destructor.
IndexValue & operator=(IndexValue &&)=default
A default move assignment operator.
Represents the index layer.
Definition Index.h:310
void SetId(const std::string &value)
Sets the index layer ID.
Definition Index.h:403
const porting::optional< std::string > & GetCheckSum() const
Gets the checksum of the index layer.
Definition Index.h:338
Index(std::string uuid, std::map< IndexName, std::shared_ptr< IndexValue > > indexFields)
Creates the Index insatnce.
Definition Index.h:321
const porting::optional< int64_t > & GetSize() const
Gets the size of the index layer.
Definition Index.h:439
Index()=default
A default constructor.
const std::string & GetId() const
Gets the index layer ID.
Definition Index.h:389
void SetCheckSum(const std::string &value)
Sets the checksum.
Definition Index.h:354
const std::map< IndexName, std::shared_ptr< IndexValue > > & GetIndexFields() const
Gets the index value type.
Definition Index.h:410
std::string & GetMutableId()
Gets a mutable reference to the index layer ID.
Definition Index.h:396
std::map< IndexName, std::shared_ptr< IndexValue > > & GetMutableIndexFields()
Gets a mutable reference to the index value type.
Definition Index.h:420
void SetSize(const int64_t &value)
Sets the size of the index layer.
Definition Index.h:453
porting::optional< std::map< std::string, std::string > > & GetMutableMetadata()
Gets a mutable reference to the metadata of the index layer.
Definition Index.h:371
porting::optional< std::string > & GetMutableCheckSum()
Gets a mutable reference to the checksum of the index layer.
Definition Index.h:347
porting::optional< int64_t > & GetMutableSize()
Gets a mutable reference to the size of the index layer.
Definition Index.h:446
const porting::optional< std::map< std::string, std::string > > & GetMetadata() const
Gets the metadata of the index layer.
Definition Index.h:361
void SetMetadata(const std::map< std::string, std::string > &value)
Sets the metadata of the index layer.
Definition Index.h:380
void SetIndexFields(const std::map< IndexName, std::shared_ptr< IndexValue > > &value)
Sets the index value type.
Definition Index.h:429
Represents the index layer of the integer type.
Definition Index.h:152
int64_t & GetMutableValue()
Gets a mutable reference to the integer value of the index layer.
Definition Index.h:178
IntIndexValue(int64_t intValue, IndexType type)
Creates the IntIndexValue instance.
Definition Index.h:162
const int64_t & GetValue() const
Gets the integer value of the index layer.
Definition Index.h:171
void SetValue(const int64_t &value)
Sets the integer value.
Definition Index.h:185
Represents the index layer of the string type.
Definition Index.h:189
std::string GetValue() const
Gets the string value of the index layer.
Definition Index.h:207
std::string & GetMutableValue()
Gets a mutable reference to the string value of the index layer.
Definition Index.h:214
void SetValue(const std::string &value)
Sets the string value.
Definition Index.h:221
StringIndexValue(std::string stringValue, IndexType type)
Creates the StringIndexValue instance.
Definition Index.h:199
Represents the index layer of the time window type.
Definition Index.h:225
void SetValue(const int64_t &value)
Sets the time window value.
Definition Index.h:258
int64_t & GetMutableValue()
Gets a mutable reference to the time window value of the index layer.
Definition Index.h:251
const int64_t & GetValue() const
Gets the time vindow value of the index layer.
Definition Index.h:243
TimeWindowIndexValue(int64_t timeWindowValue, IndexType type)
Creates the TimeWindowIndexValue instance.
Definition Index.h:235
Represents values that are not supported by the index layer.
Definition Index.h:104
UnsupportedIndexValue(IndexType type)
Creates the UnsupportedIndexValue instance.
Definition Index.h:111
Rules all the other namespaces.
Definition AppleSignInProperties.h:24