11 #ifndef RTI_DDS_FLAT_BUILDERHELPER_HPP_ 12 #define RTI_DDS_FLAT_BUILDERHELPER_HPP_ 14 namespace rti {
namespace flat {
19 template <
typename ElementBuilder>
22 template <
typename ElementOffset>
25 template <
typename ElementBuilder,
unsigned int N>
36 template <
size_t PrimitiveSize>
37 struct primitive_lc_code_helper;
40 struct primitive_lc_code_helper<1> {
48 struct primitive_lc_code_helper<2> {
56 struct primitive_lc_code_helper<4> {
64 struct primitive_lc_code_helper<8> {
72 struct primitive_lc_code {
73 enum { value = primitive_lc_code_helper<sizeof(T)>::single };
100 template <
typename T,
unsigned int N>
108 template <
typename T>
110 enum { value = primitive_lc_code_helper<sizeof(T)>::sequence };
114 struct lc_code<StringBuilder> : lc_code<PrimitiveSequenceBuilder<char> > {};
120 template <
typename Offset>
121 struct final_offset_initializer {
123 static bool initialize(
Offset& offset)
125 return RTI_XCDR_TRUE == RTIXCdrFlatData_initializeSample(
128 rti::xcdr::type_programs<rti::flat::Sample<Offset> >::get());
135 template <
typename T,
typename Enable =
void>
136 struct default_primitive_value {
143 template <
typename T,
unsigned int N>
148 T default_value = default_primitive_value<T>::get();
149 if (default_value == (T) 0) {
160 template <
typename T,
unsigned int N>
165 for (
unsigned int i = 0; i < N; i++) {
167 if (offset.is_null()) {
171 if (!final_offset_initializer<T>::initialize(offset)) {
183 #endif // RTI_DDS_FLAT_BUILDERHELPER_HPP_ unsigned int element_count() const
Returns the number of elements, N.
Definition: SequenceOffsets.hpp:242
const unsigned char * get_buffer() const
Gets this member's position in the buffer.
Definition: Offset.hpp:554
Offset to an array of primitive elements.
Definition: SequenceOffsets.hpp:220
Offset to an array of variable-size elements.
Definition: SequenceOffsets.hpp:580
ElementOffset get_element(unsigned int i)
Gets the Offset to an element.
Definition: SequenceOffsets.hpp:766
bool set_element(unsigned int i, T value)
Sets an element by index.
Definition: SequenceOffsets.hpp:111
Offset to an array of final elements.
Definition: SequenceOffsets.hpp:728
Builds a sequence member of variable-size elements.
Definition: BuilderHelper.hpp:20
offset_t get_buffer_size() const
Gets the size, in bytes, of this member in the buffer.
Definition: Offset.hpp:568
Builds an array member of variable-size elements.
Definition: BuilderHelper.hpp:26
Definition: AggregationBuilders.hpp:17
Builds a sequence member of fixed-size elements.
Definition: BuilderHelper.hpp:23
Builds a sequence of primitive members.
Definition: BuilderHelper.hpp:17