cParImpl Class Reference
[Internal classes]

Internal class that stores parameter values. More...

#include <cparimpl.h>

Inheritance diagram for cParImpl:
cNamedObject cObject cBoolParImpl cDoubleParImpl cLongParImpl cStringParImpl cXMLParImpl

List of all members.

Public Member Functions

Constructors, destructor, assignment.

 cParImpl ()
 cParImpl (const cParImpl &other)
virtual ~cParImpl ()
cParImploperator= (const cParImpl &otherpar)
Redefined cObject member functions

virtual std::string info () const
virtual std::string detailedInfo () const
virtual cParImpldup () const
virtual void parsimPack (cCommBuffer *buffer)
virtual void parsimUnpack (cCommBuffer *buffer)
Owner component, type, flags.

virtual Type getType () const =0
virtual bool isNumeric () const =0
virtual bool isVolatile () const
virtual bool isExpression () const
virtual bool isShared () const
virtual bool containsValue () const
virtual bool isSet () const
virtual void setIsVolatile (bool f)
virtual void setIsShared (bool f)
virtual void setIsSet (bool f)
virtual const char * getUnit () const
virtual void setUnit (const char *s)
Setter functions. Note that overloaded assignment operators also exist.

virtual void setBoolValue (bool b)=0
virtual void setLongValue (long l)=0
virtual void setDoubleValue (double d)=0
virtual void setStringValue (const char *s)=0
virtual void setStringValue (const std::string &s)
virtual void setXMLValue (cXMLElement *node)=0
virtual void setExpression (cExpression *e)=0
Getter functions.

virtual bool boolValue (cComponent *context) const =0
virtual long longValue (cComponent *context) const =0
virtual double doubleValue (cComponent *context) const =0
virtual const char * stringValue (cComponent *context) const =0
virtual std::string stdstringValue (cComponent *context) const =0
virtual cXMLElementxmlValue (cComponent *context) const =0
virtual cExpressiongetExpression () const =0
Compare functions

virtual int compare (const cParImpl *other) const

Static Public Member Functions

Statistics.

static long getTotalParImplObjectCount ()
static long getLiveParImplObjectCount ()
static void resetParImplObjectCounters ()

Miscellaneous utility functions.



virtual void convertToConst (cComponent *context)=0
virtual bool containsConstSubexpressions () const
virtual void evaluateConstSubexpressions (cComponent *context)
virtual std::string str () const =0
virtual void parse (const char *text)=0
static cParImplcreateWithType (Type type)

Detailed Description

Internal class that stores parameter values.

cPar delegates almost all methods to cParImpl. Delegation was introduced to save memory by using shared storage for module parameters of the same values.

cParImpl is an abstract base class, which supports several data types via subclasses: cLongParImpl, cDoubleParImpl, cBoolParImpl, cStringParImpl, cXMLParImpl.


Member Function Documentation

virtual bool cParImpl::boolValue ( cComponent context  )  const [pure virtual]

Returns value as a boolean.

The cParImpl type must be BOOL.

Implemented in cBoolParImpl, cDoubleParImpl, cLongParImpl, cStringParImpl, and cXMLParImpl.

virtual int cParImpl::compare ( const cParImpl other  )  const [virtual]

Compares two cParImpls, including name, type, flags, stored value or expression.

Makes it possible to use cParImpl as a key in std::map or std::set.

Reimplemented in cBoolParImpl, cDoubleParImpl, cLongParImpl, cStringParImpl, and cXMLParImpl.

virtual bool cParImpl::containsValue (  )  const [inline, virtual]

Returns true if the parameter contains a value.

Note that isSet() may still return true or false.

virtual double cParImpl::doubleValue ( cComponent context  )  const [pure virtual]

Returns value as long.

The cParImpl type must be LONG or DOUBLE.

Implemented in cBoolParImpl, cDoubleParImpl, cLongParImpl, cStringParImpl, and cXMLParImpl.

virtual void cParImpl::evaluateConstSubexpressions ( cComponent context  )  [virtual]

Evaluates const subexpressions, and replaces them with their values.

See cDynamicExpression::Elem::CONSTSUBEXPR.

static long cParImpl::getLiveParImplObjectCount (  )  [inline, static]

