Yate
Public Member Functions | Protected Member Functions
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 
) [explicit]

Creates a new named pointer

Parameters:
nameName of this pointer
dataInitial pointer value. The pointer will be owned by this object
valueInitial 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:
nameName 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=().

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

Returns:
Pointer to arbitrary user GenObject
GenObject* userData ( ) const [inline]

Retrieve the pointer carried by this object

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:
dataPointer to arbitrary user data
void* userObject ( const String name) const [inline]

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

Parameters:
nameName 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: