Extends cObject with a name string. More...
#include <cnamedobject.h>
Public Member Functions | |
Constructors, destructor, assignment. | |
cNamedObject () | |
cNamedObject (const char *name, bool namepooling=true) | |
cNamedObject (const cNamedObject &obj) | |
virtual | ~cNamedObject () |
cNamedObject & | operator= (const cNamedObject &o) |
virtual void | parsimPack (cCommBuffer *buffer) |
virtual void | parsimUnpack (cCommBuffer *buffer) |
Handling the name string. | |
virtual void | setName (const char *s) |
virtual const char * | getName () const |
virtual void | setNamePooling (bool b) |
virtual bool | getNamePooling () |
Extends cObject with a name string.
Also includes a "flags" member, with bits open for use by subclasses.
cNamedObject::cNamedObject | ( | const char * | name, | |
bool | namepooling = true | |||
) | [explicit] |
Create object with given name.
Name pooling is an optimization feature.
virtual const char* cNamedObject::getName | ( | ) | const [inline, virtual] |
Returns pointer to the object's name, a string stored in the object.
This function never returns NULL.
Reimplemented from cObject.
Referenced by cObject::getFullName(), and cObject::isName().
cNamedObject& cNamedObject::operator= | ( | const cNamedObject & | o | ) |
The assignment operator.
Derived classes should contain similar methods (cClassName& cClassName::operator=(cClassName&)
).
Assigment copies the contents of the object EXCEPT for the name string. If you want to copy the name string, you can do it by hand: setName(o.getName()
).
virtual void cNamedObject::setName | ( | const char * | s | ) | [virtual] |
Sets object's name.
The object creates its own copy of the string. NULL pointer may also be passed, which will be interpreted as an empty string ("").
Reimplemented in cModule, cOutVector, and cProperty.
virtual void cNamedObject::setNamePooling | ( | bool | b | ) | [virtual] |
Turn name pooling on/off.
Name pooling is an optimization technique that saves memory if several objects have identical names.