OMNeT++ Simulation Library  6.0.3
cObjectParImpl Class Reference

#include <cobjectparimpl.h>

Description

A cParImpl subclass that stores a module/channel parameter of type object.

Rules:

  1. The user cannot "take" the object from the cPar. It can only clone it if needs be.
  2. A volatile parameters's object value is replaced on each read operation.
  3. Plain cObject objects (non-cOwnedObject ones) are owned, i.e. deleted when no longer needed.
  4. cOwnedObject objects are "taken" ownership via take(), but only if their owner allows (i.e. is a soft owner).
  5. cOwnedObject objects are owned iff their owner is this object.
  6. nullptr is allowed as value.
Inheritance diagram for cObjectParImpl:
cParImpl cNamedObject cObject

Public Member Functions

Constructors, destructor, assignment.
 cObjectParImpl ()
 
 cObjectParImpl (const cObjectParImpl &other)
 
virtual ~cObjectParImpl ()
 
void operator= (const cObjectParImpl &otherpar)
 
Redefined cObject member functions
virtual cObjectParImpldup () const override
 
Redefined cParImpl setter functions.
virtual void setBoolValue (bool b) override
 
virtual void setIntValue (intval_t l) override
 
virtual void setDoubleValue (double d) override
 
virtual void setStringValue (const char *s) override
 
virtual void setObjectValue (cObject *object) override
 
virtual void setXMLValue (cXMLElement *node) override
 
virtual void setExpression (cExpression *e) override
 
Redefined cParImpl getter functions.
virtual bool boolValue (cComponent *context) const override
 
virtual intval_t intValue (cComponent *context) const override
 
virtual double doubleValue (cComponent *context) const override
 
virtual const char * stringValue (cComponent *context) const override
 
virtual std::string stdstringValue (cComponent *context) const override
 
virtual cObjectobjectValue (cComponent *context) const override
 
virtual cXMLElementxmlValue (cComponent *context) const override
 
virtual cExpressiongetExpression () const override
 
Type, prompt text, input flag, change flag.
virtual Type getType () const override
 
virtual bool isNumeric () const override
 
virtual void setExpectedType (const char *s)
 
Redefined cParImpl misc functions.
virtual void convertToConst (cComponent *context) override
 
virtual std::string str () const override
 
virtual void parse (const char *text, FileLine loc) override
 
virtual int compare (const cParImpl *other) const override
 
virtual void forEachChild (cVisitor *v, cComponent *context) override
 
- Public Member Functions inherited from cParImpl
 cParImpl ()
 
 cParImpl (const cParImpl &other)
 
virtual ~cParImpl ()
 
cParImploperator= (const cParImpl &otherpar)
 
virtual void parsimPack (cCommBuffer *buffer) const override
 
virtual void parsimUnpack (cCommBuffer *buffer) override
 
virtual bool isVolatile () const
 
virtual bool isMutable () const
 
virtual bool isExpression () const
 
virtual bool isShared () const
 
virtual bool containsValue () const
 
virtual bool isSet () const
 
virtual void setIsVolatile (bool f)
 
virtual void setIsMutable (bool f)
 
virtual void setIsShared (bool f)
 
virtual void setIsSet (bool f)
 
virtual const char * getUnit () const
 
virtual void setUnit (const char *s)
 
virtual const char * getBaseDirectory () const
 
virtual void setBaseDirectory (const char *s)
 
virtual void setStringValue (const std::string &s)
 
virtual void forEachChild (cVisitor *v)
 
- Public Member Functions inherited from cNamedObject
 cNamedObject ()
 
 cNamedObject (const char *name, bool namepooling=true)
 
 cNamedObject (const cNamedObject &obj)
 
virtual ~cNamedObject ()
 
