5 #include <libutl/slist.h> 56 if (_object ==
nullptr)
57 return super::getKey();
66 slist_add(_edgesHead, &_edgesTail, vertex);
73 slist_add(_edgesHead, &_edgesTail, vertex);
74 slist_add(vertex->_edgesHead, &vertex->_edgesTail,
this);
100 return utl::cast<Vertex>(
slist_find(_edgesHead, key));
114 return ((_flags & flg_owner) != 0);
124 _flags &= ~flg_owner;
131 return ((_flags & flg_visited) != 0);
139 _flags |= flg_visited;
141 _flags &= ~flg_visited;
152 return slist_remove(_edgesHead, &_edgesTail, *vertex,
false);
163 return slist_remove(_edgesHead, &_edgesTail, *vertex,
false,
true)
164 &&
slist_remove(vertex->_edgesHead, &vertex->_edgesTail,
self,
false,
true);
171 if (isOwner())
delete _object;
172 _object =
const_cast<Object*
>(object);
186 _object =
const_cast<Object*
>(object);
187 _edgesHead = _edgesTail =
nullptr;
void setObject(const Object *object)
Set the associated object.
void setOwner(bool owner)
Set the owner flag.
bool isOwner() const
Get the owner flag.
bool isVisited() const
Get the visited flag.
bool removeDirectedEdge(const Vertex *vertex)
Remove the directed edge to the given vertex.
bool removeUndirectedEdge(Vertex *vertex)
Remove the undirected edge to the given vertex.
void deInit()
De-initialize UTL++.
bool slist_remove(SlistNode *&list, SlistNode **tail, const Object &key, bool owner=true, bool sorted=false, const Ordering *ordering=nullptr)
Remove the object matching the given key from the list.
Object * slist_find(SlistNode *list, const Object &key, bool sorted=false, const Ordering *ordering=nullptr)
Find the object matching the given key in the given list.
void clear()
Clear edges and associated object.
Vertex * find(const Object &key) const
Find the associated vertex matching the given key.
#define UTL_CLASS_DECL(DC, BC)
Declaration of standard UTL++ functionality for a non-template class.
void addUndirectedEdge(Vertex *vertex)
Add an undirected edge to the given vertex.
unsigned char byte_t
Unsigned character.
const SlistNode * edges() const
Return the edges.
void slist_clear(SlistNode *&list, SlistNode **tail, bool owner=true)
Clear a list.
void addDirectedEdge(const Vertex *vertex)
Add a directed edge to the given vertex.
void copy(T *dest, const T *src, size_t len)
Copy one array of objects to another.
void slist_add(SlistNode *&list, SlistNode **tail, const Object *object, bool sorted=false, const Ordering *ordering=nullptr)
Add an object to a list.
virtual const Object & getKey() const
Get the key for the vertex.
Vertex(const Object *object)
Constructor.
Object * getObject() const
Get the associated object.
void setVisited(bool visited)
Set the visited flag.
Root of UTL++ class hierarchy.
void init()
Initialize UTL++.