#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>
Go to the source code of this file.
|
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) |
|
#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
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 |