59 static std::string
getIDSecure(
const T* obj,
const std::string& fallBack =
"NULL") {
60 return obj == 0 ? fallBack : obj->getID();
66 const std::string&
getID()
const {
74 void setID(
const std::string& newID) {
89 template <
class NamedLike>
91 bool operator()(
const NamedLike*
const a,
const NamedLike*
const b)
const {
92 return a->getID() < b->getID();
110 myIDs.insert(o->
getID());
virtual ~Named()
Destructor.
Function-object for stable sorting of objects acting like Named without being derived (SUMOVehicle) ...
bool operator()(const NamedLike *const a, const NamedLike *const b) const
static std::string getIDSecure(const T *obj, const std::string &fallBack="NULL")
get an identifier for Named-like object which may be Null
~StoringVisitor()
Destructor.
const std::string & getID() const
Returns the id.
StoringVisitor(std::set< std::string > &ids)
Contructor.
void addTo(const StoringVisitor &cont) const
Adds this object to the given container.
Named(const std::string &id)
Constructor.
void add(const Named *const o) const
Adds the given object to the container.
Base class for objects which have an id.
bool operator()(Named *const a, Named *const b) const
Allows to store the object; used as context while traveling the rtree in TraCI.
std::string myID
The name of the object.
void setID(const std::string &newID)
resets the id
std::set< std::string > & myIDs
The container.
Function-object for stable sorting in containers.