Returns the number of objects that currently exist in the program.

The counter is incremented by cOwnedObject constructor and decremented by the destructor. May be useful for profiling or debugging memory leaks.

static long cParImpl::getTotalParImplObjectCount (  )  [inline, static]

Returns the total number of objects created since the start of the program (or since the last reset).

The counter is incremented by cOwnedObject constructor. Counter is signed to make it easier to detect if it overflows during very long simulation runs. May be useful for profiling or debugging memory leaks.

virtual const char* cParImpl::getUnit (  )  const [virtual]

Returns the parameter's unit ("s", "mW", "Hz", "bps", etc), as declared in the @unit property of the parameter in NED.

Unit is only meaningful with numeric parameters.

virtual std::string cParImpl::info (  )  const [virtual]

Returns a one-line description of the object.

See also:
detailedInfo()

Reimplemented from cObject.

virtual bool cParImpl::isExpression (  )  const [inline, virtual]

Returns false if the stored value is a constant, and true if it is an expression.

(It is not examined whether the expression yields a constant value.)

virtual bool cParImpl::isSet (  )  const [inline, virtual]

Used by cPar only: Returns true if the parameter value is set, false otherwise (i.e.

if the object contains no value or the current value is just a default).

virtual long cParImpl::longValue ( cComponent context  )  const [pure virtual]

Returns value as long.

The cParImpl type must be LONG or DOUBLE.

Implemented in cBoolParImpl, cDoubleParImpl, cLongParImpl, cStringParImpl, and cXMLParImpl.

virtual void cParImpl::parse ( const char *  text  )  [pure virtual]

Convert the value from string, and store the result.

If the text cannot be parsed, an exception is thrown, which can be caught as std::runtime_error& if necessary.

Implemented in cBoolParImpl, cDoubleParImpl, cLongParImpl, cStringParImpl, and cXMLParImpl.

static void cParImpl::resetParImplObjectCounters (  )  [inline, static]

Reset counters used by getTotalObjectCount() and getLiveObjectCount().

(Note that getLiveObjectCount() may go negative after a reset call.)

virtual void cParImpl::setExpression ( cExpression e  )  [pure virtual]

Sets the value to the given expression.

This object will assume the responsibility to delete the expression object.

Note: if the parameter is marked as non-volatile (isVolatile()==false), one should not set an expression as value. This is not enforced by cParImpl though.

Implemented in cBoolParImpl, cDoubleParImpl, cLongParImpl, cStringParImpl, and cXMLParImpl.

virtual void cParImpl::setIsVolatile ( bool  f  )  [inline, virtual]

Sets the isVolatile flag.

NOTE: It may be necessary to invoke convertToConst(cComponent *context) as well.

virtual void cParImpl::setStringValue ( const char *  s  )  [pure virtual]

Sets the value to the given string value.

The cParImpl will make its own copy of the string. NULL is also accepted and treated as an empty string.

Implemented in cBoolParImpl, cDoubleParImpl, cLongParImpl, cStringParImpl, and cXMLParImpl.

virtual std::string cParImpl::stdstringValue ( cComponent context  )  const [pure virtual]

Returns value as string.

Only for string (S) type.

Implemented in cBoolParImpl, cDoubleParImpl, cLongParImpl, cStringParImpl, and cXMLParImpl.

virtual const char* cParImpl::stringValue ( cComponent context  )  const [pure virtual]

Returns value as const char *.

Only for STRING type. This method may only be invoked when the parameter's value is a string constant and not the result of expression evaluation, otherwise an error is thrown. This practically means this method cannot be used on parameters declared as "volatile string" in NED; they can only be accessed using stdstringValue().

Implemented in cBoolParImpl, cDoubleParImpl, cLongParImpl, cStringParImpl, and cXMLParImpl.

virtual cXMLElement* cParImpl::xmlValue ( cComponent context  )  const [pure virtual]

Returns value as pointer to cXMLElement.

The cParImpl type must be XML.

Implemented in cBoolParImpl, cDoubleParImpl, cLongParImpl, cStringParImpl, and cXMLParImpl.


The documentation for this class was generated from the following file:
Generated on Tue Dec 2 11:16:29 2014 for OMNeT++ Simulation Library by  doxygen 1.6.3