bioprocessing 6.0.4
coustystream.h
Go to the documentation of this file.
1/* Copyright (C) 2000-2013 CEA
2 *
3 * This software and supporting documentation were developed by
4 * bioPICSEL
5 * CEA/DSV/I²BM/MIRCen/LMN, Batiment 61,
6 * 18, route du Panorama
7 * 92265 Fontenay-aux-Roses
8 * France
9 */
10
11#ifndef BIOPROCESSING_WATERSHED_COUSTYSTREAM
12#define BIOPROCESSING_WATERSHED_COUSTYSTREAM
13
15
16namespace bio {
17
18 template <typename V> class CoustyStream;
19 template <typename V> class CoustyStreamRef;
20
21 //==========================================================================
22 // STREAM
23 //==========================================================================
29 template <typename V>
30 class CoustyStream: public std::set<V>, public carto::RCObject
31 {
32 //--- typedef ------------------------------------------------------------
33 protected:
34 typedef typename std::set<V> Base;
35 public:
36 typedef V Vertex;
37
38 //--- constructor --------------------------------------------------------
39 public:
42 {
43 Base::insert(x);
44 }
46
47 //--- accessors ----------------------------------------------------------
48 public:
49 void reset( Vertex x )
50 {
51 Base::clear();
52 Base::insert( x );
53 }
54 };
55
56 //==========================================================================
57 // STREAM REF
58 //==========================================================================
63 template <typename V>
64 class CoustyStreamRef: public carto::rc_ptr<CoustyStream<V> >
65 {
66 //--- typedef ------------------------------------------------------------
67 protected:
69 typedef carto::rc_ptr<Pointed> Base;
70 public:
71 typedef typename Pointed::Vertex Vertex;
72 typedef typename Pointed::iterator iterator;
73 typedef typename Pointed::const_iterator const_iterator;
74
75 //--- constructor --------------------------------------------------------
76 public:
80
81 //--- accessors ----------------------------------------------------------
82 public:
83 void reset( Vertex x ) { return (*this)->reset(x); }
84
85 //--- set methods --------------------------------------------------------
86 public:
87 const_iterator begin() const { return (*this)->begin(); }
88 const_iterator end() const { return (*this)->end(); }
89 iterator begin() { return (*this)->begin(); }
90 iterator end() { return (*this)->end(); }
91 std::pair<iterator,bool> insert( const Vertex & v ) { return (*this)->insert(v); }
92 void erase( const Vertex & v ) { (*this)->erase(v); }
93 void erase( iterator v ) { (*this)->erase(v); }
94 bool empty() const { return (*this)->empty(); }
95 size_t count(const Vertex & v) const { return (*this)->count(v); }
96
97 };
98
99} // namespace bio
100
101#endif // BIOPROCESSING_WATERSHED_COUSTYSTREAM
Reference counting pointer to a CoustyStream.
void erase(const Vertex &v)
const_iterator end() const
void erase(iterator v)
std::pair< iterator, bool > insert(const Vertex &v)
const_iterator begin() const
void reset(Vertex x)
Pointed::const_iterator const_iterator
CoustyStreamRef(Vertex x)
size_t count(const Vertex &v) const
carto::rc_ptr< Pointed > Base
CoustyStream< Vertex > Pointed
Streams represent a descent path in a graph.
void reset(Vertex x)
std::set< V > Base
CoustyStream(Vertex x)