CoreDX DDS C++ Reference Manual
Public Member Functions | List of all members
CDX::StructDynamicType Class Reference

Represents a struct of members. Each member has an associated data type. More...

Inheritance diagram for CDX::StructDynamicType:
CDX::DynamicType

Public Member Functions

uint32_t get_num_fields ()
 Provides access to the number of fields held by a STRUCT or UNION DynamicType object. More...
 
DynamicTypeget_field (uint32_t n)
 Provides access to a field held by a STRUCT or UNION DynamicType object. More...
 
const char * get_field_name (uint32_t n)
 Provides access to the name of a field held by a STRUCT or UNION DynamicType object. More...
 
unsigned char get_field_key (uint32_t n)
 Provides access to the 'key' indication for a field held by a STRUCT DynamicType object. More...
 
DDS::ReturnCode_t set_num_fields (uint32_t n)
 Defines the number of fields held by a STRUCT or UNION DynamicType object. More...
 
DDS::ReturnCode_t set_field (uint32_t n, const char *field_name, DynamicType *e, unsigned char key)
 Assigns a value to a field of a STRUCT or UNION DynamicType object. More...
 
- Public Member Functions inherited from CDX::DynamicType
virtual TypeCodeKind get_type ()
 Provides access to the 'type' of the DynamicType object. Applicable to any DynamicType. More...
 

Detailed Description

Represents a struct of members. Each member has an associated data type.

Member Function Documentation

DynamicType* CDX::StructDynamicType::get_field ( uint32_t  n)

Provides access to a field held by a STRUCT or UNION DynamicType object.

This is applicable for a STRUCT or UNION DynamicType object. For a STRUCT or UNION, this returns a field held in the data structure.

Return values
DynamicTypethe number of data fields in the STRUCT or UNION 't'.
unsigned char CDX::StructDynamicType::get_field_key ( uint32_t  n)

Provides access to the 'key' indication for a field held by a STRUCT DynamicType object.

This is applicable for a STRUCT DynamicType object. For a STRUCT, this returns an indication that field 'n' is (or is not) a key in the data structure.

Return values
unsigned_charif non-zero, the field at index 'n' is a key field. if zero, the field at index 'n' is not a key field.
const char* CDX::StructDynamicType::get_field_name ( uint32_t  n)

Provides access to the name of a field held by a STRUCT or UNION DynamicType object.

This is applicable for a STRUCT or UNION DynamicType object. For a STRUCT or UNION, this returns the name of a field held in the data structure.

Return values
const_char_*field name of field 'n' in STRUCT or UNION 't'.
uint32_t CDX::StructDynamicType::get_num_fields ( )

Provides access to the number of fields held by a STRUCT or UNION DynamicType object.

This is applicable for a STRUCT or UNION DynamicType object. For a STRUCT, this returns the number of fields held in the structure. For a UNION, this returns the number of fields contained by the UNION where a field is selectable by one or more case labels.

Return values
uint32_tthe number of data fields in the STRUCT or UNION 't'.
DDS::ReturnCode_t CDX::StructDynamicType::set_field ( uint32_t  n,
const char *  field_name,
DynamicType e,
unsigned char  key 
)

Assigns a value to a field of a STRUCT or UNION DynamicType object.

The 'nth' field of the struct or union is assigned the provided field_name, type e. The key parameter is used only for STRUCT types. If key is non-zero, then the field is added to the 'key set' for this data type. This routine makes a copy of the 'field_name' argument.

Note
The STRUCT or UNION takes ownership of the provided field.
Fields of a UNION data type can not be part of a 'key set', as the field may not exist in a particular instantiation of the union data type.
Return values
BAD_PARAMETERif 't' is not of type STRUCT or UNION.
OUT_OF_MEMORYif memory allocation (to hold a copy of field_name) fails.
OKupon success.
DDS::ReturnCode_t CDX::StructDynamicType::set_num_fields ( uint32_t  n)

Defines the number of fields held by a STRUCT or UNION DynamicType object.

Return values
BAD_PARAMETERif 't' is not of type STRUCT or UNION.
OKupon success.

© 2009-2017 Twin Oaks Computing, Inc
Castle Rock, CO 80108
All rights reserved.