# HG changeset patch # User deba # Date 1173274332 0 # Node ID 7f20ec638bc22952ac35449c9cb9bc9c40ff0f82 # Parent b199ded24c19f20ecd66a670e005b8d502d9b13f Data hiding Const members diff -r b199ded24c19 -r 7f20ec638bc2 lemon/csp.h --- a/lemon/csp.h Wed Mar 07 12:00:59 2007 +0000 +++ b/lemon/csp.h Wed Mar 07 13:32:12 2007 +0000 @@ -59,42 +59,49 @@ typedef SimplePath Path; - Graph &_g; + private: + + const Graph &_g; Tolerance tol; - CM &_cost; - DM &_delay; + const CM &_cost; + const DM &_delay; class CoMap { - CM &_cost; - DM &_delay; + const CM &_cost; + const DM &_delay; double _lambda; public: typedef typename CM::Key Key; typedef double Value; - CoMap(CM &c,DM &d) :_cost(c), _delay(d), _lambda(0) {} + CoMap(const CM &c, const DM &d) :_cost(c), _delay(d), _lambda(0) {} double lambda() const { return _lambda; } void lambda(double l) { _lambda=l; } Value operator[](Key &e) const { return _cost[e]+_lambda*_delay[e]; } - } _co_map; + }; + + CoMap _co_map; Dijkstra _dij; + + public: + ///\e ///\e /// - ConstrainedShortestPath(Graph &g, CM &ct, DM &dl) + ConstrainedShortestPath(const Graph &g, const CM &ct, const DM &dl) : _g(g), _cost(ct), _delay(dl), - _co_map(ct,dl), _dij(_g,_co_map) {} + _co_map(ct, dl), _dij(_g,_co_map) {} ///Compute the cost of a path - double cost(const Path &p) + double cost(const Path &p) const { double s=0; // Path r; @@ -103,7 +110,7 @@ } ///Compute the delay of a path - double delay(const Path &p) + double delay(const Path &p) const { double s=0; for(typename Path::EdgeIt e(p);e!=INVALID;++e) s+=_delay[e];