remove \r
[extl.git] / extl / memory / allocator_selector.h
bloba23c03d912134db723769a421f8162fd370d301a
1 /* ///////////////////////////////////////////////////////////////////////
2 * File: allocator_selector.h
4 * Created: 08.03.22
5 * Updated: 08.04.14
7 * Brief: Memory allocator selector
9 * [<Home>]
10 * Copyright (c) 2008-2020, Waruqi All rights reserved.
11 * //////////////////////////////////////////////////////////////////// */
13 #ifndef EXTL_MEMORY_ALLOCATOR_SELECTOR_H
14 #define EXTL_MEMORY_ALLOCATOR_SELECTOR_H
16 /*!\file allocator_selector.h
17 * \brief Memory allocator selector
19 #ifndef __cplusplus
20 # error allocator_selector.h need be supported by c++.
21 #endif
23 /* ///////////////////////////////////////////////////////////////////////
24 * Includes
26 #include "basic_allocator_selector.h"
27 #include "basic_pool_allocator.h"
29 /* ///////////////////////////////////////////////////////////////////////
30 * ::extl namespace
32 EXTL_BEGIN_NAMESPACE
34 /*!\brief allocator_selector class
36 * \param T The allocator type
38 * [Allocators]
39 * null_allocator<T>
40 * new_allocator<T>
41 * malloc_allocator<T>
42 * std::allocator<T>
44 * basic_pool_allocator<T, A, L, MAX_FREE_INDEX>
46 * \ingroup extl_group_memory
48 template < typename_param_k T >
49 struct allocator_selector
51 /// \name Types
52 /// @{
53 #if defined(EXTL_MEMORY_ALLOCATOR_SELECT_NULL_ALLOCATOR)
54 typedef null_allocator<T> allocator_type;
55 #elif defined(EXTL_MEMORY_ALLOCATOR_SELECT_NEW_ALLOCATOR)
56 typedef new_allocator<T> allocator_type;
57 #elif defined(EXTL_MEMORY_ALLOCATOR_SELECT_MALLOC_ALLOCATOR)
58 typedef malloc_allocator<T> allocator_type;
59 #elif defined(EXTL_MEMORY_ALLOCATOR_SELECT_BASIC_POOL_ALLOCATOR)
60 # ifdef EXTL_TEMPLATE_CLASS_DEFAULT_ARGUMENT_SUPPORT
61 typedef basic_pool_allocator<T> allocator_type;
62 # else
63 typedef basic_pool_allocator< T
64 , typename_type_k synch_traits_selector::synch_traits_type
65 , default_basic_pool_allocator_tag
66 > allocator_type;
67 # endif /* EXTL_TEMPLATE_CLASS_DEFAULT_ARGUMENT_SUPPORT */
68 #elif defined(EXTL_MEMORY_ALLOCATOR_SELECT_STD_ALLOCATOR)
69 # if !defined(EXTL_NO_STL)
70 typedef EXTL_NS_STD(allocator)<T> allocator_type;
71 # else
72 # ifdef EXTL_TEMPLATE_CLASS_DEFAULT_ARGUMENT_SUPPORT
73 typedef basic_pool_allocator<T> allocator_type;
74 # else
75 typedef basic_pool_allocator< T
76 , typename_type_k synch_traits_selector::synch_traits_type
77 , default_basic_pool_allocator_tag
78 > allocator_type;
79 # endif /* EXTL_TEMPLATE_CLASS_DEFAULT_ARGUMENT_SUPPORT */
80 # endif /* EXTL_NO_STL */
81 #else
82 # error Unknown allocator.
83 #endif
84 /// @}
88 /* ///////////////////////////////////////////////////////////////////////
89 * ::extl namespace
91 EXTL_END_NAMESPACE
93 /* //////////////////////////////////////////////////////////////////// */
94 #endif /* EXTL_MEMORY_ALLOCATOR_SELECTOR_H */
95 /* //////////////////////////////////////////////////////////////////// */