1#include <cx/ssdtree/ssdtreeobj.cxh>
2#include <cx/stype/stvar.h>
5 SSD_ByName = -1 // Pass as index to address a child by name
8#define ssditeratorObj(self, clsname) objDynCast(clsname, ssditeratorObjInst(self))
9#define ssdnodeIterLocked(self) ssdnode_iterLocked(self, _ssdCurrentLockState)
11interface SSDIteratorIf extends IteratorIf
17 bool iterOut([sal _When_(return == true, _Out_)] int32 *idx,
18 [sal _When_(return == true, _Out_)] strref *name,
19 [sal _When_(return == true, _Out_)] stvar **val);
22abstract class SSDIterator implements SSDIteratorIf
27 SSDLockState transient_lock_state;
31 [opt] [valid] unbound ObjInst *objInst();
39 // Gets a value. Caller owns the value and must destroy it with stDestroy!
40 bool get(int32 idx, strref name, [sal _When_(return == true, _Out_)] stvar *out, [inout] SSDLockState *_ssdCurrentLockState);
42 // Gets a pointer to a value. This points to the internal storage within the node
43 // so it is only guaranteed to be valid while the read lock is held.
44 [opt] [valid] stvar *ptr(int32 idx, strref name, [inout] SSDLockState *_ssdCurrentLockState);
46 // Sets the given value
47 bool set(int32 idx, strref name, stvar val, [inout] SSDLockState *_ssdCurrentLockState);
49 // Same as setValue but consumes the value
50 // (consumes even on failure)
51 bool setC(int32 idx, strref name, [inout] stvar *val, [inout] SSDLockState *_ssdCurrentLockState);
54 bool remove(int32 idx, strref name, [inout] SSDLockState *_ssdCurrentLockState);
56 // How many values / objects does this node contain?
57 int32 count([inout] SSDLockState *_ssdCurrentLockState);
59 // IMPORTANT NOTE: The generic object iterator interface cannot take any parameters;
60 // thus it always acquires a transient read lock and holds it until the iterator is
61 // destroyed. The caller MUST NOT already have an SSDLock held.
62 // If you want to use iterators inside a larger locked transaction or modify the tree,
63 // use iterLocked() instead.
64 [valid] SSDIterator *iter();
66 SSDIterator *_iterLocked([inout] SSDLockState *_ssdCurrentLockState);
69abstract class SSDNode implements SSDNodeIf implements Iterable
73 // The timestamp this node was last modified
76 // This node is an object that contains values or objects by name
79 // This node is an array that contains values or objects by array index
82 unbound void updateModified();