Yate: GenObject Class Reference

Yate

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()

GenObject | ( |  | ) |

Default constructor

Referenced by XPath::anyValue(), HashList::append(), HashList::append(), ObjList::append(), ObjList::append(), ObjVector::appendObj(), ObjVector::appendObj(), ObjList::at(), ObjVector::at(), ObjVector::data(), ObjVector::data(), ObjVector::data(), ObjVector::data(), MatchingItemBase::dumpXml(), HashList::find(), HashList::find(), ObjList::find(), ObjList::find(), ObjList::find(), XPath::find(), ObjList::findObj(), ObjList::get(), getObject(), ObjList::index(), ObjVector::index(), ObjList::insert(), ObjList::insert(), ObjVector::insertObj(), HashList::operator[](), ObjList::operator[](), ObjList::operator[](), ObjList::operator[](), ObjVector::operator[](), ObjVector::operator[](), ObjVector::operator[](), HashList::remove(), HashList::remove(), HashList::remove(), ObjList::remove(), ObjList::remove(), ObjList::remove(), ObjList::remove(), ObjList::remove(), ObjList::remove(), XPath::reset(), HashList::resync(), ObjList::set(), ObjVector::set(), ObjList::setUnique(), ObjList::setUnique(), SocketAddr::SocketAddr(), ObjList::sort(), and ObjVector::take().

## ◆ ~GenObject()

virtual ~GenObject | ( |  | ) |
| inlinevirtual

Destructor.

References setObjCounter().

## 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]

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

## ◆ getObjCounters()

ObjList & getObjCounters | ( |  | ) |
| static

Access the object counters list

Returns
  Reference to the global object counters list

## ◆ getObjCounting()

bool getObjCounting | ( |  | ) |
| inlinestatic

Get the global state of object counting

Returns
  True if object counting is enabled

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

## ◆ getObject() [1/2]

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 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]

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(), and getObject().

## ◆ setObjCounter()

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().

## ◆ setObjCounting()

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

Set the global state of object counting

Parameters

  enable | True 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:

- yateclass.h