NamedPointer Class Reference

A named pointer class. More...

#include <yateclass.h>

Inheritance diagram for NamedPointer:

NamedString String GenObject

List of all members.

Public Member Functions

 NamedPointer (const char *name, GenObject *data=0, const char *value=0)
virtual ~NamedPointer ()
GenObjectuserData () const
GenObjecttakeData ()
void userData (GenObject *data)
void * userObject (const String &name) const
NamedPointeroperator= (const char *value)
virtual void * getObject (const String &name) const

Protected Member Functions

virtual void changed ()


Detailed Description

A named pointer class.

A named string holding a pointer to arbitrary data. The pointer is owned by the object: it will be released when the object is destroyed or the string value changed


Constructor & Destructor Documentation

NamedPointer ( const char *  name,
GenObject data = 0,
const char *  value = 0 
)

Creates a new named pointer

Parameters:
name Name of this pointer
data Initial pointer value. The pointer will be owned by this object
value Initial string value

virtual ~NamedPointer (  )  [virtual]

Destructor. Release the pointer


Member Function Documentation

virtual void changed (  )  [protected, virtual]

Called whenever the string value changed. Release the pointer

Reimplemented from String.

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 from NamedString.

NamedPointer& operator= ( const char *  value  )  [inline]

String value assignment operator

Reimplemented from NamedString.

References NamedString::operator=().

GenObject* takeData (  ) 

Retrive the pointer carried by this object and release ownership. The caller will own the returned pointer

Returns:
Pointer to arbitrary user GenObject

void userData ( GenObject data  ) 

Set obscure data carried by this object. Note that a RefObject's reference counter should be increased before adding it to this named pointer

Parameters:
data Pointer to arbitrary user data

GenObject* userData (  )  const [inline]

Retrive the pointer carried by this object

Returns:
Pointer to arbitrary user GenObject

void* userObject ( const String name  )  const [inline]

Get a pointer to a derived class of user data given that class name

Parameters:
name Name of the class we are asking for
Returns:
Pointer to the requested class or NULL if user object id NULL or doesn't implement it


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

Generated on Sun Dec 7 21:36:11 2008 for Yate by  doxygen 1.5.7.1