DABC (Data Acquisition Backbone Core)  2.9.9
Data Structures | Public Member Functions | Static Public Member Functions | Protected Types | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Private Types | Private Member Functions | Static Private Member Functions | Static Private Attributes | Friends
dabc::Object Class Reference

Base class for most of the DABC classes. More...

#include <dabc/Object.h>

Inheritance diagram for dabc::Object:
dabc::BufferContainer dabc::CleanupEnvelope< T > dabc::EventsIterator dabc::EventsProducer dabc::Factory dabc::HistoryContainer dabc::LocalTransport dabc::LocalWorker dabc::MemoryContainer dabc::RecordContainer dabc::Thread dabc::Worker dabc::WorkerAddon verbs::Context verbs::PoolRegistry

Data Structures

struct  ConstructorPair
 Structure used to specify arguments for object constructor. More...
 

Public Member Functions

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 const char * ClassName () const
 Returns class name of the object instance. More...
 
virtual bool Find (ConfigIO &cfg)
 Method to locate object in xml file. More...
 
ObjectFindChild (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
 
ObjectGetChild (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...
 
ObjectGetParent () 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)
 
virtual void Print (int lvl=0)
 Print object content on debug output. More...
 
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 ()
 

Static Public Member Functions

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...
 

Protected Types

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...
 
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...
 
virtual ObjectCreateInstance (const std::string &name)
 Method used to create new item to be placed as child of the object. 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...
 
MutexObjectMutex () 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...
 

Static Protected Member Functions

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...
 

Protected Attributes

int fObjectBlock
 counter for blocking calls, as long as non-zero, non of child can be removed More...
 
ReferencesVectorfObjectChilds
 list of the child objects More...
 
unsigned fObjectFlags
 flag, protected by the mutex More...
 
MutexfObjectMutex
 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...
 

Private Types

enum  EState {
  stConstructor = 0 , stNormal = 1 , stWaitForThread = 2 , stDoingDestroy = 3 ,
  stWaitForDestructor = 4 , stDestructor = 5
}
 These are object live stages. More...
 

Private Member Functions

void Constructor ()
 Initializes all variables of the object. More...
 
bool DecReference (bool ask_to_destroy, bool do_decrement=true, bool from_thread=false)
 Decrements reference counter, return true if object must be destroyed. More...
 
void Destructor ()
 Destroys all internal data, reentrant. More...
 
EState GetState () const
 Returns object state value. More...
 
bool IncReference (bool withmutex=true)
 Increments reference counter, return false if it cannot be done. More...
 
void SetCleanupBit ()
 Method set cleanup bit that object will be cleaned up in all registered objects Used only by manager therefore private. More...
 
void SetState (EState st)
 Set object state value. More...
 

Static Private Member Functions

static Reference SearchForChild (Reference &ref, const char *name, bool firsttime, bool force) throw ()
 

Static Private Attributes

static unsigned gNumCreated = 0
 number of created instances, will used for object id More...
 
static unsigned gNumInstances = 0
 actual number of existing instances More...
 

Friends

class Manager
 
class Reference
 

Detailed Description

Base class for most of the DABC classes.

Provides possibility to build thread safe hierarchy of the objects. Has references counter to be sure how many references are existing on this object.

Thread-safety for the Object only has means together with Reference class. Only existence of reference can ensure that object will not be destroyed or completely changed by some other threads. General concept is that object can only be changed if reference counter is equal to 0 (in fact, only in constructor). There is main exception - list child objects can be changed in any moment, therefore to ensure at each moment that child or children objects will not change in meanwhile, one should use references on child. In all other special cases such possibility will be extra marked in documentation. In normal case attempt to change the referenced object will rise an exception.

Definition at line 116 of file Object.h.

Member Enumeration Documentation

◆ EState

enum dabc::Object::EState
private

These are object live stages.

Normally they should go one after another

Enumerator
stConstructor 

state during constructor

stNormal 

state during object normal functioning

stWaitForThread 

object must be cleaned by the thread

stDoingDestroy 

we are inside destroy method

stWaitForDestructor 

one waits unit refcounter decreases

stDestructor 

state during destructor

Definition at line 123 of file Object.h.

◆ EFlags

enum dabc::Object::EFlags
protected
Enumerator
flStateMask 

use 4 bits for state

flIsOwner 

flag indicates default ownership for child objects

flCleanup 

flag indicates that one should cleanup pointer from depended objects

flHasThread 

flag indicates that object has thread and should be cleaned up via thread

flAutoDestroy 

object will be automatically destroyed when no references exists, normally set in constructor, example Command

flLogging 

object is marked to provide logging information, for debug purposes only

flNoMutex 

object will be created without mutex, only can be used in constructor

flHidden 

hide object from hierarchy scan

flChildsHidden 

hide all childs from hierarchy scan

flTopXmlLevel 

object (or folder) can be found on top xml level in the Context

Definition at line 162 of file Object.h.

Constructor & Destructor Documentation

◆ Object() [1/3]

dabc::Object::Object ( const ConstructorPair pair,
unsigned  flags = flIsOwner 
)
protected

Definition at line 132 of file Object.cxx.

◆ Object() [2/3]

dabc::Object::Object ( const std::string &  name,
unsigned  flags = flIsOwner 
)

Resolve problem with child-parent mutex locking.

Now this completely avoidable. Parent pointer was and is safe - as long object is exists parent reference is preserved, only in destructor parent will be released. Child reference can disappear in any time, therefore it was difficult to get reference on child while only pointer is not enough - somebody else can remove it very fast. Therefore fObjectBlock counter is introduced. As long it is non-zero no any removal of childs are allowed. As result, reference on all childs are preserved. One can release parent lock, acquire reference on child (which includes child mutex locking) and after that again parent lock and decrement of block counter. This only limits situation during removal of childs - it all correspondent methods one should respect block counter.

Definition at line 103 of file Object.cxx.

◆ Object() [3/3]

dabc::Object::Object ( Reference  parent,
const std::string &  name,
unsigned  flags = flIsOwner 
)

Definition at line 117 of file Object.cxx.

◆ ~Object()

dabc::Object::~Object ( )
virtual

Definition at line 147 of file Object.cxx.

Member Function Documentation

◆ Constructor()

void dabc::Object::Constructor ( )
private

Initializes all variables of the object.

Definition at line 210 of file Object.cxx.

◆ Destructor()

void dabc::Object::Destructor ( )
private

Destroys all internal data, reentrant.

Definition at line 225 of file Object.cxx.

◆ IncReference()

bool dabc::Object::IncReference ( bool  withmutex = true)
private

Increments reference counter, return false if it cannot be done.

Parameters
[in]withmutexcan indicate that object mutex is already locked and we do not need repeat it again

Definition at line 278 of file Object.cxx.

◆ DecReference()

bool dabc::Object::DecReference ( bool  ask_to_destroy,
bool  do_decrement = true,
bool  from_thread = false 
)
private

Decrements reference counter, return true if object must be destroyed.

somebody else has reference, when it release reference object will be automatically destroyed

Definition at line 317 of file Object.cxx.

◆ GetState()

EState dabc::Object::GetState ( ) const
inlineprivate

Returns object state value.

Definition at line 149 of file Object.h.

◆ SetState()

void dabc::Object::SetState ( EState  st)
inlineprivate

Set object state value.

Definition at line 152 of file Object.h.

◆ SearchForChild()

dabc::Reference dabc::Object::SearchForChild ( Reference ref,
const char *  name,
bool  firsttime,
bool  force 
)
throw (
)
staticprivate

Definition at line 742 of file Object.cxx.

◆ SetCleanupBit()

void dabc::Object::SetCleanupBit ( )
private

Method set cleanup bit that object will be cleaned up in all registered objects Used only by manager therefore private.

Definition at line 297 of file Object.cxx.

◆ GetFlag()

bool dabc::Object::GetFlag ( unsigned  fl) const
inlineprotected

Return value of selected flag, not thread safe

Definition at line 184 of file Object.h.

◆ SetFlag()

void dabc::Object::SetFlag ( unsigned  fl,
bool  on = true 
)
inlineprotected

Change value of selected flag, not thread safe

Definition at line 187 of file Object.h.

◆ ObjectMutex()

Mutex* dabc::Object::ObjectMutex ( ) const
inlineprotected

Returns mutex, used for protection of Object data members.

Definition at line 190 of file Object.h.

◆ NumReferences()

unsigned dabc::Object::NumReferences ( )
protected

Return number of references on the object.

Definition at line 557 of file Object.cxx.

◆ DestroyByOwnThread()

virtual bool dabc::Object::DestroyByOwnThread ( )
inlineprotectedvirtual

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.

Reimplemented in saftdabc::Device, and dabc::Worker.

Definition at line 198 of file Object.h.

◆ DestroyCalledFromOwnThread()

bool dabc::Object::DestroyCalledFromOwnThread ( )
protected

Internal DABC method, should be called by thread which was requested to destroy object.

Definition at line 504 of file Object.cxx.

◆ ObjectCleanup()

void dabc::Object::ObjectCleanup ( )
protectedvirtual

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.

Method is called in context of thread, to which object belongs to. If user redefines this method, he is responsible to call method of parent class

Reimplemented in verbs::PoolRegistry, saftdabc::Device, mbs::ClientTransport, dabc::Worker, dabc::WorkerAddon, dabc::Thread, dabc::SocketConnectAddon, dabc::PoolHandle, dabc::Port, dabc::ParameterContainer, dabc::ModuleSync, dabc::Module, dabc::Device, and dabc::Application.

Definition at line 532 of file Object.cxx.

◆ _DoDeleteItself()

virtual bool dabc::Object::_DoDeleteItself ( )
inlineprotectedvirtual

This method is called at the moment when DecReference think that object can be destroyed and wants to return true.

Object can decide to find another way to the destructor and reject this. After _DoDeleteItself() returns true, it is fully object responsibility to delete itself.

Reimplemented in dabc::Thread.

Definition at line 214 of file Object.h.

◆ SetOwner()

void dabc::Object::SetOwner ( bool  on = true)
protected

Specifies if object will be owner of its new childs.

Definition at line 154 of file Object.cxx.

◆ SetAutoDestroy()

void dabc::Object::SetAutoDestroy ( bool  on = true)
protected

Set autodestroy flag for the object Once enabled, object will be destroyed when last reference will be cleared.

Definition at line 160 of file Object.cxx.

◆ ObjectDestroyed()

virtual void dabc::Object::ObjectDestroyed ( Object )
inlineprotectedvirtual

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.

Reimplemented in dabc::Worker, and verbs::PoolRegistry.

Definition at line 226 of file Object.h.

◆ IsNormalState()

bool dabc::Object::IsNormalState ( )
protected

Return true if object is in normal state.

Typically should used from inside object itself (therefore protected) to reject from the beginning actions which are too complex for object which is started to be destroyed

Definition at line 309 of file Object.cxx.

◆ FillFullName()

void dabc::Object::FillFullName ( std::string &  fullname,
Object upto,
bool  exclude_top_parent = false 
) const
protected

Method used to produce full item name,.

Produced name can be used to find such item in the objects hierarchy

Definition at line 1061 of file Object.cxx.

◆ _IsNormalState()

bool dabc::Object::_IsNormalState ( )
protected

Same as IsNormalState() but without mutex lock - user should lock mutex himself.

Definition at line 303 of file Object.cxx.

◆ CreateInstance()

virtual Object* dabc::Object::CreateInstance ( const std::string &  name)
inlineprotectedvirtual

Method used to create new item to be placed as child of the object.

Reimplemented in dabc::HierarchyContainer.

Definition at line 241 of file Object.h.

◆ _ChildsChanged()

virtual void dabc::Object::_ChildsChanged ( )
inlineprotectedvirtual

Method called when new childs are add or old are removed.

Reimplemented in dabc::HierarchyContainer.

Definition at line 244 of file Object.h.

◆ MakePair() [1/3]

dabc::Object::ConstructorPair dabc::Object::MakePair ( Reference  prnt,
const std::string &  fullname,
bool  withmanager = true 
)
staticprotected

Internal DABC method, used to produce pair - object parent and object name, which is typically should be used as argument in class constructor.

Parameters
[in]prntreference on parent object
[in]fullnamerelative to parent path and name
[in]withmanageridentify if object should be inserted into manager hierarchy (default) or not
Returns
instance of ConstructorPair object

Definition at line 934 of file Object.cxx.

◆ MakePair() [2/3]

dabc::Object::ConstructorPair dabc::Object::MakePair ( Object prnt,
const std::string &  fullname,
bool  withmanager = true 
)
staticprotected

Internal DABC method, used to produce pair - object parent and object name, which is typically should be used as argument in class constructor.

Definition at line 974 of file Object.cxx.

◆ MakePair() [3/3]

dabc::Object::ConstructorPair dabc::Object::MakePair ( const std::string &  fullname,
bool  withmanager = true 
)
staticprotected

Internal DABC method, used to produce pair - object parent and object name, which is typically should be used as argument in class constructor.

Definition at line 979 of file Object.cxx.

◆ GetParent()

Object* dabc::Object::GetParent ( ) const
inline

Returns pointer on parent object, thread safe

Definition at line 286 of file Object.h.

◆ GetParentRef()

Reference dabc::Object::GetParentRef ( ) const
inline
Returns
reference on parent object, thread safe

Definition at line 289 of file Object.h.

◆ IsParent()

bool dabc::Object::IsParent ( Object obj) const

Checks if specified argument is in the list of object parents.

Definition at line 985 of file Object.cxx.

◆ GetName()

const char* dabc::Object::GetName ( ) const
inline

Returns name of the object, thread safe

Definition at line 295 of file Object.h.

◆ IsName() [1/3]

bool dabc::Object::IsName ( const char *  str) const
inline

Checks if object name is same as provided string, thread safe

Definition at line 298 of file Object.h.

◆ IsName() [2/3]

bool dabc::Object::IsName ( const std::string &  str) const
inline

Checks if object name is same as provided string, thread safe

Definition at line 301 of file Object.h.

◆ IsName() [3/3]

bool dabc::Object::IsName ( const char *  str,
int  len 
) const

Checks if object name is same as provided, thread safe

Parameters
[in]strstring with name to be compared
[in]lenspecifies how many characters should be checked if len == 0, method will return false. if len < 0, str will be supposed normal null-terminated string
Returns
true if object name equal to provided string

Definition at line 203 of file Object.cxx.

◆ IsNameMatch()

bool dabc::Object::IsNameMatch ( const std::string &  mask) const

Check if object name match to the mask.

Definition at line 999 of file Object.cxx.

◆ IsOwner()

bool dabc::Object::IsOwner ( ) const

Returns true if object is owner of its children, thread safe

Definition at line 167 of file Object.cxx.

◆ IsLogging()

bool dabc::Object::IsLogging ( ) const

Return true if object selected for logging, thread safe

Definition at line 173 of file Object.cxx.

◆ SetLogging()

void dabc::Object::SetLogging ( bool  on = true)

Sets logging flag, thread safe

Definition at line 197 of file Object.cxx.

◆ IsHidden()

bool dabc::Object::IsHidden ( ) const

Return true if object wants to be hidden from hierarchy scan, thread safe

Definition at line 191 of file Object.cxx.

◆ IsChildsHidden()

bool dabc::Object::IsChildsHidden ( ) const

Return true if object wants to hide childs from hierarchy scan, thread safe

Definition at line 179 of file Object.cxx.

◆ IsTopXmlLevel()

bool dabc::Object::IsTopXmlLevel ( ) const

Return true if object should be searched in the top level of the xml file, thread safe

Definition at line 185 of file Object.cxx.

◆ AddChild()

bool dabc::Object::AddChild ( Object child,
bool  withmutex = true 
)
throw (
)

Add object to list of child objects, thread safe

Parameters
[in]childobject to add
[in]withmutextrue if object mutex should be locked
Returns
true if successful

Definition at line 565 of file Object.cxx.

◆ AddChildAt()

bool dabc::Object::AddChildAt ( Object child,
unsigned  pos,
bool  withmutex = true 
)

Add object to list of child objects at specified position.

Parameters
[in]childobject to add
[in]posposition at which add object, if grater than number of childs, will be add at the end
[in]withmutextrue if object mutex should be locked
Returns
true if successful

Definition at line 570 of file Object.cxx.

◆ RemoveChild()

bool dabc::Object::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.

Definition at line 604 of file Object.cxx.

◆ RemoveChildAt()

bool dabc::Object::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.

Definition at line 665 of file Object.cxx.

◆ RemoveChilds()

bool dabc::Object::RemoveChilds ( bool  cleanup = true)

Remove all childs.

If object is owner and cleanup flag (default) is specified, when childs will be destroyed.

Definition at line 821 of file Object.cxx.

◆ NumChilds()

unsigned dabc::Object::NumChilds ( ) const

returns number of child objects

Definition at line 670 of file Object.cxx.

◆ GetChild()

dabc::Object * dabc::Object::GetChild ( unsigned  n) const

returns pointer on child object

Definition at line 677 of file Object.cxx.

◆ GetChildRef()

dabc::Reference dabc::Object::GetChildRef ( unsigned  n) const

returns reference on child object

Definition at line 684 of file Object.cxx.

◆ GetAllChildRef()

bool dabc::Object::GetAllChildRef ( ReferencesVector vect) const

Definition at line 701 of file Object.cxx.

◆ FindChild()

dabc::Object * dabc::Object::FindChild ( const char *  name) const

returns pointer on child object with given name

Definition at line 730 of file Object.cxx.

◆ FindChildRef()

dabc::Reference dabc::Object::FindChildRef ( const char *  name,
bool  force = false 
) const
throw (
)

returns reference on child object with given name

Definition at line 735 of file Object.cxx.

◆ GetFolder()

dabc::Reference dabc::Object::GetFolder ( const std::string &  name,
bool  force = false 
)
throw (
)

Return folder of specified name, no special symbols allowed.

Parameters
[in]namefolder name
[in]forceif true, missing folder will be created
Returns
reference on the folder

Definition at line 814 of file Object.cxx.

◆ Print()

void dabc::Object::Print ( int  lvl = 0)
virtual

Print object content on debug output.

Reimplemented in dabc::Thread, dabc::RecordContainer, and dabc::Manager.

Definition at line 1092 of file Object.cxx.

◆ ItemName()

std::string dabc::Object::ItemName ( bool  compact = true) const

Produce string, which can be used as name argument in dabc::mgr.FindItem(name) call.

Parameters
[in]compactif true [default], objects belonging to the application will not include application name in their path
Returns
string with item name

Definition at line 1076 of file Object.cxx.

◆ Destroy()

void dabc::Object::Destroy ( Object obj)
throw (
)
static

User method for object destroyment.

In many cases object may not be destroyed immediately while references can exists. Nevertheless, pointer on the object is no longer valid - object can be destroyed in other thread in any time. In some special cases objects cannot be destroyed at all - they will be cleaned by other means (like thread - it is only destroyed by manager when no longer used TODO: probably, one should remove it and always use reference

Definition at line 921 of file Object.cxx.

◆ ClassName()

virtual const char* dabc::Object::ClassName ( ) const
inlinevirtual

◆ Find()

bool dabc::Object::Find ( ConfigIO cfg)
virtual

Method to locate object in xml file.

Can be reimplemented in derived classes to check more attributes like class name

Reimplemented in dabc::Thread::ExecWorker, dabc::Worker, dabc::Module, dabc::MemoryPool, dabc::Manager, dabc::Device, and dabc::Application.

Definition at line 929 of file Object.cxx.

◆ BuildFieldsMap()

virtual void dabc::Object::BuildFieldsMap ( RecordFieldsMap cont)
inlinevirtual

Fill fields map, which is relevant for the object Objects hierarchy produced from dabc::Manager.

Reimplemented in dabc::ParameterContainer, dabc::Module, and dabc::Application.

Definition at line 428 of file Object.h.

◆ NumInstances()

static unsigned dabc::Object::NumInstances ( )
inlinestatic

Static variable counts total number of objects instances.

Definition at line 435 of file Object.h.

◆ InspectGarbageCollector()

void dabc::Object::InspectGarbageCollector ( )
static

\ brief Methods to inspect how many objects pointers are remained

Garbage collector will not remove lost objects itself - one can only watch how many objects and which kind are remain in memory. Method only work when DABC compiled with option "make extrachecks=true"

Definition at line 1099 of file Object.cxx.

◆ NameMatch()

bool dabc::Object::NameMatch ( const std::string &  name,
const std::string &  mask 
)
static

Check if name matches to specified mask.

Mask can include special symbols * and ?

Definition at line 1004 of file Object.cxx.

◆ NameMatchM()

bool dabc::Object::NameMatchM ( const std::string &  name,
const std::string &  mask 
)
static

Check if name matches to specified mask.

Mask can be a list of masks separated by semicolon like name1*:name2*:??name??

Definition at line 1028 of file Object.cxx.

◆ SetName()

void dabc::Object::SetName ( const char *  name)
protected

Changes object name.

Should not be used if any references exists on the object

Definition at line 871 of file Object.cxx.

◆ SetNameDirect()

void dabc::Object::SetNameDirect ( const char *  name)
protected

Changes object name disregard of existing references.

Definition at line 884 of file Object.cxx.

◆ DeleteThis()

void dabc::Object::DeleteThis ( )
protected

Method should be used by the object to delete itself.

Definition at line 509 of file Object.cxx.

Friends And Related Function Documentation

◆ Manager

friend class Manager
friend

Definition at line 117 of file Object.h.

◆ Reference

friend class Reference
friend

Definition at line 118 of file Object.h.

Field Documentation

◆ gNumInstances

unsigned dabc::Object::gNumInstances = 0
staticprivate

actual number of existing instances

Definition at line 132 of file Object.h.

◆ gNumCreated

unsigned dabc::Object::gNumCreated = 0
staticprivate

number of created instances, will used for object id

Definition at line 133 of file Object.h.

◆ fObjectFlags

unsigned dabc::Object::fObjectFlags
protected

flag, protected by the mutex

Definition at line 175 of file Object.h.

◆ fObjectParent

Reference dabc::Object::fObjectParent
protected

reference on the parent object

Definition at line 176 of file Object.h.

◆ fObjectName

std::string dabc::Object::fObjectName
protected

object name

Definition at line 177 of file Object.h.

◆ fObjectMutex

Mutex* dabc::Object::fObjectMutex
protected

mutex protects all private property of the object

Definition at line 178 of file Object.h.

◆ fObjectRefCnt

int dabc::Object::fObjectRefCnt
protected

accounts how many references existing on the object, thread safe

Definition at line 179 of file Object.h.

◆ fObjectChilds

ReferencesVector* dabc::Object::fObjectChilds
protected

list of the child objects

Definition at line 180 of file Object.h.

◆ fObjectBlock

int dabc::Object::fObjectBlock
protected

counter for blocking calls, as long as non-zero, non of child can be removed

Definition at line 181 of file Object.h.


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