Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Static Public Member Functions | Static Private Member Functions | List of all members
Nektar::ArrayInitializationPolicy< ObjectType, typename boost::disable_if< boost::is_fundamental< ObjectType > >::type > Class Template Reference

#include <ArrayPolicies.hpp>

Static Public Member Functions

static void Initialize (ObjectType *data, unsigned int itemsToCreate)
 Initalize each element in the array with ObjectType's default constructor. More...
 
static void Initialize (ObjectType *data, unsigned int itemsToCreate, const ObjectType &initValue)
 Initalize each element in the array with ObjectType's copy constructor. More...
 
static void Initialize (ObjectType *data, unsigned int itemsToCreate, const ObjectType *initValue)
 

Static Private Member Functions

template<typename CreateType >
static void DoInitialization (ObjectType *data, unsigned int itemsToCreate, const CreateType &f)
 
static void DefaultConstructionWithPlacementNew (ObjectType *element)
 
static void CopyConstructionWithPlacementNew (ObjectType *element, const ObjectType &initValue)
 
static void CopyConstructionFromArray (ObjectType *element, const ObjectType *&rhs)
 

Detailed Description

template<typename ObjectType>
class Nektar::ArrayInitializationPolicy< ObjectType, typename boost::disable_if< boost::is_fundamental< ObjectType > >::type >

Definition at line 84 of file ArrayPolicies.hpp.

Member Function Documentation

template<typename ObjectType >
static void Nektar::ArrayInitializationPolicy< ObjectType, typename boost::disable_if< boost::is_fundamental< ObjectType > >::type >::CopyConstructionFromArray ( ObjectType *  element,
const ObjectType *&  rhs 
)
inlinestaticprivate

Definition at line 148 of file ArrayPolicies.hpp.

149  {
150  new (element) ObjectType(*rhs);
151  rhs += 1;
152  }
template<typename ObjectType >
static void Nektar::ArrayInitializationPolicy< ObjectType, typename boost::disable_if< boost::is_fundamental< ObjectType > >::type >::CopyConstructionWithPlacementNew ( ObjectType *  element,
const ObjectType &  initValue 
)
inlinestaticprivate

Definition at line 143 of file ArrayPolicies.hpp.

144  {
145  new (element) ObjectType(initValue);
146  }
template<typename ObjectType >
static void Nektar::ArrayInitializationPolicy< ObjectType, typename boost::disable_if< boost::is_fundamental< ObjectType > >::type >::DefaultConstructionWithPlacementNew ( ObjectType *  element)
inlinestaticprivate

Definition at line 138 of file ArrayPolicies.hpp.

139  {
140  new (element) ObjectType;
141  }
template<typename ObjectType >
template<typename CreateType >
static void Nektar::ArrayInitializationPolicy< ObjectType, typename boost::disable_if< boost::is_fundamental< ObjectType > >::type >::DoInitialization ( ObjectType *  data,
unsigned int  itemsToCreate,
const CreateType &  f 
)
inlinestaticprivate

Definition at line 115 of file ArrayPolicies.hpp.

116  {
117  unsigned int nextObjectToCreate = 0;
118  try
119  {
120  for(unsigned int i = 0; i < itemsToCreate; ++i)
121  {
122  ObjectType* memLocation = &data[i];
123  f(memLocation);
124  ++nextObjectToCreate;
125  }
126  }
127  catch(...)
128  {
129  for(unsigned int i = 0; i < nextObjectToCreate; ++i)
130  {
131  ObjectType* memLocation = &data[nextObjectToCreate - i - 1];
132  memLocation->~ObjectType();
133  }
134  throw;
135  }
136  }
template<typename ObjectType >
static void Nektar::ArrayInitializationPolicy< ObjectType, typename boost::disable_if< boost::is_fundamental< ObjectType > >::type >::Initialize ( ObjectType *  data,
unsigned int  itemsToCreate 
)
inlinestatic

Initalize each element in the array with ObjectType's default constructor.

Parameters
dataThe array of values to populate.
itemsToCreateThe size of data.

Definition at line 91 of file ArrayPolicies.hpp.

92  {
93  DoInitialization(data, itemsToCreate,
94  boost::bind(&ArrayInitializationPolicy<ObjectType>::DefaultConstructionWithPlacementNew, _1));
95  }
static void DoInitialization(ObjectType *data, unsigned int itemsToCreate, const CreateType &f)
template<typename ObjectType >
static void Nektar::ArrayInitializationPolicy< ObjectType, typename boost::disable_if< boost::is_fundamental< ObjectType > >::type >::Initialize ( ObjectType *  data,
unsigned int  itemsToCreate,
const ObjectType &  initValue 
)
inlinestatic

Initalize each element in the array with ObjectType's copy constructor.

Parameters
dataThe array of values to populate.
itemsToCreateThe size of data.
initValueThe inital value each element in data will have.

Definition at line 101 of file ArrayPolicies.hpp.

102  {
103  DoInitialization(data, itemsToCreate,
104  boost::bind(&ArrayInitializationPolicy<ObjectType>::CopyConstructionWithPlacementNew, _1, boost::ref(initValue)));
105  }
static void DoInitialization(ObjectType *data, unsigned int itemsToCreate, const CreateType &f)
template<typename ObjectType >
static void Nektar::ArrayInitializationPolicy< ObjectType, typename boost::disable_if< boost::is_fundamental< ObjectType > >::type >::Initialize ( ObjectType *  data,
unsigned int  itemsToCreate,
const ObjectType *  initValue 
)
inlinestatic

Definition at line 107 of file ArrayPolicies.hpp.

108  {
109  DoInitialization(data, itemsToCreate,
110  boost::bind(&ArrayInitializationPolicy<ObjectType>::CopyConstructionFromArray, _1, boost::ref(initValue)));
111  }
static void DoInitialization(ObjectType *data, unsigned int itemsToCreate, const CreateType &f)