1/*
2 * Copyright 2012-2016, Rene Gollent, rene@gollent.com.
3 * Distributed under the terms of the MIT License.
4 */
5#ifndef VALUE_NODE_MANAGER_H
6#define VALUE_NODE_MANAGER_H
7
8#include <Referenceable.h>
9
10#include "ValueNodeContainer.h"
11
12class StackFrame;
13class Thread;
14class Variable;
15
16
17class ValueNodeManager : public BReferenceable,
18	private ValueNodeContainer::Listener {
19public:
20								ValueNodeManager(bool addFrameNodes = true);
21	virtual						~ValueNodeManager();
22
23			status_t			SetStackFrame(::Thread* thread,
24									StackFrame* frame);
25
26			bool				AddListener(
27									ValueNodeContainer::Listener* listener);
28			void				RemoveListener(
29									ValueNodeContainer::Listener* listener);
30
31	virtual	void				ValueNodeChanged(ValueNodeChild* nodeChild,
32									ValueNode* oldNode, ValueNode* newNode);
33	virtual	void				ValueNodeChildrenCreated(ValueNode* node);
34	virtual	void				ValueNodeChildrenDeleted(ValueNode* node);
35	virtual	void				ValueNodeValueChanged(ValueNode* node);
36
37			ValueNodeContainer*	GetContainer() const { return fContainer; };
38
39			status_t			AddChildNodes(ValueNodeChild* nodeChild);
40
41private:
42			typedef BObjectList<ValueNodeContainer::Listener> ListenerList;
43
44			void				_AddNode(Variable* variable);
45			status_t			_CreateValueNode(ValueNodeChild* nodeChild);
46
47private:
48			bool				fAddFrameNodes;
49			ValueNodeContainer*	fContainer;
50			StackFrame*			fStackFrame;
51			::Thread*			fThread;
52			ListenerList		fListeners;
53};
54
55#endif	// VALUE_NODE_MANAGER_H
56