21 #include <tjutils/tjutils.h>
22 #include <tjutils/tjstatic.h>
23 #include <tjutils/tjlabel.h>
24 #include <tjutils/tjhandler.h>
36 static const char* get_compName();
43 struct UniqueIndexMap :
public STD_map<STD_string, STD_list<unsigned int> >,
public Labeled {
45 UniqueIndexMap() : contiguous(true) {}
47 unsigned int get_index(STD_list<unsigned int>::iterator& index,
const STD_string& type,
unsigned int max_instances);
49 void remove_index(
const STD_list<unsigned int>::iterator& index,
const STD_string& type);
54 unsigned int assign_index(STD_list<unsigned int>::iterator& index,
const STD_string& type);
61 class UniqueIndexBase :
public StaticHandler<UniqueIndexBase> {
66 static void init_static() {indices_map.init(
"indices_map");}
67 static void destroy_static() {indices_map.destroy();}
110 return indices_map->get_index(index, T::get_typename(), T::get_max_instances());
116 index=indices_map->operator[](T::get_typename()).end();
120 indices_map->remove_index(index, T::get_typename());
124 mutable STD_list<unsigned int>::iterator index;
unsigned int get_index() const