cOwnedObject-based container/wrapper to hold a single cValue.
The added value is ownership handling of object values (cObject* pointers) contained in cValue objects. Guidelines: owned objects are those that subclass from cOwnedObject and getOwner() returns this object, and all cObjects that are non-cOwnedObject.
Public Member Functions | |
Constructors, destructor, assignment. | |
cValueHolder (const cValueHolder &other) | |
cValueHolder (const char *name=nullptr) | |
cValueHolder (const char *name, const cValue &value) | |
virtual | ~cValueHolder () |
cValueHolder & | operator= (const cValueHolder &other) |
Redefined cObject member functions | |
virtual cValueHolder * | dup () const override |
virtual std::string | str () const override |
virtual void | forEachChild (cVisitor *v) override |
Container functions. | |
const cValue & | get () const |
void | set (const cValue &v) |
Public Member Functions inherited from cValueContainer | |
cValueContainer (const char *name=nullptr) | |
Public Member Functions inherited from cOwnedObject | |
cOwnedObject () | |
cOwnedObject (const char *name, bool namepooling=true) | |
cOwnedObject (const cOwnedObject &obj) | |
virtual | ~cOwnedObject () |
cOwnedObject & | operator= (const cOwnedObject &o) |
virtual cObject * | getOwner () const override |
virtual bool | isOwnedObject () const override |
Public Member Functions inherited from cNamedObject | |
cNamedObject () | |
cNamedObject (const char *name, bool namepooling=true) | |
cNamedObject (const cNamedObject &obj) | |
virtual | ~cNamedObject () |
cNamedObject & | operator= (const cNamedObject &o) |
virtual void | setName (const char *s) |
virtual const char * | getName () const override |
virtual void | setNamePooling (bool b) |
virtual bool | getNamePooling () |
Public Member Functions inherited from cObject | |
cObject () | |
cObject (const cObject &other)=default | |
virtual | ~cObject () |
virtual const char * | getClassName () const |
bool | isName (const char *s) const |
virtual const char * | getFullName () const |
virtual std::string | getFullPath () const |
virtual std::string | getClassAndFullName () const |
virtual std::string | getClassAndFullPath () const |
const cObject * | getThisPtr () const |
virtual std::ostream & | printOn (std::ostream &os) const |
virtual bool | isSoftOwner () const |
cObject * | findObject (const char *name, bool deep=true) |
virtual cClassDescriptor * | getDescriptor () const |
void | copyNotSupported () const |
Additional Inherited Members | |
Static Public Member Functions inherited from cOwnedObject | |
static long | getTotalObjectCount () |
static long | getLiveObjectCount () |
static void | resetObjectCounters () |
static cSoftOwner * | getOwningContext () |
Protected Member Functions inherited from cObject | |
virtual void | take (cOwnedObject *obj) |
virtual void | drop (cOwnedObject *obj) |
void | dropAndDelete (cOwnedObject *obj) |
|
inline |
Copy constructor. Contained objects will be duplicated so that the new cValueHolder will have its own copy of them.
Note that this behavior is different from most other container classes in the simulation library like cQueue, which only duplicate the objects they own, and leave externally owned objects alone.
|
inlineexplicit |
Constructor.
|
inlineexplicit |
Constructor.
|
inlinevirtual |
Destructor. The contained objects that were owned by the container will be deleted.
cValueHolder& operator= | ( | const cValueHolder & | other | ) |
Assignment operator. The name member is not copied; see cNamedObject::operator=() for details. Contained objects that are owned by cValueHolder will be duplicated so that the new cValueHolder will have its own copy of them.
|
inlineoverridevirtual |
Creates and returns an exact copy of this object. Contained objects will be duplicated so that the new cValueHolder will have its own copy of them.
Note that this behavior is different from most other container classes in the simulation library like cQueue, which only duplicate the objects they own, and leave externally owned objects alone.
Reimplemented from cObject.
|
inlineoverridevirtual |
Produces a one-line description of the object's contents. See cObject for more details.
Reimplemented from cObject.
References cValue::str().
|
overridevirtual |
|
inline |
Returns the stored value.
|
inline |
Replaces the stored value.