cDynamicDescriptor Class Reference¶

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

Public Member Functions

virtual const char ** getPropertyNames () const override
virtual const char * getProperty (const char *propertyName) const override
virtual int getFieldCount () const override
virtual const char * getFieldName (int field) const override
virtual unsigned int getFieldTypeFlags (int field) const override
virtual const char * getFieldTypeString (int field) const override
virtual const char ** getFieldPropertyNames (int field) const override
virtual const char * getFieldProperty (int field, const char *propertyName) const override
virtual int getFieldArraySize (any_ptr object, int field) const override
virtual void setFieldArraySize (any_ptr object, int field, int size) const override
virtual std::string getFieldValueAsString (any_ptr object, int field, int i) const override
virtual void setFieldValueAsString (any_ptr object, int field, int i, const char *value) const override
virtual cValue getFieldValue (any_ptr object, int field, int i) const override
virtual void setFieldValue (any_ptr object, int field, int i, const cValue &value) const override
virtual const char * getFieldStructName (int field) const override
virtual any_ptr getFieldStructValuePointer (any_ptr object, int field, int i) const override
virtual void setFieldStructValuePointer (any_ptr object, int field, int i, any_ptr ptr) const override
Public Member Functions inherited from cClassDescriptor
 cClassDescriptor (const char *className, const char *baseClassName=nullptr)
virtual ~cClassDescriptor ()
virtual bool doesSupport (cObject *obj) const
virtual cClassDescriptor * getBaseClassDescriptor () const
bool extendsCObject () const
std::string getNamespace () const
int getInheritanceChainLength () const
virtual std::string getValueAsString (any_ptr object) const
virtual void setValueAsString (any_ptr object, const char *value) const
virtual int findField (const char *fieldName) const
virtual const char * getFieldDeclaredOn (int field) const
virtual const char * getFieldDynamicTypeString (any_ptr object, int field, int i) const
virtual std::string getFieldArrayIndexString (any_ptr object, int field, int arrayIndex) const
Public Member Functions inherited from cNoncopyableOwnedObject
 cNoncopyableOwnedObject (const char *name=nullptr, bool namepooling=true)
virtual cNoncopyableOwnedObject * dup () const override
Public Member Functions inherited from cOwnedObject
 cOwnedObject ()
 cOwnedObject (const char *name, bool namepooling=true)
 cOwnedObject (const cOwnedObject &obj)
