13 #include <QtCore/QHash>
14 #include <UnorderedMap.hpp>
25 typedef intptr_t edge_identity_t;
35 template <
typename EdgeContent>
class Edge {
97 return _content->*ptr;
102 template <
typename R>
const R&
operator->*(R EdgeContent::*ptr)
const {
103 return _content->*ptr;
148 return _content == 0;
154 operator bool()
const {
return _content != 0; }
204 template <
typename EdgeContent>
212 template <
typename EdgeContent>
214 : _source(copy._source)
215 , _target(copy._target)
216 , _content(copy._content)
220 template <
typename EdgeContent>
240 template <
typename T>
void copy_symmetric(T& e2,
const T& e1) {
253 template <
typename EdgeContent>
struct Arc {
259 typedef EdgeContent content_t;
312 operator bool()
const {
return main != 0; }
352 copy_symmetric(*other, *main);
357 mutable EdgeContent* main, *other;
360 template <
typename EdgeContent>
369 template <
typename EdgeContent>
378 template <
typename EdgeContent>
380 : _source(copy._source)
381 , _target(copy._target)
390 return Arc(_target, _source, other, main);
397 template <
typename EdgeContent>
struct hash<mgx::graph::Edge<EdgeContent> > {
407 return qHash(uint(e.
source() >> 4)) ^ qHash(uint(e.
target() >> 4));
edge_identity_t identity_t
Type of the identity of a vertex.
Definition: Edge.hpp:40
bool operator<(const Edge &other) const
Comparison operators.
Definition: Edge.hpp:140
bool isNull() const
Test if an edge is null.
Definition: Edge.hpp:147
R & operator->*(R EdgeContent::*ptr)
Access to the data via pointer to member.
Definition: Edge.hpp:96
EdgeContent content_t
Type of the content of the edge.
Definition: Edge.hpp:45
void sync() const
Synchronize both sides of the arc.
Definition: Edge.hpp:349
Edge of a vv graph.
Definition: Edge.hpp:35
bool operator==(const Edge &other) const
Comparison operators.
Definition: Edge.hpp:116
identity_t _source
Identity of the source of the edge.
Definition: Edge.hpp:191
Type of a undirected edge (or arc)
Definition: Edge.hpp:253
EdgeContent * operator->() const
Data access.
Definition: Edge.hpp:79
identity_t source() const
Returns the identifier of the source of the edge.
Definition: Edge.hpp:162
~Arc()
Destroy and copy the content of the arcs.
Definition: Edge.hpp:298
edge_identity_t identity_t
Type of the identity of a vertex.
Definition: Edge.hpp:257
EdgeContent & operator*() const
Reference the content of the arc.
Definition: Edge.hpp:317
identity_t _target
Identity of the target of the edge.
Definition: Edge.hpp:195
identity_t source() const
Returns the identifier of the source of the edge.
Definition: Edge.hpp:333
Edge & operator=(const Edge &other)
Change the reference help by the object.
Definition: Edge.hpp:228
EdgeContent * _content
Content of the edge.
Definition: Edge.hpp:199
Arc()
Cosntruct an empty (null) arc.
Definition: Edge.hpp:361
EdgeContent * pointer
Type of the equivalent pointer.
Definition: Edge.hpp:50
const R & operator->*(R EdgeContent::*ptr) const
Constant access to the data via pointer to member.
Definition: Edge.hpp:102
Arc operator-() const
Unary '-' operator synchronize edges and returns opposite arc.
Definition: Edge.hpp:291
EdgeContent & operator*() const
Data access.
Definition: Edge.hpp:89
identity_t target() const
Returns the identifier of the target of the edge.
Definition: Edge.hpp:171
void clear()
Reset an edge weak pointer to null.
Definition: Edge.hpp:178
bool operator>(const Edge &other) const
Comparison operators.
Definition: Edge.hpp:132
bool isNull() const
Test if the content is null.
Definition: Edge.hpp:305
Edge()
Creates a null edge.
Definition: Edge.hpp:205
identity_t target() const
Returns the identifier of the target of the edge.
Definition: Edge.hpp:342
bool operator!=(const Edge &other) const
Comparison operators.
Definition: Edge.hpp:124
Arc inv() const
Synchronize the edges and returns the opposite arc.
Definition: Edge.hpp:387
EdgeContent * operator->() const
Reference the content of the arc as a pointer.
Definition: Edge.hpp:323