X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.databoard%2Fcpp%2FDataBoardTest%2FDataBoard%2FMapValue.h;fp=bundles%2Forg.simantics.databoard%2Fcpp%2FDataBoardTest%2FDataBoard%2FMapValue.h;h=c1af2accb74a826a0a99c51ed0a42614dc1d3625;hb=969bd23cab98a79ca9101af33334000879fb60c5;hp=0000000000000000000000000000000000000000;hpb=866dba5cd5a3929bbeae85991796acb212338a08;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.databoard/cpp/DataBoardTest/DataBoard/MapValue.h b/bundles/org.simantics.databoard/cpp/DataBoardTest/DataBoard/MapValue.h new file mode 100644 index 000000000..c1af2accb --- /dev/null +++ b/bundles/org.simantics.databoard/cpp/DataBoardTest/DataBoard/MapValue.h @@ -0,0 +1,51 @@ +#pragma once + +#include "Value.h" + +#include +#include + +namespace Databoard { + namespace Value { + + struct ValueComparison { + bool operator()(Value* const &a, Value* const &b) const; + }; + + typedef std::map MKVMap; + + class DATABOARD_API MapValue : public Value { + public: + MapValue(Databoard::Type::DataType* dataBoard); + virtual ~MapValue(); + + virtual std::string writeOut(int indent = 0); + virtual bool equals(const Value* other); + virtual std::string isValid(); + + bool put(Value* key, Value* value); + int count(); + + Value* get(Value* key); + bool containsKey(Value* key); + Value* remove(Value* key); + void clear(); + + // startkey inclusive, endkey exclusive + // https://www.simantics.org/wiki/index.php/Databoard_Specification#Order + void removeRange(Value* startKey, Value* endKey); + + Value* getCeiling(Value* key); + Value* getFlooring(Value* key); + Value* getHighest(); + Value* getLowest(); + Value* getHigher(Value* key); + Value* getLower(Value* key); + + protected: + + MKVMap values; + + }; + } +}