28# include <tbb/concurrent_unordered_map.h>
36template <
typename KEY,
typename VALUE>
37using ConcurrentMapBase = tbb::concurrent_unordered_map<
46template <
typename KEY,
typename VALUE>
51#if GTSAM_ENABLE_BOOST_SERIALIZATION
52#include <boost/serialization/nvp.hpp>
53#include <boost/serialization/split_member.hpp>
68template<
typename KEY,
typename VALUE>
73 typedef ConcurrentMapBase<KEY,VALUE> Base;
79 template<
typename INPUTITERATOR>
80 ConcurrentMap(INPUTITERATOR first, INPUTITERATOR last) : Base(first, last) {}
91 bool exists(
const KEY& e)
const {
return this->count(e); }
96 void unsafe_erase(
typename Base::iterator position) { ((Base*)
this)->erase(position); }
97 typename Base::size_type unsafe_erase(
const KEY& k) {
return ((Base*)
this)->erase(k); }
98 void unsafe_erase(
typename Base::iterator first,
typename Base::iterator last) {
99 return ((Base*)
this)->erase(first, last); }
106#if GTSAM_ENABLE_BOOST_SERIALIZATION
108 friend class boost::serialization::access;
109 template<
class Archive>
110 void save(Archive& ar,
const unsigned int )
const
114 std::copy(this->begin(), this->end(), map.begin());
115 ar & BOOST_SERIALIZATION_NVP(map);
117 template<
class Archive>
118 void load(Archive& ar,
const unsigned int )
123 ar & BOOST_SERIALIZATION_NVP(map);
124 this->insert(map.begin(), map.end());
126 BOOST_SERIALIZATION_SPLIT_MEMBER()
A thin wrapper around std::vector that uses a custom allocator.
A thin wrapper around std::map that uses boost's fast_pool_allocator.
Included from all GTSAM files.
std::vector< T, typename internal::FastDefaultVectorAllocator< T >::type > FastVector
FastVector is a type alias to a std::vector with a custom memory allocator.
Definition FastVector.h:33
Global functions in a separate testing namespace.
Definition chartTesting.h:28
void save(const Matrix &A, const string &s, const string &filename)
save a matrix to file, which can be loaded by matlab
Definition Matrix.cpp:154
FastMap is a thin wrapper around std::map that uses the boost fast_pool_allocator instead of the defa...
Definition ConcurrentMap.h:69
ConcurrentMap(INPUTITERATOR first, INPUTITERATOR last)
Constructor from a range, passes through to base class.
Definition ConcurrentMap.h:80
ConcurrentMap(const ConcurrentMap< KEY, VALUE > &x)
Copy constructor from another ConcurrentMap.
Definition ConcurrentMap.h:83
bool exists(const KEY &e) const
Handy 'exists' function.
Definition ConcurrentMap.h:91
ConcurrentMap(const Base &x)
Copy constructor from the base map class.
Definition ConcurrentMap.h:86
ConcurrentMap()
Default constructor.
Definition ConcurrentMap.h:76
FastMap is a thin wrapper around std::map that uses the boost fast_pool_allocator instead of the defa...
Definition FastMap.h:40