DABC (Data Acquisition Backbone Core)  2.9.9
Private Member Functions
dabc::Hierarchy Class Reference

Represents objects hierarchy of remote (or local) DABC process. More...

#include <dabc/Hierarchy.h>

Inheritance diagram for dabc::Hierarchy:
dabc::Record dabc::Reference

Private Member Functions

void BuildNew (Reference top)
 Build objects hierarchy, referenced by top. More...
 
void Create (const std::string &name, bool withmutex=false)
 Create top-level object with specified name. More...
 
Hierarchy CreateFolder (const std::string &name)
 Create folder in hierarchy, one could use it to add new childs to it. More...
 
Hierarchy CreateHChild (const std::string &name, bool allowslahes=false, bool sortorder=false)
 Create child item in hierarchy with specified name If allowslahes enabled, instead of subfolders item with coded name will be created. More...
 
bool DettachFromParent ()
 Detach from parent object. More...
 
void DisableReading (bool withchlds=true)
 Mark all elements that non of data will be read. More...
 
void DisableReadingAsChild ()
 Disable reading of element when it appears as child in the structure. More...
 
bool Duplicate (const Hierarchy &src)
 Duplicate hierarchy from the source. More...
 
void EnableHistory (unsigned length=100, bool withchilds=false)
 Activate history production for selected element and its childs. More...
 
void EnableReading (const Hierarchy &upto=nullptr)
 Enable element and all its parents to read data. More...
 
void EnableTimeRecording (bool withchilds=true)
 Enable time recording for hierarchy element every time when item is changed. More...
 
const RecordFieldField (const std::string &name) const
 
bool FillBinHeader (const std::string &itemname, dabc::Command &cmd, uint64_t mhash=0, const std::string &dflt_master_name="")
 Fill binary header with item and master versions. More...
 
std::string FindBinaryProducer (std::string &request_name, bool topmost=true)
 Search for parent element, where binary_producer property is specified Returns name of binary producer and item name, which should be requested (relative to producer itself) More...
 
Hierarchy FindChild (const char *name)
 Return child element from hierarchy. More...
 
Hierarchy FindMaster () const
 Find master item It is used in ROOT to specify position of streamer info. More...
 
Hierarchy GetHChild (const std::string &name, bool allowslahes=false, bool force=false, bool sortorder=false)
 Return child, if necessary creates with full subfolder If force specified, missing childs and folders will be recreated If allowslahes enabled, instead of subfolders item with coded name will be created. More...
 
MutexGetHMutex () const
 
Hierarchy GetTop () const
 Returns reference on the top element of the hierarchy. More...
 
uint64_t GetVersion () const
 Returns actual version of hierarchy entry. More...
 
bool HasActualRemoteHistory () const
 Returns true if remote history is recorded and it is up-to-date. More...
 
bool HasLocalHistory () const
 Returns true if item records history local, no need to request any other sources. More...
 
bool IsAnyFieldChanged () const
 
bool IsBinItemChanged (const std::string &itemname, uint64_t hash, uint64_t last_version=0)
 Return true if one could suppose that binary item is changed and binary data must be regenerated. More...
 
std::string ItemName () const
 Name which is used as item name in hierarchy. More...
 
HistoryIter MakeHistoryIter ()
 Produce history iterator. More...
 
void MarkChangedItems (uint64_t tm=0)
 If any field was modified, item will be marked with new version. More...
 
bool ReadFromBuffer (const dabc::Buffer &buf)
 Read hierarchy from buffer. More...
 
bool RemoveEmptyFolders (const std::string &path)
 Removes folder and its parents as long as no other childs are present. More...
 
bool RemoveHChild (const std::string &name, bool allowslahes=false)
 Delete H item, including all empty parent folders. More...
 
dabc::Buffer SaveToBuffer (unsigned kind=stream_Full, uint64_t version=0, unsigned hlimit=0)
 Save hierarchy in binary form, relative to specified version. More...
 
void SetPermanent (bool on=true)
 Mark item as permanent - it will not be touched when update from other places will be done. More...
 
void SetVersion (uint64_t v)
 Change version of the item, only for advanced usage. More...
 
bool Update (Hierarchy &src)
 Reconstruct complete hierarchy, setting node/structure modifications fields correctly. More...
 
