OGS
|
The class TemplateVec takes a unique name and manages a std::vector of pointers to data elements of type T.
Instances are classes PolylineVec and SurfaceVec.
Definition at line 39 of file TemplateVec.h.
#include <TemplateVec.h>
Public Member Functions | |
TemplateVec (std::string name, std::unique_ptr< std::vector< T * >> data_vec, std::unique_ptr< NameIdMap > elem_name_map=nullptr) | |
virtual | ~TemplateVec () |
void | setName (const std::string &n) |
std::string | getName () const |
NameIdMap::const_iterator | getNameIDMapBegin () const |
Returns the begin of the name id mapping structure. More... | |
NameIdMap::const_iterator | getNameIDMapEnd () const |
Returns the end of the name id mapping structure. More... | |
std::size_t | size () const |
const std::vector< T * > * | getVector () const |
bool | getElementIDByName (const std::string &name, std::size_t &id) const |
const T * | getElementByName (const std::string &name) const |
Returns an element with the given name. More... | |
bool | getNameOfElementByID (std::size_t id, std::string &element_name) const |
void | setNameOfElementByID (std::size_t id, std::string const &element_name) |
Return the name of an element based on its ID. More... | |
bool | getNameOfElement (const T *data, std::string &name) const |
virtual void | push_back (T *data_element, std::string const *const name=nullptr) |
Adds a new element to the vector. More... | |
virtual void | setNameForElement (std::size_t id, std::string const &name) |
Sets the given name for the element of the given ID. More... | |
Protected Types | |
using | NameIdPair = std::pair< std::string, std::size_t > |
using | NameIdMap = std::map< std::string, std::size_t > |
Protected Member Functions | |
TemplateVec (const TemplateVec &) | |
TemplateVec & | operator= (const TemplateVec &rhs) |
Protected Attributes | |
std::string | _name |
std::unique_ptr< std::vector< T * > > | _data_vec |
std::unique_ptr< NameIdMap > | _name_id_map |
Private Member Functions | |
NameIdMap::const_iterator | findFirstElementByID (std::size_t const &id) const |
|
protected |
Definition at line 43 of file TemplateVec.h.
|
protected |
Definition at line 42 of file TemplateVec.h.
|
inline |
Constructor of class TemlateVec.
name | unique name of the project the elements belonging to. In order to access the data elements a unique name is required. |
data_vec | Vector of data elements. |
elem_name_map | Names of data elements can be given by a std::map<std::string, std::size_t>. Here the std::string is the name of the element and the value for std::size_t stands for an index in the data_vec. |
Definition at line 59 of file TemplateVec.h.
References GeoLib::TemplateVec< T >::_data_vec, GeoLib::TemplateVec< T >::_name_id_map, and OGS_FATAL.
|
inlinevirtual |
destructor, deletes all data elements
Definition at line 79 of file TemplateVec.h.
References GeoLib::TemplateVec< T >::size().
|
protected |
copy constructor doesn't have an implementation
|
inlineprivate |
Definition at line 232 of file TemplateVec.h.
References GeoLib::TemplateVec< T >::_name_id_map.
Referenced by GeoLib::TemplateVec< T >::getNameOfElementByID(), and GeoLib::TemplateVec< T >::setNameForElement().
|
inline |
Returns an element with the given name.
Definition at line 132 of file TemplateVec.h.
References GeoLib::TemplateVec< T >::_data_vec, GeoLib::TemplateVec< T >::getElementIDByName(), and MaterialPropertyLib::name.
Referenced by GeoLib::GEOObjects::getGeoObject(), and main().
|
inline |
search the vector of names for the ID of the geometric element with the given name
name | the name of the geometric element |
id | the id of the geometric element |
Definition at line 119 of file TemplateVec.h.
References GeoLib::TemplateVec< T >::_name_id_map, and MaterialPropertyLib::name.
Referenced by GeoLib::TemplateVec< T >::getElementByName().
|
inline |
the name, the data element belonging to
Definition at line 95 of file TemplateVec.h.
References GeoLib::TemplateVec< T >::_name.
|
inline |
Returns the begin of the name id mapping structure.
Definition at line 98 of file TemplateVec.h.
References GeoLib::TemplateVec< T >::_name_id_map.
Referenced by GeoTreeModel::addChildren(), GeoTreeModel::addPointList(), GeoLib::DuplicateGeometry::duplicate(), and FileIO::Legacy::readGLIFileV4().
|
inline |
Returns the end of the name id mapping structure.
Definition at line 101 of file TemplateVec.h.
References GeoLib::TemplateVec< T >::_name_id_map.
Referenced by GeoTreeModel::addChildren(), GeoTreeModel::addPointList(), GeoLib::DuplicateGeometry::duplicate(), and FileIO::Legacy::readGLIFileV4().
|
inline |
The method returns true if the given element of type T can be found and the element has a name, else method returns false.
data | the data element, one wants to know the name |
name | the name of the data element (if the data element is found and the data element has a name) |
Definition at line 178 of file TemplateVec.h.
References GeoLib::TemplateVec< T >::_data_vec, GeoLib::TemplateVec< T >::getNameOfElementByID(), and MaterialPropertyLib::name.
Referenced by GeoLib::IO::BoostXmlGmlInterface::addPolylinesToPropertyTree(), GeoLib::IO::BoostXmlGmlInterface::addSurfacesToPropertyTree(), main(), and FileIO::Legacy::writeGLIFileV4().
|
inline |
The method returns true if there is a name associated with the given id, else method returns false.
id | the id |
element_name | if a name associated with the id is found name is assigned to element_name |
Definition at line 153 of file TemplateVec.h.
References GeoLib::TemplateVec< T >::_name_id_map, and GeoLib::TemplateVec< T >::findFirstElementByID().
Referenced by LineEditDialog::LineEditDialog(), MeshGeoToolsLib::appendLinesAlongPolylines(), GeoLib::GEOObjects::getElementNameByID(), GeoLib::TemplateVec< T >::getNameOfElement(), main(), GeoLib::IO::XmlGmlInterface::write(), FileIO::Legacy::writeAllDataToGLIFileV4(), and FileIO::Legacy::writeTINSurfaces().
|
inline |
get a pointer to a standard vector containing the data elements
Definition at line 112 of file TemplateVec.h.
References GeoLib::TemplateVec< T >::_data_vec.
Referenced by GeoTreeModel::addChildren(), GeoTreeModel::addPointList(), GeoTreeModel::addPolylineList(), GeoLib::IO::BoostXmlGmlInterface::addPolylinesToPropertyTree(), GeoTreeModel::addSurfaceList(), GeoLib::IO::BoostXmlGmlInterface::addSurfacesToPropertyTree(), MeshGeoToolsLib::appendLinesAlongPolylines(), GeoTreeModel::appendPolylines(), GeoTreeModel::appendSurfaces(), GEOModels::connectPolylineSegments(), GeoLib::geoPointsToStations(), main(), GeoLib::markUnusedPoints(), GeoLib::GEOObjects::mergePoints(), FileIO::SHPInterface::readPolylines(), GeoLib::IO::TINInterface::readTIN(), GeoLib::IO::BoostXmlGmlInterface::write(), GeoLib::IO::XmlGmlInterface::write(), FileIO::Legacy::writeAllDataToGLIFileV4(), writeBCsAndGeometry(), FileIO::Legacy::writeGLIFileV4(), and FileIO::Legacy::writeTINSurfaces().
|
protected |
assignment operator doesn't have an implementation
|
inlinevirtual |
Adds a new element to the vector.
Reimplemented in GeoLib::PointVec.
Definition at line 192 of file TemplateVec.h.
References GeoLib::TemplateVec< T >::_data_vec, GeoLib::TemplateVec< T >::_name_id_map, MaterialPropertyLib::name, and WARN().
|
inline |
sets the name of the vector of geometric objects the data elements belonging to
n | the name as standard string |
Definition at line 90 of file TemplateVec.h.
References GeoLib::TemplateVec< T >::_name.
|
inlinevirtual |
Sets the given name for the element of the given ID.
Reimplemented in GeoLib::PointVec.
Definition at line 214 of file TemplateVec.h.
References GeoLib::TemplateVec< T >::_name_id_map, GeoLib::TemplateVec< T >::findFirstElementByID(), and MaterialPropertyLib::name.
Referenced by GEOModels::addNameForElement(), main(), and GeoLib::PointVec::setNameForElement().
|
inline |
Return the name of an element based on its ID.
Definition at line 165 of file TemplateVec.h.
References GeoLib::TemplateVec< T >::_name_id_map.
Referenced by GEOModels::connectPolylineSegments().
|
inline |
Definition at line 106 of file TemplateVec.h.
References GeoLib::TemplateVec< T >::_data_vec.
Referenced by LineEditDialog::LineEditDialog(), GeoLib::TemplateVec< T >::~TemplateVec(), GeoTreeModel::addPolylineList(), GeoTreeModel::addSurfaceList(), MeshGeoToolsLib::appendLinesAlongPolylines(), FileIO::GMSH::GMSHPolygonTree::checkIntersectionsSegmentExistingPolylines(), GeoLib::computeAndInsertAllIntersectionPoints(), FileIO::GMSH::GMSHPolygonTree::insertPolyline(), MeshGeoToolsLib::insertSubSegments(), and main().
|
protected |
pointer to a vector of data elements
Definition at line 252 of file TemplateVec.h.
Referenced by GeoLib::TemplateVec< T >::TemplateVec(), GeoLib::TemplateVec< T >::getElementByName(), GeoLib::TemplateVec< T >::getNameOfElement(), GeoLib::TemplateVec< T >::getVector(), GeoLib::TemplateVec< T >::push_back(), and GeoLib::TemplateVec< T >::size().
|
protected |
the name of the object
Definition at line 247 of file TemplateVec.h.
Referenced by GeoLib::TemplateVec< T >::getName(), and GeoLib::TemplateVec< T >::setName().
|
protected |
store names associated with the element ids
Definition at line 256 of file TemplateVec.h.
Referenced by GeoLib::TemplateVec< T >::TemplateVec(), GeoLib::TemplateVec< T >::findFirstElementByID(), GeoLib::TemplateVec< T >::getElementIDByName(), GeoLib::TemplateVec< T >::getNameIDMapBegin(), GeoLib::TemplateVec< T >::getNameIDMapEnd(), GeoLib::TemplateVec< T >::getNameOfElementByID(), GeoLib::TemplateVec< T >::push_back(), GeoLib::TemplateVec< T >::setNameForElement(), and GeoLib::TemplateVec< T >::setNameOfElementByID().