23 #include <QtCore/QHash> 24 #include <UnorderedMap.hpp> 45 template <
typename EdgeContent>
class Edge {
76 Edge(identity_t src, identity_t tgt, EdgeContent* content);
107 return _content->*ptr;
112 template <
typename R>
const R&
operator->*(R EdgeContent::*ptr)
const {
113 return _content->*ptr;
158 return _content == 0;
164 operator bool()
const {
return _content != 0; }
214 template <
typename EdgeContent>
222 template <
typename EdgeContent>
230 template <
typename EdgeContent>
263 template <
typename EdgeContent>
struct Arc {
286 Arc(identity_t src, identity_t tgt, EdgeContent* c1, EdgeContent* c2);
322 operator bool()
const {
return main != 0; }
367 mutable EdgeContent* main, *other;
370 template <
typename EdgeContent>
379 template <
typename EdgeContent>
388 template <
typename EdgeContent>
390 : _source(copy._source)
391 , _target(copy._target)
400 return Arc(_target, _source, other, main);
407 template <
typename EdgeContent>
struct hash<
mgx::graph::Edge<EdgeContent> > {
417 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:50
bool operator<(const Edge &other) const
Comparison operators.
Definition: Edge.hpp:150
bool isNull() const
Test if an edge is null.
Definition: Edge.hpp:157
R & operator->*(R EdgeContent::*ptr)
Access to the data via pointer to member.
Definition: Edge.hpp:106
EdgeContent content_t
Type of the content of the edge.
Definition: Edge.hpp:55
void sync() const
Synchronize both sides of the arc.
Definition: Edge.hpp:359
Edge of a vv graph.
Definition: Edge.hpp:45
bool operator==(const Edge &other) const
Comparison operators.
Definition: Edge.hpp:126
identity_t _source
Identity of the source of the edge.
Definition: Edge.hpp:201
Type of a undirected edge (or arc)
Definition: Edge.hpp:263
EdgeContent * operator->() const
Data access.
Definition: Edge.hpp:89
identity_t source() const
Returns the identifier of the source of the edge.
Definition: Edge.hpp:172
~Arc()
Destroy and copy the content of the arcs.
Definition: Edge.hpp:308
edge_identity_t identity_t
Type of the identity of a vertex.
Definition: Edge.hpp:267
EdgeContent & operator*() const
Reference the content of the arc.
Definition: Edge.hpp:327
identity_t _target
Identity of the target of the edge.
Definition: Edge.hpp:205
identity_t source() const
Returns the identifier of the source of the edge.
Definition: Edge.hpp:343
Edge & operator=(const Edge &other)
Change the reference help by the object.
Definition: Edge.hpp:238
EdgeContent * _content
Content of the edge.
Definition: Edge.hpp:209
Arc()
Cosntruct an empty (null) arc.
Definition: Edge.hpp:371
EdgeContent * pointer
Type of the equivalent pointer.
Definition: Edge.hpp:60
const R & operator->*(R EdgeContent::*ptr) const
Constant access to the data via pointer to member.
Definition: Edge.hpp:112
This namespace contains all the API of MorphoGraphX.
Definition: Assert.hpp:26
Arc operator-() const
Unary '-' operator synchronize edges and returns opposite arc.
Definition: Edge.hpp:301
void copy_symmetric(T &e2, const T &e1)
Default copy of the arc uses the = operator.
Definition: Edge.hpp:250
EdgeContent & operator*() const
Data access.
Definition: Edge.hpp:99
identity_t target() const
Returns the identifier of the target of the edge.
Definition: Edge.hpp:181
void clear()
Reset an edge weak pointer to null.
Definition: Edge.hpp:188
bool operator>(const Edge &other) const
Comparison operators.
Definition: Edge.hpp:142
bool isNull() const
Test if the content is null.
Definition: Edge.hpp:315
Edge()
Creates a null edge.
Definition: Edge.hpp:215
intptr_t edge_identity_t
Type of the identifier of an edge.
Definition: Edge.hpp:35
identity_t target() const
Returns the identifier of the target of the edge.
Definition: Edge.hpp:352
bool operator!=(const Edge &other) const
Comparison operators.
Definition: Edge.hpp:134
Arc inv() const
Synchronize the edges and returns the opposite arc.
Definition: Edge.hpp:397
EdgeContent * operator->() const
Reference the content of the arc as a pointer.
Definition: Edge.hpp:333