37 #ifndef LibMultiSense_details_storage_hh 38 #define LibMultiSense_details_storage_hh 46 namespace multisense {
57 template<
class T>
void store(
const T& msg) {
61 if (
m_map.end() != it) {
62 it->second.destroy<T>();
73 if (
m_map.end() == it)
76 it->second.extract(msg);
90 return Holder(reinterpret_cast<void *>(
new T(msg)));
96 delete reinterpret_cast<T*
>(
m_refP);
102 msg = *(
reinterpret_cast<T*
>(
m_refP));
110 typedef std::map<wire::IdType, Holder>
Map;
130 template<
class KEY,
class DATA>
141 typename MapType::iterator it =
m_map.begin();
142 for(; it !=
m_map.end();) {
174 void remove(KEY key) {
181 typedef std::map<KEY,DATA*>
MapType;
184 typename MapType::iterator it =
m_map.find(key);
186 if (
m_map.end() == it)
193 if (
m_map.size() == m_depth)
200 typename MapType::iterator it2 =
m_map.find(key);
201 if (
m_map.end() != it2) {
208 typename MapType::iterator it2 =
m_map.lower_bound(m_minimum);
209 if (
m_map.end() != it2) {
224 #endif // LibMultiSense_details_storage_hh
#define CRL_EXCEPTION(fmt,...)
void insert(KEY key, DATA *data)
DepthCache(std::size_t depth, KEY min)
std::map< KEY, DATA * > MapType
DATA * find_nolock(KEY key)
void insert_nolock(KEY key, DATA *data)
static CRL_CONSTEXPR Status Status_Ok
const std::size_t m_depth
void remove_nolock(KEY key)
void insert_(KEY key, DATA *data)
std::map< wire::IdType, Holder > Map
static Holder Create(const T &msg)
static CRL_CONSTEXPR Status Status_Error