Class PVUnion

Inheritance Relationships

Base Type

Class Documentation

class PVUnion : public epics::pvData::PVField

PVUnion has a single subfield.

The type for the subfield is specified by a union introspection interface.

Public Types

typedef PVUnion &reference
typedef const PVUnion &const_reference

Public Functions

POINTER_DEFINITIONS(PVUnion)
virtual ~PVUnion()

Destructor

inline const UnionConstPtr &getUnion() const

Get the introspection interface

Returns

The interface.

inline const PVFieldPtr &get()

Get the PVField value stored in the field.

Returns

PVField value of field, null if

getSelectedIndex() == UNDEFINED_INDEX 
.

inline PVField::const_shared_pointer get() const
template<typename PVT>
inline std::tr1::shared_ptr<PVT> get()
template<typename PVT>
inline std::tr1::shared_ptr<const PVT> get() const
PVFieldPtr select(int32 index)

Select field (set index) and get the field at the index.

Parameters

index – index of the field to select.

Throws

std::invalid_argument – if index is invalid (out of range).

Returns

corresponding PVField (of undetermined value), null if

index == UNDEFINED_INDEX 
.

template<typename PVT>
inline std::tr1::shared_ptr<PVT> select(int32 index)
PVFieldPtr select(std::string const &fieldName)

Select field (set index) and get the field by given name.

Parameters

fieldName – the name of the field to select.

Throws

std::invalid_argument – if field does not exist.

Returns

corresponding PVField (of undetermined value).

template<typename PVT>
inline std::tr1::shared_ptr<PVT> select(std::string const &fieldName)
inline int32 getSelectedIndex() const

Get selected field index.

Returns

selected field index.

std::string getSelectedFieldName() const

Get selected field name.

Returns

selected field name, empty string if field does not exist.

inline void set(PVFieldPtr const &value)

Set the PVField (by reference!) as selected field. If a value is not a valid union field an std::invalid_argument exception is thrown.

Parameters

value – the field to set.

void set(int32 index, PVFieldPtr const &value)

Set the PVField (by reference!) as field at given index. If a value is not a valid union field an std::invalid_argument exception is thrown. Use select(int32) to put by value.

See also

select(int32)

Parameters
  • index – index of a field to put.

  • value – the field to set.

void set(std::string const &fieldName, PVFieldPtr const &value)

Set the PVField (by reference!) as field by given name. If a value is not a valid union field an std::invalid_argument exception is thrown. Use select(std::string const &) to put by value.

Parameters
  • fieldName – Name of the field to put.

  • value – the field to set.

virtual void serialize (ByteBuffer *pbuffer, SerializableControl *pflusher) const OVERRIDE FINAL

Serialize.

Parameters
  • pbuffer – The byte buffer.

  • pflusher – Interface to call when buffer is full.

virtual void deserialize (ByteBuffer *pbuffer, DeserializableControl *pflusher) OVERRIDE FINAL

Deserialize

Parameters
  • pbuffer – The byte buffer.

  • pflusher – Interface to call when buffer is empty.

explicit PVUnion(UnionConstPtr const &punion)

Constructor

Parameters

punion – The introspection interface.

virtual std::ostream & dumpValue (std::ostream &o) const OVERRIDE FINAL

Puts the PVField raw value to the stream.

Parameters

o – output stream.

Returns

The output stream.

void copy(const PVUnion &from)
void copyUnchecked(const PVUnion &from)

Public Static Attributes

static const int32 UNDEFINED_INDEX = -1

Undefined index. Default value upon PVUnion construction. Can be set by the user. Corresponds to null value.