cNamedObjectoperator= (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 cObjectgetThisPtr () const
 
virtual std::ostream & printOn (std::ostream &os) const
 
virtual cObjectgetOwner () const
 
virtual bool isOwnedObject () const
 
virtual bool isSoftOwner () const
 
virtual void forEachChild (cVisitor *v)
 
cObjectfindObject (const char *name, bool deep=true)
 
virtual cClassDescriptorgetDescriptor () const
 
void copyNotSupported () const
 

Additional Inherited Members

- Static Public Member Functions inherited from cParImpl
static long getTotalParImplObjectCount ()
 
static long getLiveParImplObjectCount ()
 
static void resetParImplObjectCounters ()
 
static cParImplcreateWithType (Type type)
 
- Protected Member Functions inherited from cObject
virtual void take (cOwnedObject *obj)
 
virtual void drop (cOwnedObject *obj)
 
void dropAndDelete (cOwnedObject *obj)
 

Constructor & Destructor Documentation

◆ cObjectParImpl() [1/2]

cObjectParImpl ( )
inlineexplicit

Constructor.

◆ cObjectParImpl() [2/2]

cObjectParImpl ( const cObjectParImpl other)
inline

Copy constructor.

◆ ~cObjectParImpl()

virtual ~cObjectParImpl ( )
virtual

Destructor.

Member Function Documentation

◆ operator=()

void operator= ( const cObjectParImpl otherpar)

Assignment operator.

◆ dup()

virtual cObjectParImpl* dup ( ) const
inlineoverridevirtual

Creates and returns an exact copy of this object.

Reimplemented from cParImpl.

◆ setBoolValue()

virtual void setBoolValue ( bool  b)
overridevirtual

Raises an error: cannot convert bool to object.

Implements cParImpl.

◆ setIntValue()

virtual void setIntValue ( intval_t  l)
overridevirtual

Raises an error: cannot convert integer to object.

Implements cParImpl.

◆ setDoubleValue()

virtual void setDoubleValue ( double  d)
overridevirtual

Raises an error: cannot convert double to object.

Implements cParImpl.

◆ setStringValue()

virtual void setStringValue ( const char *  s)
overridevirtual

Raises an error: cannot convert string to object.

Implements cParImpl.

◆ setObjectValue()

virtual void setObjectValue ( cObject object)
overridevirtual

Sets the value to the given object.

Implements cParImpl.

◆ setXMLValue()

virtual void setXMLValue ( cXMLElement node)
overridevirtual

Raises an error: cannot convert XML to object.

Implements cParImpl.

◆ setExpression()

virtual void setExpression ( cExpression e)
overridevirtual

Sets the value to the given expression. This object will assume the responsibility to delete the expression object.

Implements cParImpl.

◆ boolValue()

virtual bool boolValue ( cComponent context) const
overridevirtual

Raises an error: cannot convert object to bool.

Implements cParImpl.

◆ intValue()

virtual intval_t intValue ( cComponent context) const
overridevirtual

Raises an error: cannot convert object to integer.

Implements cParImpl.

◆ doubleValue()

virtual double doubleValue ( cComponent context) const
overridevirtual

Raises an error: cannot convert object to double.

Implements cParImpl.

◆ stringValue()

virtual const char* stringValue ( cComponent context) const
overridevirtual

Raises an error: cannot convert object to string.

Implements cParImpl.

◆ stdstringValue()

virtual std::string stdstringValue ( cComponent context) const
overridevirtual

Raises an error: cannot convert object to string.

Implements cParImpl.

◆ objectValue()

virtual cObject* objectValue ( cComponent context) const
overridevirtual

Returns the value of the parameter.

Implements cParImpl.

◆ xmlValue()

virtual cXMLElement* xmlValue ( cComponent context) const
overridevirtual

Raises an error: cannot convert object to XML.

Implements cParImpl.

◆ getExpression()

virtual cExpression* getExpression ( ) const
overridevirtual

Returns pointer to the expression stored by the object, or nullptr.

Implements cParImpl.

◆ getType()

virtual Type getType ( ) const
overridevirtual

Returns object.

Implements cParImpl.

◆ isNumeric()

virtual bool isNumeric ( ) const
overridevirtual

Returns false.

Implements cParImpl.

◆ setExpectedType()

virtual void setExpectedType ( const char *  s)
virtual

Sets the expected type ("@class" property in NED)

◆ convertToConst()

virtual void convertToConst ( cComponent context)
overridevirtual

Replaces for non-const values, replaces the stored expression with its evaluation.

Implements cParImpl.

◆ str()

virtual std::string str ( ) const
overridevirtual

Returns the value in text form.

Reimplemented from cObject.

◆ parse()

virtual void parse ( const char *  text,
FileLine  loc 
)
overridevirtual

Converts from text.

Implements cParImpl.

◆ compare()

virtual int compare ( const cParImpl other) const
overridevirtual

Object comparison.

Reimplemented from cParImpl.

◆ forEachChild()

virtual void forEachChild ( cVisitor v,
cComponent context 
)
overridevirtual

Visits the object element

Reimplemented from cParImpl.


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