bool UpdateFromBuffer (const dabc::Buffer &buf, HierarchyStreamKind kind=stream_Full)
 Apply modification to hierarchy, using stored binary data
More...
 

Additional Inherited Members

- Public Member Functions inherited from dabc::Reference
bool AddChild (Object *obj)
 Add child to list of object children. More...
 
const char * ClassName () const
 Return class name of referenced object, if object not assigned, returns "---". More...
 
void Destroy () throw ()
 Release reference and starts destroyment of referenced object. More...
 
Reference FindChild (const char *name) const
 Searches for child in referenced object. More...
 
bool GetAllChildRef (ReferencesVector *vect) const
 Return references for all childs. More...
 
Reference GetChild (unsigned n) const
 Return reference on child n. More...
 
Reference GetFolder (const std::string &name, bool force=false) throw ()
 Return folder of specified name, no special symbols are allowed. More...
 
const char * GetName () const
 Return name of referenced object, if object not assigned, returns "---". More...
 
ObjectGetObject () const
 Return pointer on the object. More...
 
ObjectGetParent () const
 Returns pointer on parent object. More...
 
Reference GetParentRef () const
 Returns reference on parent object. More...
 
bool IsName (const char *name) const
 Returns true if object name is the same as specified one. More...
 
std::string ItemName (bool compact=true) const
 Produce string, which can be used as name argument in dabc::mgr.FindItem(name) call. More...
 
bool null () const
 Returns true if reference contains nullptr. More...
 
unsigned NumChilds () const
 Return number of childs in referenced object. More...
 
unsigned NumReferences () const
 Returns number of references on the object. More...
 
bool operator! () const
 Returns true if reference contains nullptr. More...
 
bool operator!= (const Reference &src) const
 Compare operator - return true if references refer to different object. More...
 
bool operator!= (Object *obj) const
 Compare operator - return true if reference refer to different objects. More...
 
Objectoperator() () const
 Return pointer on the object. More...
 
Referenceoperator<< (Reference &src) throw ()
 Move operator - reference moved from source to target. More...
 
Referenceoperator= (const Reference &src) throw ()
 Assignment operator - copy reference. More...
 
Referenceoperator= (Object *obj) throw ()
 Assignment operator - copy reference. More...
 
bool operator== (const Reference &src) const
 Compare operator - return true if references refer to same object. More...
 
bool operator== (Object *obj) const
 Compare operator - return true if reference refer to same object. More...
 
void Print (int lvl=0, const char *from=0) const
 Show on debug output content of reference. More...
 
 Reference (const Reference &src) throw ()
 Copy constructor, if source is transient than source reference will be emptied. More...
 
 Reference (Object *obj=nullptr)
 Constructor, creates reference on the object. More...
 
std::string RelativeName (const dabc::Reference &topitem)
 Produce name, which can be used to find item, calling topitem.FindChild(). More...
 
void Release () throw ()
 Releases reference on the object. More...
 
bool RemoveChild (const char *name, bool cleanup=true)
 Remove child with given name and return reference on that child. More...
 
bool RemoveChilds (bool cleanup=true)
 Remove all childs in referenced object If cleanup true (default) and object is owner, all objects will be destroyed. 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 SetObject (Object *obj, bool withmutex=true)
 Direct set of object to reference. More...
 
Reference Take ()
 Copy reference to output object. More...
 
virtual ~Reference ()
 Destructor, releases reference on the object. More...
 
- Protected Member Functions inherited from dabc::Reference
bool AcquireRefWithoutMutex (Reference &ref)
 Special method, which allows to generate new reference when object mutex is locked. More...
 
void Assign (const Reference &src)
 Method used in copy constructor and assigned operations. More...
 
MutexObjectMutex () const
 
template<class T >
bool verify_object (Object *src, T *&tgt)
 Method used in reference constructor/assignments to verify is object is suitable. More...
 
- Protected Attributes inherited from dabc::Reference
ObjectfObj
 pointer on the object More...
 

Detailed Description

Represents objects hierarchy of remote (or local) DABC process.

Idea to completely replicate folder structure with many attributes, which are stored into HierarchyContainer class. One should be able to convert such hierarchy to/from xml file. Idea to create such hierarchy is to able provide different clients to monitor and control DABC process.

Definition at line 285 of file Hierarchy.h.

