]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.databoard/cpp/DataBoardTest/DataBoard/MapValue.h
Migrated source code from Simantics SVN
[simantics/platform.git] / bundles / org.simantics.databoard / cpp / DataBoardTest / DataBoard / MapValue.h
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 (file)
index 0000000..c1af2ac
--- /dev/null
@@ -0,0 +1,51 @@
+#pragma once\r
+\r
+#include "Value.h"\r
+\r
+#include <string>\r
+#include <map>\r
+\r
+namespace Databoard {\r
+       namespace Value {\r
+\r
+               struct ValueComparison {\r
+                       bool operator()(Value* const &a, Value* const &b) const;\r
+               };\r
+\r
+               typedef std::map<Value*, Value*, ValueComparison> MKVMap;\r
+\r
+               class DATABOARD_API MapValue : public Value {\r
+               public:\r
+                       MapValue(Databoard::Type::DataType* dataBoard);\r
+                       virtual ~MapValue();\r
+\r
+                       virtual std::string writeOut(int indent = 0);\r
+                       virtual bool equals(const Value* other);\r
+                       virtual std::string isValid();\r
+\r
+                       bool put(Value* key, Value* value);\r
+                       int count();\r
+\r
+                       Value* get(Value* key);\r
+                       bool containsKey(Value* key);\r
+                       Value* remove(Value* key);\r
+                       void clear();\r
+\r
+                       // startkey inclusive, endkey exclusive\r
+                       // https://www.simantics.org/wiki/index.php/Databoard_Specification#Order\r
+                       void removeRange(Value* startKey, Value* endKey);\r
+\r
+                       Value* getCeiling(Value* key);\r
+                       Value* getFlooring(Value* key);\r
+                       Value* getHighest();\r
+                       Value* getLowest();\r
+                       Value* getHigher(Value* key);\r
+                       Value* getLower(Value* key);\r
+\r
+               protected:\r
+\r
+                       MKVMap values;\r
+\r
+               };\r
+       }\r
+}\r