Class Structure

Inheritance Relationships

Base Type

Class Documentation

class Structure : public epics::pvData::Field

This class implements introspection object for a structure.

Public Types

typedef Structure &reference
typedef const Structure &const_reference

Public Functions

POINTER_DEFINITIONS(Structure)
virtual ~Structure()
inline std::size_t getNumberFields() const

Get the number of immediate subfields in the structure.

Returns

The number of fields.

FieldConstPtr getField(std::string const &fieldName) const

Lookup Field by name

Parameters

fieldName – Member field name. May not contain ‘.’

Returns

NULL if no member by this name.

template<typename FT>
inline std::tr1::shared_ptr<const FT> getField(std::string const &fieldName) const

Lookup Field by name and cast to Field sub-class.

Parameters

fieldName – Member field name. May not contain ‘.’

Returns

NULL If no member by this name, or member exists, but has type other than FT.

inline FieldConstPtr getFieldT(std::string const &fieldName) const

Lookup Field by name

Parameters

fieldName – Member field name. May not contain ‘.’

Throws

std::runtime_error – If no member by this name

Returns

Field pointer (never NULL)

template<typename FT>
inline std::tr1::shared_ptr<const FT> getFieldT(std::string const &fieldName) const

Lookup Field by name and cast to Field sub-class.

Parameters

fieldName – Member field name. May not contain ‘.’

Throws

std::runtime_error – If no member by this name, or member exists, but has type other than FT.

Returns

Field pointer (never NULL)

inline const FieldConstPtr &getField(std::size_t index) const

Lookup Field by index, within this Structure.

Parameters

index – Index of member in this structure.

index>=0 && index<getNumberFields() 

Throws

std::out_of_range – If index >= getNumberFields()

Returns

Field pointer (never NULL)

template<typename FT>
inline std::tr1::shared_ptr<const FT> getField(std::size_t index) const

Lookup Field by index, within this Structure.

Parameters

index – Index of member in this structure.

index>=0 && index<getNumberFields() 

Throws

std::out_of_range – If index >= getNumberFields()

Returns

NULL if member is not a sub-class of FT

inline FieldConstPtr getFieldT(std::size_t index) const

Lookup Field by index, within this Structure.

Parameters

index – Index of member in this structure.

index>=0 && index<getNumberFields() 

Throws

std::out_of_range – If index >= getNumberFields()

Returns

Field pointer (never NULL)

template<typename FT>
inline std::tr1::shared_ptr<const FT> getFieldT(std::size_t index) const

Lookup Field by index, within this Structure.

Parameters

index – Index of member in this structure.

index>=0 && index<getNumberFields() 

Throws
  • std::out_of_range – If index >= getNumberFields()

  • std::runtime_error – If member is not a sub-class of FT

Returns

Field pointer (never NULL)

std::size_t getFieldIndex(std::string const &fieldName) const

Get the field index for the specified fieldName.

Returns

The introspection interface. This will be -1 if the field is not in the structure.

inline FieldConstPtrArray const &getFields() const

Get the fields in the structure.

Returns

The array of fields.

inline StringArray const &getFieldNames() const

Get the names of the fields in the structure.

Returns

The array of fieldNames.

inline const std::string &getFieldName(std::size_t fieldIndex) const

Get the name of the field with the specified index;

Parameters

fieldIndex – The index of the desired field.

Returns

The fieldName.

virtual std::string getID() const

Get the identification string.

Returns

The identification string, can be empty.

virtual std::ostream &dump(std::ostream &o) const

Puts the string representation to the stream.

Parameters

o – output stream.

Returns

The output stream.

virtual void serialize(ByteBuffer *buffer, SerializableControl *control) const

Serialize field into given buffer.

Parameters
  • buffer – serialization buffer.

  • flusher – flush interface.

virtual void deserialize(ByteBuffer *buffer, DeserializableControl *control)

Deserialize buffer.

Parameters
  • buffer – serialization buffer.

  • flusher – deserialization control.

std::tr1::shared_ptr<PVStructure> build() const

Allocate a new instance

Version

Added after 7.0.0

Public Static Functions

static const std::string &defaultId()

Get the default structure ID.

Returns

The default structure ID.

Public Static Attributes

static const std::string DEFAULT_ID = Structure::defaultId()

Default structure ID.

Protected Functions

Structure(StringArray const &fieldNames, FieldConstPtrArray const &fields, std::string const &id = defaultId())