virtual ~cOwnedObject ()
cOwnedObject & operator= (const cOwnedObject &o)
virtual cObject * getOwner () 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 ()
cNamedObject & operator= (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 cObject * getThisPtr () const
virtual std::string str () const
virtual std::ostream & printOn (std::ostream &os) const
virtual bool isSoftOwner () const
virtual void forEachChild (cVisitor *v)
cObject * findObject (const char *name, bool deep=true)
virtual cClassDescriptor * getDescriptor () const
void copyNotSupported () const

Additional Inherited Members

Public Types inherited from cClassDescriptor
enum  {
  FD_ISARRAY = 0x01 , FD_ISCOMPOUND = 0x02 , FD_ISPOINTER = 0x04 , FD_ISCOBJECT = 0x08 ,
  FD_ISCOWNEDOBJECT = 0x10 , FD_ISEDITABLE = 0x20 , FD_ISREPLACEABLE = 0x40 , FD_ISRESIZABLE = 0x80 ,
  FD_NONE = 0x0
}
 Field types. More...
Static Public Member Functions inherited from cClassDescriptor
static cClassDescriptor * getDescriptorFor (const char *classname)
static cClassDescriptor * getDescriptorFor (const cObject *object)
Static Public Member Functions inherited from cOwnedObject
static long getTotalObjectCount ()
static long getLiveObjectCount ()
static void resetObjectCounters ()
static cSoftOwner * getOwningContext ()
Static Public Attributes inherited from cClassDescriptor
static constexpr const char * UNPRINTABLE = "(unprintable)"
 Returned by getValueAsString() and getFieldValueAsString() for types that have no text representation.
Protected Member Functions inherited from cObject
virtual void take (cOwnedObject *obj)
virtual void drop (cOwnedObject *obj)
void dropAndDelete (cOwnedObject *obj)

Description

Base class for dynamically created descriptors. Provides defaults for all pure virtual methods of cClassDescriptor (zero fields, empty properties).

Member Function Documentation

◆ getPropertyNames()

virtual const char ** getPropertyNames ( ) const
overridevirtual

Returns a NUL-terminated string array with the names of properties on this class. The list includes the properties of the ancestor classes as well.

Implements cClassDescriptor.

◆ getProperty()

virtual const char * getProperty ( const char * propertyname) const
overridevirtual

Returns the value of the given property of the descriptor as a single string. Returns nullptr if there is no such property. For structured property values (with multiple keys and/or list(s) inside), the value is returned as a single unparsed string. If a property appears in a base class and its subclass too, the subclass's property will be returned.

Implements cClassDescriptor.

◆ getFieldCount()

virtual int getFieldCount ( ) const
overridevirtual

Returns the number of fields in the described class.

Implements cClassDescriptor.

Reimplemented in cStdListDescriptor< E >, cStdMapDescriptor< MapType >, cStdPairDescriptor< F, S >, cStdSetDescriptor< E >, and cStdVectorDescriptor< E >.

◆ getFieldName()

virtual const char * getFieldName ( int field) const
overridevirtual

Returns the name of a field in the described class. The argument must be in the 0..getFieldCount()-1 range, inclusive.

Implements cClassDescriptor.

Reimplemented in cStdListDescriptor< E >, cStdMapDescriptor< MapType >, cStdPairDescriptor< F, S >, cStdSetDescriptor< E >, and cStdVectorDescriptor< E >.

◆ getFieldTypeFlags()

virtual unsigned int getFieldTypeFlags ( int field) const
overridevirtual

Returns the type flags of a field in the described class. Flags is a binary OR of the following: FD_ISARRAY, FD_ISCOMPOUND, FD_ISPOINTER, FD_ISCOWNEDOBJECT, FD_ISCOBJECT. The argument must be in the 0..getFieldCount()-1 range, inclusive.

Implements cClassDescriptor.

Reimplemented in cStdListDescriptor< E >, cStdMapDescriptor< MapType >, cStdPairDescriptor< F, S >, cStdSetDescriptor< E >, and cStdVectorDescriptor< E >.

◆ getFieldTypeString()

virtual const char * getFieldTypeString ( int field) const
overridevirtual

Returns the declared type of a field in the described class as a string. The argument must be in the 0..getFieldCount()-1 range, inclusive.

See also
getFieldDynamicTypeString()

Implements cClassDescriptor.

Reimplemented in cStdListDescriptor< E >, cStdMapDescriptor< MapType >, cStdPairDescriptor< F, S >, cStdSetDescriptor< E >, and cStdVectorDescriptor< E >.

◆ getFieldPropertyNames()

virtual const char ** getFieldPropertyNames ( int field) const
overridevirtual

Returns a nullptr-terminated string array with the names of the given field's properties.

Implements cClassDescriptor.

◆ getFieldProperty()

virtual const char * getFieldProperty ( int field,
const char * propertyname ) const
overridevirtual

Returns the value of the given property of the given field in the described class as a single string. Returns nullptr if there is no such property. For structured property values (with multiple keys and/or list(s) inside), the value is returned as a single unparsed string.

Implements cClassDescriptor.

◆ getFieldArraySize()

virtual int getFieldArraySize ( any_ptr object,
int field ) const
overridevirtual

Returns the array size of a field in the given object. If the field is not an array, it returns 0.

Implements cClassDescriptor.

Reimplemented in cStdListDescriptor< E >, cStdMapDescriptor< MapType >, cStdSetDescriptor< E >, and cStdVectorDescriptor< E >.

◆ setFieldArraySize()

virtual void setFieldArraySize ( any_ptr object,
int field,
int size ) const
overridevirtual

Sets the array size of a field in the given object. If the operation is not successful, an exception is thrown.

The field argument must be in the 0..getFieldCount()-1 range. The i argument must be in the 0..getFieldArraySize()-1 range, or 0 if the field is not an array.

Implements cClassDescriptor.

Reimplemented in cStdVectorDescriptor< E >.

Referenced by cStdVectorDescriptor< E >::setFieldArraySize().

◆ getFieldValueAsString()

virtual std::string getFieldValueAsString ( any_ptr object,
int field,
int i ) const
overridevirtual

Returns the value of the given field in the given object as a string. For compound fields, the message compiler generates code which calls operator<<.

The field argument must be in the 0..getFieldCount()-1 range. The i argument must be in the 0..getFieldArraySize()-1 range, or 0 if the field is not an array.

Implements cClassDescriptor.

Reimplemented in cStdListDescriptor< E >, cStdMapDescriptor< MapType >, cStdPairDescriptor< F, S >, cStdSetDescriptor< E >, and cStdVectorDescriptor< E >.

◆ setFieldValueAsString()

virtual void setFieldValueAsString ( any_ptr object,
int field,
int i,
const char * value ) const
overridevirtual

Sets the value of a field in the given object by parsing the given value string. If the operation is not successful, an exception is thrown.

The field argument must be in the 0..getFieldCount()-1 range. The i argument must be in the 0..getFieldArraySize()-1 range, or 0 if the field is not an array.

Implements cClassDescriptor.

Reimplemented in cStdListDescriptor< E >, cStdMapDescriptor< MapType >, cStdPairDescriptor< F, S >, and cStdVectorDescriptor< E >.

Referenced by cStdListDescriptor< E >::setFieldValueAsString(), cStdMapDescriptor< MapType >::setFieldValueAsString(), cStdPairDescriptor< F, S >::setFieldValueAsString(), and cStdVectorDescriptor< E >::setFieldValueAsString().

◆ getFieldValue()

virtual cValue getFieldValue ( any_ptr object,
int field,
int i ) const
overridevirtual

Returns the value of the given field in the given object.

The field argument must be in the 0..getFieldCount()-1 range. The i argument must be in the 0..getFieldArraySize()-1 range, or 0 if the field is not an array.

Implements cClassDescriptor.

◆ setFieldValue()

virtual void setFieldValue ( any_ptr object,
int field,
int i,
const cValue & value ) const
overridevirtual

Sets the value of a field in the given object. If the operation is not successful, an exception is thrown.

The field argument must be in the 0..getFieldCount()-1 range. The i argument must be in the 0..getFieldArraySize()-1 range, or 0 if the field is not an array.

Implements cClassDescriptor.

◆ getFieldStructName()

virtual const char * getFieldStructName ( int field) const
overridevirtual

Returns the declared type name of a compound field in the described class. The field is a pointer, the "*" is removed. The return value may be used as class name to obtain a class descriptor for this compound field.

Implements cClassDescriptor.

Reimplemented in cStdListDescriptor< E >, cStdMapDescriptor< MapType >, cStdPairDescriptor< F, S >, cStdSetDescriptor< E >, and cStdVectorDescriptor< E >.

◆ getFieldStructValuePointer()

virtual any_ptr getFieldStructValuePointer ( any_ptr object,
int field,
int i ) const
overridevirtual

Returns the pointer to the value of a compound field in the given object. The field argument must be in the 0..getFieldCount()-1 range. The i argument must be in the 0..getFieldArraySize()-1 range, or 0 if the field is not an array.

Implements cClassDescriptor.

Reimplemented in cStdListDescriptor< E >, cStdMapDescriptor< MapType >, cStdPairDescriptor< F, S >, cStdSetDescriptor< E >, and cStdVectorDescriptor< E >.

◆ setFieldStructValuePointer()

virtual void setFieldStructValuePointer ( any_ptr object,
int field,
int i,
any_ptr ptr ) const
overridevirtual

Sets a pointer field in the given object. If the operation is not successful, an exception is thrown.

The field argument must be in the 0..getFieldCount()-1 range. The i argument must be in the 0..getFieldArraySize()-1 range, or 0 if the field is not an array.

Implements cClassDescriptor.