cProperty Class Reference
[Internal classes]

Stores a property with its value. More...

#include <cproperty.h>

Inheritance diagram for cProperty:
cNamedObject cObject

List of all members.

Public Member Functions

Constructors, destructor, assignment.

 cProperty (const char *name=NULL, const char *index=NULL)
 cProperty (const cProperty &other)
virtual ~cProperty ()
cPropertyoperator= (const cProperty &other)
Redefined cObject functions

virtual void setName (const char *name)
virtual const char * getFullName () const
virtual cPropertydup () const
virtual std::string info () const
virtual void parsimPack (cCommBuffer *buffer)
virtual void parsimUnpack (cCommBuffer *buffer)
Property getter/setter methods

virtual void setIndex (const char *index)
virtual const char * getIndex () const
virtual void setIsImplicit (bool b)
virtual bool isImplicit () const
virtual const std::vector
< const char * > & 
getKeys () const
virtual bool containsKey (const char *key) const
virtual void addKey (const char *key)
virtual int getNumValues (const char *key) const
virtual void setNumValues (const char *key, int size)
virtual const char * getValue (const char *key, int index=0) const
virtual void setValue (const char *key, int index, const char *value)
virtual void erase (const char *key)

Detailed Description

Stores a property with its value.

The value consists of key-valuelist pairs; the key might be empty (default key).


Constructor & Destructor Documentation

cProperty::cProperty ( const char *  name = NULL,
const char *  index = NULL 
) [explicit]

Constructor.

The property name should be specified without the "@" mark.


Member Function Documentation

virtual void cProperty::addKey ( const char *  key  )  [virtual]

Adds the given key to the property.

Has no effect if the key already exists.

virtual bool cProperty::containsKey ( const char *  key  )  const [virtual]

Returns true if the property contains the given key.

Specify "" or DEFAULTKEY for the default key.

virtual const char* cProperty::getIndex (  )  const [virtual]

Returns the index of this property; see NED syntax @propname[index](keys-and-values).

Returns NULL if the property has no index (@propname(keys-and-values)).

virtual const std::vector<const char *>& cProperty::getKeys (  )  const [virtual]

Returns the list of keys if this property.

The default key is listed as "".

virtual int cProperty::getNumValues ( const char *  key  )  const [virtual]

Returns the number of values for the given key in the property.

Specify "" or DEFAULTKEY for the default key.

Returns 0 if the given key does not exist.

virtual const char* cProperty::getValue ( const char *  key,
int  index = 0 
) const [virtual]

Returns the indexth value for the given key in the property.

Specify "" or DEFAULTKEY for the default key. If the key does not exist or the index is out of bounds, NULL is returned.

virtual bool cProperty::isImplicit (  )  const [virtual]

Returns whether this property is implicit.

Implicit properties are those not spelled out in the NED file, but rather, added automatically during the parsing process or later.

virtual void cProperty::setName ( const char *  name  )  [virtual]

Redefined.

See also:
setIndex()

Reimplemented from cNamedObject.

virtual void cProperty::setNumValues ( const char *  key,
int  size 
) [virtual]

Expands or trims the list of values for the given key in the property, by discarding elements or adding "" elements.

Specify "" or DEFAULTKEY for the default key. Note that simply setting an element above getNumValues(key) will also expand the list.

Throws an error if the given key does not exist.

virtual void cProperty::setValue ( const char *  key,
int  index,
const char *  value 
) [virtual]

Replaces a value for the given key in the property.

Specify "" or DEFAULTKEY for the default key. cProperty will create its own copy of the string passed. index may be greater than getNumValues(key); that will cause the values list to expand, the new elements filled with "".

Throws an error if the given key does not exist, or the index is negative.


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