Yate: GenObject Class Reference

Yate

- Main Page
- Namespaces
- Classes
- Files

- Class List
- Class Hierarchy
- Class Members

Public Member Functions | Static Public Member Functions | List of all members
GenObject Class Reference

`#include <yateclass.h>`

Inheritance diagram for GenObject:

## Public Member Functions
| GenObject ()
virtual | ~GenObject ()
virtual bool | alive () const
virtual void | destruct ()
virtual const String & | toString () const
virtual const String & | traceId () const
virtual void * | getObject (const String &name) const
NamedCounter * | getObjCounter () const
NamedCounter * | setObjCounter (NamedCounter *counter)

## Static Public Member Functions
static void * | getObject (const String &name, const GenObject *obj)
static bool | getObjCounting ()
static void | setObjCounting (bool enable)
static NamedCounter * | getObjCounter (const String &name, bool create=true)
static ObjList & | getObjCounters ()

## Detailed Description

An object with just a public virtual destructor

## Constructor & Destructor Documentation

GenObject | ( |  | ) |

Default constructor

virtual ~GenObject | ( |  | ) |
| inlinevirtual

Destructor.

References GenObject::setObjCounter().

## Member Function Documentation

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.

virtual void destruct | ( |  | ) |
| virtual

Destroys the object, disposes the memory.

Reimplemented in ClientSound, ClientLogic, RefObject, and MessageHandler.

Referenced by TelEngine::destruct(), and ClientSound::destruct().

NamedCounter* getObjCounter | ( |  | ) | const
| inline

Get the counter of this object

Returns
  Pointer to current counter object

Referenced by TempObjectCounter::TempObjectCounter().

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

Retrieve or allocate an object counter

Parameters

  name | Name of the counter
  create | True to create a new counter if needed

Returns
  Pointer to existing or new counter object

static ObjList& getObjCounters | ( |  | ) |
| static

Access the object counters list

Returns
  Reference to the global object counters list

static bool getObjCounting | ( |  | ) |
| inlinestatic

Get the global state of object counting

Returns
  True if object counting is enabled

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

Get a pointer to a derived class given that class name

Parameters

  name | Name of the class we are asking for

Returns
  Pointer to the requested class or NULL if this object doesn't implement it

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

Referenced by GenObject::getObject(), and NamedPointer::userObject().

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

Helper method to get the pointer to a derived class

Parameters

  name | Name of the class we are asking for
  obj | Pointer to the object to get derived class from

Returns
  Pointer to the requested class or NULL if this object doesn't implement it

References GenObject::getObject().

NamedCounter* setObjCounter | ( | NamedCounter * | counter | ) |

Set the counter of this object

Parameters

  counter | New counter object or NULL

Returns
  Pointer to old counter object

Referenced by GenObject::~GenObject().

static void setObjCounting | ( | bool | enable | ) |
| inlinestatic

Set the global state of object counting

Parameters

  enable | True to enable object counting, false to disable

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 ClientFileItem, DurationUpdate, ClientResource, ClientContact, ClientAccount, NamedString, ClientLogic, String, XmlElement, CallEndpoint, Plugin, DataEndpoint, and Window.

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:

- yateclass.h