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 14class ObjectID; 15class TypeComponentPath; 16 17 18class StackFrameValues : public BReferenceable { 19public: 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 41private: 42 struct Key; 43 struct ValueEntry; 44 struct ValueEntryHashDefinition; 45 46 typedef BOpenHashTable<ValueEntryHashDefinition> ValueTable; 47 48private: 49 StackFrameValues& operator=(const StackFrameValues& other); 50 51 void _Cleanup(); 52 53private: 54 ValueTable* fValues; 55}; 56 57 58bool 59StackFrameValues::GetValue(ObjectID* variable, const TypeComponentPath& path, 60 BVariant& _value) const 61{ 62 return GetValue(variable, &path, _value); 63} 64 65 66bool 67StackFrameValues::HasValue(ObjectID* variable, const TypeComponentPath& path) 68 const 69{ 70 return HasValue(variable, &path); 71} 72 73 74#endif // STACK_FRAME_VALUES_H 75