OMNeT++ API 6.1
Discrete Event Simulation Library
cOutVector Class Reference

Description

Responsible for recording an "output vector" into the simulation results file. An output vector is a time series where each value is recorded with its own timestamp. Time stamps are monotonically increasing. The vector is registered in the result file with the module (the owner of this object), a vector name, and optional attributes. The first two identify the vector, and the attributes convey additional meta information that may be used by result analysis tools.

Before recording values, the output vector needs to be registered, i.e. declared with its name and attributes. After registration, the name and attributes cannot be changed, e.g. new attribute cannot be added. This class allows attributes to be specified up front as a string map (which allows registering the vector immediately), or one by one using the setAttribute() call. In the latter case, the setAttribute() calls must be followed by an registerVector() call. If the registerVector() call is omitted, the vector will be registered when the first data item is recorded into the vector; if no data is recorded, the vector will be missing from the result file.

Inheritance diagram for cOutVector:
[legend]

Public Member Functions

Constructors, destructor, assignment
 cOutVector (const char *name=nullptr)
 
 cOutVector (const char *name, const opp_string_map &attributes)
 
virtual ~cOutVector ()
 
Redefined cObject member functions.
virtual void setName (const char *name) override
 
virtual std::string str () const override
 
Metadata annotations.
virtual void setAttributes (const opp_string_map &attributes)
 
virtual void setAttribute (const char *name, const char *value)
 
virtual void registerVector ()
 
virtual void setEnum (const char *registeredEnumName)
 
virtual void setEnum (cEnum *enumDecl)
 
virtual void setUnit (const char *unit)
 
virtual void setType (Type type)
 
virtual void setInterpolationMode (InterpolationMode mode)
 
virtual void setMin (double minValue)
 
virtual void setMax (double maxValue)
 
Writing to output vectors.
virtual bool record (double value)
 
virtual bool record (SimTime value)
 
virtual bool recordWithTimestamp (simtime_t t, double value)
 
virtual bool recordWithTimestamp (simtime_t t, SimTime value)
 
virtual void enable ()
 
virtual void disable ()
 
virtual void setEnabled (bool b)
 
virtual bool isEnabled () const
 
virtual void setRecordDuringWarmupPeriod (bool b)
 
virtual bool getRecordDuringWarmupPeriod () const
 
long getValuesReceived () const
 
long getValuesStored () const
 
- Public Member Functions inherited from cNoncopyableOwnedObject
 cNoncopyableOwnedObject (const char *name=nullptr, bool namepooling=true)
 
virtual cNoncopyableOwnedObjectdup () const override
 
- Public Member Functions inherited from cOwnedObject
 cOwnedObject ()
 
 cOwnedObject (const char *name, bool namepooling=true)
 
 cOwnedObject (const cOwnedObject &obj)
 
virtual ~cOwnedObject ()
 
cOwnedObjectoperator= (const cOwnedObject &o)
 
virtual cObjectgetOwner () 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 ()
 
cNamedObjectoperator= (const cNamedObject &o)
 
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 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 cOwnedObject
static long getTotalObjectCount ()
 
static long getLiveObjectCount ()
 
static void resetObjectCounters ()
 
static cSoftOwnergetOwningContext ()
 
- Protected Member Functions inherited from cObject
virtual void take (cOwnedObject *obj)
 
virtual void drop (cOwnedObject *obj)
 
void dropAndDelete (cOwnedObject *obj)
 

Constructor & Destructor Documentation

◆ cOutVector() [1/2]

cOutVector ( const char *  name = nullptr)
explicit

Construct an output vector with a name. Attributes may be added later, in one step, or one-by-one. In the latter case, or if no attributes will be added, registerVector() should be called.

◆ cOutVector() [2/2]

cOutVector ( const char *  name,
const opp_string_map attributes 
)
explicit

Construct an output vector with a name and attributes, and register it immediately.

◆ ~cOutVector()

virtual ~cOutVector ( )
virtual

Destructor.

Member Function Documentation

◆ setName()

virtual void setName ( const char *  name)
overridevirtual

Sets the name of the object. It is not possible to call this method after the first call to record().

Reimplemented from cNamedObject.

◆ str()

virtual std::string str ( ) const
overridevirtual

Produces a one-line description of the object's contents. See cObject for more details.

Reimplemented from cObject.

◆ setAttributes()

virtual void setAttributes ( const opp_string_map attributes)
virtual

Sets the vector attributes in one step, and registers the vector.

◆ setAttribute()

