CoreDX DDS Modern C++ API
|
Create a dynamic structure type. More...
Inherits dds::core::xtypes::TDynamicType< DELEGATE >.
Public Member Functions | |
StructType (const std::string &name) | |
Constructor. More... | |
StructType (const std::string &name, const StructType &parent) | |
Constructor. More... | |
StructType (const std::string &name, const StructType &parent, const std::vector< MemberType > &members) | |
Constructor. More... | |
template<typename MemberIter > | |
StructType (const std::string &name, const StructType &parent, const MemberIter &begin, const MemberIter &end) | |
Constructor. More... | |
StructType (const std::string &name, const StructType &parent, const std::vector< MemberType > &members, const Annotation &annotation) | |
Constructor. More... | |
StructType (const std::string &name, const StructType &parent, const std::vector< MemberType > &members, const std::vector< Annotation > &annotations) | |
Constructor. More... | |
template<typename AnnotationIter , typename MemberIter > | |
StructType (const std::string &name, const StructType &parent, const MemberIter &mbegin, const MemberIter &mend, const AnnotationIter &abegin, const AnnotationIter &aend) | |
Constructor. More... | |
StructType (const std::string &name, std::initializer_list< MemberType > members) | |
Constructor. More... | |
StructType (const std::string &name, const StructType &parent, std::initializer_list< MemberType > members) | |
Constructor. More... | |
const StructType & | parent () const |
construct from a DynamicType (cast) More... | |
size_t | member_count () const |
Access the member count. | |
std::vector< MemberType > | members () const |
Access the members. | |
std::map< uint32_t, MemberType > | all_members () const |
Access the members - including inherited members - access by 'id'. | |
const MemberType | member (uint32_t id) const |
Access a member by id. | |
const MemberType | member (const std::string &name) const |
Access a member by name. | |
const std::vector< Annotation > & | annotations () const |
Access the annotations. | |
StructType | add_member (const MemberType &member) |
Add a member. More... | |
StructType | remove_member (const MemberType &member) |
Remove a member. More... | |
StructType | add_annotation (const Annotation &annotation) |
Add an annotation. More... | |
StructType | remove_annotation (const Annotation &annotation) |
Remove an annotation. More... | |
StructType | extensibility_kind (dds::core::xtypes::ExtensibilityKind kind) |
Set the extensibility kind of the structure. More... | |
dds::core::xtypes::ExtensibilityKind | extensibility_kind () const |
Access the extensibility kind of the structure. | |
virtual void | accept (DynamicTypeVisitor &v) const |
Accept a DynamicTypeVisitor. More... | |
Related Functions | |
(Note that these are not member functions.) | |
template<typename T > | |
bool | isFinal (const StructType< T > &s) |
Test if the StructType has FINAL extensibility. | |
template<typename T > | |
bool | isExtensible (const StructType< T > &s) |
Test if the StructType has EXTENSIBLE extensibility. | |
template<typename T > | |
bool | isMutable (const StructType< T > &s) |
Test if the StructType has MUTABLE extensibility. | |
template<typename T > | |
bool | isNested (const StructType< T > &s) |
Test if the StructType is marked as NESTED. More... | |
template<typename T > | |
bool | hasParent (const StructType< T > &s) |
Test if the StructType has a parent type that it derives from. | |
Create a dynamic structure type.
If the members don't have Id associated explicitly, then their ID will be the same as the ordinal position on the members vector.
dds::core::xtypes::StructType::StructType | ( | const std::string & | name | ) |
Constructor.
Sets the struct name.
dds::core::xtypes::StructType::StructType | ( | const std::string & | name, |
const StructType & | parent | ||
) |
Constructor.
Sets the struct name and specifies a parent (base struct).
dds::core::xtypes::StructType::StructType | ( | const std::string & | name, |
const StructType & | parent, | ||
const std::vector< MemberType > & | members | ||
) |
Constructor.
Sets the struct name and specifies a parent (base struct). Assigns the provided members.
dds::core::xtypes::StructType::StructType | ( | const std::string & | name, |
const StructType & | parent, | ||
const MemberIter & | begin, | ||
const MemberIter & | end | ||
) |
Constructor.
Sets the struct name and specifies a parent (base struct). Assigns the provided members.
dds::core::xtypes::StructType::StructType | ( | const std::string & | name, |
const StructType & | parent, | ||
const std::vector< MemberType > & | members, | ||
const Annotation & | annotation | ||
) |
Constructor.
Sets the struct name and specifies a parent (base struct). Assigns the provided members. Applys the provided annotation.
dds::core::xtypes::StructType::StructType | ( | const std::string & | name, |
const StructType & | parent, | ||
const std::vector< MemberType > & | members, | ||
const std::vector< Annotation > & | annotations | ||
) |
Constructor.
Sets the struct name and specifies a parent (base struct). Assigns the provided members. Applys the provided annotations.
dds::core::xtypes::StructType::StructType | ( | const std::string & | name, |
const StructType & | parent, | ||
const MemberIter & | mbegin, | ||
const MemberIter & | mend, | ||
const AnnotationIter & | abegin, | ||
const AnnotationIter & | aend | ||
) |
Constructor.
Sets the struct name and specifies a parent (base struct). Assigns the provided members. Applys the provided annotations.
dds::core::xtypes::StructType::StructType | ( | const std::string & | name, |
std::initializer_list< MemberType > | members | ||
) |
Constructor.
Sets the struct name. Assigns the provided member via an initializer list.
dds::core::xtypes::StructType::StructType | ( | const std::string & | name, |
const StructType & | parent, | ||
std::initializer_list< MemberType > | members | ||
) |
Constructor.
Sets the struct name and specifies a parent (base struct). Assigns the provided member via an initializer list.
|
virtual |
Accept a DynamicTypeVisitor.
Useful for traversing the type hierarchy.
StructType dds::core::xtypes::StructType::add_annotation | ( | const Annotation & | annotation | ) |
Add an annotation.
StructType dds::core::xtypes::StructType::add_member | ( | const MemberType & | member | ) |
Add a member.
May throw dds::core::PreconditionNotMetError() if there is a collision between this new member and an existing member. The collision can be due to a matching ID or name. Additionally, dds::core::PreconditionNotMetError() is thrown if the member is marked as key and optional.
StructType dds::core::xtypes::StructType::extensibility_kind | ( | dds::core::xtypes::ExtensibilityKind | kind | ) |
Set the extensibility kind of the structure.
Use instead of applying an ExtensibilityAnnotation.
const StructType& dds::core::xtypes::StructType::parent | ( | ) | const |
construct from a DynamicType (cast)
Access the parent StructType
StructType dds::core::xtypes::StructType::remove_annotation | ( | const Annotation & | annotation | ) |
Remove an annotation.
StructType dds::core::xtypes::StructType::remove_member | ( | const MemberType & | member | ) |
Remove a member.
|
related |
Test if the StructType is marked as NESTED.
This is irrelevant wrt DynamicType's