OpenDDS::SafetyProfile::ArrayEltPolicy< Forany, T > Struct Template Reference

#include <SafetyProfileSequence.h>

List of all members.

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). Forany the array's *_forany type generated by the IDL compiler

Definition at line 217 of file SafetyProfileSequence.h.


Member Typedef Documentation

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

Definition at line 219 of file SafetyProfileSequence.h.

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

Definition at line 220 of file SafetyProfileSequence.h.

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

Definition at line 218 of file SafetyProfileSequence.h.


Member Function Documentation

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

Definition at line 476 of file SafetyProfileSequence.h.

References OpenDDS::SafetyProfile::ArrayEltPolicy< Forany, T >::extra.

00479   {
00480     const seq_size_type start = use_cookie ? extra : 0;
00481     for (seq_size_type i = start; i < n + start; ++i) {
00482       TAO::Array_Traits<Forany>::construct(buffer[i]);
00483     }
00484     if (use_cookie) {
00485       *reinterpret_cast<seq_size_type*>(buffer) = n;
00486     }
00487   }

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

Definition at line 490 of file SafetyProfileSequence.h.

Referenced by OpenDDS::SafetyProfile::ArrayEltPolicy< Forany, T >::move_n().

00492   {
00493     for (seq_size_type i = 0; i < n; ++i) {
00494       TAO::Array_Traits<Forany>::copy(out[i], in[i]);
00495     }
00496   }

template<typename Forany, typename T>
T * OpenDDS::SafetyProfile::ArrayEltPolicy< Forany, T >::destroy ( T *  buffer,
seq_size_type  n 
) [inline, static]

Definition at line 507 of file SafetyProfileSequence.h.

References OpenDDS::SafetyProfile::ArrayEltPolicy< Forany, T >::extra.

00508   {
00509     seq_size_type num = n;
00510     T* alloc = buffer;
00511 
00512     if (n == INT_MAX) {
00513       alloc = buffer - extra;
00514       num = *reinterpret_cast<seq_size_type*>(alloc);
00515     }
00516 
00517     for (seq_size_type i = 0; i < num; ++i) {
00518       TAO::Array_Traits<Forany>::destroy(buffer[i]);
00519     }
00520 
00521     return alloc;
00522   }

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

Definition at line 223 of file SafetyProfileSequence.h.

00223 { return elt; }

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 
) [inline, static]

Definition at line 226 of file SafetyProfileSequence.h.

References OpenDDS::SafetyProfile::ArrayEltPolicy< Forany, T >::copy_n().

00226 { copy_n(in, n, out); }

template<typename Forany, typename T>
void OpenDDS::SafetyProfile::ArrayEltPolicy< Forany, T >::reset_n ( T *  buffer,
seq_size_type  n 
) [inline, static]

Definition at line 499 of file SafetyProfileSequence.h.

00500   {
00501     for (seq_size_type i = 0; i < n; ++i) {
00502       TAO::Array_Traits<Forany>::zero(buffer[i]);
00503     }
00504   }


Member Data Documentation

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 221 of file SafetyProfileSequence.h.

Referenced by OpenDDS::SafetyProfile::ArrayEltPolicy< Forany, T >::construct(), and OpenDDS::SafetyProfile::ArrayEltPolicy< Forany, T >::destroy().


The documentation for this struct was generated from the following file:
Generated on Fri Feb 12 20:06:51 2016 for OpenDDS by  doxygen 1.4.7