Member Function Documentation

◆ Create()

void dabc::Hierarchy::Create ( const std::string &  name,
bool  withmutex = false 
)
private

Create top-level object with specified name.

Definition at line 934 of file Hierarchy.cxx.

◆ GetHMutex()

Mutex* dabc::Hierarchy::GetHMutex ( ) const
inlineprivate

Definition at line 292 of file Hierarchy.h.

◆ FindMaster()

dabc::Hierarchy dabc::Hierarchy::FindMaster ( ) const
private

Find master item It is used in ROOT to specify position of streamer info.

Definition at line 1035 of file Hierarchy.cxx.

◆ FindBinaryProducer()

std::string dabc::Hierarchy::FindBinaryProducer ( std::string &  request_name,
bool  topmost = true 
)
private

Search for parent element, where binary_producer property is specified Returns name of binary producer and item name, which should be requested (relative to producer itself)

topmost identify where in hierarchy producer property will be searched

Definition at line 1098 of file Hierarchy.cxx.

◆ Field()

const RecordField& dabc::Hierarchy::Field ( const std::string &  name) const
inlineprivate

Definition at line 304 of file Hierarchy.h.

◆ IsAnyFieldChanged()

bool dabc::Hierarchy::IsAnyFieldChanged ( ) const
inlineprivate

Definition at line 306 of file Hierarchy.h.

◆ BuildNew()

void dabc::Hierarchy::BuildNew ( Reference  top)
private

Build objects hierarchy, referenced by top.

Definition at line 795 of file Hierarchy.cxx.

◆ SetPermanent()

void dabc::Hierarchy::SetPermanent ( bool  on = true)
inlineprivate

Mark item as permanent - it will not be touched when update from other places will be done.

Definition at line 312 of file Hierarchy.h.

◆ Update()

bool dabc::Hierarchy::Update ( dabc::Hierarchy src)
private

Reconstruct complete hierarchy, setting node/structure modifications fields correctly.

source hierarchy can be modified to reuse fields inside

Definition at line 802 of file Hierarchy.cxx.

◆ Duplicate()

bool dabc::Hierarchy::Duplicate ( const Hierarchy src)
private

Duplicate hierarchy from the source.

Existing items are preserved

Definition at line 821 of file Hierarchy.cxx.

◆ EnableHistory()

void dabc::Hierarchy::EnableHistory ( unsigned  length = 100,
bool  withchilds = false 
)
private

Activate history production for selected element and its childs.

Definition at line 837 of file Hierarchy.cxx.

◆ EnableTimeRecording()

void dabc::Hierarchy::EnableTimeRecording ( bool  withchilds = true)
inlineprivate

Enable time recording for hierarchy element every time when item is changed.

Definition at line 326 of file Hierarchy.h.

◆ MarkChangedItems()

void dabc::Hierarchy::MarkChangedItems ( uint64_t  tm = 0)
inlineprivate

If any field was modified, item will be marked with new version.

Definition at line 330 of file Hierarchy.h.

◆ HasLocalHistory()

bool dabc::Hierarchy::HasLocalHistory ( ) const
private

Returns true if item records history local, no need to request any other sources.

Definition at line 857 of file Hierarchy.cxx.

◆ HasActualRemoteHistory()

bool dabc::Hierarchy::HasActualRemoteHistory ( ) const
private

Returns true if remote history is recorded and it is up-to-date.

Definition at line 863 of file Hierarchy.cxx.

◆ SaveToBuffer()

dabc::Buffer dabc::Hierarchy::SaveToBuffer ( unsigned  kind = stream_Full,
uint64_t  version = 0,
unsigned  hlimit = 0 
)
private

Save hierarchy in binary form, relative to specified version.

Definition at line 873 of file Hierarchy.cxx.

◆ ReadFromBuffer()

bool dabc::Hierarchy::ReadFromBuffer ( const dabc::Buffer buf)
private

Read hierarchy from buffer.

Definition at line 896 of file Hierarchy.cxx.

◆ UpdateFromBuffer()

bool dabc::Hierarchy::UpdateFromBuffer ( const dabc::Buffer buf,
HierarchyStreamKind  kind = stream_Full 
)
private

Apply modification to hierarchy, using stored binary data

Definition at line 912 of file Hierarchy.cxx.

◆ GetVersion()

uint64_t dabc::Hierarchy::GetVersion ( ) const
inlineprivate

Returns actual version of hierarchy entry.

Definition at line 349 of file Hierarchy.h.

◆ SetVersion()

void dabc::Hierarchy::SetVersion ( uint64_t  v)
inlineprivate

Change version of the item, only for advanced usage.

Definition at line 352 of file Hierarchy.h.

◆ IsBinItemChanged()

bool dabc::Hierarchy::IsBinItemChanged ( const std::string &  itemname,
uint64_t  hash,
uint64_t  last_version = 0 
)
private

Return true if one could suppose that binary item is changed and binary data must be regenerated.

First of all version is proved and than hash (if available)

Definition at line 1047 of file Hierarchy.cxx.

◆ FillBinHeader()

bool dabc::Hierarchy::FillBinHeader ( const std::string &  itemname,
dabc::Command cmd,
uint64_t  mhash = 0,
const std::string &  dflt_master_name = "" 
)
private

Fill binary header with item and master versions.

Definition at line 1070 of file Hierarchy.cxx.

◆ FindChild()

Hierarchy dabc::Hierarchy::FindChild ( const char *  name)
inlineprivate

Return child element from hierarchy.

Definition at line 362 of file Hierarchy.h.

◆ RemoveEmptyFolders()

bool dabc::Hierarchy::RemoveEmptyFolders ( const std::string &  path)
private

Removes folder and its parents as long as no other childs are present.

Definition at line 1117 of file Hierarchy.cxx.

◆ ItemName()

std::string dabc::Hierarchy::ItemName ( ) const
private

Name which is used as item name in hierarchy.

Name of top object is not included

Definition at line 1133 of file Hierarchy.cxx.

◆ GetTop()

dabc::Hierarchy dabc::Hierarchy::GetTop ( ) const
private

Returns reference on the top element of the hierarchy.

Definition at line 1139 of file Hierarchy.cxx.

◆ DettachFromParent()

bool dabc::Hierarchy::DettachFromParent ( )
private

Detach from parent object.

Definition at line 1150 of file Hierarchy.cxx.

◆ DisableReading()

void dabc::Hierarchy::DisableReading ( bool  withchlds = true)
private

Mark all elements that non of data will be read.

Definition at line 1157 of file Hierarchy.cxx.

◆ DisableReadingAsChild()

void dabc::Hierarchy::DisableReadingAsChild ( )
private

Disable reading of element when it appears as child in the structure.

Definition at line 1162 of file Hierarchy.cxx.

◆ EnableReading()

void dabc::Hierarchy::EnableReading ( const Hierarchy upto = nullptr)
private

Enable element and all its parents to read data.

Definition at line 1167 of file Hierarchy.cxx.

◆ GetHChild()

dabc::Hierarchy dabc::Hierarchy::GetHChild ( const std::string &  name,
bool  allowslahes = false,
bool  force = false,
bool  sortorder = false 
)
private

Return child, if necessary creates with full subfolder If force specified, missing childs and folders will be recreated If allowslahes enabled, instead of subfolders item with coded name will be created.

Definition at line 944 of file Hierarchy.cxx.

◆ CreateHChild()

Hierarchy dabc::Hierarchy::CreateHChild ( const std::string &  name,
bool  allowslahes = false,
bool  sortorder = false 
)
inlineprivate

Create child item in hierarchy with specified name If allowslahes enabled, instead of subfolders item with coded name will be created.

Definition at line 392 of file Hierarchy.h.

◆ RemoveHChild()

bool dabc::Hierarchy::RemoveHChild ( const std::string &  name,
bool  allowslahes = false 
)
private

Delete H item, including all empty parent folders.

Definition at line 1018 of file Hierarchy.cxx.

◆ CreateFolder()

Hierarchy dabc::Hierarchy::CreateFolder ( const std::string &  name)
inlineprivate

Create folder in hierarchy, one could use it to add new childs to it.

Definition at line 399 of file Hierarchy.h.

◆ MakeHistoryIter()

dabc::HistoryIter dabc::Hierarchy::MakeHistoryIter ( )
private

Produce history iterator.

Definition at line 1236 of file Hierarchy.cxx.


The documentation for this class was generated from the following files: