Esempio n. 1
0
GenObject* ObjList::remove(bool delobj)
{
    GenObject *tmp = m_obj;

    if (m_next) {
	ObjList *n = m_next;
	m_next = n->next();
	m_obj = n->get();
	m_delete = n->m_delete;
	n->m_obj = 0;
	n->m_next = 0;
	n->destruct();
    }
    else
	m_obj = 0;

    if (delobj && tmp) {
	XDebug(DebugInfo,"ObjList::remove() deleting %p",tmp);
	// Don't use TelEngine::destruct(): the compiler will call the non-template
	// function (which doesn't reset the pointer)
	tmp->destruct();
	tmp = 0;
    }
    return tmp;
}
Esempio n. 2
0
GenObject* ObjList::set(const GenObject* obj, bool delold)
{
    if (m_obj == obj)
	return 0;
    GenObject *tmp = m_obj;
    m_obj = const_cast<GenObject*>(obj);
    if (delold && tmp) {
	tmp->destruct();
	return 0;
    }
    return tmp;
}
Esempio n. 3
0
ObjList::~ObjList()
{
#ifdef XDEBUG
    Debugger debug("ObjList::~ObjList()"," [%p]",this);
#endif
    if (m_obj) {
	GenObject *tmp = m_obj;
	m_obj = 0;
	if (m_delete) {
	    XDebug(DebugInfo,"ObjList::~ObjList() deleting %p",tmp);
	    tmp->destruct();
	}
    }
    TelEngine::destruct(m_next);
}