Changeset 774:4297098d9677 in lemon0.x for src/hugo/skeletons
 Timestamp:
 08/30/04 14:01:47 (19 years ago)
 Branch:
 default
 Phase:
 public
 Convert:
 svn:c9d7d8f590d60310b91f818b3a526b0e/lemon/trunk@1066
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

src/hugo/skeletons/graph.h
r732 r774 35 35 public: 36 36 /// Defalult constructor. 37 StaticGraphSkeleton() { }37 StaticGraphSkeleton() { } 38 38 ///Copy consructor. 39 39 40 40 ///\todo It is not clear, what we expect from a copy constructor. 41 41 ///E.g. How to assign the nodes/edges to each other? What about maps? 42 StaticGraphSkeleton(const StaticGraphSkeleton &G) {} 43 44 /// The base type of the node iterators. 45 46 /// This is the base type of each node iterators, 47 /// thus each kind of node iterator will convert to this. 42 StaticGraphSkeleton(const StaticGraphSkeleton& g) { } 43 44 /// The base type of node iterators, 45 /// or in other words, the trivial node iterator. 46 47 /// This is the base type of each node iterator, 48 /// thus each kind of node iterator converts to this. 49 /// More precisely each kind of node iterator have to be inherited 50 /// from the trivial node iterator. 48 51 class Node { 49 52 public: 50 53 /// @warning The default constructor sets the iterator 51 54 /// to an undefined value. 52 Node() {} //FIXME 55 Node() { } 56 /// Copy constructor. 57 Node(const Node&) { } 53 58 /// Invalid constructor \& conversion. 54 59 55 60 /// This constructor initializes the iterator to be invalid. 56 61 /// \sa Invalid for more details. 57 58 Node(Invalid) {} 59 //Node(const Node &) {} 60 62 Node(Invalid) { } 61 63 /// Two iterators are equal if and only if they point to the 62 64 /// same object or both are invalid. … … 74 76 /// This iterator goes through each node. 75 77 /// Its usage is quite simple, for example you can count the number 76 /// of nodes in graph \c Gof type \c Graph like this:78 /// of nodes in graph \c g of type \c Graph like this: 77 79 /// \code 78 /// int count=0;79 /// for(Graph::NodeIt n(G);G.valid(n);G.next(n)) count++;80 /// int count=0; 81 /// for (Graph::NodeIt n(g); g.valid(n); ++n) ++count; 80 82 /// \endcode 81 83 class NodeIt : public Node { … … 83 85 /// @warning The default constructor sets the iterator 84 86 /// to an undefined value. 85 NodeIt() {} //FIXME 87 NodeIt() { } 88 /// Copy constructor. 89 NodeIt(const NodeIt&) { } 86 90 /// Invalid constructor \& conversion. 87 91 88 /// Initialize the iterator to be invalid 92 /// Initialize the iterator to be invalid. 89 93 /// \sa Invalid for more details. 90 NodeIt(Invalid) {} 91 /// Sets the iterator to the first node of \c G. 92 NodeIt(const StaticGraphSkeleton &) {} 93 /// @warning The default constructor sets the iterator 94 /// to an undefined value. 95 NodeIt(const NodeIt &n) : Node(n) {} 94 NodeIt(Invalid) { } 95 /// Sets the iterator to the first node of \c g. 96 NodeIt(const StaticGraphSkeleton& g) { } 97 /// Sets the iterator to the node of \c g pointed by the trivial 98 /// iterator n. This feature necessitates that each time we 99 /// iterate the nodeset, the iteration order is the same. 100 NodeIt(const StaticGraphSkeleton& g, const Node& n) { } 101 /// Assign the iterator to the next node. 102 NodeIt& operator++() { return *this; } 96 103 }; 97 104 … … 102 109 /// @warning The default constructor sets the iterator 103 110 /// to an undefined value. 104 Edge() {} //FIXME 105 /// Initialize the iterator to be invalid 106 Edge(Invalid) {} 111 Edge() { } 112 /// Copy constructor. 113 Edge(const Edge&) { } 114 /// Initialize the iterator to be invalid. 115 Edge(Invalid) { } 107 116 /// Two iterators are equal if and only if they point to the 108 117 /// same object or both are invalid. … … 118 127 /// Its usage is quite simple, for example you can count the number 119 128 /// of outgoing edges of a node \c n 120 /// in graph \c Gof type \c Graph as follows.129 /// in graph \c g of type \c Graph as follows. 121 130 /// \code 122 /// int count=0;123 /// for(Graph::OutEdgeIt e(G,n);G.valid(e);G.next(e)) count++;131 /// int count=0; 132 /// for (Graph::OutEdgeIt e(g, n); g.valid(e); ++e) ++count; 124 133 /// \endcode 125 134 … … 128 137 /// @warning The default constructor sets the iterator 129 138 /// to an undefined value. 130 OutEdgeIt() {} 131 /// Initialize the iterator to be invalid 132 OutEdgeIt(Invalid) {} 139 OutEdgeIt() { } 140 /// Copy constructor. 141 OutEdgeIt(const OutEdgeIt&) { } 142 /// Initialize the iterator to be invalid. 143 OutEdgeIt(Invalid) { } 133 144 /// This constructor sets the iterator to first outgoing edge. 134 145 … … 136 147 /// node 137 148 ///@param n the node 138 ///@param G the graph 139 OutEdgeIt(const StaticGraphSkeleton &, Node) {} 149 ///@param g the graph 150 OutEdgeIt(const StaticGraphSkeleton& g, const Node& n) { } 151 /// Sets the iterator to the value of the trivial iterator \c e. 152 /// This feature necessitates that each time we 153 /// iterate the edgeset, the iteration order is the same. 154 OutEdgeIt(const StaticGraphSkeleton& g, const Edge& e) { } 155 /// Assign the iterator to the next outedge of the corresponding node. 156 OutEdgeIt& operator++() { return *this; } 140 157 }; 141 158 … … 146 163 /// Its usage is quite simple, for example you can count the number 147 164 /// of outgoing edges of a node \c n 148 /// in graph \c Gof type \c Graph as follows.165 /// in graph \c g of type \c Graph as follows. 149 166 /// \code 150 /// int count=0;151 /// for(Graph::InEdgeIt e(G,n);G.valid(e);G.next(e)) count++;167 /// int count=0; 168 /// for(Graph::InEdgeIt e(g, n); g.valid(e); ++) ++count; 152 169 /// \endcode 153 170 … … 156 173 /// @warning The default constructor sets the iterator 157 174 /// to an undefined value. 158 InEdgeIt() {} 159 /// Initialize the iterator to be invalid 160 InEdgeIt(Invalid) {} 161 InEdgeIt(const StaticGraphSkeleton &, Node) {} 175 InEdgeIt() { } 176 /// Copy constructor. 177 InEdgeIt(const InEdgeIt&) { } 178 /// Initialize the iterator to be invalid. 179 InEdgeIt(Invalid) { } 180 /// . 181 InEdgeIt(const StaticGraphSkeleton&, const Node&) { } 182 /// . 183 InEdgeIt(const StaticGraphSkeleton&, const Edge&) { } 184 /// Assign the iterator to the next inedge of the corresponding node. 185 InEdgeIt& operator++() { return *this; } 162 186 }; 163 187 // class SymEdgeIt : public Edge {}; … … 167 191 /// This iterator goes through each edge of a graph. 168 192 /// Its usage is quite simple, for example you can count the number 169 /// of edges in a graph \c Gof type \c Graph as follows:193 /// of edges in a graph \c g of type \c Graph as follows: 170 194 /// \code 171 /// int count=0;172 /// for(Graph::EdgeIt e(G);G.valid(e);G.next(e)) count++;195 /// int count=0; 196 /// for(Graph::EdgeIt e(g); g.valid(e); ++e) ++count; 173 197 /// \endcode 174 198 class EdgeIt : public Edge { … … 176 200 /// @warning The default constructor sets the iterator 177 201 /// to an undefined value. 178 EdgeIt() {} 179 /// Initialize the iterator to be invalid 180 EdgeIt(Invalid) {} 181 EdgeIt(const StaticGraphSkeleton &) {} 202 EdgeIt() { } 203 /// Copy constructor. 204 EdgeIt(const EdgeIt&) { } 205 /// Initialize the iterator to be invalid. 206 EdgeIt(Invalid) { } 207 /// . 208 EdgeIt(const StaticGraphSkeleton&) { } 209 /// . 210 EdgeIt(const StaticGraphSkeleton&, const Edge&) { } 211 EdgeIt& operator++() { return *this; } 182 212 }; 183 213 … … 187 217 /// \return the first node. 188 218 /// 189 NodeIt &first(NodeIt &i) const { return i;}219 NodeIt& first(NodeIt& i) const { return i; } 190 220 191 221 /// The first incoming edge. 192 InEdgeIt &first(InEdgeIt &i, Node) const { return i;}222 InEdgeIt& first(InEdgeIt &i, Node) const { return i; } 193 223 /// The first outgoing edge. 194 OutEdgeIt &first(OutEdgeIt &i, Node) const { return i;}195 // SymEdgeIt &first(SymEdgeIt &, Node) const { return i;}224 OutEdgeIt& first(OutEdgeIt& i, Node) const { return i; } 225 // SymEdgeIt& first(SymEdgeIt&, Node) const { return i; } 196 226 /// The first edge of the Graph. 197 EdgeIt &first(EdgeIt &i) const { return i;}227 EdgeIt& first(EdgeIt& i) const { return i; } 198 228 199 229 // Node getNext(Node) const {} … … 204 234 205 235 /// Go to the next node. 206 NodeIt &next(NodeIt &i) const { return i;}236 NodeIt& next(NodeIt& i) const { return i; } 207 237 /// Go to the next incoming edge. 208 InEdgeIt &next(InEdgeIt &i) const { return i;}238 InEdgeIt& next(InEdgeIt& i) const { return i; } 209 239 /// Go to the next outgoing edge. 210 OutEdgeIt &next(OutEdgeIt &i) const { return i;}211 //SymEdgeIt &next(SymEdgeIt &) const {}240 OutEdgeIt& next(OutEdgeIt& i) const { return i; } 241 //SymEdgeIt& next(SymEdgeIt&) const { } 212 242 /// Go to the next edge. 213 EdgeIt &next(EdgeIt &i) const { return i;}243 EdgeIt& next(EdgeIt& i) const { return i; } 214 244 215 245 ///Gives back the head node of an edge. … … 230 260 ///\todo Maybe, it would be better if iterator converted to 231 261 ///bool directly, as Jacint prefers. 232 bool valid(const Node&) const { return true; }262 bool valid(const Node&) const { return true; } 233 263 /// Checks if an edge iterator is valid 234 264 235 265 ///\todo Maybe, it would be better if iterator converted to 236 266 ///bool directly, as Jacint prefers. 237 bool valid(const Edge&) const { return true; }267 bool valid(const Edge&) const { return true; } 238 268 239 269 ///Gives back the \e id of a node. … … 241 271 ///\warning Not all graph structures provide this feature. 242 272 /// 243 int id(const Node&) const { return 0; }273 int id(const Node&) const { return 0; } 244 274 ///Gives back the \e id of an edge. 245 275 246 276 ///\warning Not all graph structures provide this feature. 247 277 /// 248 int id(const Edge&) const { return 0; }278 int id(const Edge&) const { return 0; } 249 279 250 280 /// Resets the graph. … … 252 282 /// This function deletes all edges and nodes of the graph. 253 283 /// It also frees the memory allocated to store them. 254 void clear() {} 255 256 int nodeNum() const { return 0;} 257 int edgeNum() const { return 0;} 258 284 void clear() { } 285 286 int nodeNum() const { return 0; } 287 int edgeNum() const { return 0; } 259 288 260 289 … … 271 300 public: 272 301 273 class ReferenceMap<Node,T>; 274 275 NodeMap(const StaticGraphSkeleton &) {} 276 NodeMap(const StaticGraphSkeleton &, T) {} 302 NodeMap(const StaticGraphSkeleton&) { } 303 NodeMap(const StaticGraphSkeleton&, T) { } 277 304 278 305 ///Copy constructor 279 template<typename TT> NodeMap(const NodeMap<TT> &) {}306 template<typename TT> NodeMap(const NodeMap<TT>&) { } 280 307 ///Assignment operator 281 template<typename TT> NodeMap &operator=(const NodeMap<TT>&)282 { return *this;}308 template<typename TT> NodeMap& operator=(const NodeMap<TT>&) 309 { return *this; } 283 310 }; 284 311 … … 296 323 typedef Edge KeyType; 297 324 298 EdgeMap(const StaticGraphSkeleton &) {}299 EdgeMap(const StaticGraphSkeleton &, T ) {}325 EdgeMap(const StaticGraphSkeleton&) { } 326 EdgeMap(const StaticGraphSkeleton&, T) { } 300 327 301 328 ///Copy constructor 302 template<typename TT> EdgeMap(const EdgeMap<TT> &) {}329 template<typename TT> EdgeMap(const EdgeMap<TT>&) { } 303 330 ///Assignment operator 304 template<typename TT> EdgeMap &operator=(const EdgeMap<TT> 305 { return *this;}331 template<typename TT> EdgeMap &operator=(const EdgeMap<TT>&) 332 { return *this; } 306 333 }; 307 334 }; … … 318 345 public: 319 346 /// Defalult constructor. 320 GraphSkeleton() { }347 GraphSkeleton() { } 321 348 ///Copy consructor. 322 349 323 350 ///\todo It is not clear, what we expect from a copy constructor. 324 351 ///E.g. How to assign the nodes/edges to each other? What about maps? 325 GraphSkeleton(const GraphSkeleton &G) {}352 GraphSkeleton(const GraphSkeleton&) { } 326 353 327 354 ///Add a new node to the graph. … … 329 356 /// \return the new node. 330 357 /// 331 Node addNode() { return INVALID; }358 Node addNode() { return INVALID; } 332 359 ///Add a new edge to the graph. 333 360 … … 335 362 ///and head node \c head. 336 363 ///\return the new edge. 337 Edge addEdge(Node, Node) { return INVALID; }364 Edge addEdge(Node, Node) { return INVALID; } 338 365 339 366 /// Resets the graph. … … 342 369 /// It also frees the memory allocated to store them. 343 370 /// \todo It might belong to \c EraseableGraphSkeleton. 344 void clear() { }371 void clear() { } 345 372 }; 346 373 … … 353 380 public: 354 381 /// Deletes a node. 355 void erase(Node n) { }382 void erase(Node n) { } 356 383 /// Deletes an edge. 357 void erase(Edge e) { }384 void erase(Edge e) { } 358 385 359 386 /// Defalult constructor. 360 EraseableGraphSkeleton() { }387 EraseableGraphSkeleton() { } 361 388 ///Copy consructor. 362 EraseableGraphSkeleton(const GraphSkeleton &G) {}389 EraseableGraphSkeleton(const GraphSkeleton&) { } 363 390 }; 364 391
Note: See TracChangeset
for help on using the changeset viewer.