11 #ifndef BIOPROCESSING_GRAPH_BASEEDGE 12 #define BIOPROCESSING_GRAPH_BASEEDGE 15 #include <cartobase/smart/rcptr.h> 35 class BaseEdge:
public carto::RCObject
52 virtual Vertex
x() {
throw; }
54 virtual const Vertex
x()
const {
throw; }
56 virtual Vertex
y() {
throw; }
58 virtual const Vertex
y()
const {
throw; }
60 virtual Vertex
other(
const Vertex & v ) {
throw; }
62 virtual const Vertex
other(
const Vertex & v )
const {
throw; }
85 std::ostream & operator<<( std::ostream & os, const bio::BaseEdge<V> & e )
87 os <<
"E{ " << e.
x() <<
" -- " << e.y() <<
" }";
100 template <
typename V>
101 class BaseEdgeRef:
public carto::rc_ptr<BaseEdge<V> >
106 typedef carto::rc_ptr<BaseEdge<V> >
Base;
136 virtual Vertex
x() {
return (*this)->x(); }
138 virtual const Vertex
x()
const {
return (*this)->x(); }
140 virtual Vertex
y() {
return (*this)->y(); }
142 virtual const Vertex
y()
const {
return (*this)->y(); }
144 virtual Vertex
other(
const Vertex & v ) {
return (*this)->other(v); }
146 virtual const Vertex
other(
const Vertex & v )
const {
return (*this)->other(v); }
154 if( !(*
this) && !other )
156 else if( !(*
this) || !other )
159 return *(this->
get()) == *(other.get());
163 return !( *
this ==
other );
170 return this > &
other;
177 return this < &
other;
181 return ( *
this == other ) || ( *
this >
other );
185 return ( *
this == other ) || ( *
this <
other );
200 template <
typename V>
201 std::ostream & operator<<( std::ostream & os, const bio::BaseEdgeRef<V> & e )
211 #endif // BIOPROCESSING_GRAPH_BASEEDGE virtual const Vertex y() const
access the second vertex (arbitrary choice for non oriented edges)
virtual Vertex y()
access the second vertex (arbitrary choice for non oriented edges)
carto::rc_ptr< BaseEdge< V > > Base
Base class.
BaseEdge< V > This
Type of *this.
Pointed::Vertex Vertex
Usable vertex type.
virtual const Vertex x() const
access the first vertex (arbitrary choice for non oriented edges)
BaseEdgeRef(const Base &other)
Copy constructor (it copies the reference, it does not duplicate the pointed object) ...
Reference counting pointer to a BaseEdge.
Pointed::Edge Edge
Usable edge type.
virtual const Vertex y() const
access the second vertex (arbitrary choice for non oriented edges)
static Edge none()
Empty pointer factory.
BaseEdgeRef()
Default constructor (creates an empty pointer)
virtual bool operator==(const This &other) const
virtual const Vertex other(const Vertex &v) const
access the vertex that is not v
BaseEdgeRef< V > Ref
Reference type.
Pointed::Edge Ref
Reference type.
virtual bool operator>(const This &other) const
BaseEdgeRef< V > Edge
Usable Edge type (RC)
virtual Vertex other(const Vertex &v)
access the vertex that is not v
BaseEdgeRef< V > This
Type of *this.
BaseEdgeRef(Pointed *e)
Constructor from a pointer (the pointer should either be created by new, or be already referenced by ...
virtual Vertex other(const Vertex &v)
access the vertex that is not v
virtual bool operator<=(const This &other) const
virtual const Vertex other(const Vertex &v) const
access the vertex that is not v
BaseEdge< V > Pointed
Pointed object type.
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)
virtual bool operator<(const This &other) const
virtual bool operator>=(const This &other) const
virtual Vertex x()
access the first vertex (arbitrary choice for non oriented edges)
virtual const Vertex x() const
access the first vertex (arbitrary choice for non oriented edges)
virtual bool operator!=(const This &other) const