Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Classes | Namespaces | Macros | Functions
NekMemoryManager.hpp File Reference
#include <LibUtilities/Memory/ThreadSpecificPool.hpp>
#include <LibUtilities/BasicUtils/ErrorUtil.hpp>
#include <LibUtilities/BasicConst/NektarUnivTypeDefs.hpp>
#include <boost/mpl/contains.hpp>
#include <boost/mpl/list_c.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/utility/enable_if.hpp>
#include <boost/mpl/integral_c.hpp>
#include <boost/bind.hpp>
#include <boost/type_traits.hpp>
#include <boost/preprocessor/repetition/enum_params.hpp>
#include <boost/preprocessor/repetition/repeat_from_to.hpp>
#include <boost/preprocessor/repetition/enum_trailing.hpp>
#include <boost/preprocessor/repetition/enum_binary_params.hpp>
#include <boost/preprocessor/repetition/enum_trailing_params.hpp>
#include <boost/preprocessor/control/if.hpp>
#include <boost/preprocessor/facilities/empty.hpp>
#include <boost/preprocessor/comparison/equal.hpp>
#include <boost/preprocessor/punctuation/comma.hpp>
#include <boost/preprocessor/repetition/enum_trailing_binary_params.hpp>
#include <vector>
Include dependency graph for NekMemoryManager.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  Nektar::MemoryManager< DataType >
 General purpose memory allocation routines with the ability to allocate from thread specific memory pools. More...
 
class  Nektar::MemoryManager< DataType >::DeallocateSharedPtr< ObjectType, CustomDeallocator >
 
class  Nektar::MemoryManager< DataType >::DefaultCustomDeallocator
 
struct  Nektar::MemoryManager< DataType >::rebind< U >
 

Namespaces

 Nektar
 <
 

Macros

#define NEKTAR_MAX_MEMORY_MANAGER_CONSTRUCTOR_ARGS   20
 
#define ALLOCATE_METHOD_GENERATOR(z, i, methodName)
 
#define ALLOCATE_SHARED_PTR_METHOD_GENERATOR(z, i, methodName)
 Generator for allocating shared pointers to objects with constructors having a variable number of parameters. More...
 
#define ALLOCATE_SHARED_PTR_METHOD_WITH_DEALLOCATOR_GENERATOR(z, i, methodName)
 

Functions

template<typename DataType >
bool Nektar::operator== (const MemoryManager< DataType > &lhs, const MemoryManager< DataType > &rhs)
 
template<typename DataType >
bool Nektar::operator!= (const MemoryManager< DataType > &lhs, const MemoryManager< DataType > &rhs)
 

Macro Definition Documentation

#define ALLOCATE_METHOD_GENERATOR (   z,
  i,
  methodName 
)
Value:
template<BOOST_PP_ENUM_PARAMS(i, typename Arg)> \
static DataType* methodName(BOOST_PP_ENUM_BINARY_PARAMS(i, const Arg, & arg)) \
{ \
return new DataType(BOOST_PP_ENUM_PARAMS(i, arg)); \
}

Definition at line 220 of file NekMemoryManager.hpp.

#define ALLOCATE_SHARED_PTR_METHOD_GENERATOR (   z,
  i,
  methodName 
)
Value:
template<BOOST_PP_ENUM_PARAMS(i, typename Arg)> \
static boost::shared_ptr<DataType> methodName(BOOST_PP_ENUM_BINARY_PARAMS(i, const Arg, & arg)) \
{ \
return AllocateSharedPtrD(DefaultCustomDeallocator(), BOOST_PP_ENUM_PARAMS(i, arg)); \
}

Generator for allocating shared pointers to objects with constructors having a variable number of parameters.

Uses the Boost preprocessor macros

  • BOOST_PP_ENUM_PARAMS(idx, text) which generates a list of parameters, in this case: "typename Arg0, typename Arg1, ..." used for the template definition.
  • BOOST_PP_ENUM_BINARY_PARAMS(idx, type, name) which generates a list of parameters and variables, in this case: "Arg0& arg0, Arg1& arg1, ..." used for the function prototype.
Note
All the parameter lists are references so whenever the MemoryManager::AllocateSharedPtr(...) is used, all parameters must be passed by reference. Consequently, fundamental datatype parameters must be defined locally first. So
1 MemoryManager::AllocateSharedPtr(Var, true);
must be replaced by
1 bool flag = true;
2 MemoryManager::AllocateSharedPtr(Var, flag);

Definition at line 264 of file NekMemoryManager.hpp.

#define ALLOCATE_SHARED_PTR_METHOD_WITH_DEALLOCATOR_GENERATOR (   z,
  i,
  methodName 
)
Value:
template<typename DeallocatorType BOOST_PP_ENUM_TRAILING_PARAMS(i, typename Arg)> \
static boost::shared_ptr<DataType> methodName(const DeallocatorType& d BOOST_PP_ENUM_TRAILING_BINARY_PARAMS(i, Arg, & arg)) \
{ \
DataType* data = Allocate(BOOST_PP_ENUM_PARAMS(i, arg)); \
return boost::shared_ptr<DataType>(data, DeallocateSharedPtr<DataType, DeallocatorType>(d)); \
}

Definition at line 271 of file NekMemoryManager.hpp.

#define NEKTAR_MAX_MEMORY_MANAGER_CONSTRUCTOR_ARGS   20

Definition at line 74 of file NekMemoryManager.hpp.