Stores properties. More...
#include <cproperties.h>
Public Member Functions | |
Constructors, destructor, assignment. | |
cProperties () | |
cProperties (const cProperties &other) | |
virtual | ~cProperties () |
cProperties & | operator= (const cProperties &other) |
Redefined cObject functions | |
virtual cProperties * | dup () const |
virtual const char * | getName () const |
virtual std::string | info () const |
virtual void | parsimPack (cCommBuffer *buffer) |
virtual void | parsimUnpack (cCommBuffer *buffer) |
Properties | |
virtual int | getNumProperties () const |
virtual const std::vector < const char * > | getNames () const |
virtual cProperty * | get (int k) const |
virtual cProperty * | get (const char *name, const char *index=NULL) const |
virtual bool | getAsBool (const char *name, const char *index=NULL) const |
virtual std::vector< const char * > | getIndicesFor (const char *name) const |
virtual void | add (cProperty *p) |
virtual void | remove (int k) |
Stores properties.
virtual cProperty* cProperties::get | ( | const char * | name, | |
const char * | index = NULL | |||
) | const [virtual] |
Returns the given property, or NULL if it does not exist.
Name and index correspond to the the NED syntax @propertyname[index](keys-and-values)
, where "[index]" is optional.
virtual bool cProperties::getAsBool | ( | const char * | name, | |
const char * | index = NULL | |||
) | const [virtual] |
Returns the property as a boolean.
If the property is missing, this method returns false; otherwise, only the first value in the default key ("") is examined. If it is "false", this method returns false; in all other cases (missing, empty, some other value) it returns true.
Examples: @foo
: true, @foo()
: true, @foo(false)
: false, @foo(true)
: true, @foo(any)
: true, @foo(a=x,b=y,c=z)
: true; @foo(somekey=false)
: true (!)
virtual std::vector<const char *> cProperties::getIndicesFor | ( | const char * | name | ) | const [virtual] |
Returns unique indices for a property.
Name and index correspond to the NED syntax @propertyname[index](keys-and-values)
. The strings in the returned array do not need to be deallocated and must not be modified.
virtual const std::vector<const char *> cProperties::getNames | ( | ) | const [virtual] |
Returns the names of cProperty object stored in this object.
The strings in the returned array do not need to be deallocated and must not be modified.