virtual void setAttribute ( const char *  name,
const char *  value 
)
virtual

Sets the specified vector attribute. This method may only be called when the vector is not yet registered. The last setAttribute() call should be followed by an registerVector() call.

◆ registerVector()

virtual void registerVector ( )
virtual

Registers the vector if it has not been registered yet. After this call, no more attributes can be added to the vector. If this call is omitted, the vector will be registered when the first data item is recorded into it, or if no data is recorded, the vector will be missing from the result file.

◆ setEnum() [1/2]

virtual void setEnum ( const char *  registeredEnumName)
virtual

Associates the vector with a cEnum, by setting the "enum" and "enumname" vector attributes. The enum name as well as the symbols and their integer values will be recorded. cOutVector does not verify that recorded values actually comply with this annotation.

◆ setEnum() [2/2]

virtual void setEnum ( cEnum enumDecl)
virtual

Associates the vector with a cEnum, by setting the "enum" and "enumname" vector attributes. The enum name as well as the symbols and their integer values will be recorded. cOutVector does not verify that recorded values actually comply with this annotation.

◆ setUnit()

virtual void setUnit ( const char *  unit)
virtual

Annotate the vector with a physical unit (like "s", "mW" or "bytes"), by setting the "unit" vector attribute.

◆ setType()

virtual void setType ( Type  type)
virtual

Annotate the vector with a data type, by setting the "type" vector attribute. cOutVector does not verify that recorded values actually comply with this annotation.

◆ setInterpolationMode()

virtual void setInterpolationMode ( InterpolationMode  mode)
virtual

Annotate the vector with an interpolation mode, by setting the "interpolationmode" vector attribute. This information may be used by result analysis tools as a hint for choosing a plotting style.

◆ setMin()

virtual void setMin ( double  minValue)
virtual

Annotate the vector with a minimum value, by setting the "min" vector attribute. cOutVector does not verify that recorded values actually comply with this annotation.

◆ setMax()

virtual void setMax ( double  maxValue)
virtual

Annotate the vector with a maximum value, by setting the "max" vector attribute. cOutVector does not verify that recorded values actually comply with this annotation.

◆ record() [1/2]

virtual bool record ( double  value)
virtual

Records the value with the current simulation time as timestamp.

The return value is true if the data was actually recorded, and false if it was not recorded (because of filtering, etc.)

◆ record() [2/2]

virtual bool record ( SimTime  value)
inlinevirtual

Convenience method, delegates to record(double).

References SimTime::dbl(), and cOutVector::record().

Referenced by cOutVector::record().

◆ recordWithTimestamp() [1/2]

virtual bool recordWithTimestamp ( simtime_t  t,
double  value 
)
virtual

Records the value with the given time as timestamp. Values must be recorded in increasing timestamp order, that is, it is not possible to record a value with a timestamp that is less than that of the last recorded value.

The return value is true if the data was actually recorded, and false if it was not recorded (because of filtering, etc.)

◆ recordWithTimestamp() [2/2]

virtual bool recordWithTimestamp ( simtime_t  t,
SimTime  value 
)
inlinevirtual

◆ enable()

virtual void enable ( )
inlinevirtual

Enables recording data via this object. (It is enabled by default.)

◆ disable()

virtual void disable ( )
inlinevirtual

Disables recording data via this object. record() methods will return false without doing anything.

◆ setEnabled()

virtual void setEnabled ( bool  b)
inlinevirtual

Enables/disables recording data via this object.

See also
enable(), disable()

◆ isEnabled()

virtual bool isEnabled ( ) const
inlinevirtual

Returns true if recording the data is enabled, false otherwise.

◆ setRecordDuringWarmupPeriod()

virtual void setRecordDuringWarmupPeriod ( bool  b)
inlinevirtual

Enables/disables recording data during the warm-up period. When set to false, record() calls will be ignored during warm-up period.

See also
cSimulation::getWarmupPeriod()

◆ getRecordDuringWarmupPeriod()

virtual bool getRecordDuringWarmupPeriod ( ) const
inlinevirtual

Returns true if the object will record data during the warm-up period.

See also
cSimulation::getWarmupPeriod()

◆ getValuesReceived()

long getValuesReceived ( ) const
inline

Returns the total number of values passed to the record() method of this output vector object. This includes the values passed while the object was disabled (see disable()).

◆ getValuesStored()

long getValuesStored ( ) const
inline

Returns the number of values actually stored by this output vector object. The values passed while the object was disabled (via disable(), environment configuration, filtering, etc.) do not count.


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