12 #ifndef MAPPED_PTR_VECTOR_H 13 #define MAPPED_PTR_VECTOR_H 28 template <
typename T,
typename StringCompareT = std::less<std::
string> >
34 typedef std::map<std::string, std::pair<unsigned int, unsigned int>,
35 StringCompareT > tIndex;
39 std::vector<T*> _vector;
41 std::string _currentName;
42 std::pair<unsigned int, unsigned int> _currentIndices;
44 bool is_equal(
const std::string& first,
const std::string& second,
45 const typename tIndex::key_compare& keyComp)
const;
55 unsigned int size()
const;
61 void push_back(T* inP,
const unsigned int fileIndex = 0);
62 void push_back(
const std::string& name,
const unsigned int fileIndex = 0);
63 void push_back(
const std::vector<std::string>& names,
64 const std::vector<unsigned int>& fileIndices);
65 void push_back(
const std::vector<std::string>& names);
74 unsigned int find(
const std::string& name);
76 void rename(
const std::string& oldName,
const std::string& newName);
79 void erase(
const std::string& name);
82 bool is_read(
const std::string& name);
85 void read(
const std::string& name);
88 unsigned int write(
const std::string& name);
90 std::pair<unsigned int, unsigned int>
get_indices(
const std::string& name);
91 std::string
get_name(
const unsigned int index);
std::string get_name(const unsigned int index)
Definition: mapped_ptr_vector.C:440
unsigned int write(const std::string &name)
Serialize the object.
Definition: mapped_ptr_vector.C:371
void read(const std::string &name)
De-serialize the object.
Definition: mapped_ptr_vector.C:354
bool empty() const
Definition: mapped_ptr_vector.C:87
unsigned int find(const std::string &name)
Definition: mapped_ptr_vector.C:246
~mapped_ptr_vector()
Definition: mapped_ptr_vector.C:57
void operator=(const mapped_ptr_vector &inMappedVector)
Definition: mapped_ptr_vector.C:66
void push_back(T *inP, const unsigned int fileIndex=0)
Definition: mapped_ptr_vector.C:119
unsigned int size() const
Definition: mapped_ptr_vector.C:78
bool operator==(const mapped_ptr_vector &inMappedVector)
Definition: mapped_ptr_vector.C:109
mapped_ptr_vector()
Definition: mapped_ptr_vector.C:27
void rename(const std::string &oldName, const std::string &newName)
Definition: mapped_ptr_vector.C:257
bool is_read(const std::string &name)
Is object de-serialized.
Definition: mapped_ptr_vector.C:330
void get_sorted_indices(std::vector< unsigned int > &sortedIndices)
Definition: mapped_ptr_vector.C:465
Definition: mapped_ptr_vector.h:29
void erase(const std::string &name)
Removes object pointer.
Definition: mapped_ptr_vector.C:289
T & operator[](unsigned int index)
Definition: mapped_ptr_vector.C:214
std::pair< unsigned int, unsigned int > get_indices(const std::string &name)
Definition: mapped_ptr_vector.C:402
void clear()
Definition: mapped_ptr_vector.C:96