61 if (!src.null()) Assign(src);
70 if (!src.null()) Assign(src);
114 return GetObject() ? GetObject()->NumReferences() : 0;
120 if (GetObject()) GetObject()->SetAutoDestroy(on);
125 if (
null() || !ref.
null())
return false;
126 if (!fObj->IncReference(
false))
141 if (fObj->DecReference(
false))
153 if (fObj->DecReference(
true))
164 return GetObject() ? GetObject()->
GetParent() : 0;
169 return GetObject() ? GetObject()->GetName() :
"---";
174 return GetObject() ? GetObject()->ClassName() :
"---";
179 if ((name==0) || (*name==0) || (GetObject()==0))
return false;
180 return GetObject()->IsName(name);
185 return GetObject() ? GetObject()->ObjectMutex() : 0;
190 return GetObject() ? GetObject()->AddChild(obj,
true) :
false;
196 return GetObject() ? GetObject()->NumChilds() : 0;
201 return GetObject() ? GetObject()->GetChildRef(n) :
Reference();
206 if ((GetObject()==0) || (vect==0))
return false;
207 return GetObject()->GetAllChildRef(vect);
212 return GetObject() ? GetObject()->FindChildRef(name) :
Reference();
217 if (!GetObject())
return false;
219 return GetObject()->RemoveChild(GetObject()->FindChild(name), cleanup);
225 return GetObject() ? GetObject()->RemoveChilds(cleanup) :
true;
238 return GetObject()->GetFolder(name, force);
243 if (GetObject()==0)
return std::string();
245 return GetObject()->ItemName(compact);
250 if (
null() || topitem.
null() || (topitem==*
this))
return "";
254 GetObject()->FillFullName(res, topitem(),
true);
static void Debug(int level, const char *filename, unsigned linenumber, const char *funcname, const char *message)
Base class for most of the DABC classes.
bool IncReference(bool withmutex=true)
Increments reference counter, return false if it cannot be done.
Object * GetParent() const
Returns pointer on parent object, thread safe
const char * GetName() const
Returns name of the object, thread safe
Reference on the arbitrary object
void SetObject(Object *obj, bool withmutex=true)
Direct set of object to reference.
bool AddChild(Object *obj)
Add child to list of object children.
void Release()
Releases reference on the object.
const char * ClassName() const
Return class name of referenced object, if object not assigned, returns "---".
const char * GetName() const
Return name of referenced object, if object not assigned, returns "---".
virtual ~Reference()
Destructor, releases reference on the object.
Reference Take()
Copy reference to output object.
bool GetAllChildRef(ReferencesVector *vect) const
Return references for all childs.
Reference FindChild(const char *name) const
Searches for child in referenced object.
bool RemoveChilds(bool cleanup=true)
Remove all childs in referenced object If cleanup true (default) and object is owner,...
void Print(int lvl=0, const char *from=0) const
Show on debug output content of reference.
bool IsName(const char *name) const
Returns true if object name is the same as specified one.
unsigned NumReferences() const
Returns number of references on the object.
Reference(Object *obj=nullptr)
Constructor, creates reference on the object.
Reference GetFolder(const std::string &name, bool force=false)
Return folder of specified name, no special symbols are allowed.
bool RemoveChild(const char *name, bool cleanup=true)
Remove child with given name and return reference on that child.
Reference & operator=(const Reference &src)
Assignment operator - copy reference.
Object * GetParent() const
Returns pointer on parent object.
unsigned NumChilds() const
Return number of childs in referenced object.
bool null() const
Returns true if reference contains nullptr.
std::string RelativeName(const dabc::Reference &topitem)
Produce name, which can be used to find item, calling topitem.FindChild().
Object * fObj
pointer on the object
std::string ItemName(bool compact=true) const
Produce string, which can be used as name argument in dabc::mgr.FindItem(name) call.
void Assign(const Reference &src)
Method used in copy constructor and assigned operations.
bool AcquireRefWithoutMutex(Reference &ref)
Special method, which allows to generate new reference when object mutex is locked.
void Destroy()
Release reference and starts destroyment of referenced object.
Mutex * ObjectMutex() const
Reference GetChild(unsigned n) const
Return reference on child n.
void SetAutoDestroy(bool on=true)
Set autodestroy flag for the object Once enabled, object will be destroyed when last reference will b...
Reference & operator<<(Reference &src)
Move operator - reference moved from source to target.
Vector of dabc::Reference objects.
std::string format(const char *fmt,...)