CoreDX DDS Modern C++ API
Public Member Functions | Related Functions | List of all members
dds::core::xtypes::StructType Class Reference

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 StructTypeparent () const
 construct from a DynamicType (cast) More...
 
size_t member_count () const
 Access the member count.
 
std::vector< MemberTypemembers () const
 Access the members.
 
std::map< uint32_t, MemberTypeall_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.
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ StructType() [1/9]

dds::core::xtypes::StructType::StructType ( const std::string &  name)

Constructor.

Sets the struct name.

◆ StructType() [2/9]

dds::core::xtypes::StructType::StructType ( const std::string &  name,
const StructType parent 
)

Constructor.

Sets the struct name and specifies a parent (base struct).

◆ StructType() [3/9]

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.

◆ StructType() [4/9]

template<typename MemberIter >
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.

◆ StructType() [5/9]

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.

Not Yet Supported:
Annotation application is not supported – use extensibility_kind() methods.

◆ StructType() [6/9]

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.

Not Yet Supported:
Annotation application is not supported – use extensibility_kind() methods.

◆ StructType() [7/9]

template<typename AnnotationIter , typename MemberIter >
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.

Not Yet Supported:
Annotation application is not supported – use extensibility_kind() methods.

◆ StructType() [8/9]

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.

◆ StructType() [9/9]

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.

Member Function Documentation

◆ accept()

virtual void dds::core::xtypes::StructType::accept ( DynamicTypeVisitor v) const
virtual

Accept a DynamicTypeVisitor.

Useful for traversing the type hierarchy.

◆ add_annotation()

StructType dds::core::xtypes::StructType::add_annotation ( const Annotation annotation)

Add an annotation.

Not Yet Supported:
Annotation application is not supported

◆ add_member()

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.

◆ extensibility_kind()

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.

◆ parent()

const StructType& dds::core::xtypes::StructType::parent ( ) const

construct from a DynamicType (cast)

Access the parent StructType

◆ remove_annotation()

StructType dds::core::xtypes::StructType::remove_annotation ( const Annotation annotation)

Remove an annotation.

Not Yet Supported:
Annotation application is not supported

◆ remove_member()

StructType dds::core::xtypes::StructType::remove_member ( const MemberType member)

Remove a member.

Not Yet Supported:
member removal is not supported

Friends And Related Function Documentation

◆ isNested()

template<typename T >
bool isNested ( const StructType< T > &  s)
related

Test if the StructType is marked as NESTED.

This is irrelevant wrt DynamicType's


© 2009-2020 Twin Oaks Computing, Inc
Castle Rock, CO 80104
All rights reserved.