41 using NameIdMap = std::map<std::string, std::size_t>;
55 TemplateVec(std::string
const& name, std::vector<T*>&& data_vec,
68 for (std::size_t k(0); k <
size(); k++)
155 element_name = it->first;
175 for (std::size_t k(0); k <
_data_vec.size(); k++)
188 std::string
const*
const name =
nullptr)
191 if (!name || name->empty())
204 "Name '{:s}' exists already. The object will be inserted "
232 { return elem.second == id; });
void WARN(fmt::format_string< Args... > fmt, Args &&... args)
The class TemplateVec takes a unique name and manages a std::vector of pointers to data elements of t...
std::map< std::string, std::size_t > NameIdMap
const T * getElementByName(const std::string &name) const
Returns an element with the given name.
void setNameOfElementByID(std::size_t id, std::string const &element_name)
Return the name of an element based on its ID.
std::pair< std::string, std::size_t > NameIdPair
NameIdMap::const_iterator getNameIDMapBegin() const
Returns the begin of the name id mapping structure.
TemplateVec(TemplateVec &&)=delete
std::vector< T * > _data_vec
virtual void push_back(T *data_element, std::string const *const name=nullptr)
Adds a new element to the vector.
bool getNameOfElementByID(std::size_t id, std::string &element_name) const
TemplateVec(std::string const &name, std::vector< T * > &&data_vec, NameIdMap &&elem_name_map)
virtual void setNameForElement(std::size_t id, std::string const &name)
Sets the given name for the element of the given ID.
NameIdMap::const_iterator findFirstElementByID(std::size_t const &id) const
std::string getName() const
bool getElementIDByName(const std::string &name, std::size_t &id) const
void setName(const std::string &n)
TemplateVec & operator=(TemplateVec const &rhs)=delete
bool getNameOfElement(const T *data, std::string &name) const
TemplateVec & operator=(TemplateVec &&rhs)=delete
std::vector< T * > const & getVector() const
TemplateVec(TemplateVec const &)=delete
NameIdMap::const_iterator getNameIDMapEnd() const
Returns the end of the name id mapping structure.