11 #ifndef BIOPROCESSING_GRAPH_SETEDGE 12 #define BIOPROCESSING_GRAPH_SETEDGE 17 #include <cartobase/smart/rcptr.h> 62 _set.insert( other.
x() );
63 _set.insert( other.
y() );
71 const_iterator
begin()
const {
return _set.begin(); }
72 const_iterator
end()
const {
return _set.end(); }
81 const Vertex
x()
const {
return *(
begin() ); }
83 Vertex
y() {
return *( ++(
begin() ) ); }
85 const Vertex
y()
const {
return *( ++(
begin() ) ); }
87 Vertex
other(
const Vertex & v )
90 return( v == *i ? *(++i) : *i );
93 const Vertex
other(
const Vertex & v )
const 95 const_iterator i =
begin();
96 return( v == *i ? *(++i) : *i );
104 return x() == other.
x() &&
y() == other.
y();
109 return x() != other.
x() ||
y() != other.
y();
116 for( i =
begin(), j = other.begin(); i !=
end(); ++i, ++j )
130 for( i =
begin(), j = other.begin(); i !=
end(); ++i, ++j )
143 return ( *
this == other ) || ( *
this >
other );
149 return ( *
this == other ) || ( *
this <
other );
166 template <
typename V>
184 SetEdgeRef(
const Vertex &
x,
const Vertex &
y ): Base( new Pointed(x,y) ) {}
204 virtual const_iterator
begin()
const {
return ((Pointed*)(this->
get()))->begin(); }
205 virtual const_iterator
end()
const {
return ((Pointed*)(this->
get()))->end(); }
206 virtual iterator
begin() {
return ((Pointed*)(this->
get()))->begin(); }
207 virtual iterator
end() {
return ((Pointed*)(this->
get()))->end(); }
215 if( !(*
this) && !other )
217 else if( !(*
this) || !other )
220 return *((Pointed*)this->
get()) == *((Pointed*)other.get());
224 return !( *
this ==
other );
230 else if( !(*
this) || !other )
233 return *((Pointed*)this->
get()) > *((Pointed*)other.get());
239 else if( !(*
this) || !other )
242 return *((Pointed*)this->
get()) < *((Pointed*)other.get());
246 return ( *
this == other ) || ( *
this >
other );
250 return ( *
this == other ) || ( *
this <
other );
259 #endif // BIOPROCESSING_GRAPH_BASEEDGE SetEdgeRef(const Vertex &x, const Vertex &y)
Constructor from a pair of vertices.
const_iterator begin() const
const_iterator end() const
virtual const_iterator end() const
V Vertex
Usable vertex type.
Pointed::const_iterator const_iterator
SetEdgeRef< V > Edge
Usable edge type.
Pointed::iterator iterator
BaseEdge< V > Base
Base class type.
Reference counting pointer to a BaseEdge.
Vertex other(const Vertex &v)
access the vertex that is not v
SetEdgeRef< V > This
Type of *this.
virtual const_iterator begin() const
SetEdge< V > This
Type of *this.
Vertex x()
access the first vertex (x is the smaller vertex)
const Vertex y() const
access the second vertex (y is the bigger vertex)
virtual bool operator<(const This &other) const
For inequality we first look at x, and if they are equal, we look at y.
const Vertex x() const
access the first vertex (x is the smaller vertex)
SetEdge(const Base &other)
Copy constructor from base class.
virtual bool operator!=(const This &other) const
there is equality if both vertices are equal
virtual bool operator>=(const This &other) const
For inequality we first look at x, and if they are equal, we look at y.
const Vertex other(const Vertex &v) const
access the vertex that is not v
virtual bool operator>(const This &other) const
For inequality we first look at x, and if they are equal, we look at y.
SetEdgeRef(Pointed *e)
Constructor from a pointer (the pointer should either be created by new, or be already referenced by ...
Pointed::Vertex Vertex
Usable Vertex type.
virtual bool operator==(const This &other) const
there is equality if both vertices are equal
Pointed::Edge Edge
USable Edge type.
Reference counting pointer to a SetEdge.
SetEdgeRef(const Base &other)
Copy constructor (it copies the reference, it does not duplicate the pointed object) ...
SetEdge(const This &other)
Copy constructor.
Vertex y()
access the second vertex (y is the bigger vertex)
static Edge none()
Empty pointer factory.
virtual bool operator<=(const This &other) const
For inequality we first look at x, and if they are equal, we look at y.
Edges: set implementation of non-oriented edges.
SetEdgeRef< V > Ref
Reference type.
SetEdgeRef()
Default constructor (builds a none pointer)
VertexSet::const_iterator const_iterator
SetEdge< V > Pointed
Pointed object type.
BaseEdgeRef< V > Base
Base class type.
VertexSet::iterator iterator
virtual Vertex y()
access the second vertex (arbitrary choice for non oriented edges)
virtual Vertex x()
access the first vertex (arbitrary choice for non oriented edges)
SetEdge(const Vertex &x, const Vertex &y)
Constructor from a pair of vertices.
std::set< V > VertexSet
Vertex set type.