]> gerrit.simantics Code Review - simantics/platform.git/blob - 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
1 #pragma once\r
2 \r
3 #include "Value.h"\r
4 \r
5 #include <string>\r
6 #include <map>\r
7 \r
8 namespace Databoard {\r
9         namespace Value {\r
10 \r
11                 struct ValueComparison {\r
12                         bool operator()(Value* const &a, Value* const &b) const;\r
13                 };\r
14 \r
15                 typedef std::map<Value*, Value*, ValueComparison> MKVMap;\r
16 \r
17                 class DATABOARD_API MapValue : public Value {\r
18                 public:\r
19                         MapValue(Databoard::Type::DataType* dataBoard);\r
20                         virtual ~MapValue();\r
21 \r
22                         virtual std::string writeOut(int indent = 0);\r
23                         virtual bool equals(const Value* other);\r
24                         virtual std::string isValid();\r
25 \r
26                         bool put(Value* key, Value* value);\r
27                         int count();\r
28 \r
29                         Value* get(Value* key);\r
30                         bool containsKey(Value* key);\r
31                         Value* remove(Value* key);\r
32                         void clear();\r
33 \r
34                         // startkey inclusive, endkey exclusive\r
35                         // https://www.simantics.org/wiki/index.php/Databoard_Specification#Order\r
36                         void removeRange(Value* startKey, Value* endKey);\r
37 \r
38                         Value* getCeiling(Value* key);\r
39                         Value* getFlooring(Value* key);\r
40                         Value* getHighest();\r
41                         Value* getLowest();\r
42                         Value* getHigher(Value* key);\r
43                         Value* getLower(Value* key);\r
44 \r
45                 protected:\r
46 \r
47                         MKVMap values;\r
48 \r
49                 };\r
50         }\r
51 }\r