ADTF  3.18.2
structure< T >

This is used to create a structure type from an existing c++ struct definition. More...

Inheritance diagram for structure< T >:
[legend]

Public Member Functions

 structure (const std::string &strName)
 Initializes the structure type. More...
 
template<typename MemberType >
structureAdd (const std::string &strName, MemberType T::*pMemberOffset)
 Adds a new member of arithmetic type (POD). More...
 
template<typename MemberType >
structureAdd (const std::string &strName, MemberType T::*pMemberOffset, const cEnumerationType &oTypeDefinition)
 Adds a new member of an enumeration type. More...
 
template<typename MemberType >
structureAdd (const std::string &strName, MemberType T::*pMemberOffset, const cStructureType &oTypeDefinition)
 Adds a new member of a structure type. More...
 
- Public Member Functions inherited from cStructureType
 cStructureType (const std::string &strName, size_t nSize, size_t nAlignment)
 Initializes the structure type. More...
 
 cStructureType (const cStructureType &oOther)
 
std::string GetName () const override
 
size_t GetSize () const override
 
size_t GetAlignment () const override
 
const std::vector< member > & GetMembers () const
 
std::pair< std::string, std::string > GetAsStringPair () const
 Legacy conversion to a pair of (first) md_struct and (second)md_description. More...
 
 operator std::pair< std::string, std::string > () const
 Legacy conversion operator to a pair of (first) md_struct and (second)md_description. More...
 

Private Attributes

size_t m_nCurrentSerializedOffset = 0
 

Additional Inherited Members

- Protected Member Functions inherited from cStructureType
void Add (member &&sNewMember)
 Adds a new member to the structure. More...
 

Detailed Description

template<typename T = void>
class adtf::mediadescription::flash::structure< T >

This is used to create a structure type from an existing c++ struct definition.

Example Usage

struct tSub
{
uint8_t nValue1;
uint8_t nValue2;
};
struct tParent
{
uint32_t nSomething;
tSub sSub;
};
auto oSubType = structure<tSub>("tSub")
.Add("nValue1", &tSub::nValue1)
.Add("nValue2", &tSub::nValue2);
auto oParentType = structure<tParent>("tParent")
.Add("nSomething", &tParent::nSomething)
.Add("sSub", &tParent::sSub, oSubType);

Also have a look at Demo Time Trigger Plugin.

Definition at line 365 of file type_reflection_legacy.h.

Constructor & Destructor Documentation

◆ structure()

structure ( const std::string &  strName)
inline

Initializes the structure type.

Parameters
[in]strNameThe name.

Definition at line 375 of file type_reflection_legacy.h.

Member Function Documentation

◆ Add() [1/3]

structure& Add ( const std::string &  strName,
MemberType T::*  pMemberOffset 
)
inline

Adds a new member of arithmetic type (POD).

Parameters
[in]strNameThe name of the member.
[in]pMemberOffsetThe pointer to the member.
Returns
A reference to the structure.

Definition at line 387 of file type_reflection_legacy.h.

References cStructureType::Add().

Referenced by structure< void >::Add().

◆ Add() [2/3]

structure& Add ( const std::string &  strName,
MemberType T::*  pMemberOffset,
const cEnumerationType oTypeDefinition 
)
inline

Adds a new member of an enumeration type.

Parameters
[in]strNameThe name of the member.
[in]pMemberOffsetThe pointer to the member.
[in]oTypeDefinitionThe enumeration type.
Returns
A reference to the structure.

Definition at line 409 of file type_reflection_legacy.h.

References cStructureType::Add().

◆ Add() [3/3]

structure& Add ( const std::string &  strName,
MemberType T::*  pMemberOffset,
const cStructureType oTypeDefinition 
)
inline

Adds a new member of a structure type.

Parameters
[in]strNameThe name of the member.
[in]pMemberOffsetThe pointer to the member.
[in]oTypeDefinitionThe structure type.
Returns
A reference to the structure.

Definition at line 430 of file type_reflection_legacy.h.

References cStructureType::Add().