Yate
GenObject Class Reference

#include <yateclass.h>

Inheritance diagram for GenObject:
Cipher DataBlock DnsRecord GenPointer< Obj > GenericVector< Obj > HashList MatchingItemBase ObjList ObjVector RefObject SocketAddr SocketFilter String ClientFileItem ClientLogic MathVectorBase MessageDispatcher MessageReceiver MimeBody Plugin TranslatorFactory Window XmlChild

Public Member Functions

 GenObject ()
 
virtual ~GenObject ()
 
virtual bool alive () const
 
virtual void destruct ()
 
virtual const StringtoString () const
 
virtual const StringtraceId () const
 
virtual void * getObject (const String &name) const
 
NamedCountergetObjCounter () const
 
NamedCountersetObjCounter (NamedCounter *counter)
 

Static Public Member Functions

static void * getObject (const String &name, const GenObject *obj)
 
static bool getObjCounting ()
 
static void setObjCounting (bool enable)
 
static NamedCountergetObjCounter (const String &name, bool create=true)
 
static ObjListgetObjCounters ()
 

Detailed Description

An object with just a public virtual destructor

Constructor & Destructor Documentation

◆ GenObject()

GenObject ( )

Default constructor

◆ ~GenObject()

virtual ~GenObject ( )
inlinevirtual

Destructor.

Member Function Documentation

◆ alive()

virtual bool alive ( ) const
virtual

Check if the object is still valid and safe to access. Note that you should not trust this result unless the object is locked by other means.

Returns
True if the object is still useable

Reimplemented in RefObject.

◆ destruct()

virtual void destruct ( )
virtual

Destroys the object, disposes the memory.

Reimplemented in RefObject, ClientLogic, ClientSound, and MessageHandler.

Referenced by ClientSound::destruct().

◆ getObjCounter() [1/2]

NamedCounter * getObjCounter ( ) const
inline

Get the counter of this object

Returns
Pointer to current counter object

Referenced by TempObjectCounter::TempObjectCounter(), and TempObjectCounter::TempObjectCounter().

◆ getObjCounter() [2/2]

static NamedCounter * getObjCounter ( const String & name,
bool create = true )
static

Retrieve or allocate an object counter

Parameters
nameName of the counter
createTrue to create a new counter if needed
Returns
Pointer to existing or new counter object

◆ getObjCounters()

static ObjList & getObjCounters ( )
static

Access the object counters list

Returns
Reference to the global object counters list

◆ getObjCounting()

static bool getObjCounting ( )
inlinestatic

Get the global state of object counting

Returns
True if object counting is enabled

◆ getObject() [1/2]

virtual void * getObject ( const String & name) const
virtual

Get a pointer to a derived class given that class name

Parameters
nameName of the class we are asking for
Returns
Pointer to the requested class or NULL if this object doesn't implement it

Reimplemented in Array, Cipher, HashList, NamedList, NamedPointer, NamedString, ObjList, ObjVector, RefObject, SocketFilter, SocketRef, String, CallEndpoint, Channel, DataConsumer, DataEndpoint, DataSource, DataTranslator, Driver, Message, MimeAuthLine, MimeBinaryBody, MimeBody, MimeHeaderLine, MimeLinesBody, MimeMultipartBody, MimeSdpBody, MimeStringBody, Module, and Plugin.

Referenced by getObject().

◆ getObject() [2/2]

static void * getObject ( const String & name,
const GenObject * obj )
inlinestatic

Helper method to get the pointer to a derived class

Parameters
nameName of the class we are asking for
objPointer to the object to get derived class from
Returns
Pointer to the requested class or NULL if this object doesn't implement it

References getObject().

◆ setObjCounter()

NamedCounter * setObjCounter ( NamedCounter * counter)

Set the counter of this object

Parameters
counterNew counter object or NULL
Returns
Pointer to old counter object

◆ setObjCounting()

static void setObjCounting ( bool enable)
inlinestatic

Set the global state of object counting

Parameters
enableTrue to enable object counting, false to disable

◆ toString()

virtual const String & toString ( ) const
virtual

Get a string representation of this object

Returns
A reference to a String representing this object which is either null, the object itself (for objects derived from String) or some form of identification

Reimplemented in GenericVector< Obj >, MatchingItemBase, NamedString, String, CallEndpoint, ClientAccount, ClientContact, ClientFileItem, ClientLogic, ClientResource, DataEndpoint, DurationUpdate, Plugin, SharedVars, Window, and XmlElement.

Referenced by XPath::anyValue().

◆ traceId()

virtual const String & traceId ( ) const
virtual

Get the trace ID associated with this object

Returns
The trace ID or an empty string

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