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
14class ObjectID;
15class Type;
16class TypeComponentPath;
17class ValueLocation;
18
19
20class StackFrameValueInfos : public BReferenceable {
21public:
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
45private:
46			struct Key;
47			struct InfoEntry;
48			struct InfoEntryHashDefinition;
49
50			typedef BOpenHashTable<InfoEntryHashDefinition> ValueTable;
51
52private:
53			StackFrameValueInfos&	operator=(const StackFrameValueInfos& other);
54
55			void				_Cleanup();
56
57private:
58			ValueTable*			fValues;
59};
60
61
62bool
63StackFrameValueInfos::GetInfo(ObjectID* variable, const TypeComponentPath& path,
64	Type** _type, ValueLocation** _location) const
65{
66	return GetInfo(variable, &path, _type, _location);
67}
68
69
70bool
71StackFrameValueInfos::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