DABC (Data Acquisition Backbone Core)
2.9.9
|
#include <dabc/Hierarchy.h>
Public Member Functions | |
Buffer & | bindata () |
void | BuildObjectsHierarchy (const Reference &top) |
virtual const char * | ClassName () const |
Returns class name of the object instance. More... | |
uint64_t | GetChildsVersion () const |
uint64_t | GetVersion () const |
HierarchyContainer (const std::string &name) | |
bool | IsNodeChanged (bool withchilds=true) |
Returns true if any node field was changed or removed/inserted If specified, all childs will be checked. More... | |
uint64_t | StoreSize (unsigned kind=stream_Full, uint64_t v=0, unsigned hist_limit=0) |
bool | Stream (iostream &s, unsigned kind=stream_Full, uint64_t v=0, unsigned hist_limit=0) |
virtual | ~HierarchyContainer () |
Public Member Functions inherited from dabc::RecordContainer | |
RecordFieldsMap & | Fields () const |
virtual void | Print (int lvl=0) |
Print object content on debug output. More... | |
virtual | ~RecordContainer () |
Public Member Functions inherited from dabc::Object | |
bool | AddChild (Object *child, bool withmutex=true) throw () |
Add object to list of child objects, thread safe More... | |
bool | AddChildAt (Object *child, unsigned pos, bool withmutex=true) |
Add object to list of child objects at specified position. More... | |
virtual void | BuildFieldsMap (RecordFieldsMap *cont) |
Fill fields map, which is relevant for the object Objects hierarchy produced from dabc::Manager. More... | |
virtual bool | Find (ConfigIO &cfg) |
Method to locate object in xml file. More... | |
Object * | FindChild (const char *name) const |
returns pointer on child object with given name More... | |
Reference | FindChildRef (const char *name, bool force=false) const throw () |
returns reference on child object with given name More... | |
bool | GetAllChildRef (ReferencesVector *vect) const |
Object * | GetChild (unsigned n) const |
returns pointer on child object More... | |
Reference | GetChildRef (unsigned n) const |
returns reference on child object More... | |
Reference | GetFolder (const std::string &name, bool force=false) throw () |
Return folder of specified name, no special symbols allowed. More... | |
const char * | GetName () const |
Returns name of the object, thread safe More... | |
Object * | GetParent () const |
Returns pointer on parent object, thread safe More... | |
Reference | GetParentRef () const |
bool | IsChildsHidden () const |
Return true if object wants to hide childs from hierarchy scan, thread safe More... | |
bool | IsHidden () const |
Return true if object wants to be hidden from hierarchy scan, thread safe More... | |
bool | IsLogging () const |
Return true if object selected for logging, thread safe More... | |
bool | IsName (const char *str) const |
Checks if object name is same as provided string, thread safe More... | |
bool | IsName (const char *str, int len) const |
Checks if object name is same as provided, thread safe More... | |
bool | IsName (const std::string &str) const |
Checks if object name is same as provided string, thread safe More... | |
bool | IsNameMatch (const std::string &mask) const |
Check if object name match to the mask. More... | |
bool | IsOwner () const |
Returns true if object is owner of its children, thread safe More... | |
bool | IsParent (Object *obj) const |
Checks if specified argument is in the list of object parents. More... | |
bool | IsTopXmlLevel () const |
Return true if object should be searched in the top level of the xml file, thread safe More... | |
std::string | ItemName (bool compact=true) const |
Produce string, which can be used as name argument in dabc::mgr.FindItem(name) call. More... | |
unsigned | NumChilds () const |
returns number of child objects More... | |
Object (const std::string &name, unsigned flags=flIsOwner) | |
Resolve problem with child-parent mutex locking. More... | |
Object (Reference parent, const std::string &name, unsigned flags=flIsOwner) | |
bool | RemoveChild (Object *child, bool cleanup=true) throw () |
Detach child from parent object If cleanup==true and parent is owner of child, child will be destroyed. More... | |
bool | RemoveChildAt (unsigned n, bool cleanup=true) throw () |
Detach child object from parent at specified position If cleanup==true and object is owner of child, child will be destroyed. More... | |
bool | RemoveChilds (bool cleanup=true) |
Remove all childs. More... | |
void | SetLogging (bool on=true) |
Sets logging flag, thread safe More... | |
virtual | ~Object () |
Protected Types | |
enum | { maskFieldsStored = 1 , maskChildsStored = 2 , maskDiffStored = 4 , maskHistory = 8 } |
Protected Types inherited from dabc::Object | |
enum | EFlags { flStateMask = 0x000f , flIsOwner = 0x0010 , flCleanup = 0x0020 , flHasThread = 0x0040 , flAutoDestroy = 0x0080 , flLogging = 0x0100 , flNoMutex = 0x0200 , flHidden = 0x0400 , flChildsHidden = 0x0800 , flTopXmlLevel = 0x1000 } |
Protected Member Functions | |
virtual void | _ChildsChanged () |
Method called when new childs are add or old are removed. More... | |
void | AddHistory (RecordFieldsMap *diff) |
Add new entry to history. More... | |
bool | CheckIfDoingHistory () |
Return true if history activated for the node If necessary, history object will be initialized. More... | |
void | ClearHistoryEntries () |
Clear all entries in history, but not history object itself. More... | |
HierarchyContainer * | CreateChildAt (const std::string &name, int indx) |
Create child with specified name. More... | |
void | CreateHMutex () |
virtual Object * | CreateInstance (const std::string &name) |
Method used to create new item to be placed as child of the object. More... | |
bool | DuplicateHierarchyFrom (HierarchyContainer *cont) |
Duplicate hierarchy from provided container. More... | |
void | EnableTimeRecording (bool withchilds=true) |
Enable time recording for hierarchy element every time when item is changed. More... | |
bool | ExtractHistoryStep (RecordFieldsMap *fields, unsigned step) |
Extract values of specified history step. More... | |
uint64_t | GetNextVersion () const |
std::string | ItemName () |
void | MarkChangedItems (uint64_t tm=0) |
Central method, which analyzes all possible changes in node (and its childs) If any changes found, node marked with new version If enabled, history item will be created. More... | |
void | MarkReading (bool withchilds, bool readvalues, bool readchilds) |
Mark reading flags. More... | |
unsigned | MarkVersionIfChanged (uint64_t ver, uint64_t &tm, bool withchilds) |
If item changed, marked with version, time stamp applied, history recording returns mask with changes - 1 - any child node was changed, 2 - hierarchy was changed. More... | |
virtual bool | SaveTo (HStore &res, bool create_node=true) |
Save hierarchy in json/xml form. More... | |
void | SetModified (bool node, bool hierarchy, bool recursive=false) |
Switch on node or hierarchy modified flags. More... | |
void | SetVersion (uint64_t v) |
HierarchyContainer * | TopParent () |
bool | UpdateHierarchyFrom (HierarchyContainer *cont) |
Update hierarchy from provided container. More... | |
Protected Member Functions inherited from dabc::RecordContainer | |
virtual std::string | FieldName (unsigned cnt) const |
virtual RecordField | GetField (const std::string &name) const |
virtual bool | HasField (const std::string &name) const |
virtual unsigned | NumFields () const |
RecordContainer (const std::string &name, unsigned flags=flIsOwner) | |
RecordContainer (Reference parent, const std::string &name, unsigned flags=flIsOwner) | |
virtual bool | RemoveField (const std::string &name) |
virtual bool | SetField (const std::string &name, const RecordField &v) |
void | SetFieldsMap (RecordFieldsMap *newmap) |
Replaces existing fields map. More... | |
RecordFieldsMap * | TakeFieldsMap () |
Remove map and returns to the user. More... | |
Protected Member Functions inherited from dabc::Object | |
virtual bool | _DoDeleteItself () |
This method is called at the moment when DecReference think that object can be destroyed and wants to return true. More... | |
bool | _IsNormalState () |
Same as IsNormalState() but without mutex lock - user should lock mutex himself. More... | |
void | DeleteThis () |
Method should be used by the object to delete itself. More... | |
virtual bool | DestroyByOwnThread () |
Internal DABC method, used to activate object cleanup via object thread Returns: false - object cannot be cleanup by the thread, true - thread guarantees that DestroyCalledFromOwnThread() will be called from thread context. More... | |
bool | DestroyCalledFromOwnThread () |
Internal DABC method, should be called by thread which was requested to destroy object. More... | |
void | FillFullName (std::string &fullname, Object *upto, bool exclude_top_parent=false) const |
Method used to produce full item name,. More... | |
bool | GetFlag (unsigned fl) const |
Return value of selected flag, not thread safe More... | |
bool | IsNormalState () |
Return true if object is in normal state. More... | |
unsigned | NumReferences () |
Return number of references on the object. More... | |
Object (const ConstructorPair &pair, unsigned flags=flIsOwner) | |
virtual void | ObjectCleanup () |
User method to cleanup object content before it will be destroyed Main motivation is to release any references on other objects to avoid any cross-references and as result deadlocks in objects cleanup. More... | |
virtual void | ObjectDestroyed (Object *) |
Method called by the manager when registered dependent object is destroyed Should be used in user class to clear all references on the object to let destroy it. More... | |
Mutex * | ObjectMutex () const |
Returns mutex, used for protection of Object data members. More... | |
void | SetAutoDestroy (bool on=true) |
Set autodestroy flag for the object Once enabled, object will be destroyed when last reference will be cleared. More... | |
void | SetFlag (unsigned fl, bool on=true) |
Change value of selected flag, not thread safe More... | |
void | SetName (const char *name) |
Changes object name. More... | |
void | SetNameDirect (const char *name) |
Changes object name disregard of existing references. More... | |
void | SetOwner (bool on=true) |
Specifies if object will be owner of its new childs. More... | |
Protected Attributes | |
bool | fAutoTime |
when enabled, by node change (not hierarchy) time attribute will be set More... | |
Buffer | fBinData |
binary data, assigned with element More... | |
bool | fChildsChanged |
indicate if something was changed in the hierarchy More... | |
uint64_t | fChildsVersion |
Version of hierarchy structure Childs version is changed when any childs is changed or inserted/removed. More... | |
bool | fDisableChildsReading |
when true, non of childs should be read More... | |
bool | fDisableDataReading |
when true, non of data (fields and history) need to be read in streamer More... | |
bool | fDisableReadingAsChild |
when true, object will not be updated when provided as child More... | |
Mutex * | fHierarchyMutex |
mutex, which should be use for access to hierarchy and all its childs More... | |
History | fHist |
special object with history data More... | |
bool | fNamesChanged |
indicate if DNS structure was changed (either childs or relevant dabc fields) More... | |
uint64_t | fNamesVersion |
Version used in DNS requests. More... | |
bool | fNodeChanged |
indicate if something was changed in the node during update More... | |
uint64_t | fNodeVersion |
Version number of the node Any changes in the node will cause changes of the version. More... | |
bool | fPermanent |
indicate that item is permanent and should be excluded from update More... | |
Protected Attributes inherited from dabc::RecordContainer | |
RecordFieldsMap * | fFields |
Protected Attributes inherited from dabc::Object | |
int | fObjectBlock |
counter for blocking calls, as long as non-zero, non of child can be removed More... | |
ReferencesVector * | fObjectChilds |
list of the child objects More... | |
unsigned | fObjectFlags |
flag, protected by the mutex More... | |
Mutex * | fObjectMutex |
mutex protects all private property of the object More... | |
std::string | fObjectName |
object name More... | |
Reference | fObjectParent |
reference on the parent object More... | |
int | fObjectRefCnt |
accounts how many references existing on the object, thread safe More... | |
Friends | |
class | Hierarchy |
class | HistoryIter |
class | HistoryIterContainer |
Additional Inherited Members | |
Static Public Member Functions inherited from dabc::Object | |
static void | Destroy (Object *obj) throw () |
User method for object destroyment. More... | |
static void | InspectGarbageCollector () |
\ brief Methods to inspect how many objects pointers are remained More... | |
static bool | NameMatch (const std::string &name, const std::string &mask) |
Check if name matches to specified mask. More... | |
static bool | NameMatchM (const std::string &name, const std::string &mask) |
Check if name matches to specified mask. More... | |
static unsigned | NumInstances () |
Static variable counts total number of objects instances. More... | |
Static Protected Member Functions inherited from dabc::Object | |
static ConstructorPair | MakePair (const std::string &fullname, bool withmanager=true) |
Internal DABC method, used to produce pair - object parent and object name, which is typically should be used as argument in class constructor. More... | |
static ConstructorPair | MakePair (Object *prnt, const std::string &fullname, bool withmanager=true) |
Internal DABC method, used to produce pair - object parent and object name, which is typically should be used as argument in class constructor. More... | |
static ConstructorPair | MakePair (Reference prnt, const std::string &fullname, bool withmanager=true) |
Internal DABC method, used to produce pair - object parent and object name, which is typically should be used as argument in class constructor. More... | |
Definition at line 138 of file Hierarchy.h.
|
protected |
Enumerator | |
---|---|
maskFieldsStored | |
maskChildsStored | |
maskDiffStored | |
maskHistory |
Definition at line 146 of file Hierarchy.h.
dabc::HierarchyContainer::HierarchyContainer | ( | const std::string & | name | ) |
Definition at line 158 of file Hierarchy.cxx.
|
virtual |
Definition at line 182 of file Hierarchy.cxx.
|
protected |
Definition at line 202 of file Hierarchy.cxx.
|
protected |
Definition at line 573 of file Hierarchy.cxx.
|
protected |
Create child with specified name.
If indx value specified, child will be created or kept at this position All intermediate childs will be removed
Definition at line 555 of file Hierarchy.cxx.
|
protected |
Update hierarchy from provided container.
Some field or childs could be extracted and change there ownership
Definition at line 476 of file Hierarchy.cxx.
|
protected |
Duplicate hierarchy from provided container.
Childs or fields can be updated or inserted, nothing will be deleted
Definition at line 453 of file Hierarchy.cxx.
|
protected |
Switch on node or hierarchy modified flags.
Definition at line 441 of file Hierarchy.cxx.
|
protected |
Add new entry to history.
Definition at line 603 of file Hierarchy.cxx.
|
protected |
Extract values of specified history step.
Definition at line 612 of file Hierarchy.cxx.
|
protected |
Clear all entries in history, but not history object itself.
Definition at line 624 of file Hierarchy.cxx.
|
protected |
Return true if history activated for the node If necessary, history object will be initialized.
Definition at line 649 of file Hierarchy.cxx.
|
protected |
If item changed, marked with version, time stamp applied, history recording returns mask with changes - 1 - any child node was changed, 2 - hierarchy was changed.
Definition at line 690 of file Hierarchy.cxx.
|
protected |
Mark reading flags.
Definition at line 677 of file Hierarchy.cxx.
|
protected |
Central method, which analyzes all possible changes in node (and its childs) If any changes found, node marked with new version If enabled, history item will be created.
If enabled, time stamp will be provided for changed items
tm | provides time which will be set for changed items, if =0 (default), current time will be used |
Definition at line 761 of file Hierarchy.cxx.
|
protected |
Enable time recording for hierarchy element every time when item is changed.
Definition at line 782 of file Hierarchy.cxx.
|
inlineprotectedvirtual |
Method used to create new item to be placed as child of the object.
Reimplemented from dabc::Object.
Definition at line 238 of file Hierarchy.h.
|
inlineprotectedvirtual |
Method called when new childs are add or old are removed.
Reimplemented from dabc::Object.
Definition at line 240 of file Hierarchy.h.
|
protected |
Definition at line 748 of file Hierarchy.cxx.
|
inlineprotected |
Definition at line 244 of file Hierarchy.h.
|
protected |
Definition at line 197 of file Hierarchy.cxx.
|
protectedvirtual |
Save hierarchy in json/xml form.
Reimplemented from dabc::RecordContainer.
Definition at line 403 of file Hierarchy.cxx.
|
inlinevirtual |
Returns class name of the object instance.
In some cases class name used to correctly locate object in xml file
Reimplemented from dabc::RecordContainer.
Definition at line 255 of file Hierarchy.h.
uint64_t dabc::HierarchyContainer::StoreSize | ( | unsigned | kind = stream_Full , |
uint64_t | v = 0 , |
||
unsigned | hist_limit = 0 |
||
) |
Definition at line 216 of file Hierarchy.cxx.
bool dabc::HierarchyContainer::Stream | ( | iostream & | s, |
unsigned | kind = stream_Full , |
||
uint64_t | v = 0 , |
||
unsigned | hist_limit = 0 |
||
) |
Definition at line 224 of file Hierarchy.cxx.
bool dabc::HierarchyContainer::IsNodeChanged | ( | bool | withchilds = true | ) |
Returns true if any node field was changed or removed/inserted If specified, all childs will be checked.
Definition at line 631 of file Hierarchy.cxx.
|
inline |
Definition at line 265 of file Hierarchy.h.
|
inline |
Definition at line 267 of file Hierarchy.h.
void dabc::HierarchyContainer::BuildObjectsHierarchy | ( | const Reference & | top | ) |
Definition at line 581 of file Hierarchy.cxx.
|
inline |
Definition at line 271 of file Hierarchy.h.
|
friend |
Definition at line 140 of file Hierarchy.h.
|
friend |
Definition at line 141 of file Hierarchy.h.
|
friend |
Definition at line 142 of file Hierarchy.h.
|
protected |
Version number of the node Any changes in the node will cause changes of the version.
version number of node itself
Definition at line 155 of file Hierarchy.h.
|
protected |
Version used in DNS requests.
Changed when any childs add/removed or dns-relevant fields are changed This version is used by name services to detect and update possible changes in hierarchy and do not care about any other values changes
Definition at line 161 of file Hierarchy.h.
|
protected |
Version of hierarchy structure Childs version is changed when any childs is changed or inserted/removed.
version number of hierarchy below
Definition at line 165 of file Hierarchy.h.
|
protected |
when enabled, by node change (not hierarchy) time attribute will be set
Definition at line 167 of file Hierarchy.h.
|
protected |
indicate that item is permanent and should be excluded from update
Definition at line 169 of file Hierarchy.h.
|
protected |
indicate if something was changed in the node during update
Definition at line 171 of file Hierarchy.h.
|
protected |
indicate if DNS structure was changed (either childs or relevant dabc fields)
Definition at line 172 of file Hierarchy.h.
|
protected |
indicate if something was changed in the hierarchy
Definition at line 173 of file Hierarchy.h.
|
protected |
when true, non of data (fields and history) need to be read in streamer
Definition at line 175 of file Hierarchy.h.
|
protected |
when true, non of childs should be read
Definition at line 176 of file Hierarchy.h.
|
protected |
when true, object will not be updated when provided as child
Definition at line 177 of file Hierarchy.h.
|
protected |
binary data, assigned with element
Definition at line 179 of file Hierarchy.h.
|
protected |
special object with history data
Definition at line 181 of file Hierarchy.h.
|
protected |
mutex, which should be use for access to hierarchy and all its childs
Definition at line 183 of file Hierarchy.h.