1 /*
2 * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
3 * Distributed under the terms of the MIT License.
4 */
5 #ifndef STACK_FRAME_VALUES_H
6 #define STACK_FRAME_VALUES_H
7
8
9 #include <Referenceable.h>
10 #include <util/OpenHashTable.h>
11 #include <Variant.h>
12
13
14 class ObjectID;
15 class TypeComponentPath;
16
17
18 class StackFrameValues : public BReferenceable {
19 public:
20 StackFrameValues();
21 StackFrameValues(const StackFrameValues& other);
22 // throws std::bad_alloc
23 virtual ~StackFrameValues();
24
25 status_t Init();
26
27 bool GetValue(ObjectID* variable,
28 const TypeComponentPath* path,
29 BVariant& _value) const;
30 inline bool GetValue(ObjectID* variable,
31 const TypeComponentPath& path,
32 BVariant& _value) const;
33 bool HasValue(ObjectID* variable,
34 const TypeComponentPath* path) const;
35 inline bool HasValue(ObjectID* variable,
36 const TypeComponentPath& path) const;
37 status_t SetValue(ObjectID* variable,
38 TypeComponentPath* path,
39 const BVariant& value);
40
41 private:
42 struct Key;
43 struct ValueEntry;
44 struct ValueEntryHashDefinition;
45
46 typedef BOpenHashTable<ValueEntryHashDefinition> ValueTable;
47
48 private:
49 StackFrameValues& operator=(const StackFrameValues& other);
50
51 void _Cleanup();
52
53 private:
54 ValueTable* fValues;
55 };
56
57
58 bool
GetValue(ObjectID * variable,const TypeComponentPath & path,BVariant & _value)59 StackFrameValues::GetValue(ObjectID* variable, const TypeComponentPath& path,
60 BVariant& _value) const
61 {
62 return GetValue(variable, &path, _value);
63 }
64
65
66 bool
HasValue(ObjectID * variable,const TypeComponentPath & path)67 StackFrameValues::HasValue(ObjectID* variable, const TypeComponentPath& path)
68 const
69 {
70 return HasValue(variable, &path);
71 }
72
73
74 #endif // STACK_FRAME_VALUES_H
75