6 #ifndef CNOID_UTIL_DATA_MAP_H
7 #define CNOID_UTIL_DATA_MAP_H
12 #include "exportdecl.h"
19 static const int MIN_DYNAMIC_ID = 10000;
22 int getDynamicID(
const std::string& name);
23 const std::string& getDynamicIDname(
int id);
26 virtual std::map<std::string, int>& nameToIdMap();
27 virtual std::map<int, std::string>& idToNameMap();
28 virtual int nextDynamicId();
32 template <
class ElementType =
double,
class Allocator = std::allocator<ElementType> >
34 protected std::map<int, std::vector<ElementType, Allocator> >
36 typedef std::map<int, std::vector<ElementType, Allocator> > MapType;
38 static const std::vector<ElementType, Allocator> emptyData;
42 typedef std::vector<ElementType, Allocator>
Data;
49 MapType::operator=(rhs);
54 using typename MapType::iterator;
64 typedef typename MapType::iterator iterator;
65 size_t size()
const {
return MapType::size(); }
66 bool empty()
const {
return MapType::empty(); }
67 void clear() { MapType::clear(); }
68 typename MapType::iterator begin() {
return MapType::begin(); }
69 typename MapType::const_iterator begin()
const {
return MapType::begin(); }
70 typename MapType::iterator end() {
return MapType::end(); }
71 typename MapType::const_iterator end()
const {
return MapType::end(); }
72 typename MapType::iterator find(
const typename MapType::key_type& x) {
return MapType::find(x); }
73 typename MapType::const_iterator find(
const typename MapType::key_type& x)
const {
return MapType::find(x); }
78 typename MapType::const_iterator p = find(
id);
86 template <
class ElementType,
class Allocator>
87 const std::vector<ElementType, Allocator> DataMap<ElementType, Allocator>::emptyData;