OpenDDS  Snapshot(2023/04/28-20:55)
Public Types | Static Public Member Functions | Static Public Attributes | List of all members
OpenDDS::SafetyProfile::ArrayEltPolicy< Forany, T > Struct Template Reference

#include <SafetyProfileSequence.h>

Public Types

typedef T & Element
 
typedef const T & ConstElement
 
typedef const T ConstRawElement
 

Static Public Member Functions

static T & make_element (T &elt, seq_flag_type)
 
static void construct (T *buffer, seq_size_type n, seq_flag_type use_cookie)
 
static void copy_n (const T *input, seq_size_type n, T *output)
 
static void move_n (T *in, seq_size_type n, T *out)
 
static void reset_n (T *buffer, seq_size_type n)
 
static T * destroy (T *buffer, seq_size_type n)
 

Static Public Attributes

static const seq_size_type extra
 

Detailed Description

template<typename Forany, typename T = typename Forany::_array_type>
struct OpenDDS::SafetyProfile::ArrayEltPolicy< Forany, T >

Element Policy for sequences of arrays. Currently arrays of fixed-length and variable-length elements are both handled the same way, but optimizing the fixed-length element types could be done here (they don't need construction, destruction, or cookies).

Template Parameters
Foranythe array's *_forany type generated by the IDL compiler

Definition at line 218 of file SafetyProfileSequence.h.

Member Typedef Documentation

◆ ConstElement

template<typename Forany , typename T = typename Forany::_array_type>
typedef const T& OpenDDS::SafetyProfile::ArrayEltPolicy< Forany, T >::ConstElement

Definition at line 220 of file SafetyProfileSequence.h.

◆ ConstRawElement

template<typename Forany , typename T = typename Forany::_array_type>
typedef const T OpenDDS::SafetyProfile::ArrayEltPolicy< Forany, T >::ConstRawElement

Definition at line 221 of file SafetyProfileSequence.h.

◆ Element

template<typename Forany , typename T = typename Forany::_array_type>
typedef T& OpenDDS::SafetyProfile::ArrayEltPolicy< Forany, T >::Element

Definition at line 219 of file SafetyProfileSequence.h.

Member Function Documentation

◆ construct()

template<typename Forany , typename T >
void OpenDDS::SafetyProfile::ArrayEltPolicy< Forany, T >::construct ( T *  buffer,
seq_size_type  n,
seq_flag_type  use_cookie 
)
inlinestatic

Definition at line 475 of file SafetyProfileSequence.h.

478  {
479  const seq_size_type start = use_cookie ? extra : 0;
480  for (seq_size_type i = start; i < n + start; ++i) {
482  }
483  if (use_cookie) {
484  *reinterpret_cast<seq_size_type*>(buffer) = n;
485  }
486  }

◆ copy_n()

template<typename Forany , typename T >
void OpenDDS::SafetyProfile::ArrayEltPolicy< Forany, T >::copy_n ( const T *  input,
seq_size_type  n,
T *  output 
)
inlinestatic

Definition at line 489 of file SafetyProfileSequence.h.

References OpenDDS::XTypes::copy().

491  {
492  for (seq_size_type i = 0; i < n; ++i) {
493  TAO::Array_Traits<Forany>::copy(out[i], in[i]);
494  }
495  }
DDS::ReturnCode_t copy(DDS::DynamicData_ptr dest, DDS::DynamicData_ptr src)

◆ destroy()

template<typename Forany , typename T >
T * OpenDDS::SafetyProfile::ArrayEltPolicy< Forany, T >::destroy ( T *  buffer,
seq_size_type  n 
)
inlinestatic

Definition at line 506 of file SafetyProfileSequence.h.

507  {
508  seq_size_type num = n;
509  T* alloc = buffer;
510 
511  if (n == INT_MAX) {
512  alloc = buffer - extra;
513  num = *reinterpret_cast<seq_size_type*>(alloc);
514  }
515 
516  for (seq_size_type i = 0; i < num; ++i) {
518  }
519 
520  return alloc;
521  }

◆ make_element()

template<typename Forany , typename T = typename Forany::_array_type>
static T& OpenDDS::SafetyProfile::ArrayEltPolicy< Forany, T >::make_element ( T &  elt,
seq_flag_type   
)
inlinestatic

Definition at line 224 of file SafetyProfileSequence.h.

224 { return elt; }

◆ move_n()

template<typename Forany , typename T = typename Forany::_array_type>
static void OpenDDS::SafetyProfile::ArrayEltPolicy< Forany, T >::move_n ( T *  in,
seq_size_type  n,
T *  out 
)
inlinestatic

Definition at line 227 of file SafetyProfileSequence.h.

227 { copy_n(in, n, out); }
static void copy_n(const T *input, seq_size_type n, T *output)

◆ reset_n()

template<typename Forany , typename T >
void OpenDDS::SafetyProfile::ArrayEltPolicy< Forany, T >::reset_n ( T *  buffer,
seq_size_type  n 
)
inlinestatic

Definition at line 498 of file SafetyProfileSequence.h.

499  {
500  for (seq_size_type i = 0; i < n; ++i) {
502  }
503  }

Member Data Documentation

◆ extra

template<typename Forany , typename T = typename Forany::_array_type>
const seq_size_type OpenDDS::SafetyProfile::ArrayEltPolicy< Forany, T >::extra
static
Initial value:
=
(sizeof(seq_size_type) - 1) / sizeof(T) + 1

Definition at line 222 of file SafetyProfileSequence.h.


The documentation for this struct was generated from the following file: