Make UEFI boot-platform build again
[haiku.git] / headers / private / debugger / value / ValueNodeContainer.h
blob3f10c5b3603fdb1cfe6f8cd82f5fcbc3a09c945a
1 /*
2 * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
3 * Distributed under the terms of the MIT License.
4 */
5 #ifndef VALUE_NODE_CONTAINER_H
6 #define VALUE_NODE_CONTAINER_H
9 #include <Locker.h>
11 #include <ObjectList.h>
12 #include <Referenceable.h>
15 class ValueNode;
16 class ValueNodeChild;
19 class ValueNodeContainer : public BReferenceable {
20 public:
21 class Listener;
23 public:
24 ValueNodeContainer();
25 virtual ~ValueNodeContainer();
27 status_t Init();
29 inline bool Lock() { return fLock.Lock(); }
30 inline void Unlock() { fLock.Unlock(); }
32 int32 CountChildren() const;
33 ValueNodeChild* ChildAt(int32 index) const;
34 bool AddChild(ValueNodeChild* child);
35 void RemoveChild(ValueNodeChild* child);
36 void RemoveAllChildren();
38 bool AddListener(Listener* listener);
39 void RemoveListener(Listener* listener);
41 // container must be locked
43 void NotifyValueNodeChanged(
44 ValueNodeChild* nodeChild,
45 ValueNode* oldNode, ValueNode* newNode);
46 void NotifyValueNodeChildrenCreated(ValueNode* node);
47 void NotifyValueNodeChildrenDeleted(ValueNode* node);
48 void NotifyValueNodeValueChanged(ValueNode* node);
50 private:
51 typedef BObjectList<ValueNodeChild> NodeChildList;
52 typedef BObjectList<Listener> ListenerList;
54 private:
55 BLocker fLock;
56 NodeChildList fChildren;
57 ListenerList fListeners;
61 class ValueNodeContainer::Listener {
62 public:
63 virtual ~Listener();
65 // container is locked
67 virtual void ValueNodeChanged(ValueNodeChild* nodeChild,
68 ValueNode* oldNode, ValueNode* newNode);
69 virtual void ValueNodeChildrenCreated(ValueNode* node);
70 virtual void ValueNodeChildrenDeleted(ValueNode* node);
71 virtual void ValueNodeValueChanged(ValueNode* node);
75 #endif // VALUE_NODE_CONTAINER_H