xref: /haiku/headers/private/debugger/model/StackFrameValueInfos.h (revision 1deede7388b04dbeec5af85cae7164735ea9e70d)
1 /*
2  * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
3  * Distributed under the terms of the MIT License.
4  */
5 #ifndef STACK_FRAME_VALUE_INFOS_H
6 #define STACK_FRAME_VALUE_INFOS_H
7 
8 
9 #include <Referenceable.h>
10 #include <util/OpenHashTable.h>
11 #include <Variant.h>
12 
13 
14 class ObjectID;
15 class Type;
16 class TypeComponentPath;
17 class ValueLocation;
18 
19 
20 class StackFrameValueInfos : public BReferenceable {
21 public:
22 								StackFrameValueInfos();
23 	virtual						~StackFrameValueInfos();
24 
25 			status_t			Init();
26 
27 			bool				GetInfo(ObjectID* variable,
28 									const TypeComponentPath* path,
29 									Type** _type, ValueLocation** _location)
30 										const;
31 									// returns references
32 	inline	bool				GetInfo(ObjectID* variable,
33 									const TypeComponentPath& path,
34 									Type** _type, ValueLocation** _location)
35 										const;
36 									// returns references
37 			bool				HasInfo(ObjectID* variable,
38 									const TypeComponentPath* path) const;
39 	inline	bool				HasInfo(ObjectID* variable,
40 									const TypeComponentPath& path) const;
41 			status_t			SetInfo(ObjectID* variable,
42 									TypeComponentPath* path, Type* type,
43 									ValueLocation* location);
44 
45 private:
46 			struct Key;
47 			struct InfoEntry;
48 			struct InfoEntryHashDefinition;
49 
50 			typedef BOpenHashTable<InfoEntryHashDefinition> ValueTable;
51 
52 private:
53 			StackFrameValueInfos&	operator=(const StackFrameValueInfos& other);
54 
55 			void				_Cleanup();
56 
57 private:
58 			ValueTable*			fValues;
59 };
60 
61 
62 bool
63 StackFrameValueInfos::GetInfo(ObjectID* variable, const TypeComponentPath& path,
64 	Type** _type, ValueLocation** _location) const
65 {
66 	return GetInfo(variable, &path, _type, _location);
67 }
68 
69 
70 bool
71 StackFrameValueInfos::HasInfo(ObjectID* variable, const TypeComponentPath& path)
72 	const
73 {
74 	return HasInfo(variable, &path);
75 }
76 
77 
78 #endif	// STACK_FRAME_VALUE_INFOS_H
79