gtsam  3.2.1
gtsam
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
FastDefaultAllocator.h
Go to the documentation of this file.
1 /* ----------------------------------------------------------------------------
2 
3  * GTSAM Copyright 2010, Georgia Tech Research Corporation,
4  * Atlanta, Georgia 30332-0415
5  * All Rights Reserved
6  * Authors: Frank Dellaert, et al. (see THANKS for the full author list)
7 
8  * See LICENSE for the license information
9 
10  * -------------------------------------------------------------------------- */
11 
19 #pragma once
20 
21 #include <gtsam/global_includes.h>
22 
23 #if !defined GTSAM_ALLOCATOR_BOOSTPOOL && !defined GTSAM_ALLOCATOR_TBB && !defined GTSAM_ALLOCATOR_STL
24 # ifdef GTSAM_USE_TBB
25 // Use TBB allocator by default if we have TBB, otherwise boost pool
26 # define GTSAM_ALLOCATOR_TBB
27 # else
28 # define GTSAM_ALLOCATOR_BOOSTPOOL
29 # endif
30 #endif
31 
32 #if defined GTSAM_ALLOCATOR_BOOSTPOOL
33 # include <boost/pool/pool_alloc.hpp>
34 #elif defined GTSAM_ALLOCATOR_TBB
35 # include <tbb/tbb_allocator.h>
36 # undef min // TBB seems to include Windows.h which defines these macros that cause problems
37 # undef max
38 # undef ERROR
39 #elif defined GTSAM_ALLOCATOR_STL
40 # include <memory>
41 #endif
42 
43 namespace gtsam
44 {
45 
46  namespace internal
47  {
49  template<typename T>
51  {
52 #if defined GTSAM_ALLOCATOR_BOOSTPOOL
53  typedef boost::fast_pool_allocator<T> type;
54  static const bool isBoost = true;
55  static const bool isTBB = false;
56  static const bool isSTL = false;
57 #elif defined GTSAM_ALLOCATOR_TBB
58  typedef tbb::tbb_allocator<T> type;
59  static const bool isBoost = false;
60  static const bool isTBB = true;
61  static const bool isSTL = false;
62 #elif defined GTSAM_ALLOCATOR_STL
63  typedef std::allocator<T> type;
64  static const bool isBoost = false;
65  static const bool isTBB = false;
66  static const bool isSTL = true;
67 #endif
68  };
69 
71  template<typename T>
73  {
74 #if defined GTSAM_ALLOCATOR_TBB
75  typedef tbb::tbb_allocator<T> type;
76  static const bool isBoost = false;
77  static const bool isTBB = true;
78  static const bool isSTL = false;
79 #else
80  typedef std::allocator<T> type;
81  static const bool isBoost = false;
82  static const bool isTBB = false;
83  static const bool isSTL = true;
84 #endif
85  };
86  }
87 
88 }
Default allocator for vector types (we never use boost pool for vectors)
Definition: FastDefaultAllocator.h:72
Included from all GTSAM files.
Default allocator for list, map, and set types.
Definition: FastDefaultAllocator.h:50