Added static template method to engine used to remove a component from its engine and destroy it.
git-svn-id: http://voip.null.ro/svn/yate@2296 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
parent
4527e90585
commit
694d9c7a18
|
@ -685,6 +685,19 @@ public:
|
|||
*/
|
||||
Thread* thread() const;
|
||||
|
||||
/**
|
||||
* Helper template used to remove a component descendant from its engine,
|
||||
* destroy it and set the received pointer to 0
|
||||
* @param obj Reference to pointer (lvalue) to the object to remove and destroy
|
||||
*/
|
||||
template <class Obj> static inline void destruct(Obj*& obj) {
|
||||
if (!obj)
|
||||
return;
|
||||
if (obj->engine())
|
||||
obj->engine()->remove(obj);
|
||||
TelEngine::destruct(obj);
|
||||
}
|
||||
|
||||
protected:
|
||||
/**
|
||||
* Method called periodically by the worker thread to keep everything alive
|
||||
|
|
Loading…
Reference in New Issue