cConfigOption Class Reference

API: cConfigOption Class Reference
API
cConfigOption Class Reference
Inheritance diagram for cConfigOption:
[legend]

Public Types

enum  Type
 Configuration option data types. More...
enum  ObjectKind
 Configuration option kinds. More...

Public Member Functions

Constructors, destructor
 cConfigOption (const char *name, bool isGlobal, Type type, const char *unit, const char *defaultValue, const char *description)
 cConfigOption (const char *name, ObjectKind kind, Type type, const char *unit, const char *defaultValue, const char *description)
Redefined cObject methods
virtual std::string str () const override
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 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 bool isSoftOwner () const
virtual void forEachChild (cVisitor *v)
cObjectfindObject (const char *name, bool deep=true)
virtual cClassDescriptorgetDescriptor () const
void copyNotSupported () const

Static Public Member Functions

Lookup
static cConfigOptionfind (const char *name)
static cConfigOptionget (const char *name)
Static Public Member Functions inherited from cOwnedObject
static long getTotalObjectCount ()
static long getLiveObjectCount ()
static void resetObjectCounters ()
static cSoftOwnergetOwningContext ()

Getter methods

bool isPerObject () const
bool isGlobal () const
ObjectKind getObjectKind () const
Type getType () const
const char * getUnit () const
const char * getDefaultValue () const
const char * getDescription () const
static const char * getObjectKindName (ObjectKind kind)
static const char * getTypeName (Type type)

Additional Inherited Members

Protected Member Functions inherited from cObject
virtual void take (cOwnedObject *obj)
virtual void drop (cOwnedObject *obj)
void dropAndDelete (cOwnedObject *obj)

Description

Member Enumeration Documentation

◆ Type

enum Type

Configuration option data types.

◆ ObjectKind

enum ObjectKind

Configuration option kinds.

Constructor & Destructor Documentation

◆ cConfigOption() [1/2]

cConfigOption ( const char * name,
bool isGlobal,
Type type,
const char * unit,
const char * defaultValue,
const char * description )

Constructor for non per-object options.

References isGlobal().

Referenced by find(), and get().

◆ cConfigOption() [2/2]

cConfigOption ( const char * name,
ObjectKind kind,
Type type,
const char * unit,
const char * defaultValue,
const char * description )

Constructor for per-object options.

Member Function Documentation

◆ str()

virtual std::string str ( ) const
overridevirtual

Returns a brief, one-line description of the object. The returned string does (should) NOT include the object's name and class. This method is used to display object information at several places in the Qtenv GUI, among others.

Reimplemented from cObject.

◆ isPerObject()

bool isPerObject ( ) const
inline

Returns whether this is a per-object configuration. Per-object configuration entries take the form of <object-full-path>.<configname> = <value> in the inifile, instead of <configname> = <value>

◆ isGlobal()

bool isGlobal ( ) const
inline

Returns whether this is a global setting. Global settings may only occur in the [General] section.

Referenced by cConfigOption().

◆ getObjectKind()

ObjectKind getObjectKind ( ) const
inline

Returns the object kind for per-object configuration options, KIND_NONE otherwise.

◆ getObjectKindName()

const char * getObjectKindName ( ObjectKind kind)
static

Returns the human-readable name of a per-object option object kind.

◆ getType()

Type getType ( ) const
inline

Data type of the option.

◆ getTypeName()

const char * getTypeName ( Type type)
static

Returns the human-readable name of an option data type.

◆ getUnit()

const char * getUnit ( ) const
inline

Returns the unit of the option (e.g. "s" for seconds, "b" for bytes, etc), or nullptr if the option does not have a unit.

◆ getDefaultValue()

const char * getDefaultValue ( ) const
inline

Returns the default value in string form, or nullptr if there is no default.

◆ getDescription()

const char * getDescription ( ) const
inline

Returns a brief textual description of the option, which can be used as help text or hint.

◆ find()

cConfigOption * find ( const char * name)
static

Finds a configuration option by name. Returns nullptr if not found.

References cConfigOption().

◆ get()

cConfigOption * get ( const char * name)
static

Finds a configuration option by name. Throws an error if not found.

References cConfigOption().