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 17 of file AppendLinesAlongPolyline.h.
#include <TemplateVec.h>
Public Types | |
using | NameIdPair = std::pair<std::string, std::size_t> |
using | NameIdMap = std::map<std::string, std::size_t> |
Public Member Functions | |
TemplateVec (std::string const &name, std::vector< T * > &&data_vec, NameIdMap &&elem_name_map) | |
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. | |
NameIdMap::const_iterator | getNameIDMapEnd () const |
Returns the end of the name id mapping structure. | |
std::size_t | size () const |
std::vector< T * > const & | 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. | |
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. | |
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. | |
virtual void | setNameForElement (std::size_t id, std::string const &name) |
Sets the given name for the element of the given ID. | |
Protected Member Functions | |
TemplateVec (TemplateVec const &)=delete | |
TemplateVec (TemplateVec &&)=delete | |
TemplateVec & | operator= (TemplateVec const &rhs)=delete |
TemplateVec & | operator= (TemplateVec &&rhs)=delete |
Protected Attributes | |
std::string | _name |
std::vector< T * > | _data_vec |
NameIdMap | _name_id_map |
Private Member Functions | |
NameIdMap::const_iterator | findFirstElementByID (std::size_t const &id) const |
using GeoLib::TemplateVec< T >::NameIdMap = std::map<std::string, std::size_t> |
Definition at line 41 of file TemplateVec.h.
using GeoLib::TemplateVec< T >::NameIdPair = std::pair<std::string, std::size_t> |
Definition at line 40 of file TemplateVec.h.
|
inline |
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 55 of file TemplateVec.h.
|
inlinevirtual |
destructor, deletes all data elements
Definition at line 66 of file TemplateVec.h.
References GeoLib::TemplateVec< T >::_data_vec, and GeoLib::TemplateVec< T >::size().
|
protecteddelete |
|
protecteddelete |
|
inlineprivate |
Definition at line 228 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 126 of file TemplateVec.h.
References GeoLib::TemplateVec< T >::_data_vec, and GeoLib::TemplateVec< T >::getElementIDByName().
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 113 of file TemplateVec.h.
References GeoLib::TemplateVec< T >::_name_id_map.
Referenced by GeoLib::TemplateVec< T >::getElementByName().
|
inline |
the name, the data element belonging to
Definition at line 82 of file TemplateVec.h.
References GeoLib::TemplateVec< T >::_name.
|
inline |
Returns the begin of the name id mapping structure.
Definition at line 85 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 91 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 173 of file TemplateVec.h.
References GeoLib::TemplateVec< T >::_data_vec, and GeoLib::TemplateVec< T >::getNameOfElementByID().
Referenced by GeoLib::IO::BoostXmlGmlInterface::addPolylinesToPropertyTree(), GeoLib::IO::BoostXmlGmlInterface::addSurfacesToPropertyTree(), and main().
|
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 147 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 105 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::createPolyline(), GeoLib::geoPointsToStations(), FileIO::GMSH::GMSHAdaptiveMeshDensity::getQuadTreeGeometry(), main(), GeoLib::markUnusedPoints(), GeoLib::GEOObjects::mergePoints(), FileIO::Legacy::readGLIFileV4(), FileIO::SHPInterface::readPolylines(), GeoLib::IO::TINInterface::readTIN(), GeoLib::IO::BoostXmlGmlInterface::write(), GeoLib::IO::XmlGmlInterface::write(), FileIO::GMSH::GMSHPolygonTree::writeAdditionalPointData(), FileIO::Legacy::writeAllDataToGLIFileV4(), writeBCsAndGeometry(), and FileIO::Legacy::writeTINSurfaces().
|
protecteddelete |
|
protecteddelete |
|
inlinevirtual |
Adds a new element to the vector.
Reimplemented in GeoLib::PointVec.
Definition at line 187 of file TemplateVec.h.
References GeoLib::TemplateVec< T >::_data_vec, GeoLib::TemplateVec< T >::_name_id_map, 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 77 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 211 of file TemplateVec.h.
References GeoLib::TemplateVec< T >::_name_id_map, and GeoLib::TemplateVec< T >::findFirstElementByID().
Referenced by GEOModels::addNameForElement(), and GeoLib::PointVec::setNameForElement().
|
inline |
Return the name of an element based on its ID.
Definition at line 160 of file TemplateVec.h.
References GeoLib::TemplateVec< T >::_name_id_map.
Referenced by GEOModels::connectPolylineSegments().
|
inline |
Definition at line 99 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(), and MeshGeoToolsLib::insertSubSegments().
|
protected |
vector of data elements
Definition at line 247 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 242 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 251 of file TemplateVec.h.
Referenced by 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().