Changeset 962:1a770e9f80b2 in lemon-0.x for src/lemon
- Timestamp:
- 11/05/04 01:31:49 (20 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@1345
- Location:
- src/lemon
- Files:
-
- 2 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
src/lemon/Makefile.am
r959 r962 34 34 extendable_graph_extender.h \ 35 35 clearable_graph_extender.h \ 36 erasable_graph_extender.h 36 erasable_graph_extender.h \ 37 undir_graph_extender.h 37 38 38 39 noinst_HEADERS = \ 39 40 concept/graph.h \ 40 41 concept/graph_component.h \ 42 concept/undir_graph.h \ 41 43 concept/sym_graph.h \ 42 44 concept/maps.h \ -
src/lemon/alteration_observer_registry.h
r946 r962 279 279 280 280 281 /// Class to extend a graph functionality with the possibility of alteration observing. 282 283 /// AlterableGraphExtender extends the _Base graphs functionality with the possibility of 284 /// alteration observing. It defines two observer registrys for the nodes and mapes. 281 /// \brief Class to extend a graph with the functionality of alteration 282 /// observing. 283 /// 284 /// AlterableGraphExtender extends the _Base graphs functionality with 285 /// the possibility of alteration observing. It defines two observer 286 /// registrys for the nodes and mapes. 287 /// 288 /// \todo Document what "alteration observing" is. And probably find a 289 /// better (shorter) name. 285 290 /// 286 291 /// \param _Base is the base class to extend. … … 288 293 /// \pre _Base is conform to the BaseGraphComponent concept. 289 294 /// 290 /// \post AlterableGraphExtender<_Base> is conform to the AlterableGraphComponent concept. 295 /// \post AlterableGraphExtender<_Base> is conform to the 296 /// AlterableGraphComponent concept. 291 297 /// 292 298 /// \author Balazs Dezso … … 302 308 typedef typename Parent::Edge Edge; 303 309 310 /// The edge observer registry. 311 typedef AlterationObserverRegistry<Edge> EdgeObserverRegistry; 304 312 /// The node observer registry. 305 typedef AlterationObserverRegistry<Edge> EdgeObserverRegistry;306 /// The edge observer registry.307 313 typedef AlterationObserverRegistry<Node> NodeObserverRegistry; 308 314 … … 331 337 }; 332 338 339 /// \brief Class to extend an undirected graph with the functionality of 340 /// alteration observing. 341 /// 342 /// \todo Document. 343 /// 344 /// \sa AlterableGraphExtender 345 /// 346 /// \bug This should be done some other way. Possibilities: template 347 /// specialization (not very easy, if at all possible); some kind of 348 /// enable_if boost technique? 349 350 template <typename _Base> 351 class AlterableUndirGraphExtender 352 : public AlterableGraphExtender<_Base> { 353 public: 354 355 typedef AlterableUndirGraphExtender Graph; 356 typedef AlterableGraphExtender<_Base> Parent; 357 358 typedef typename Parent::UndirEdge UndirEdge; 359 360 /// The edge observer registry. 361 typedef AlterationObserverRegistry<UndirEdge> UndirEdgeObserverRegistry; 362 363 protected: 364 365 mutable UndirEdgeObserverRegistry undir_edge_observers; 366 367 UndirEdgeObserverRegistry& getUndirEdgeObserverRegistry() const { 368 return undir_edge_observers; 369 } 370 371 ~AlterableUndirGraphExtender() { 372 undir_edge_observers.clear(); 373 } 374 }; 333 375 334 376 /// @} -
src/lemon/concept/graph_component.h
r961 r962 264 264 function_requires< GraphItemConcept<Edge> >(); 265 265 { 266 const Graph& const_graph = graph;267 266 Node n; 268 267 Edge e; 269 n = const_graph.tail(e);270 n = const_graph.head(e);268 n = graph.tail(e); 269 n = graph.head(e); 271 270 } 272 271 } 273 272 274 Graph& graph;273 const Graph& graph; 275 274 }; 276 275 … … 646 645 template <typename Graph> 647 646 struct IterableGraphComponentConcept { 648 649 647 void constraints() { 650 648 function_requires< BaseIterableGraphComponentConcept<Graph> >(); … … 662 660 function_requires< GraphIncIteratorConcept<InEdgeIt, Graph> >(); 663 661 } 664 Graph& graph;665 662 }; 666 663 -
src/lemon/iterable_graph_extender.h
r946 r962 9 9 template <typename _Base> 10 10 class IterableGraphExtender : public _Base { 11 public: 11 12 12 13 typedef _Base Parent; 13 14 typedef IterableGraphExtender<_Base> Graph; 14 15 public:16 15 17 16 typedef typename Parent::Node Node; … … 27 26 NodeIt(Invalid i) : Node(i) { } 28 27 29 explicit NodeIt(const Graph& _graph) : Node(),graph(&_graph) {28 explicit NodeIt(const Graph& _graph) : graph(&_graph) { 30 29 _graph.first(*static_cast<Node*>(this)); 31 30 } … … 50 49 EdgeIt(Invalid i) : Edge(i) { } 51 50 52 explicit EdgeIt(const Graph& _graph) : Edge(),graph(&_graph) {51 explicit EdgeIt(const Graph& _graph) : graph(&_graph) { 53 52 _graph.first(*static_cast<Edge*>(this)); 54 53 } … … 74 73 75 74 OutEdgeIt(const Graph& _graph, const Node& node) 76 : Edge(),graph(&_graph) {75 : graph(&_graph) { 77 76 _graph.firstOut(*this, node); 78 77 } … … 98 97 99 98 InEdgeIt(const Graph& _graph, const Node& node) 100 : Edge(),graph(&_graph) {99 : graph(&_graph) { 101 100 _graph.firstIn(*this, node); 102 101 } … … 127 126 }; 128 127 128 template <typename _Base> 129 class IterableUndirGraphExtender : public IterableGraphExtender<_Base> { 130 public: 131 132 typedef IterableGraphExtender<_Base> Parent; 133 typedef IterableUndirGraphExtender<_Base> Graph; 134 135 typedef typename Parent::UndirEdge UndirEdge; 136 137 class UndirEdgeIt : public UndirEdge { 138 const Graph* graph; 139 public: 140 141 UndirEdgeIt() { } 142 143 UndirEdgeIt(Invalid i) : UndirEdge(i) { } 144 145 explicit UndirEdgeIt(const Graph& _graph) : graph(&_graph) { 146 _graph.first(*static_cast<UndirEdge*>(this)); 147 } 148 149 UndirEdgeIt(const Graph& _graph, const UndirEdge& e) : 150 UndirEdge(e), graph(&_graph) { } 151 152 UndirEdgeIt& operator++() { 153 graph->next(*this); 154 return *this; 155 } 156 157 }; 158 159 160 }; 129 161 } 130 162
Note: See TracChangeset
for help on using the changeset viewer.