This class implements introspection object for a structure.
More...
#include "pvIntrospect.h"
This class implements introspection object for a structure.
Definition at line 697 of file pvIntrospect.h.
epics::pvData::Structure::~Structure |
( |
| ) |
|
|
virtual |
Definition at line 514 of file FieldCreateFactory.cpp.
519 fieldNames(fieldNames),
524 THROW_EXCEPTION2(std::invalid_argument,
"Can't construct Structure, id is empty string");
526 if(fieldNames.size()!=fields.size()) {
527 THROW_EXCEPTION2(std::invalid_argument,
"Can't construct Structure, fieldNames.size()!=fields.size()");
529 size_t number = fields.size();
530 for(
size_t i=0;
i<number;
i++) {
531 const string& name = fieldNames[
i];
533 THROW_EXCEPTION2(std::invalid_argument,
"Can't construct Structure, empty string in fieldNames");
535 if(fields[
i].
get()==
NULL)
536 THROW_EXCEPTION2(std::invalid_argument,
"Can't construct Structure, NULL in fields");
538 for(
size_t j=
i+1; j<number; j++) {
539 string otherName = fieldNames[j];
540 int result = name.compare(otherName);
542 string message(
"Can't construct Structure, duplicate fieldName ");
#define THROW_EXCEPTION2(TYPE, MSG)
std::tr1::shared_ptr< PVStructure > epics::pvData::Structure::build |
( |
| ) |
const |
Allocate a new instance
- Version
- Added after 7.0.0
Definition at line 661 of file FieldCreateFactory.cpp.
663 return getPVDataCreate()->createPVStructure(std::tr1::static_pointer_cast<const Structure>(shared_from_this()));
FORCE_INLINE const PVDataCreatePtr & getPVDataCreate()
const string & epics::pvData::Structure::defaultId |
( |
| ) |
|
|
static |
Get the default structure ID.
- Returns
- The default structure ID.
Definition at line 508 of file FieldCreateFactory.cpp.
510 static const string id =
"structure";
Deserialize buffer.
- Parameters
-
buffer | serialization buffer. |
flusher | deserialization control. |
Implements epics::pvData::Serializable.
Definition at line 657 of file FieldCreateFactory.cpp.
658 throw std::runtime_error(
"not valid operation, use FieldCreate::deserialize instead");
std::ostream & epics::pvData::Structure::dump |
( |
std::ostream & |
o | ) |
const |
|
virtual |
Puts the string representation to the stream.
- Parameters
-
- Returns
- The output stream.
Implements epics::pvData::Field.
Definition at line 595 of file FieldCreateFactory.cpp.
597 o << format::indent() <<
getID() << std::endl;
599 format::indent_scope s(o);
virtual std::string getID() const OVERRIDE FINAL
FieldConstPtr epics::pvData::Structure::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 >
std::tr1::shared_ptr<const FT> epics::pvData::Structure::getField |
( |
std::string const & |
fieldName | ) |
const |
|
inline |
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.
Definition at line 734 of file pvIntrospect.h.
FieldConstPtr getField(std::string const &fieldName) const
#define STATIC_ASSERT(expr)
Declare a condition that should be true at compile-time.
shared_ptr< T > dynamic_pointer_cast(shared_ptr< U > const &r) BOOST_NOEXCEPT
const FieldConstPtr& epics::pvData::Structure::getField |
( |
std::size_t |
index | ) |
const |
|
inline |
Lookup Field by index, within this Structure.
- Parameters
-
index | Index of member in this structure. |
- Returns
- Field pointer (never NULL)
- Exceptions
-
Definition at line 772 of file pvIntrospect.h.
772 {
return fields.at(index);}
template<typename FT >
std::tr1::shared_ptr<const FT> epics::pvData::Structure::getField |
( |
std::size_t |
index | ) |
const |
|
inline |
Lookup Field by index, within this Structure.
- Parameters
-
index | Index of member in this structure. |
- Returns
- NULL if member is not a sub-class of FT
- Exceptions
-
Definition at line 780 of file pvIntrospect.h.
FieldConstPtr getField(std::string const &fieldName) const
#define STATIC_ASSERT(expr)
Declare a condition that should be true at compile-time.
shared_ptr< T > dynamic_pointer_cast(shared_ptr< U > const &r) BOOST_NOEXCEPT
size_t epics::pvData::Structure::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.
Definition at line 570 of file FieldCreateFactory.cpp.
571 size_t numberFields = fields.size();
572 for(
size_t i=0;
i<numberFields;
i++) {
574 int result = fieldName.compare(fieldNames[
i]);
575 if(result==0)
return i;
std::tr1::shared_ptr< const Field > FieldConstPtr
const std::string& epics::pvData::Structure::getFieldName |
( |
std::size_t |
fieldIndex | ) |
const |
|
inline |
Get the name of the field with the specified index;
- Parameters
-
fieldIndex | The index of the desired field. |
- Returns
- The fieldName.
Definition at line 834 of file pvIntrospect.h.
834 {
return fieldNames.at(fieldIndex);}
StringArray const& epics::pvData::Structure::getFieldNames |
( |
| ) |
const |
|
inline |
Get the names of the fields in the structure.
- Returns
- The array of fieldNames.
Definition at line 828 of file pvIntrospect.h.
Get the fields in the structure.
- Returns
- The array of fields.
Definition at line 823 of file pvIntrospect.h.
FieldConstPtr epics::pvData::Structure::getFieldT |
( |
std::string const & |
fieldName | ) |
const |
|
inline |
Lookup Field by name
- Parameters
-
fieldName | Member field name. May not contain '.' |
- Returns
- Field pointer (never NULL)
- Exceptions
-
std::runtime_error | If no member by this name |
Definition at line 746 of file pvIntrospect.h.
746 {
return getFieldImpl(fieldName,
true);};
template<typename FT >
std::tr1::shared_ptr<const FT> epics::pvData::Structure::getFieldT |
( |
std::string const & |
fieldName | ) |
const |
|
inline |
Lookup Field by name and cast to Field sub-class.
- Parameters
-
fieldName | Member field name. May not contain '.' |
- Returns
- Field pointer (never NULL)
- Exceptions
-
std::runtime_error | If no member by this name, or member exists, but has type other than FT. |
Definition at line 754 of file pvIntrospect.h.
757 std::tr1::shared_ptr<const FT>
result(
758 std::tr1::dynamic_pointer_cast<const FT>(
getFieldT(fieldName))
762 throw std::runtime_error(
"Wrong Field type");
FieldConstPtr getFieldT(std::string const &fieldName) const
#define STATIC_ASSERT(expr)
Declare a condition that should be true at compile-time.
FieldConstPtr epics::pvData::Structure::getFieldT |
( |
std::size_t |
index | ) |
const |
|
inline |
Lookup Field by index, within this Structure.
- Parameters
-
index | Index of member in this structure. |
- Returns
- Field pointer (never NULL)
- Exceptions
-
Definition at line 791 of file pvIntrospect.h.
791 {
return fields.at(index);}
template<typename FT >
std::tr1::shared_ptr<const FT> epics::pvData::Structure::getFieldT |
( |
std::size_t |
index | ) |
const |
|
inline |
Lookup Field by index, within this Structure.
- Parameters
-
index | Index of member in this structure. |
- Returns
- Field pointer (never NULL)
- Exceptions
-
std::out_of_range | If index >= getNumberFields() |
std::runtime_error | If member is not a sub-class of FT |
Definition at line 800 of file pvIntrospect.h.
803 std::tr1::shared_ptr<const FT>
result(
804 std::tr1::dynamic_pointer_cast<const FT>(
getFieldT(index))
808 throw std::runtime_error(
"Wrong Field type");
FieldConstPtr getFieldT(std::string const &fieldName) const
#define STATIC_ASSERT(expr)
Declare a condition that should be true at compile-time.
string epics::pvData::Structure::getID |
( |
| ) |
const |
|
virtual |
std::size_t epics::pvData::Structure::getNumberFields |
( |
| ) |
const |
|
inline |
Get the number of immediate subfields in the structure.
- Returns
- The number of fields.
Definition at line 720 of file pvIntrospect.h.
720 {
return fieldNames.size();}
epics::pvData::Structure::POINTER_DEFINITIONS |
( |
Structure |
| ) |
|
Serialize field into given buffer.
- Parameters
-
buffer | serialization buffer. |
flusher | flush interface. |
Implements epics::pvData::Serializable.
Definition at line 651 of file FieldCreateFactory.cpp.
652 control->ensureBuffer(1);
653 buffer->putByte((
int8)0x80);
654 serializeStructureField(
this, buffer, control);
The documentation for this class was generated from the following files: