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