Changeset 434:1ce1b4cd8dd5 in lemon-0.x for src/work
- Timestamp:
- 04/27/04 10:31:00 (21 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@582
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/work/klao/path.h
r369 r434 1 1 // -*- c++ -*- // 2 2 3 /** 4 * 5 * Class for representing paths in graphs. 6 * 7 */ 3 ///ingroup datas 4 ///\file 5 ///\brief Class for representing paths in graphs. 8 6 9 7 #ifndef HUGO_PATH_H … … 18 16 namespace hugo { 19 17 18 /// \addtogroup datas 19 /// @{ 20 21 ///A container for directed paths 22 23 ///\param Graph The graph type in which the path is. 24 /// 25 ///In a sense, the path can be treated as a graph, for is has \c NodeIt 26 ///and \c EdgeIt with the same usage. These types converts to the \c Node 27 ///and \c Edge of the original graph. 28 ///\todo How to clear a path? 29 ///\todo Clarify the consistency checks to do. 20 30 template<typename Graph> 21 31 class DirPath { … … 33 43 public: 34 44 45 /// Constructor 46 47 /// \param _G The graph in which the path is. 48 /// 35 49 DirPath(const Graph &_G) : gr(&_G) {} 36 50 37 51 /// Subpath defined by two nodes. 38 /// It is an error if the two edges are not in order!52 /// \warning It is an error if the two edges are not in order! 39 53 DirPath(const DirPath &P, const NodeIt &a, const NodeIt &b); 40 54 /// Subpath defined by two edges. Contains edges in [a,b) 41 /// It is an error if the two edges are not in order!55 /// \warning It is an error if the two edges are not in order! 42 56 DirPath(const DirPath &P, const EdgeIt &a, const EdgeIt &b); 43 57 … … 129 143 130 144 friend class Builder; 145 146 ///Class to build paths 147 148 ///\ingroup datas 149 ///This class is used to build new paths. 150 ///You can push new edges to the front and to the back of the path in 151 ///arbitrary order the you can commit these changes to the graph. 152 ///\todo We must clarify when the path will be in "transitional" state. 131 153 class Builder { 132 154 DirPath &P; … … 134 156 135 157 public: 158 ///Constructor 159 160 ///\param _P the path you want to build. 161 /// 136 162 Builder(DirPath &_P) : P(_P) {} 137 163 164 ///Set the first node of the path. 165 166 ///Set the first node of the path. 167 ///If the path is empty, this must be call before any call of 168 ///\ref pushFront() or \ref pushBack() 169 void setFirst(const GraphNode &) { } 170 171 ///Push a new edge to the front of the path 172 173 ///Push a new edge to the front of the path. 174 ///\sa setFirst() 138 175 bool pushFront(const GraphEdge& e) { 139 176 if( empty() || P.gr->head(e)==from() ) { … … 143 180 return false; 144 181 } 182 ///Push a new edge to the back of the path 183 184 ///Push a new edge to the back of the path. 185 ///\sa setFirst() 145 186 bool pushBack(const GraphEdge& e) { 146 187 if( empty() || P.gr->tail(e)==to() ) { … … 151 192 } 152 193 194 ///Commit the changes to the path. 153 195 void commit() { 154 196 if( !d.empty() ) { … … 158 200 } 159 201 202 ///Desctuctor 203 204 ///The desctuctor. 205 ///It commit also commit the changes. 206 ///\todo Is this what we want? 160 207 ~Builder() { commit(); } 161 208 … … 190 237 191 238 }; 192 193 239 194 240 … … 613 659 } 614 660 661 ///@} 615 662 616 663 } // namespace hugo
Note: See TracChangeset
for help on using the changeset viewer.