Changeset 235:aa50acc936dc in lemon-0.x for src
- Timestamp:
- 03/22/04 18:05:08 (21 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@332
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/work/marci/graph_wrapper.h
r234 r235 241 241 // }; 242 242 243 template<typename /*Graph*/GraphWrapper 244 /*=typename GraphWrapperSkeleton< TrivGraphWrapper<Graph>*/ > 245 class RevGraphWrapper : 246 public GraphWrapper/*GraphWrapperSkeleton< TrivGraphWrapper<Graph> >*/ { 247 protected: 248 //Graph* graph; 249 243 // template<typename /*Graph*/GraphWrapper 244 // /*=typename GraphWrapperSkeleton< TrivGraphWrapper<Graph>*/ > 245 // class RevGraphWrapper : 246 // public GraphWrapper/*GraphWrapperSkeleton< TrivGraphWrapper<Graph> >*/ { 247 // protected: 248 // //Graph* graph; 249 250 // public: 251 // //typedef Graph BaseGraph; 252 253 // //typedef typename Graph::Node Node; 254 // //typedef typename Graph::NodeIt NodeIt; 255 256 // //typedef typename Graph::Edge Edge; 257 // typedef typename GraphWrapper/*typename GraphWrapperSkeleton< TrivGraphWrapper<Graph> >*/::OutEdgeIt InEdgeIt; 258 // typedef typename GraphWrapper/*typename GraphWrapperSkeleton< TrivGraphWrapper<Graph> >*/::InEdgeIt OutEdgeIt; 259 // //typedef typename Graph::SymEdgeIt SymEdgeIt; 260 // //typedef typename Graph::EdgeIt EdgeIt; 261 262 // //RevGraphWrapper() : graph(0) { } 263 // RevGraphWrapper(GraphWrapper _gw/*BaseGraph& _graph*/) : GraphWrapper/*GraphWrapperSkeleton< TrivGraphWrapper<Graph> >*/(_gw/*TrivGraphWrapper<Graph>(_graph)*/) { } 264 265 // //void setGraph(Graph& _graph) { graph = &_graph; } 266 // //Graph& getGraph() const { return (*graph); } 267 268 // //template<typename I> I& first(I& i) const { return graph->first(i); } 269 // //template<typename I, typename P> I& first(I& i, const P& p) const { 270 // // return graph->first(i, p); } 271 272 // //template<typename I> I getNext(const I& i) const { 273 // // return graph->getNext(i); } 274 // //template<typename I> I& next(I &i) const { return graph->next(i); } 275 276 // //template< typename It > It first() const { 277 // // It e; first(e); return e; } 278 279 // //template< typename It > It first(const Node& v) const { 280 // // It e; first(e, v); return e; } 281 282 // //Node head(const Edge& e) const { return graph->tail(e); } 283 // //Node tail(const Edge& e) const { return graph->head(e); } 284 285 // //template<typename I> bool valid(const I& i) const 286 // // { return graph->valid(i); } 287 288 // //template<typename I> void setInvalid(const I &i); 289 // //{ return graph->setInvalid(i); } 290 291 // //template<typename I> Node aNode(const I& e) const { 292 // // return graph->aNode(e); } 293 // //template<typename I> Node bNode(const I& e) const { 294 // // return graph->bNode(e); } 295 296 // //Node addNode() const { return graph->addNode(); } 297 // //Edge addEdge(const Node& tail, const Node& head) const { 298 // // return graph->addEdge(tail, head); } 299 300 // //int nodeNum() const { return graph->nodeNum(); } 301 // //int edgeNum() const { return graph->edgeNum(); } 302 303 // //template<typename I> void erase(const I& i) const { graph->erase(i); } 304 305 // //void clear() const { graph->clear(); } 306 307 // template<typename T> class NodeMap : 308 // public GraphWrapper/*Skeleton< TrivGraphWrapper<Graph> >*/::NodeMap<T> 309 // { 310 // public: 311 // NodeMap(const RevGraphWrapper<GraphWrapper>& _gw) : 312 // GraphWrapper/*Skeleton< TrivGraphWrapper<Graph> >*/::NodeMap<T>(_gw) { } 313 // NodeMap(const RevGraphWrapper<GraphWrapper>& _gw, T a) : 314 // GraphWrapper/*Skeleton< TrivGraphWrapper<Graph> >*/::NodeMap<T>(_gw, a) { } 315 // }; 316 317 // template<typename T> class EdgeMap : 318 // public GraphWrapper/*Skeleton< TrivGraphWrapper<Graph> >*/::EdgeMap<T> { 319 // public: 320 // EdgeMap(const RevGraphWrapper<GraphWrapper>& _gw) : 321 // GraphWrapper/*Skeleton< TrivGraphWrapper<Graph> >*/::EdgeMap<T>(_gw) { } 322 // EdgeMap(const RevGraphWrapper<GraphWrapper>& _gw, T a) : 323 // GraphWrapper/*Skeleton< TrivGraphWrapper<Graph> >*/::EdgeMap<T>(_gw, a) { } 324 // }; 325 // }; 326 327 328 template<typename GraphWrapper> 329 class RevGraphWrapper : public GraphWrapperSkeleton<GraphWrapper> { 250 330 public: 251 //typedef Graph BaseGraph; 252 253 //typedef typename Graph::Node Node; 254 //typedef typename Graph::NodeIt NodeIt; 255 256 //typedef typename Graph::Edge Edge; 257 typedef typename GraphWrapper/*typename GraphWrapperSkeleton< TrivGraphWrapper<Graph> >*/::OutEdgeIt InEdgeIt; 258 typedef typename GraphWrapper/*typename GraphWrapperSkeleton< TrivGraphWrapper<Graph> >*/::InEdgeIt OutEdgeIt; 259 //typedef typename Graph::SymEdgeIt SymEdgeIt; 260 //typedef typename Graph::EdgeIt EdgeIt; 261 262 //RevGraphWrapper() : graph(0) { } 263 RevGraphWrapper(GraphWrapper _gw/*BaseGraph& _graph*/) : GraphWrapper/*GraphWrapperSkeleton< TrivGraphWrapper<Graph> >*/(_gw/*TrivGraphWrapper<Graph>(_graph)*/) { } 264 265 //void setGraph(Graph& _graph) { graph = &_graph; } 266 //Graph& getGraph() const { return (*graph); } 267 268 //template<typename I> I& first(I& i) const { return graph->first(i); } 269 //template<typename I, typename P> I& first(I& i, const P& p) const { 270 // return graph->first(i, p); } 271 272 //template<typename I> I getNext(const I& i) const { 273 // return graph->getNext(i); } 274 //template<typename I> I& next(I &i) const { return graph->next(i); } 275 276 //template< typename It > It first() const { 277 // It e; first(e); return e; } 278 279 //template< typename It > It first(const Node& v) const { 280 // It e; first(e, v); return e; } 281 282 //Node head(const Edge& e) const { return graph->tail(e); } 283 //Node tail(const Edge& e) const { return graph->head(e); } 284 285 //template<typename I> bool valid(const I& i) const 286 // { return graph->valid(i); } 287 288 //template<typename I> void setInvalid(const I &i); 289 //{ return graph->setInvalid(i); } 290 291 //template<typename I> Node aNode(const I& e) const { 292 // return graph->aNode(e); } 293 //template<typename I> Node bNode(const I& e) const { 294 // return graph->bNode(e); } 295 296 //Node addNode() const { return graph->addNode(); } 297 //Edge addEdge(const Node& tail, const Node& head) const { 298 // return graph->addEdge(tail, head); } 299 300 //int nodeNum() const { return graph->nodeNum(); } 301 //int edgeNum() const { return graph->edgeNum(); } 302 303 //template<typename I> void erase(const I& i) const { graph->erase(i); } 304 305 //void clear() const { graph->clear(); } 306 307 template<typename T> class NodeMap : 308 public GraphWrapper/*Skeleton< TrivGraphWrapper<Graph> >*/::NodeMap<T> 309 { 310 public: 311 NodeMap(const RevGraphWrapper<GraphWrapper>& _gw) : 312 GraphWrapper/*Skeleton< TrivGraphWrapper<Graph> >*/::NodeMap<T>(_gw) { } 313 NodeMap(const RevGraphWrapper<GraphWrapper>& _gw, T a) : 314 GraphWrapper/*Skeleton< TrivGraphWrapper<Graph> >*/::NodeMap<T>(_gw, a) { } 315 }; 316 317 template<typename T> class EdgeMap : 318 public GraphWrapper/*Skeleton< TrivGraphWrapper<Graph> >*/::EdgeMap<T> { 319 public: 320 EdgeMap(const RevGraphWrapper<GraphWrapper>& _gw) : 321 GraphWrapper/*Skeleton< TrivGraphWrapper<Graph> >*/::EdgeMap<T>(_gw) { } 322 EdgeMap(const RevGraphWrapper<GraphWrapper>& _gw, T a) : 323 GraphWrapper/*Skeleton< TrivGraphWrapper<Graph> >*/::EdgeMap<T>(_gw, a) { } 324 }; 331 typedef typename GraphWrapperSkeleton<GraphWrapper>::OutEdgeIt InEdgeIt; 332 typedef typename GraphWrapperSkeleton<GraphWrapper>::InEdgeIt OutEdgeIt; 333 334 RevGraphWrapper(GraphWrapper _gw) : 335 GraphWrapperSkeleton<GraphWrapper>(_gw) { } 325 336 }; 326 337
Note: See TracChangeset
for help on using the changeset viewer.