[Lemon-commits] deba: r3218 - in lemon/trunk: . benchmark demo lemon lemon/bits test
Lemon SVN
svn at lemon.cs.elte.hu
Fri Mar 2 19:04:32 CET 2007
Author: deba
Date: Fri Mar 2 19:04:28 2007
New Revision: 3218
Modified:
lemon/trunk/benchmark/bench_tools.h
lemon/trunk/benchmark/hcube.cc
lemon/trunk/benchmark/swap_bipartite_bench.cc
lemon/trunk/configure.ac
lemon/trunk/demo/descriptor_map_demo.cc
lemon/trunk/demo/simann_maxcut_demo.cc
lemon/trunk/lemon/bellman_ford.h
lemon/trunk/lemon/bfs.h
lemon/trunk/lemon/bipartite_matching.h
lemon/trunk/lemon/bits/alteration_notifier.h
lemon/trunk/lemon/bits/array_map.h
lemon/trunk/lemon/bits/base_extender.h
lemon/trunk/lemon/bits/debug_map.h
lemon/trunk/lemon/bits/edge_set_extender.h
lemon/trunk/lemon/bits/graph_adaptor_extender.h
lemon/trunk/lemon/bits/graph_extender.h
lemon/trunk/lemon/bits/item_reader.h
lemon/trunk/lemon/bits/item_writer.h
lemon/trunk/lemon/bits/lp_id.h
lemon/trunk/lemon/bits/utility.h
lemon/trunk/lemon/bits/variant.h
lemon/trunk/lemon/bits/vector_map.h
lemon/trunk/lemon/bpugraph_adaptor.h
lemon/trunk/lemon/bucket_heap.h
lemon/trunk/lemon/csp.h
lemon/trunk/lemon/dfs.h
lemon/trunk/lemon/dijkstra.h
lemon/trunk/lemon/edge_set.h
lemon/trunk/lemon/error.h
lemon/trunk/lemon/full_graph.h
lemon/trunk/lemon/graph_adaptor.h
lemon/trunk/lemon/graph_reader.h
lemon/trunk/lemon/graph_to_eps.h
lemon/trunk/lemon/graph_utils.h
lemon/trunk/lemon/graph_writer.h
lemon/trunk/lemon/grid_ugraph.h
lemon/trunk/lemon/hao_orlin.h
lemon/trunk/lemon/hypercube_graph.h
lemon/trunk/lemon/iterable_maps.h
lemon/trunk/lemon/johnson.h
lemon/trunk/lemon/kruskal.h
lemon/trunk/lemon/lemon_reader.h
lemon/trunk/lemon/lemon_writer.h
lemon/trunk/lemon/list_graph.h
lemon/trunk/lemon/lp_base.h
lemon/trunk/lemon/lp_glpk.cc
lemon/trunk/lemon/lp_soplex.cc
lemon/trunk/lemon/matrix_maps.h
lemon/trunk/lemon/max_matching.h
lemon/trunk/lemon/nagamochi_ibaraki.h
lemon/trunk/lemon/path.h
lemon/trunk/lemon/polynomial.h
lemon/trunk/lemon/preflow.h
lemon/trunk/lemon/radix_heap.h
lemon/trunk/lemon/radix_sort.h
lemon/trunk/lemon/random.h
lemon/trunk/lemon/smart_graph.h
lemon/trunk/lemon/steiner.h
lemon/trunk/lemon/ugraph_adaptor.h
lemon/trunk/lemon/unionfind.h
lemon/trunk/test/all_pairs_shortest_path_test.cc
lemon/trunk/test/arborescence_test.cc
lemon/trunk/test/bipartite_matching_test.cc
lemon/trunk/test/lp_test.cc
lemon/trunk/test/map_test.h
lemon/trunk/test/max_matching_test.cc
lemon/trunk/test/mip_test.cc
lemon/trunk/test/radix_sort_test.cc
Log:
Hard Warning checking
- based on the remark of the ZIB user
- we do not use -Winline
Modified: lemon/trunk/benchmark/bench_tools.h
==============================================================================
--- lemon/trunk/benchmark/bench_tools.h (original)
+++ lemon/trunk/benchmark/bench_tools.h Fri Mar 2 19:04:28 2007
@@ -80,7 +80,7 @@
}
};
-inline void PrintTime(char *ID,lemon::Timer &T)
+inline void PrintTime(const char *ID, lemon::Timer &T)
{
lemon::TimeStamp S(T);
std::cout << ID << ' ' << S.userTime() << ' '
Modified: lemon/trunk/benchmark/hcube.cc
==============================================================================
--- lemon/trunk/benchmark/hcube.cc (original)
+++ lemon/trunk/benchmark/hcube.cc Fri Mar 2 19:04:28 2007
@@ -78,7 +78,7 @@
Graph::EdgeMap<int> map(G);
for(int i=0;i<5;i++) {
Primes P;
- for(int i=0;i<dim*(1<<dim);i++) P();
+ for(int j=0;j<dim*(1<<dim);j++) P();
// for(EdgeIt e(G);G.valid(e);G.next(e)) map[e]=P();
Modified: lemon/trunk/benchmark/swap_bipartite_bench.cc
==============================================================================
--- lemon/trunk/benchmark/swap_bipartite_bench.cc (original)
+++ lemon/trunk/benchmark/swap_bipartite_bench.cc Fri Mar 2 19:04:28 2007
@@ -42,19 +42,19 @@
vector<LGraph::Node> laNodes;
vector<LGraph::Node> lbNodes;
- for (int i = 0; i < n; ++i) {
+ for (int j = 0; j < n; ++j) {
Node node = graph.addANode();
aNodes.push_back(node);
LGraph::Node lnode = lgraph.addANode();
laNodes.push_back(lnode);
}
- for (int i = 0; i < m; ++i) {
+ for (int j = 0; j < m; ++j) {
Node node = graph.addBNode();
bNodes.push_back(node);
LGraph::Node lnode = lgraph.addBNode();
lbNodes.push_back(lnode);
}
- for (int i = 0; i < e; ++i) {
+ for (int j = 0; j < e; ++j) {
int a,b;
Node aNode = aNodes[a=rnd[n]];
Node bNode = bNodes[b=rnd[m]];
Modified: lemon/trunk/configure.ac
==============================================================================
--- lemon/trunk/configure.ac (original)
+++ lemon/trunk/configure.ac Fri Mar 2 19:04:28 2007
@@ -17,7 +17,7 @@
AC_PROG_LIBTOOL
if test x"$lx_cmdline_cxxflags_set" != x"set" -a "$GXX" = yes; then
- CXXFLAGS="$CXXFLAGS -Wall -W"
+ CXXFLAGS="$CXXFLAGS -Wall -W -Wall -W -Wunused -Wformat=2 -Wctor-dtor-privacy -Wnon-virtual-dtor -Wno-char-subscripts -Wwrite-strings -Wno-char-subscripts -Wreturn-type -Wcast-qual -Wcast-align -Wsign-promo -Woverloaded-virtual -Woverloaded-virtual -Wshadow -ansi -fno-strict-aliasing -Wold-style-cast -Wno-unknown-pragmas"
fi
AC_CHECK_PROG([doxygen_found],[doxygen],[yes],[no])
Modified: lemon/trunk/demo/descriptor_map_demo.cc
==============================================================================
--- lemon/trunk/demo/descriptor_map_demo.cc (original)
+++ lemon/trunk/demo/descriptor_map_demo.cc Fri Mar 2 19:04:28 2007
@@ -62,7 +62,7 @@
Value operator[](const Key& key) const {
double angle = descriptor[key] * 2 * M_PI
- / (double)descriptor.inverse().size();
+ / double(descriptor.inverse().size());
double x = std::cos(angle) * radius + center.x;
double y = std::sin(angle) * radius + center.y;
return Value(x, y);
@@ -103,7 +103,7 @@
//
// The inversemap cannot works without its DescriptorMap because
// it holds reference to it.
- const int EDGE = (int)(NODE * std::log(double(NODE)));
+ const int EDGE = int(NODE * std::log(double(NODE)));
for (int i = 0; i < EDGE; ++i) {
int si = rnd[NODE];
int ti = rnd[NODE];
Modified: lemon/trunk/demo/simann_maxcut_demo.cc
==============================================================================
--- lemon/trunk/demo/simann_maxcut_demo.cc (original)
+++ lemon/trunk/demo/simann_maxcut_demo.cc Fri Mar 2 19:04:28 2007
@@ -116,7 +116,7 @@
simann.setEntity(e);
simann.run();
- Entity* be = (Entity *) simann.getBestEntity();
+ Entity* be = static_cast<Entity*>(simann.getBestEntity());
std::cout << be->sum << std::endl;
for (NodeIt n(g); n != INVALID; ++n)
if (be->a[n]) std::cout << g.id(n) << ": 1" << std::endl;
Modified: lemon/trunk/lemon/bellman_ford.h
==============================================================================
--- lemon/trunk/lemon/bellman_ford.h (original)
+++ lemon/trunk/lemon/bellman_ford.h Fri Mar 2 19:04:28 2007
@@ -436,15 +436,15 @@
/// \return %True when the algorithm have not found more shorter
/// paths.
bool processNextRound() {
- for (int i = 0; i < (int)_process.size(); ++i) {
+ for (int i = 0; i < int(_process.size()); ++i) {
_mask->set(_process[i], false);
}
std::vector<Node> nextProcess;
std::vector<Value> values(_process.size());
- for (int i = 0; i < (int)_process.size(); ++i) {
+ for (int i = 0; i < int(_process.size()); ++i) {
values[i] = (*_dist)[_process[i]];
}
- for (int i = 0; i < (int)_process.size(); ++i) {
+ for (int i = 0; i < int(_process.size()); ++i) {
for (OutEdgeIt it(*graph, _process[i]); it != INVALID; ++it) {
Node target = graph->target(it);
Value relaxed = OperationTraits::plus(values[i], (*length)[it]);
@@ -472,11 +472,11 @@
/// called just weak round.
/// \return %True when the algorithm have not found more shorter paths.
bool processNextWeakRound() {
- for (int i = 0; i < (int)_process.size(); ++i) {
+ for (int i = 0; i < int(_process.size()); ++i) {
_mask->set(_process[i], false);
}
std::vector<Node> nextProcess;
- for (int i = 0; i < (int)_process.size(); ++i) {
+ for (int i = 0; i < int(_process.size()); ++i) {
for (OutEdgeIt it(*graph, _process[i]); it != INVALID; ++it) {
Node target = graph->target(it);
Value relaxed =
@@ -645,13 +645,13 @@
}
bool operator==(const ActiveIt& it) const {
- return (Node)(*this) == (Node)it;
+ return static_cast<Node>(*this) == static_cast<Node>(it);
}
bool operator!=(const ActiveIt& it) const {
- return (Node)(*this) != (Node)it;
+ return static_cast<Node>(*this) != static_cast<Node>(it);
}
bool operator<(const ActiveIt& it) const {
- return (Node)(*this) < (Node)it;
+ return static_cast<Node>(*this) < static_cast<Node>(it);
}
private:
@@ -865,8 +865,9 @@
BellmanFordWizardBase(const _Graph& graph,
const _LengthMap& length,
Node source = INVALID) :
- _graph((void *)&graph), _length((void *)&length), _pred(0),
- _dist(0), _source(source) {}
+ _graph(reinterpret_cast<void*>(const_cast<_Graph*>(&graph))),
+ _length(reinterpret_cast<void*>(const_cast<_LengthMap*>(&length))),
+ _pred(0), _dist(0), _source(source) {}
};
@@ -923,8 +924,8 @@
/// Constructor that requires parameters.
/// These parameters will be the default values for the traits class.
BellmanFordWizard(const Graph& graph, const LengthMap& length,
- Node source = INVALID)
- : _Traits(graph, length, source) {}
+ Node src = INVALID)
+ : _Traits(graph, length, src) {}
/// \brief Copy constructor
BellmanFordWizard(const _Traits &b) : _Traits(b) {}
@@ -938,9 +939,10 @@
void run() {
if(Base::_source == INVALID) throw UninitializedParameter();
BellmanFord<Graph,LengthMap,_Traits>
- bf(*(Graph*)Base::_graph, *(LengthMap*)Base::_length);
- if (Base::_pred) bf.predMap(*(PredMap*)Base::_pred);
- if (Base::_dist) bf.distMap(*(DistMap*)Base::_dist);
+ bf(*reinterpret_cast<const Graph*>(Base::_graph),
+ *reinterpret_cast<const LengthMap*>(Base::_length));
+ if (Base::_pred) bf.predMap(*reinterpret_cast<PredMap*>(Base::_pred));
+ if (Base::_dist) bf.distMap(*reinterpret_cast<DistMap*>(Base::_dist));
bf.run(Base::_source);
}
@@ -948,8 +950,8 @@
///
/// Runs BellmanFord algorithm from the given node.
/// \param source is the given source.
- void run(Node source) {
- Base::_source = source;
+ void run(Node src) {
+ Base::_source = src;
run();
}
@@ -969,7 +971,7 @@
template<class T>
BellmanFordWizard<DefPredMapBase<T> > predMap(const T &t)
{
- Base::_pred=(void *)&t;
+ Base::_pred=reinterpret_cast<void*>(const_cast<T*>(&t));
return BellmanFordWizard<DefPredMapBase<T> >(*this);
}
@@ -988,7 +990,7 @@
///
template<class T>
BellmanFordWizard<DefDistMapBase<T> > distMap(const T &t) {
- Base::_dist=(void *)&t;
+ Base::_dist=reinterpret_cast<void*>(const_cast<T*>(&t));
return BellmanFordWizard<DefDistMapBase<T> >(*this);
}
@@ -1013,8 +1015,8 @@
///
/// Sets the source node, from which the BellmanFord algorithm runs.
/// \param source is the source node.
- BellmanFordWizard<_Traits>& source(Node source) {
- Base::_source = source;
+ BellmanFordWizard<_Traits>& source(Node src) {
+ Base::_source = src;
return *this;
}
Modified: lemon/trunk/lemon/bfs.h
==============================================================================
--- lemon/trunk/lemon/bfs.h (original)
+++ lemon/trunk/lemon/bfs.h Fri Mar 2 19:04:28 2007
@@ -488,11 +488,11 @@
///parameter should be initially false.
///
///\param target The target node.
- ///\retval reached Indicates that the target node is reached.
+ ///\retval reach Indicates that the target node is reached.
///\return The processed node.
///
///\warning The queue must not be empty!
- Node processNextNode(Node target, bool& reached)
+ Node processNextNode(Node target, bool& reach)
{
if(_queue_tail==_queue_next_dist) {
_curr_dist++;
@@ -507,7 +507,7 @@
_reached->set(m,true);
_pred->set(m,e);
_dist->set(m,_curr_dist);
- reached = reached || (target == m);
+ reach = reach || (target == m);
}
return n;
}
@@ -521,12 +521,12 @@
///should be initially false.
///
///\param nm The nodemaps of possible targets.
- ///\retval reached Indicates that one of the target nodes is reached.
+ ///\retval reach Indicates that one of the target nodes is reached.
///\return The processed node.
///
///\warning The queue must not be empty!
template<class NM>
- Node processNextNode(const NM& nm, bool& reached)
+ Node processNextNode(const NM& nm, bool& reach)
{
if(_queue_tail==_queue_next_dist) {
_curr_dist++;
@@ -541,7 +541,7 @@
_reached->set(m,true);
_pred->set(m,e);
_dist->set(m,_curr_dist);
- reached = reached || nm[m];
+ reached = reach || nm[m];
}
return n;
}
@@ -604,8 +604,8 @@
///
void start(Node dest)
{
- bool reached = false;
- while ( !emptyQueue() && !reached) processNextNode(dest, reached);
+ bool reach = false;
+ while ( !emptyQueue() && !reach) processNextNode(dest, reach);
}
///Executes the algorithm until a condition is met.
@@ -622,8 +622,8 @@
template<class NM>
void start(const NM &nm)
{
- bool reached = false;
- while ( !emptyQueue() && !reached) processNextNode(nm, reached);
+ bool reach = false;
+ while ( !emptyQueue() && !reach) processNextNode(nm, reach);
}
///Runs %BFS algorithm from node \c s.
@@ -882,8 +882,8 @@
/// \param g is the initial value of \ref _g
/// \param s is the initial value of \ref _source
BfsWizardBase(const GR &g, Node s=INVALID) :
- _g((void *)&g), _reached(0), _processed(0), _pred(0),
- _dist(0), _source(s) {}
+ _g(reinterpret_cast<void*>(const_cast<GR*>(&g))),
+ _reached(0), _processed(0), _pred(0), _dist(0), _source(s) {}
};
@@ -957,12 +957,15 @@
void run()
{
if(Base::_source==INVALID) throw UninitializedParameter();
- Bfs<Graph,TR> alg(*(Graph*)Base::_g);
+ Bfs<Graph,TR> alg(*reinterpret_cast<const Graph*>(Base::_g));
if(Base::_reached)
- alg.reachedMap(*(ReachedMap*)Base::_reached);
- if(Base::_processed) alg.processedMap(*(ProcessedMap*)Base::_processed);
- if(Base::_pred) alg.predMap(*(PredMap*)Base::_pred);
- if(Base::_dist) alg.distMap(*(DistMap*)Base::_dist);
+ alg.reachedMap(*reinterpret_cast<ReachedMap*>(Base::_reached));
+ if(Base::_processed)
+ alg.processedMap(*reinterpret_cast<ProcessedMap*>(Base::_processed));
+ if(Base::_pred)
+ alg.predMap(*reinterpret_cast<PredMap*>(Base::_pred));
+ if(Base::_dist)
+ alg.distMap(*reinterpret_cast<DistMap*>(Base::_dist));
alg.run(Base::_source);
}
@@ -992,7 +995,7 @@
template<class T>
BfsWizard<DefPredMapBase<T> > predMap(const T &t)
{
- Base::_pred=(void *)&t;
+ Base::_pred=reinterpret_cast<void*>(const_cast<T*>(&t));
return BfsWizard<DefPredMapBase<T> >(*this);
}
@@ -1013,7 +1016,7 @@
template<class T>
BfsWizard<DefReachedMapBase<T> > reachedMap(const T &t)
{
- Base::_pred=(void *)&t;
+ Base::_pred=reinterpret_cast<void*>(const_cast<T*>(&t));
return BfsWizard<DefReachedMapBase<T> >(*this);
}
@@ -1034,7 +1037,7 @@
template<class T>
BfsWizard<DefProcessedMapBase<T> > processedMap(const T &t)
{
- Base::_pred=(void *)&t;
+ Base::_pred=reinterpret_cast<void*>(const_cast<T*>(&t));
return BfsWizard<DefProcessedMapBase<T> >(*this);
}
@@ -1055,7 +1058,7 @@
template<class T>
BfsWizard<DefDistMapBase<T> > distMap(const T &t)
{
- Base::_dist=(void *)&t;
+ Base::_dist=reinterpret_cast<void*>(const_cast<T*>(&t));
return BfsWizard<DefDistMapBase<T> >(*this);
}
@@ -1404,11 +1407,11 @@
/// parameter should be initially false.
///
/// \param target The target node.
- /// \retval reached Indicates that the target node is reached.
+ /// \retval reach Indicates that the target node is reached.
/// \return The processed node.
///
/// \warning The queue must not be empty!
- Node processNextNode(Node target, bool& reached) {
+ Node processNextNode(Node target, bool& reach) {
Node n = _list[++_list_front];
_visitor->process(n);
Edge e;
@@ -1419,7 +1422,7 @@
_visitor->reach(m);
_reached->set(m, true);
_list[++_list_back] = m;
- reached = reached || (target == m);
+ reach = reach || (target == m);
} else {
_visitor->examine(e);
}
@@ -1441,7 +1444,7 @@
///
/// \warning The queue must not be empty!
template <typename NM>
- Node processNextNode(const NM& nm, bool& reached) {
+ Node processNextNode(const NM& nm, bool& reach) {
Node n = _list[++_list_front];
_visitor->process(n);
Edge e;
@@ -1452,7 +1455,7 @@
_visitor->reach(m);
_reached->set(m, true);
_list[++_list_back] = m;
- reached = reached || nm[m];
+ reach = reach || nm[m];
} else {
_visitor->examine(e);
}
@@ -1499,9 +1502,9 @@
/// \pre init() must be called and at least one node should be added
/// with addSource() before using this function.
void start(Node dest) {
- bool reached = false;
- while (!emptyQueue() && !reached) {
- processNextNode(dest, reached);
+ bool reach = false;
+ while (!emptyQueue() && !reach) {
+ processNextNode(dest, reach);
}
}
@@ -1517,9 +1520,9 @@
/// <tt>nm[v]</tt> true.
template <typename NM>
void start(const NM &nm) {
- bool reached = false;
- while (!emptyQueue() && !reached) {
- processNextNode(nm, reached);
+ bool reach = false;
+ while (!emptyQueue() && !reach) {
+ processNextNode(nm, reach);
}
}
Modified: lemon/trunk/lemon/bipartite_matching.h
==============================================================================
--- lemon/trunk/lemon/bipartite_matching.h (original)
+++ lemon/trunk/lemon/bipartite_matching.h Fri Mar 2 19:04:28 2007
@@ -115,7 +115,7 @@
///
/// It initalizes the data structures with an initial matching.
template <typename MatchingMap>
- void matchingInit(const MatchingMap& matching) {
+ void matchingInit(const MatchingMap& mm) {
for (ANodeIt it(*graph); it != INVALID; ++it) {
anode_matching[it] = INVALID;
}
@@ -124,7 +124,7 @@
}
matching_size = 0;
for (UEdgeIt it(*graph); it != INVALID; ++it) {
- if (matching[it]) {
+ if (mm[it]) {
++matching_size;
anode_matching[graph->aNode(it)] = it;
bnode_matching[graph->bNode(it)] = it;
@@ -137,7 +137,7 @@
/// It initalizes the data structures with an initial matching.
/// \return %True when the given map contains really a matching.
template <typename MatchingMap>
- void checkedMatchingInit(const MatchingMap& matching) {
+ void checkedMatchingInit(const MatchingMap& mm) {
for (ANodeIt it(*graph); it != INVALID; ++it) {
anode_matching[it] = INVALID;
}
@@ -146,7 +146,7 @@
}
matching_size = 0;
for (UEdgeIt it(*graph); it != INVALID; ++it) {
- if (matching[it]) {
+ if (mm[it]) {
++matching_size;
if (anode_matching[graph->aNode(it)] != INVALID) {
return false;
@@ -187,7 +187,7 @@
while (!success && !queue.empty()) {
std::vector<Node> newqueue;
- for (int i = 0; i < (int)queue.size(); ++i) {
+ for (int i = 0; i < int(queue.size()); ++i) {
Node anode = queue[i];
for (IncEdgeIt jt(*graph, anode); jt != INVALID; ++jt) {
Node bnode = graph->bNode(jt);
@@ -213,7 +213,7 @@
typename Graph::template ANodeMap<bool> aused(*graph, false);
- for (int i = 0; i < (int)bqueue.size(); ++i) {
+ for (int i = 0; i < int(bqueue.size()); ++i) {
Node bnode = bqueue[i];
bool used = false;
@@ -279,7 +279,7 @@
while (!queue.empty()) {
std::vector<Node> newqueue;
- for (int i = 0; i < (int)queue.size(); ++i) {
+ for (int i = 0; i < int(queue.size()); ++i) {
Node anode = queue[i];
for (IncEdgeIt jt(*graph, anode); jt != INVALID; ++jt) {
Node bnode = graph->bNode(jt);
@@ -363,7 +363,7 @@
while (!queue.empty()) {
std::vector<Node> newqueue;
- for (int i = 0; i < (int)queue.size(); ++i) {
+ for (int i = 0; i < int(queue.size()); ++i) {
Node anode = queue[i];
for (IncEdgeIt jt(*graph, anode); jt != INVALID; ++jt) {
Node bnode = graph->bNode(jt);
@@ -403,10 +403,10 @@
/// value mapped to the other uedges.
/// \return The number of the matching edges.
template <typename MatchingMap>
- int quickMatching(MatchingMap& matching) const {
+ int quickMatching(MatchingMap& mm) const {
for (ANodeIt it(*graph); it != INVALID; ++it) {
if (anode_matching[it] != INVALID) {
- matching[anode_matching[it]] = true;
+ mm[anode_matching[it]] = true;
}
}
return matching_size;
@@ -417,9 +417,9 @@
/// Set true all matching uedge in the map and the others to false.
/// \return The number of the matching edges.
template <typename MatchingMap>
- int matching(MatchingMap& matching) const {
+ int matching(MatchingMap& mm) const {
for (UEdgeIt it(*graph); it != INVALID; ++it) {
- matching[it] = it == anode_matching[graph->aNode(it)];
+ mm[it] = it == anode_matching[graph->aNode(it)];
}
return matching_size;
}
@@ -683,17 +683,17 @@
/// it will allocate one. The destuctor deallocates this
/// automatically allocated map, of course.
/// \return \c (*this)
- MaxWeightedBipartiteMatching& heap(Heap& heap, HeapCrossRef &crossRef) {
+ MaxWeightedBipartiteMatching& heap(Heap& hp, HeapCrossRef &cr) {
if(local_heap_cross_ref) {
delete _heap_cross_ref;
local_heap_cross_ref = false;
}
- _heap_cross_ref = &crossRef;
+ _heap_cross_ref = &cr;
if(local_heap) {
delete _heap;
local_heap = false;
}
- _heap = &heap;
+ _heap = &hp;
return *this;
}
@@ -889,12 +889,12 @@
/// for each matching edges and \f$ \pi(a) + \pi(b) - w(ab) \ge 0 \f$
/// for each edges.
template <typename PotentialMap>
- void potential(PotentialMap& potential) const {
+ void potential(PotentialMap& pt) const {
for (ANodeIt it(*graph); it != INVALID; ++it) {
- potential[it] = anode_potential[it];
+ pt[it] = anode_potential[it];
}
for (BNodeIt it(*graph); it != INVALID; ++it) {
- potential[it] = bnode_potential[it];
+ pt[it] = bnode_potential[it];
}
}
@@ -904,10 +904,10 @@
/// value mapped to the other uedges.
/// \return The number of the matching edges.
template <typename MatchingMap>
- int quickMatching(MatchingMap& matching) const {
+ int quickMatching(MatchingMap& mm) const {
for (ANodeIt it(*graph); it != INVALID; ++it) {
if (anode_matching[it] != INVALID) {
- matching[anode_matching[it]] = true;
+ mm[anode_matching[it]] = true;
}
}
return matching_size;
@@ -918,9 +918,9 @@
/// Set true all matching uedge in the map and the others to false.
/// \return The number of the matching edges.
template <typename MatchingMap>
- int matching(MatchingMap& matching) const {
+ int matching(MatchingMap& mm) const {
for (UEdgeIt it(*graph); it != INVALID; ++it) {
- matching[it] = it == anode_matching[graph->aNode(it)];
+ mm[it] = it == anode_matching[graph->aNode(it)];
}
return matching_size;
}
@@ -1254,17 +1254,17 @@
/// it will allocate one. The destuctor deallocates this
/// automatically allocated map, of course.
/// \return \c (*this)
- MinCostMaxBipartiteMatching& heap(Heap& heap, HeapCrossRef &crossRef) {
+ MinCostMaxBipartiteMatching& heap(Heap& hp, HeapCrossRef &cr) {
if(local_heap_cross_ref) {
delete _heap_cross_ref;
local_heap_cross_ref = false;
}
- _heap_cross_ref = &crossRef;
+ _heap_cross_ref = &cr;
if(local_heap) {
delete _heap;
local_heap = false;
}
- _heap = &heap;
+ _heap = &hp;
return *this;
}
@@ -1442,12 +1442,12 @@
/// each matching edges and \f$ \pi(a) - \pi(b) + w(ab) \ge 0 \f$
/// for each edges.
template <typename PotentialMap>
- void potential(PotentialMap& potential) const {
+ void potential(PotentialMap& pt) const {
for (ANodeIt it(*graph); it != INVALID; ++it) {
- potential[it] = anode_potential[it];
+ pt[it] = anode_potential[it];
}
for (BNodeIt it(*graph); it != INVALID; ++it) {
- potential[it] = bnode_potential[it];
+ pt[it] = bnode_potential[it];
}
}
@@ -1457,10 +1457,10 @@
/// value mapped to the other uedges.
/// \return The number of the matching edges.
template <typename MatchingMap>
- int quickMatching(MatchingMap& matching) const {
+ int quickMatching(MatchingMap& mm) const {
for (ANodeIt it(*graph); it != INVALID; ++it) {
if (anode_matching[it] != INVALID) {
- matching[anode_matching[it]] = true;
+ mm[anode_matching[it]] = true;
}
}
return matching_size;
@@ -1471,9 +1471,9 @@
/// Set true all matching uedge in the map and the others to false.
/// \return The number of the matching edges.
template <typename MatchingMap>
- int matching(MatchingMap& matching) const {
+ int matching(MatchingMap& mm) const {
for (UEdgeIt it(*graph); it != INVALID; ++it) {
- matching[it] = it == anode_matching[graph->aNode(it)];
+ mm[it] = it == anode_matching[graph->aNode(it)];
}
return matching_size;
}
Modified: lemon/trunk/lemon/bits/alteration_notifier.h
==============================================================================
--- lemon/trunk/lemon/bits/alteration_notifier.h (original)
+++ lemon/trunk/lemon/bits/alteration_notifier.h Fri Mar 2 19:04:28 2007
@@ -148,8 +148,8 @@
/// \brief Constructor which attach the observer into notifier.
///
/// Constructor which attach the observer into notifier.
- ObserverBase(AlterationNotifier& notifier) {
- attach(notifier);
+ ObserverBase(AlterationNotifier& nf) {
+ attach(nf);
}
/// \brief Constructor which attach the obserever to the same notifier.
@@ -158,7 +158,7 @@
/// the other observer is attached to.
ObserverBase(const ObserverBase& copy) {
if (copy.attached()) {
- attach(*copy._notifier());
+ attach(*copy.notifier());
}
}
@@ -173,8 +173,8 @@
///
/// This member attaches the observer into an AlterationNotifier.
///
- void attach(AlterationNotifier& notifier) {
- notifier.attach(*this);
+ void attach(AlterationNotifier& nf) {
+ nf.attach(*this);
}
/// \brief Detaches the observer into an AlterationNotifier.
Modified: lemon/trunk/lemon/bits/array_map.h
==============================================================================
--- lemon/trunk/lemon/bits/array_map.h (original)
+++ lemon/trunk/lemon/bits/array_map.h Fri Mar 2 19:04:28 2007
@@ -81,10 +81,10 @@
explicit ArrayMap(const Graph& graph) {
Parent::attach(graph.notifier(Item()));
allocate_memory();
- Notifier* notifier = Parent::notifier();
+ Notifier* nf = Parent::notifier();
Item it;
- for (notifier->first(it); it != INVALID; notifier->next(it)) {
- int id = notifier->id(it);;
+ for (nf->first(it); it != INVALID; nf->next(it)) {
+ int id = nf->id(it);;
allocator.construct(&(values[id]), Value());
}
}
@@ -95,10 +95,10 @@
ArrayMap(const Graph& graph, const Value& value) {
Parent::attach(graph.notifier(Item()));
allocate_memory();
- Notifier* notifier = Parent::notifier();
+ Notifier* nf = Parent::notifier();
Item it;
- for (notifier->first(it); it != INVALID; notifier->next(it)) {
- int id = notifier->id(it);;
+ for (nf->first(it); it != INVALID; nf->next(it)) {
+ int id = nf->id(it);;
allocator.construct(&(values[id]), value);
}
}
@@ -113,10 +113,10 @@
capacity = copy.capacity;
if (capacity == 0) return;
values = allocator.allocate(capacity);
- Notifier* notifier = Parent::notifier();
+ Notifier* nf = Parent::notifier();
Item it;
- for (notifier->first(it); it != INVALID; notifier->next(it)) {
- int id = notifier->id(it);;
+ for (nf->first(it); it != INVALID; nf->next(it)) {
+ int id = nf->id(it);;
allocator.construct(&(values[id]), copy.values[id]);
}
}
@@ -142,9 +142,9 @@
template <typename CMap>
ArrayMap& operator=(const CMap& cmap) {
checkConcept<concepts::ReadMap<Key, _Value>, CMap>();
- const typename Parent::Notifier* notifier = Parent::notifier();
+ const typename Parent::Notifier* nf = Parent::notifier();
Item it;
- for (notifier->first(it); it != INVALID; notifier->next(it)) {
+ for (nf->first(it); it != INVALID; nf->next(it)) {
set(it, cmap[it]);
}
return *this;
@@ -201,8 +201,8 @@
/// It adds a new key to the map. It called by the observer notifier
/// and it overrides the add() member function of the observer base.
virtual void add(const Key& key) {
- Notifier* notifier = Parent::notifier();
- int id = notifier->id(key);
+ Notifier* nf = Parent::notifier();
+ int id = nf->id(key);
if (id >= capacity) {
int new_capacity = (capacity == 0 ? 1 : capacity);
while (new_capacity <= id) {
@@ -210,8 +210,8 @@
}
Value* new_values = allocator.allocate(new_capacity);
Item it;
- for (notifier->first(it); it != INVALID; notifier->next(it)) {
- int jd = notifier->id(it);;
+ for (nf->first(it); it != INVALID; nf->next(it)) {
+ int jd = nf->id(it);;
if (id != jd) {
allocator.construct(&(new_values[jd]), values[jd]);
allocator.destroy(&(values[jd]));
@@ -229,10 +229,10 @@
/// It adds more new keys to the map. It called by the observer notifier
/// and it overrides the add() member function of the observer base.
virtual void add(const std::vector<Key>& keys) {
- Notifier* notifier = Parent::notifier();
+ Notifier* nf = Parent::notifier();
int max_id = -1;
- for (int i = 0; i < (int)keys.size(); ++i) {
- int id = notifier->id(keys[i]);
+ for (int i = 0; i < int(keys.size()); ++i) {
+ int id = nf->id(keys[i]);
if (id > max_id) {
max_id = id;
}
@@ -244,11 +244,11 @@
}
Value* new_values = allocator.allocate(new_capacity);
Item it;
- for (notifier->first(it); it != INVALID; notifier->next(it)) {
- int id = notifier->id(it);
+ for (nf->first(it); it != INVALID; nf->next(it)) {
+ int id = nf->id(it);
bool found = false;
- for (int i = 0; i < (int)keys.size(); ++i) {
- int jd = notifier->id(keys[i]);
+ for (int i = 0; i < int(keys.size()); ++i) {
+ int jd = nf->id(keys[i]);
if (id == jd) {
found = true;
break;
@@ -262,8 +262,8 @@
values = new_values;
capacity = new_capacity;
}
- for (int i = 0; i < (int)keys.size(); ++i) {
- int id = notifier->id(keys[i]);
+ for (int i = 0; i < int(keys.size()); ++i) {
+ int id = nf->id(keys[i]);
allocator.construct(&(values[id]), Value());
}
}
@@ -282,7 +282,7 @@
/// Erase more keys from the map. It called by the observer notifier
/// and it overrides the erase() member function of the observer base.
virtual void erase(const std::vector<Key>& keys) {
- for (int i = 0; i < (int)keys.size(); ++i) {
+ for (int i = 0; i < int(keys.size()); ++i) {
int id = Parent::notifier()->id(keys[i]);
allocator.destroy(&(values[id]));
}
@@ -293,11 +293,11 @@
/// It buildes the map. It called by the observer notifier
/// and it overrides the build() member function of the observer base.
virtual void build() {
- Notifier* notifier = Parent::notifier();
+ Notifier* nf = Parent::notifier();
allocate_memory();
Item it;
- for (notifier->first(it); it != INVALID; notifier->next(it)) {
- int id = notifier->id(it);;
+ for (nf->first(it); it != INVALID; nf->next(it)) {
+ int id = nf->id(it);;
allocator.construct(&(values[id]), Value());
}
}
@@ -307,11 +307,11 @@
/// It erase all items from the map. It called by the observer notifier
/// and it overrides the clear() member function of the observer base.
virtual void clear() {
- Notifier* notifier = Parent::notifier();
+ Notifier* nf = Parent::notifier();
if (capacity != 0) {
Item it;
- for (notifier->first(it); it != INVALID; notifier->next(it)) {
- int id = notifier->id(it);
+ for (nf->first(it); it != INVALID; nf->next(it)) {
+ int id = nf->id(it);
allocator.destroy(&(values[id]));
}
allocator.deallocate(values, capacity);
Modified: lemon/trunk/lemon/bits/base_extender.h
==============================================================================
--- lemon/trunk/lemon/bits/base_extender.h (original)
+++ lemon/trunk/lemon/bits/base_extender.h Fri Mar 2 19:04:28 2007
@@ -193,16 +193,16 @@
}
}
- Node nodeFromId(int id) const {
- return Parent::nodeFromId(id);
+ Node nodeFromId(int ix) const {
+ return Parent::nodeFromId(ix);
}
- Edge edgeFromId(int id) const {
- return direct(Parent::edgeFromId(id >> 1), bool(id & 1));
+ Edge edgeFromId(int ix) const {
+ return direct(Parent::edgeFromId(ix >> 1), bool(ix & 1));
}
- UEdge uEdgeFromId(int id) const {
- return Parent::edgeFromId(id);
+ UEdge uEdgeFromId(int ix) const {
+ return Parent::edgeFromId(ix);
}
int id(const Node &n) const {
@@ -238,42 +238,42 @@
return Parent::edgeNum();
}
- Edge findEdge(Node source, Node target, Edge prev = INVALID) const {
- if (prev == INVALID) {
- UEdge edge = Parent::findEdge(source, target);
+ Edge findEdge(Node s, Node t, Edge p = INVALID) const {
+ if (p == INVALID) {
+ UEdge edge = Parent::findEdge(s, t);
if (edge != INVALID) return direct(edge, true);
- edge = Parent::findEdge(target, source);
+ edge = Parent::findEdge(t, s);
if (edge != INVALID) return direct(edge, false);
- } else if (direction(prev)) {
- UEdge edge = Parent::findEdge(source, target, prev);
+ } else if (direction(p)) {
+ UEdge edge = Parent::findEdge(s, t, p);
if (edge != INVALID) return direct(edge, true);
- edge = Parent::findEdge(target, source);
+ edge = Parent::findEdge(t, s);
if (edge != INVALID) return direct(edge, false);
} else {
- UEdge edge = Parent::findEdge(target, source, prev);
+ UEdge edge = Parent::findEdge(t, s, p);
if (edge != INVALID) return direct(edge, false);
}
return INVALID;
}
- UEdge findUEdge(Node source, Node target, UEdge prev = INVALID) const {
- if (source != target) {
- if (prev == INVALID) {
- UEdge edge = Parent::findEdge(source, target);
+ UEdge findUEdge(Node s, Node t, UEdge p = INVALID) const {
+ if (s != t) {
+ if (p == INVALID) {
+ UEdge edge = Parent::findEdge(s, t);
if (edge != INVALID) return edge;
- edge = Parent::findEdge(target, source);
+ edge = Parent::findEdge(t, s);
if (edge != INVALID) return edge;
- } else if (Parent::source(prev) == source) {
- UEdge edge = Parent::findEdge(source, target, prev);
+ } else if (Parent::s(p) == s) {
+ UEdge edge = Parent::findEdge(s, t, p);
if (edge != INVALID) return edge;
- edge = Parent::findEdge(target, source);
+ edge = Parent::findEdge(t, s);
if (edge != INVALID) return edge;
} else {
- UEdge edge = Parent::findEdge(target, source, prev);
+ UEdge edge = Parent::findEdge(t, s, p);
if (edge != INVALID) return edge;
}
} else {
- return Parent::findEdge(source, target, prev);
+ return Parent::findEdge(s, t, p);
}
return INVALID;
}
@@ -357,21 +357,21 @@
return bNode(edge);
}
- void firstInc(UEdge& edge, bool& direction, const Node& node) const {
+ void firstInc(UEdge& edge, bool& dir, const Node& node) const {
if (Parent::aNode(node)) {
Parent::firstFromANode(edge, node);
- direction = true;
+ dir = true;
} else {
Parent::firstFromBNode(edge, node);
- direction = static_cast<UEdge&>(edge) == INVALID;
+ dir = static_cast<UEdge&>(edge) == INVALID;
}
}
- void nextInc(UEdge& edge, bool& direction) const {
- if (direction) {
+ void nextInc(UEdge& edge, bool& dir) const {
+ if (dir) {
Parent::nextFromANode(edge);
} else {
Parent::nextFromBNode(edge);
- if (edge == INVALID) direction = true;
+ if (edge == INVALID) dir = true;
}
}
@@ -457,8 +457,8 @@
return (Parent::id(static_cast<const UEdge&>(edge)) << 1) +
(edge.forward ? 0 : 1);
}
- Edge edgeFromId(int id) const {
- return Edge(Parent::fromUEdgeId(id >> 1), (id & 1) == 0);
+ Edge edgeFromId(int ix) const {
+ return Edge(Parent::fromUEdgeId(ix >> 1), (ix & 1) == 0);
}
int maxEdgeId() const {
return (Parent::maxUEdgeId() << 1) + 1;
@@ -468,8 +468,8 @@
return edge.forward;
}
- Edge direct(const UEdge& edge, bool direction) const {
- return Edge(edge, direction);
+ Edge direct(const UEdge& edge, bool dir) const {
+ return Edge(edge, dir);
}
int edgeNum() const {
Modified: lemon/trunk/lemon/bits/debug_map.h
==============================================================================
--- lemon/trunk/lemon/bits/debug_map.h (original)
+++ lemon/trunk/lemon/bits/debug_map.h Fri Mar 2 19:04:28 2007
@@ -165,7 +165,7 @@
flag[Parent::notifier()->id(it)] = false;
}
}
- for (int i = 0; i < (int)flag.size(); ++i) {
+ for (int i = 0; i < int(flag.size()); ++i) {
LEMON_ASSERT(!flag[i], MapError());
}
}
@@ -235,7 +235,7 @@
/// and it overrides the add() member function of the observer base.
virtual void add(const Key& key) {
int id = Parent::notifier()->id(key);
- if (id >= (int)container.size()) {
+ if (id >= int(container.size())) {
container.resize(id + 1);
flag.resize(id + 1, false);
}
@@ -246,8 +246,8 @@
const typename Parent::Notifier* notifier = Parent::notifier();
Item it;
for (notifier->first(it); it != INVALID; notifier->next(it)) {
- int id = Parent::notifier()->id(it);
- fl[id] = true;
+ int jd = Parent::notifier()->id(it);
+ fl[jd] = true;
}
LEMON_ASSERT(fl == flag, MapError());
}
@@ -259,7 +259,7 @@
/// and it overrides the add() member function of the observer base.
virtual void add(const std::vector<Key>& keys) {
int max = container.size() - 1;
- for (int i = 0; i < (int)keys.size(); ++i) {
+ for (int i = 0; i < int(keys.size()); ++i) {
int id = Parent::notifier()->id(keys[i]);
if (id >= max) {
max = id;
@@ -267,7 +267,7 @@
}
container.resize(max + 1);
flag.resize(max + 1, false);
- for (int i = 0; i < (int)keys.size(); ++i) {
+ for (int i = 0; i < int(keys.size()); ++i) {
LEMON_ASSERT(!flag[Parent::notifier()->id(keys[i])], MapError());
flag[Parent::notifier()->id(keys[i])] = true;
}
@@ -318,7 +318,7 @@
}
LEMON_ASSERT(fl == flag, MapError());
}
- for (int i = 0; i < (int)keys.size(); ++i) {
+ for (int i = 0; i < int(keys.size()); ++i) {
container[Parent::notifier()->id(keys[i])] = Value();
LEMON_ASSERT(flag[Parent::notifier()->id(keys[i])], MapError());
flag[Parent::notifier()->id(keys[i])] = false;
@@ -331,7 +331,7 @@
/// and it overrides the build() member function of the observer base.
virtual void build() {
if (strictCheck) {
- for (int i = 0; i < (int)flag.size(); ++i) {
+ for (int i = 0; i < int(flag.size()); ++i) {
LEMON_ASSERT(flag[i], MapError());
}
}
@@ -362,7 +362,7 @@
flag[id] = false;
}
if (strictCheck) {
- for (int i = 0; i < (int)flag.size(); ++i) {
+ for (int i = 0; i < int(flag.size()); ++i) {
LEMON_ASSERT(!flag[i], MapError());
}
}
Modified: lemon/trunk/lemon/bits/edge_set_extender.h
==============================================================================
--- lemon/trunk/lemon/bits/edge_set_extender.h (original)
+++ lemon/trunk/lemon/bits/edge_set_extender.h Fri Mar 2 19:04:28 2007
@@ -189,28 +189,28 @@
///
/// Returns the base node (ie. the source in this case) of the iterator
Node baseNode(const OutEdgeIt &e) const {
- return Parent::source((Edge)e);
+ return Parent::source(static_cast<const Edge&>(e));
}
/// \brief Running node of the iterator
///
/// Returns the running node (ie. the target in this case) of the
/// iterator
Node runningNode(const OutEdgeIt &e) const {
- return Parent::target((Edge)e);
+ return Parent::target(static_cast<const Edge&>(e));
}
/// \brief Base node of the iterator
///
/// Returns the base node (ie. the target in this case) of the iterator
Node baseNode(const InEdgeIt &e) const {
- return Parent::target((Edge)e);
+ return Parent::target(static_cast<const Edge&>(e));
}
/// \brief Running node of the iterator
///
/// Returns the running node (ie. the source in this case) of the
/// iterator
Node runningNode(const InEdgeIt &e) const {
- return Parent::source((Edge)e);
+ return Parent::source(static_cast<const Edge&>(e));
}
using Parent::first;
@@ -496,28 +496,28 @@
///
/// Returns the base node (ie. the source in this case) of the iterator
Node baseNode(const OutEdgeIt &e) const {
- return Parent::source((Edge)e);
+ return Parent::source(static_cast<const Edge&>(e));
}
/// \brief Running node of the iterator
///
/// Returns the running node (ie. the target in this case) of the
/// iterator
Node runningNode(const OutEdgeIt &e) const {
- return Parent::target((Edge)e);
+ return Parent::target(static_cast<const Edge&>(e));
}
/// \brief Base node of the iterator
///
/// Returns the base node (ie. the target in this case) of the iterator
Node baseNode(const InEdgeIt &e) const {
- return Parent::target((Edge)e);
+ return Parent::target(static_cast<const Edge&>(e));
}
/// \brief Running node of the iterator
///
/// Returns the running node (ie. the source in this case) of the
/// iterator
Node runningNode(const InEdgeIt &e) const {
- return Parent::source((Edge)e);
+ return Parent::source(static_cast<const Edge&>(e));
}
/// Base node of the iterator
Modified: lemon/trunk/lemon/bits/graph_adaptor_extender.h
==============================================================================
--- lemon/trunk/lemon/bits/graph_adaptor_extender.h (original)
+++ lemon/trunk/lemon/bits/graph_adaptor_extender.h Fri Mar 2 19:04:28 2007
@@ -399,28 +399,28 @@
///
/// Returns the base node (ie. the source in this case) of the iterator
Node baseNode(const OutEdgeIt &e) const {
- return Parent::source((Edge)e);
+ return Parent::source(static_cast<const Edge&>(e));
}
/// \brief Running node of the iterator
///
/// Returns the running node (ie. the target in this case) of the
/// iterator
Node runningNode(const OutEdgeIt &e) const {
- return Parent::target((Edge)e);
+ return Parent::target(static_cast<const Edge&>(e));
}
/// \brief Base node of the iterator
///
/// Returns the base node (ie. the target in this case) of the iterator
Node baseNode(const InEdgeIt &e) const {
- return Parent::target((Edge)e);
+ return Parent::target(static_cast<const Edge&>(e));
}
/// \brief Running node of the iterator
///
/// Returns the running node (ie. the source in this case) of the
/// iterator
Node runningNode(const InEdgeIt &e) const {
- return Parent::source((Edge)e);
+ return Parent::source(static_cast<const Edge&>(e));
}
/// Base node of the iterator
@@ -651,28 +651,28 @@
///
/// Returns the base node (ie. the source in this case) of the iterator
Node baseNode(const OutEdgeIt &e) const {
- return Parent::source((Edge&)e);
+ return Parent::source(static_cast<const Edge&>(e));
}
/// \brief Running node of the iterator
///
/// Returns the running node (ie. the target in this case) of the
/// iterator
Node runningNode(const OutEdgeIt &e) const {
- return Parent::target((Edge&)e);
+ return Parent::target(static_cast<const Edge&>(e));
}
/// \brief Base node of the iterator
///
/// Returns the base node (ie. the target in this case) of the iterator
Node baseNode(const InEdgeIt &e) const {
- return Parent::target((Edge&)e);
+ return Parent::target(static_cast<const Edge&>(e));
}
/// \brief Running node of the iterator
///
/// Returns the running node (ie. the source in this case) of the
/// iterator
Node runningNode(const InEdgeIt &e) const {
- return Parent::source((Edge&)e);
+ return Parent::source(static_cast<const Edge&>(e));
}
class IncEdgeIt : public Parent::UEdge {
Modified: lemon/trunk/lemon/bits/graph_extender.h
==============================================================================
--- lemon/trunk/lemon/bits/graph_extender.h (original)
+++ lemon/trunk/lemon/bits/graph_extender.h Fri Mar 2 19:04:28 2007
@@ -556,28 +556,28 @@
///
/// Returns the base node (ie. the source in this case) of the iterator
Node baseNode(const OutEdgeIt &e) const {
- return Parent::source((Edge)e);
+ return Parent::source(static_cast<const Edge&>(e));
}
/// \brief Running node of the iterator
///
/// Returns the running node (ie. the target in this case) of the
/// iterator
Node runningNode(const OutEdgeIt &e) const {
- return Parent::target((Edge)e);
+ return Parent::target(static_cast<const Edge&>(e));
}
/// \brief Base node of the iterator
///
/// Returns the base node (ie. the target in this case) of the iterator
Node baseNode(const InEdgeIt &e) const {
- return Parent::target((Edge)e);
+ return Parent::target(static_cast<const Edge&>(e));
}
/// \brief Running node of the iterator
///
/// Returns the running node (ie. the source in this case) of the
/// iterator
Node runningNode(const InEdgeIt &e) const {
- return Parent::source((Edge)e);
+ return Parent::source(static_cast<const Edge&>(e));
}
/// Base node of the iterator
@@ -679,10 +679,10 @@
UEdge addEdge(const Node& from, const Node& to) {
UEdge uedge = Parent::addEdge(from, to);
notifier(UEdge()).add(uedge);
- std::vector<Edge> edges;
- edges.push_back(Parent::direct(uedge, true));
- edges.push_back(Parent::direct(uedge, false));
- notifier(Edge()).add(edges);
+ std::vector<Edge> ev;
+ ev.push_back(Parent::direct(uedge, true));
+ ev.push_back(Parent::direct(uedge, false));
+ notifier(Edge()).add(ev);
return uedge;
}
@@ -721,10 +721,10 @@
}
void erase(const UEdge& uedge) {
- std::vector<Edge> edges;
- edges.push_back(Parent::direct(uedge, true));
- edges.push_back(Parent::direct(uedge, false));
- notifier(Edge()).erase(edges);
+ std::vector<Edge> ev;
+ ev.push_back(Parent::direct(uedge, true));
+ ev.push_back(Parent::direct(uedge, false));
+ notifier(Edge()).erase(ev);
notifier(UEdge()).erase(uedge);
Parent::erase(uedge);
}
@@ -1007,28 +1007,28 @@
///
/// Returns the base node (ie. the source in this case) of the iterator
Node baseNode(const OutEdgeIt &e) const {
- return Parent::source((Edge&)e);
+ return Parent::source(static_cast<const Edge&>(e));
}
/// \brief Running node of the iterator
///
/// Returns the running node (ie. the target in this case) of the
/// iterator
Node runningNode(const OutEdgeIt &e) const {
- return Parent::target((Edge&)e);
+ return Parent::target(static_cast<const Edge&>(e));
}
/// \brief Base node of the iterator
///
/// Returns the base node (ie. the target in this case) of the iterator
Node baseNode(const InEdgeIt &e) const {
- return Parent::target((Edge&)e);
+ return Parent::target(static_cast<const Edge&>(e));
}
/// \brief Running node of the iterator
///
/// Returns the running node (ie. the source in this case) of the
/// iterator
Node runningNode(const InEdgeIt &e) const {
- return Parent::source((Edge&)e);
+ return Parent::source(static_cast<const Edge&>(e));
}
class IncEdgeIt : public Parent::UEdge {
@@ -1295,14 +1295,14 @@
return node;
}
- UEdge addEdge(const Node& source, const Node& target) {
- UEdge uedge = Parent::addEdge(source, target);
+ UEdge addEdge(const Node& s, const Node& t) {
+ UEdge uedge = Parent::addEdge(s, t);
notifier(UEdge()).add(uedge);
- std::vector<Edge> edges;
- edges.push_back(Parent::direct(uedge, true));
- edges.push_back(Parent::direct(uedge, false));
- notifier(Edge()).add(edges);
+ std::vector<Edge> ev;
+ ev.push_back(Parent::direct(uedge, true));
+ ev.push_back(Parent::direct(uedge, false));
+ notifier(Edge()).add(ev);
return uedge;
}
@@ -1351,10 +1351,10 @@
}
void erase(const UEdge& uedge) {
- std::vector<Edge> edges;
- edges.push_back(Parent::direct(uedge, true));
- edges.push_back(Parent::direct(uedge, false));
- notifier(Edge()).erase(edges);
+ std::vector<Edge> ev;
+ ev.push_back(Parent::direct(uedge, true));
+ ev.push_back(Parent::direct(uedge, false));
+ notifier(Edge()).erase(ev);
notifier(UEdge()).erase(uedge);
Parent::erase(uedge);
}
Modified: lemon/trunk/lemon/bits/item_reader.h
==============================================================================
--- lemon/trunk/lemon/bits/item_reader.h (original)
+++ lemon/trunk/lemon/bits/item_reader.h Fri Mar 2 19:04:28 2007
@@ -594,7 +594,7 @@
int temp;
if (!(is >> temp))
throw DataFormatError("DefaultReader<char> format error");
- value = (char)temp;
+ value = static_cast<char>(temp);
break;
}
}
Modified: lemon/trunk/lemon/bits/item_writer.h
==============================================================================
--- lemon/trunk/lemon/bits/item_writer.h (original)
+++ lemon/trunk/lemon/bits/item_writer.h Fri Mar 2 19:04:28 2007
@@ -155,7 +155,7 @@
os << "\"";
if (escaped) {
std::ostringstream ls;
- for (int i = 0; i < (int)value.size(); ++i) {
+ for (int i = 0; i < int(value.size()); ++i) {
writeEscape(ls, value[i]);
}
os << ls.str();
@@ -204,7 +204,7 @@
return;
default:
if (c < 0x20) {
- os << '\\' << std::oct << (int)c;
+ os << '\\' << std::oct << static_cast<int>(c);
} else {
os << c;
}
Modified: lemon/trunk/lemon/bits/lp_id.h
==============================================================================
--- lemon/trunk/lemon/bits/lp_id.h (original)
+++ lemon/trunk/lemon/bits/lp_id.h Fri Mar 2 19:04:28 2007
@@ -77,7 +77,7 @@
int fn = impl.index[xn];
impl.index[xn] = impl.first_free;
impl.first_free = xn;
- for(int i = fn + 1; i < (int)impl.cross.size(); ++i) {
+ for(int i = fn + 1; i < int(impl.cross.size()); ++i) {
impl.cross[i - 1] = impl.cross[i];
impl.index[impl.cross[i]]--;
}
@@ -89,12 +89,12 @@
void firstFloating(int& fn) const {
fn = impl.first_index;
- if (fn == (int)impl.cross.size()) fn = -1;
+ if (fn == int(impl.cross.size())) fn = -1;
}
void nextFloating(int& fn) const {
++fn;
- if (fn == (int)impl.cross.size()) fn = -1;
+ if (fn == int(impl.cross.size())) fn = -1;
}
void firstFix(int& xn) const {
Modified: lemon/trunk/lemon/bits/utility.h
==============================================================================
--- lemon/trunk/lemon/bits/utility.h (original)
+++ lemon/trunk/lemon/bits/utility.h Fri Mar 2 19:04:28 2007
@@ -69,9 +69,7 @@
};
- class InvalidType {
- private:
- InvalidType();
+ struct InvalidType {
};
template <typename T>
Modified: lemon/trunk/lemon/bits/variant.h
==============================================================================
--- lemon/trunk/lemon/bits/variant.h (original)
+++ lemon/trunk/lemon/bits/variant.h Fri Mar 2 19:04:28 2007
@@ -73,18 +73,18 @@
///
/// This constructor initalizes to the given value of the \c First
/// type.
- BiVariant(const First& first) {
+ BiVariant(const First& f) {
flag = true;
- new(reinterpret_cast<First*>(data)) First(first);
+ new(reinterpret_cast<First*>(data)) First(f);
}
/// \brief Constructor
///
/// This constructor initalizes to the given value of the \c
/// Second type.
- BiVariant(const Second& second) {
+ BiVariant(const Second& s) {
flag = false;
- new(reinterpret_cast<Second*>(data)) Second(second);
+ new(reinterpret_cast<Second*>(data)) Second(s);
}
/// \brief Copy constructor
@@ -121,10 +121,10 @@
///
/// This function sets the variant to the given value of the \c
/// First type.
- BiVariant& setFirst(const First& first) {
+ BiVariant& setFirst(const First& f) {
destroy();
flag = true;
- new(reinterpret_cast<First*>(data)) First(first);
+ new(reinterpret_cast<First*>(data)) First(f);
return *this;
}
@@ -143,21 +143,21 @@
///
/// This function sets the variant to the given value of the \c
/// Second type.
- BiVariant& setSecond(const Second& second) {
+ BiVariant& setSecond(const Second& s) {
destroy();
flag = false;
- new(reinterpret_cast<Second*>(data)) Second(second);
+ new(reinterpret_cast<Second*>(data)) Second(s);
return *this;
}
/// \brief Operator form of the \c setFirst()
- BiVariant& operator=(const First& first) {
- return setFirst(first);
+ BiVariant& operator=(const First& f) {
+ return setFirst(f);
}
/// \brief Operator form of the \c setSecond()
- BiVariant& operator=(const Second& second) {
- return setSecond(second);
+ BiVariant& operator=(const Second& s) {
+ return setSecond(s);
}
/// \brief Assign operator
Modified: lemon/trunk/lemon/bits/vector_map.h
==============================================================================
--- lemon/trunk/lemon/bits/vector_map.h (original)
+++ lemon/trunk/lemon/bits/vector_map.h Fri Mar 2 19:04:28 2007
@@ -134,9 +134,9 @@
template <typename CMap>
VectorMap& operator=(const CMap& cmap) {
checkConcept<concepts::ReadMap<Key, _Value>, CMap>();
- const typename Parent::Notifier* notifier = Parent::notifier();
+ const typename Parent::Notifier* nf = Parent::notifier();
Item it;
- for (notifier->first(it); it != INVALID; notifier->next(it)) {
+ for (nf->first(it); it != INVALID; nf->next(it)) {
set(it, cmap[it]);
}
return *this;
@@ -176,7 +176,7 @@
/// and it overrides the add() member function of the observer base.
virtual void add(const Key& key) {
int id = Parent::notifier()->id(key);
- if (id >= (int)container.size()) {
+ if (id >= int(container.size())) {
container.resize(id + 1);
}
}
@@ -187,7 +187,7 @@
/// and it overrides the add() member function of the observer base.
virtual void add(const std::vector<Key>& keys) {
int max = container.size() - 1;
- for (int i = 0; i < (int)keys.size(); ++i) {
+ for (int i = 0; i < int(keys.size()); ++i) {
int id = Parent::notifier()->id(keys[i]);
if (id >= max) {
max = id;
@@ -209,7 +209,7 @@
/// Erase more keys from the map. It called by the observer notifier
/// and it overrides the erase() member function of the observer base.
virtual void erase(const std::vector<Key>& keys) {
- for (int i = 0; i < (int)keys.size(); ++i) {
+ for (int i = 0; i < int(keys.size()); ++i) {
container[Parent::notifier()->id(keys[i])] = Value();
}
}
Modified: lemon/trunk/lemon/bpugraph_adaptor.h
==============================================================================
--- lemon/trunk/lemon/bpugraph_adaptor.h (original)
+++ lemon/trunk/lemon/bpugraph_adaptor.h Fri Mar 2 19:04:28 2007
@@ -127,19 +127,19 @@
int uEdgeNum() const { return graph->uEdgeNum(); }
typedef FindEdgeTagIndicator<Graph> FindEdgeTag;
- Edge findEdge(const Node& source, const Node& target,
+ Edge findEdge(const Node& u, const Node& v,
const Edge& prev = INVALID) {
- return graph->findEdge(source, target, prev);
+ return graph->findEdge(u, v, prev);
}
- UEdge findUEdge(const Node& source, const Node& target,
+ UEdge findUEdge(const Node& u, const Node& v,
const UEdge& prev = INVALID) {
- return graph->findUEdge(source, target, prev);
+ return graph->findUEdge(u, v, prev);
}
Node addANode() const { return graph->addANode(); }
Node addBNode() const { return graph->addBNode(); }
- UEdge addEdge(const Node& source, const Node& target) const {
- return graph->addEdge(source, target);
+ UEdge addEdge(const Node& u, const Node& v) const {
+ return graph->addEdge(u, v);
}
void erase(const Node& i) const { graph->erase(i); }
@@ -156,11 +156,11 @@
int id(const Edge& e) const { return graph->id(e); }
int id(const UEdge& e) const { return graph->id(e); }
- Node fromNodeId(int id) const { return graph->fromNodeId(id); }
- ANode nodeFromANodeId(int id) const { return graph->nodeFromANodeId(id); }
- BNode nodeFromBNodeId(int id) const { return graph->nodeFromBNodeId(id); }
- Edge fromEdgeId(int id) const { return graph->fromEdgeId(id); }
- UEdge fromUEdgeId(int id) const { return graph->fromUEdgeId(id); }
+ Node fromNodeId(int ix) const { return graph->fromNodeId(ix); }
+ ANode nodeFromANodeId(int ix) const { return graph->nodeFromANodeId(ix); }
+ BNode nodeFromBNodeId(int ix) const { return graph->nodeFromBNodeId(ix); }
+ Edge fromEdgeId(int ix) const { return graph->fromEdgeId(ix); }
+ UEdge fromUEdgeId(int ix) const { return graph->fromUEdgeId(ix); }
int maxNodeId() const { return graph->maxNodeId(); }
int maxANodeId() const { return graph->maxANodeId(); }
@@ -361,8 +361,8 @@
int id(const ANode& v) const { return Parent::id(v); }
int id(const BNode& v) const { return Parent::id(v); }
- ANode nodeFromANodeId(int id) const { return Parent::nodeFromBNodeId(id); }
- BNode nodeFromBNodeId(int id) const { return Parent::nodeFromANodeId(id); }
+ ANode nodeFromANodeId(int ix) const { return Parent::nodeFromBNodeId(ix); }
+ BNode nodeFromBNodeId(int ix) const { return Parent::nodeFromANodeId(ix); }
int maxANodeId() const { return Parent::maxBNodeId(); }
int maxBNodeId() const { return Parent::maxANodeId(); }
Modified: lemon/trunk/lemon/bucket_heap.h
==============================================================================
--- lemon/trunk/lemon/bucket_heap.h (original)
+++ lemon/trunk/lemon/bucket_heap.h Fri Mar 2 19:04:28 2007
@@ -100,7 +100,7 @@
private:
void relocate_last(int idx) {
- if (idx + 1 < (int)data.size()) {
+ if (idx + 1 < int(data.size())) {
data[idx] = data.back();
if (data[idx].prev != -1) {
data[data[idx].prev].next = idx;
@@ -127,7 +127,7 @@
}
void lace(int idx) {
- if ((int)first.size() <= data[idx].value) {
+ if (int(first.size()) <= data[idx].value) {
first.resize(data[idx].value + 1, -1);
}
data[idx].next = first[data[idx].value];
@@ -354,7 +354,7 @@
private:
void relocate_last(int idx) {
- if (idx + 1 != (int)data.size()) {
+ if (idx + 1 != int(data.size())) {
data[idx] = data.back();
if (data[idx].prev != -1) {
data[data[idx].prev].next = idx;
@@ -381,7 +381,7 @@
}
void lace(int idx) {
- if ((int)first.size() <= data[idx].value) {
+ if (int(first.size()) <= data[idx].value) {
first.resize(data[idx].value + 1, -1);
}
data[idx].next = first[data[idx].value];
@@ -607,7 +607,7 @@
data[idx].item = i;
}
index[i] = idx;
- if (p >= (int)first.size()) first.resize(p + 1, -1);
+ if (p >= int(first.size())) first.resize(p + 1, -1);
data[idx].next = first[p];
first[p] = idx;
if (p < minimal) {
@@ -750,7 +750,7 @@
data[idx].item = i;
}
index[i] = idx;
- if (p >= (int)first.size()) first.resize(p + 1, -1);
+ if (p >= int(first.size())) first.resize(p + 1, -1);
data[idx].next = first[p];
first[p] = idx;
if (p > maximal) {
Modified: lemon/trunk/lemon/csp.h
==============================================================================
--- lemon/trunk/lemon/csp.h (original)
+++ lemon/trunk/lemon/csp.h Fri Mar 2 19:04:28 2007
@@ -88,9 +88,9 @@
///\e
///
- ConstrainedShortestPath(Graph &g, CM &cost, DM &delay)
- : _g(g), _cost(cost), _delay(delay),
- _co_map(cost,delay), _dij(_g,_co_map) {}
+ ConstrainedShortestPath(Graph &g, CM &ct, DM &dl)
+ : _g(g), _cost(ct), _delay(dl),
+ _co_map(ct,dl), _dij(_g,_co_map) {}
///Compute the cost of a path
Modified: lemon/trunk/lemon/dfs.h
==============================================================================
--- lemon/trunk/lemon/dfs.h (original)
+++ lemon/trunk/lemon/dfs.h Fri Mar 2 19:04:28 2007
@@ -858,8 +858,8 @@
/// \param g is the initial value of \ref _g
/// \param s is the initial value of \ref _source
DfsWizardBase(const GR &g, Node s=INVALID) :
- _g((void *)&g), _reached(0), _processed(0), _pred(0),
- _dist(0), _source(s) {}
+ _g(reinterpret_cast<void*>(const_cast<GR*>(&g))),
+ _reached(0), _processed(0), _pred(0), _dist(0), _source(s) {}
};
@@ -933,11 +933,15 @@
void run()
{
if(Base::_source==INVALID) throw UninitializedParameter();
- Dfs<Graph,TR> alg(*(Graph*)Base::_g);
- if(Base::_reached) alg.reachedMap(*(ReachedMap*)Base::_reached);
- if(Base::_processed) alg.processedMap(*(ProcessedMap*)Base::_processed);
- if(Base::_pred) alg.predMap(*(PredMap*)Base::_pred);
- if(Base::_dist) alg.distMap(*(DistMap*)Base::_dist);
+ Dfs<Graph,TR> alg(*reinterpret_cast<const Graph*>(Base::_g));
+ if(Base::_reached)
+ alg.reachedMap(*reinterpret_cast<ReachedMap*>(Base::_reached));
+ if(Base::_processed)
+ alg.processedMap(*reinterpret_cast<ProcessedMap*>(Base::_processed));
+ if(Base::_pred)
+ alg.predMap(*reinterpret_cast<PredMap*>(Base::_pred));
+ if(Base::_dist)
+ alg.distMap(*reinterpret_cast<DistMap*>(Base::_dist));
alg.run(Base::_source);
}
@@ -967,7 +971,7 @@
template<class T>
DfsWizard<DefPredMapBase<T> > predMap(const T &t)
{
- Base::_pred=(void *)&t;
+ Base::_pred=reinterpret_cast<void*>(const_cast<T*>(&t));
return DfsWizard<DefPredMapBase<T> >(*this);
}
@@ -988,7 +992,7 @@
template<class T>
DfsWizard<DefReachedMapBase<T> > reachedMap(const T &t)
{
- Base::_pred=(void *)&t;
+ Base::_pred=reinterpret_cast<void*>(const_cast<T*>(&t));
return DfsWizard<DefReachedMapBase<T> >(*this);
}
@@ -1009,7 +1013,7 @@
template<class T>
DfsWizard<DefProcessedMapBase<T> > processedMap(const T &t)
{
- Base::_pred=(void *)&t;
+ Base::_pred=reinterpret_cast<void*>(const_cast<T*>(&t));
return DfsWizard<DefProcessedMapBase<T> >(*this);
}
@@ -1029,7 +1033,7 @@
template<class T>
DfsWizard<DefDistMapBase<T> > distMap(const T &t)
{
- Base::_dist=(void *)&t;
+ Base::_dist=reinterpret_cast<void*>(const_cast<T*>(&t));
return DfsWizard<DefDistMapBase<T> >(*this);
}
Modified: lemon/trunk/lemon/dijkstra.h
==============================================================================
--- lemon/trunk/lemon/dijkstra.h (original)
+++ lemon/trunk/lemon/dijkstra.h Fri Mar 2 19:04:28 2007
@@ -487,18 +487,18 @@
///it will allocate one. The destuctor deallocates this
///automatically allocated heap and cross reference, of course.
///\return <tt> (*this) </tt>
- Dijkstra &heap(Heap& heap, HeapCrossRef &crossRef)
+ Dijkstra &heap(Heap& hp, HeapCrossRef &cr)
{
if(local_heap_cross_ref) {
delete _heap_cross_ref;
local_heap_cross_ref=false;
}
- _heap_cross_ref = &crossRef;
+ _heap_cross_ref = &cr;
if(local_heap) {
delete _heap;
local_heap=false;
}
- _heap = &heap;
+ _heap = &hp;
return *this;
}
@@ -962,8 +962,9 @@
/// \param l is the initial value of \ref _length
/// \param s is the initial value of \ref _source
DijkstraWizardBase(const GR &g,const LM &l, Node s=INVALID) :
- _g((void *)&g), _length((void *)&l), _pred(0),
- _dist(0), _source(s) {}
+ _g(reinterpret_cast<void*>(const_cast<GR*>(&g))),
+ _length(reinterpret_cast<void*>(const_cast<LM*>(&l))),
+ _pred(0), _dist(0), _source(s) {}
};
@@ -1037,9 +1038,10 @@
{
if(Base::_source==INVALID) throw UninitializedParameter();
Dijkstra<Graph,LengthMap,TR>
- dij(*(Graph*)Base::_g,*(LengthMap*)Base::_length);
- if(Base::_pred) dij.predMap(*(PredMap*)Base::_pred);
- if(Base::_dist) dij.distMap(*(DistMap*)Base::_dist);
+ dij(*reinterpret_cast<const Graph*>(Base::_g),
+ *reinterpret_cast<const LengthMap*>(Base::_length));
+ if(Base::_pred) dij.predMap(*reinterpret_cast<PredMap*>(Base::_pred));
+ if(Base::_dist) dij.distMap(*reinterpret_cast<DistMap*>(Base::_dist));
dij.run(Base::_source);
}
@@ -1069,7 +1071,7 @@
template<class T>
DijkstraWizard<DefPredMapBase<T> > predMap(const T &t)
{
- Base::_pred=(void *)&t;
+ Base::_pred=reinterpret_cast<void*>(const_cast<T*>(&t));
return DijkstraWizard<DefPredMapBase<T> >(*this);
}
@@ -1089,7 +1091,7 @@
template<class T>
DijkstraWizard<DefDistMapBase<T> > distMap(const T &t)
{
- Base::_dist=(void *)&t;
+ Base::_dist=reinterpret_cast<void*>(const_cast<T*>(&t));
return DijkstraWizard<DefDistMapBase<T> >(*this);
}
Modified: lemon/trunk/lemon/edge_set.h
==============================================================================
--- lemon/trunk/lemon/edge_set.h (original)
+++ lemon/trunk/lemon/edge_set.h Fri Mar 2 19:04:28 2007
@@ -86,7 +86,7 @@
ListEdgeSetBase() : first_edge(-1), first_free_edge(-1) {}
- Edge addEdge(const Node& source, const Node& target) {
+ Edge addEdge(const Node& u, const Node& v) {
int n;
if (first_free_edge == -1) {
n = edges.size();
@@ -95,18 +95,18 @@
n = first_free_edge;
first_free_edge = edges[first_free_edge].next_in;
}
- edges[n].next_in = (*nodes)[target].first_in;
- if ((*nodes)[target].first_in != -1) {
- edges[(*nodes)[target].first_in].prev_in = n;
- }
- (*nodes)[target].first_in = n;
- edges[n].next_out = (*nodes)[source].first_out;
- if ((*nodes)[source].first_out != -1) {
- edges[(*nodes)[source].first_out].prev_out = n;
- }
- (*nodes)[source].first_out = n;
- edges[n].source = source;
- edges[n].target = target;
+ edges[n].next_in = (*nodes)[v].first_in;
+ if ((*nodes)[v].first_in != -1) {
+ edges[(*nodes)[v].first_in].prev_in = n;
+ }
+ (*nodes)[v].first_in = n;
+ edges[n].next_out = (*nodes)[u].first_out;
+ if ((*nodes)[u].first_out != -1) {
+ edges[(*nodes)[u].first_out].prev_out = n;
+ }
+ (*nodes)[u].first_out = n;
+ edges[n].source = u;
+ edges[n].target = v;
return Edge(n);
}
@@ -188,8 +188,8 @@
int id(const Node& node) const { return graph->id(node); }
int id(const Edge& edge) const { return edge.id; }
- Node nodeFromId(int id) const { return graph->nodeFromId(id); }
- Edge edgeFromId(int id) const { return Edge(id); }
+ Node nodeFromId(int ix) const { return graph->nodeFromId(ix); }
+ Edge edgeFromId(int ix) const { return Edge(ix); }
int maxNodeId() const { return graph->maxNodeId(); };
int maxEdgeId() const { return edges.size() - 1; }
@@ -293,7 +293,7 @@
Parent::erase(node);
}
virtual void erase(const std::vector<Node>& nodes) {
- for (int i = 0; i < (int)nodes.size(); ++i) {
+ for (int i = 0; i < int(nodes.size()); ++i) {
_edgeset.eraseNode(nodes[i]);
}
Parent::erase(nodes);
@@ -382,7 +382,7 @@
Parent::erase(node);
}
virtual void erase(const std::vector<Node>& nodes) {
- for (int i = 0; i < (int)nodes.size(); ++i) {
+ for (int i = 0; i < int(nodes.size()); ++i) {
_edgeset.eraseNode(nodes[i]);
}
Parent::erase(nodes);
@@ -460,15 +460,15 @@
SmartEdgeSetBase() {}
- Edge addEdge(const Node& source, const Node& target) {
+ Edge addEdge(const Node& u, const Node& v) {
int n = edges.size();
edges.push_back(EdgeT());
- edges[n].next_in = (*nodes)[target].first_in;
- (*nodes)[target].first_in = n;
- edges[n].next_out = (*nodes)[source].first_out;
- (*nodes)[source].first_out = n;
- edges[n].source = source;
- edges[n].target = target;
+ edges[n].next_in = (*nodes)[v].first_in;
+ (*nodes)[v].first_in = n;
+ edges[n].next_out = (*nodes)[u].first_out;
+ (*nodes)[u].first_out = n;
+ edges[n].source = u;
+ edges[n].target = v;
return Edge(n);
}
@@ -516,8 +516,8 @@
int id(const Node& node) const { return graph->id(node); }
int id(const Edge& edge) const { return edge.id; }
- Node nodeFromId(int id) const { return graph->nodeFromId(id); }
- Edge edgeFromId(int id) const { return Edge(id); }
+ Node nodeFromId(int ix) const { return graph->nodeFromId(ix); }
+ Edge edgeFromId(int ix) const { return Edge(ix); }
int maxNodeId() const { return graph->maxNodeId(); };
int maxEdgeId() const { return edges.size() - 1; }
@@ -626,7 +626,7 @@
}
virtual void erase(const std::vector<Node>& nodes) {
try {
- for (int i = 0; i < (int)nodes.size(); ++i) {
+ for (int i = 0; i < int(nodes.size()); ++i) {
_edgeset.eraseNode(nodes[i]);
}
Parent::erase(nodes);
@@ -731,7 +731,7 @@
}
virtual void erase(const std::vector<Node>& nodes) {
try {
- for (int i = 0; i < (int)nodes.size(); ++i) {
+ for (int i = 0; i < int(nodes.size()); ++i) {
_edgeset.eraseNode(nodes[i]);
}
Parent::erase(nodes);
Modified: lemon/trunk/lemon/error.h
==============================================================================
--- lemon/trunk/lemon/error.h (original)
+++ lemon/trunk/lemon/error.h Fri Mar 2 19:04:28 2007
@@ -126,15 +126,15 @@
ErrorMessage(const ErrorMessage& em) throw() : buf(em.buf) { }
///\e
- ErrorMessage(const char *message) throw() {
+ ErrorMessage(const char *msg) throw() {
init();
- *this << message;
+ *this << msg;
}
///\e
- ErrorMessage(const std::string &message) throw() {
+ ErrorMessage(const std::string &msg) throw() {
init();
- *this << message;
+ *this << msg;
}
///\e
@@ -266,11 +266,11 @@
: _message(the_message), _line(line_num) { file(file_name); }
///\e
- void line(int line) { _line = line; }
+ void line(int ln) { _line = ln; }
///\e
- void message(const std::string& message) { _message.set(message); }
+ void message(const std::string& msg) { _message.set(msg); }
///\e
- void file(const std::string &file) { _file.set(file); }
+ void file(const std::string &fl) { _file.set(fl); }
///\e
int line() const { return _line; }
@@ -329,12 +329,12 @@
IoError(foe), _file(foe._file) {}
///\e
- explicit FileOpenError(const std::string& file)
- : _file(file) {}
+ explicit FileOpenError(const std::string& fl)
+ : _file(fl) {}
///\e
- void file(const std::string &file) { _file.set(file); }
+ void file(const std::string &fl) { _file.set(fl); }
/// \brief Returns the filename.
///
@@ -382,9 +382,9 @@
: _message(the_message), _file(file_name) {}
///\e
- void message(const std::string& message) { _message.set(message); }
+ void message(const std::string& msg) { _message.set(msg); }
///\e
- void file(const std::string &file) { _file.set(file); }
+ void file(const std::string &fl) { _file.set(fl); }
///\e
const char* message() const {
Modified: lemon/trunk/lemon/full_graph.h
==============================================================================
--- lemon/trunk/lemon/full_graph.h (original)
+++ lemon/trunk/lemon/full_graph.h Fri Mar 2 19:04:28 2007
@@ -56,7 +56,7 @@
typedef True NodeNumTag;
typedef True EdgeNumTag;
- Node operator()(int index) const { return Node(index); }
+ Node operator()(int ix) const { return Node(ix); }
int index(const Node& node) const { return node.id; }
Edge edge(const Node& u, const Node& v) const {
@@ -129,30 +129,30 @@
--node.id;
}
- void first(Edge& edge) const {
- edge.id = _edgeNum-1;
+ void first(Edge& e) const {
+ e.id = _edgeNum-1;
}
- static void next(Edge& edge) {
- --edge.id;
+ static void next(Edge& e) {
+ --e.id;
}
- void firstOut(Edge& edge, const Node& node) const {
- edge.id = _edgeNum + node.id - _nodeNum;
+ void firstOut(Edge& e, const Node& n) const {
+ e.id = _edgeNum + n.id - _nodeNum;
}
- void nextOut(Edge& edge) const {
- edge.id -= _nodeNum;
- if (edge.id < 0) edge.id = -1;
+ void nextOut(Edge& e) const {
+ e.id -= _nodeNum;
+ if (e.id < 0) e.id = -1;
}
- void firstIn(Edge& edge, const Node& node) const {
- edge.id = node.id * _nodeNum;
+ void firstIn(Edge& e, const Node& n) const {
+ e.id = n.id * _nodeNum;
}
- void nextIn(Edge& edge) const {
- ++edge.id;
- if (edge.id % _nodeNum == 0) edge.id = -1;
+ void nextIn(Edge& e) const {
+ ++e.id;
+ if (e.id % _nodeNum == 0) e.id = -1;
}
};
@@ -207,7 +207,7 @@
/// static size graph the node's of the graph can be indiced
/// by the range from 0 to \e nodeNum()-1 and the index of
/// the node can accessed by the \e index() member.
- Node operator()(int index) const { return Parent::operator()(index); }
+ Node operator()(int ix) const { return Parent::operator()(ix); }
/// \brief Returns the index of the node.
///
@@ -250,7 +250,7 @@
public:
- Node operator()(int index) const { return Node(index); }
+ Node operator()(int ix) const { return Node(ix); }
int index(const Node& node) const { return node.id; }
Edge edge(const Node& u, const Node& v) const {
@@ -271,12 +271,12 @@
Node source(Edge e) const {
/// \todo we may do it faster
- return Node(((int)sqrt((double)(1 + 8 * e.id)) + 1) / 2);
+ return Node((int(sqrt(double(1 + 8 * e.id)) + 1)) / 2);
}
Node target(Edge e) const {
- int source = ((int)sqrt((double)(1 + 8 * e.id)) + 1) / 2;;
- return Node(e.id - (source) * (source - 1) / 2);
+ int s = (int(sqrt(double(1 + 8 * e.id)) + 1)) / 2;
+ return Node(e.id - s * (s - 1) / 2);
}
static int id(Node v) { return v.id; }
@@ -322,47 +322,47 @@
bool operator<(const Edge edge) const {return id < edge.id;}
};
- void first(Node& node) const {
- node.id = _nodeNum - 1;
+ void first(Node& n) const {
+ n.id = _nodeNum - 1;
}
- static void next(Node& node) {
- --node.id;
+ static void next(Node& n) {
+ --n.id;
}
- void first(Edge& edge) const {
- edge.id = _edgeNum - 1;
+ void first(Edge& e) const {
+ e.id = _edgeNum - 1;
}
- static void next(Edge& edge) {
- --edge.id;
+ static void next(Edge& e) {
+ --e.id;
}
- void firstOut(Edge& edge, const Node& node) const {
- int src = node.id;
+ void firstOut(Edge& e, const Node& n) const {
+ int src = n.id;
int trg = 0;
- edge.id = (trg < src ? src * (src - 1) / 2 + trg : -1);
+ e.id = (trg < src ? src * (src - 1) / 2 + trg : -1);
}
/// \todo with specialized iterators we can make faster iterating
- void nextOut(Edge& edge) const {
- int src = source(edge).id;
- int trg = target(edge).id;
+ void nextOut(Edge& e) const {
+ int src = source(e).id;
+ int trg = target(e).id;
++trg;
- edge.id = (trg < src ? src * (src - 1) / 2 + trg : -1);
+ e.id = (trg < src ? src * (src - 1) / 2 + trg : -1);
}
- void firstIn(Edge& edge, const Node& node) const {
- int src = node.id + 1;
- int trg = node.id;
- edge.id = (src < _nodeNum ? src * (src - 1) / 2 + trg : -1);
+ void firstIn(Edge& e, const Node& n) const {
+ int src = n.id + 1;
+ int trg = n.id;
+ e.id = (src < _nodeNum ? src * (src - 1) / 2 + trg : -1);
}
- void nextIn(Edge& edge) const {
- int src = source(edge).id;
- int trg = target(edge).id;
+ void nextIn(Edge& e) const {
+ int src = source(e).id;
+ int trg = target(e).id;
++src;
- edge.id = (src < _nodeNum ? src * (src - 1) / 2 + trg : -1);
+ e.id = (src < _nodeNum ? src * (src - 1) / 2 + trg : -1);
}
};
@@ -421,7 +421,7 @@
/// static size graph the node's of the graph can be indiced
/// by the range from 0 to \e nodeNum()-1 and the index of
/// the node can accessed by the \e index() member.
- Node operator()(int index) const { return Parent::operator()(index); }
+ Node operator()(int ix) const { return Parent::operator()(ix); }
/// \brief Returns the index of the node.
///
@@ -478,10 +478,10 @@
FullBpUGraphBase() {}
- void construct(int aNodeNum, int bNodeNum) {
- _aNodeNum = aNodeNum;
- _bNodeNum = bNodeNum;
- _edgeNum = aNodeNum * bNodeNum;
+ void construct(int ann, int bnn) {
+ _aNodeNum = ann;
+ _bNodeNum = bnn;
+ _edgeNum = ann * bnn;
}
public:
@@ -521,8 +521,8 @@
bool operator<(const UEdge i) const {return id<i.id;}
};
- Node aNode(int index) const { return Node(index << 1); }
- Node bNode(int index) const { return Node((index << 1) + 1); }
+ Node aNode(int ix) const { return Node(ix << 1); }
+ Node bNode(int ix) const { return Node((ix << 1) + 1); }
int aNodeIndex(const Node& node) const { return node.id >> 1; }
int bNodeIndex(const Node& node) const { return node.id >> 1; }
@@ -695,8 +695,8 @@
Parent::construct(0, 0);
}
- FullBpUGraph(int aNodeNum, int bNodeNum) {
- Parent::construct(aNodeNum, bNodeNum);
+ FullBpUGraph(int ann, int bnn) {
+ Parent::construct(ann, bnn);
}
/// \brief Resize the graph
@@ -737,7 +737,7 @@
/// static size graph the node's of the graph can be indiced
/// by the range from 0 to \e aNodeNum()-1 and the index of
/// the node can accessed by the \e aNodeIndex() member.
- Node aNode(int index) const { return Parent::aNode(index); }
+ Node aNode(int ix) const { return Parent::aNode(ix); }
/// \brief Returns the B-node with the given index.
///
@@ -745,7 +745,7 @@
/// static size graph the node's of the graph can be indiced
/// by the range from 0 to \e bNodeNum()-1 and the index of
/// the node can accessed by the \e bNodeIndex() member.
- Node bNode(int index) const { return Parent::bNode(index); }
+ Node bNode(int ix) const { return Parent::bNode(ix); }
/// \brief Returns the index of the A-node.
///
Modified: lemon/trunk/lemon/graph_adaptor.h
==============================================================================
--- lemon/trunk/lemon/graph_adaptor.h (original)
+++ lemon/trunk/lemon/graph_adaptor.h Fri Mar 2 19:04:28 2007
@@ -93,17 +93,17 @@
int edgeNum() const { return graph->edgeNum(); }
typedef FindEdgeTagIndicator<Graph> FindEdgeTag;
- Edge findEdge(const Node& source, const Node& target,
+ Edge findEdge(const Node& u, const Node& v,
const Edge& prev = INVALID) {
- return graph->findEdge(source, target, prev);
+ return graph->findEdge(u, v, prev);
}
Node addNode() const {
return Node(graph->addNode());
}
- Edge addEdge(const Node& source, const Node& target) const {
- return Edge(graph->addEdge(source, target));
+ Edge addEdge(const Node& u, const Node& v) const {
+ return Edge(graph->addEdge(u, v));
}
void erase(const Node& i) const { graph->erase(i); }
@@ -114,12 +114,12 @@
int id(const Node& v) const { return graph->id(v); }
int id(const Edge& e) const { return graph->id(e); }
- Node fromNodeId(int id) const {
- return graph->fromNodeId(id);
+ Node fromNodeId(int ix) const {
+ return graph->fromNodeId(ix);
}
- Edge fromEdgeId(int id) const {
- return graph->fromEdgeId(id);
+ Edge fromEdgeId(int ix) const {
+ return graph->fromEdgeId(ix);
}
int maxNodeId() const {
@@ -243,9 +243,9 @@
Node target(const Edge& e) const { return Parent::source(e); }
typedef FindEdgeTagIndicator<Graph> FindEdgeTag;
- Edge findEdge(const Node& source, const Node& target,
+ Edge findEdge(const Node& u, const Node& v,
const Edge& prev = INVALID) {
- return Parent::findEdge(target, source, prev);
+ return Parent::findEdge(v, u, prev);
}
};
@@ -460,10 +460,10 @@
typedef SubMapExtender<Adaptor, typename Parent::
template NodeMap<_Value> > Parent;
- NodeMap(const Graph& graph)
- : Parent(graph) {}
- NodeMap(const Graph& graph, const _Value& value)
- : Parent(graph, value) {}
+ NodeMap(const Graph& g)
+ : Parent(g) {}
+ NodeMap(const Graph& g, const _Value& v)
+ : Parent(g, v) {}
NodeMap& operator=(const NodeMap& cmap) {
return operator=<NodeMap>(cmap);
@@ -486,10 +486,10 @@
typedef SubMapExtender<Adaptor, typename Parent::
template EdgeMap<_Value> > Parent;
- EdgeMap(const Graph& graph)
- : Parent(graph) {}
- EdgeMap(const Graph& graph, const _Value& value)
- : Parent(graph, value) {}
+ EdgeMap(const Graph& g)
+ : Parent(g) {}
+ EdgeMap(const Graph& g, const _Value& v)
+ : Parent(g, v) {}
EdgeMap& operator=(const EdgeMap& cmap) {
return operator=<EdgeMap>(cmap);
@@ -633,10 +633,10 @@
typedef SubMapExtender<Adaptor, typename Parent::
template NodeMap<_Value> > Parent;
- NodeMap(const Graph& graph)
- : Parent(graph) {}
- NodeMap(const Graph& graph, const _Value& value)
- : Parent(graph, value) {}
+ NodeMap(const Graph& g)
+ : Parent(g) {}
+ NodeMap(const Graph& g, const _Value& v)
+ : Parent(g, v) {}
NodeMap& operator=(const NodeMap& cmap) {
return operator=<NodeMap>(cmap);
@@ -659,10 +659,10 @@
typedef SubMapExtender<Adaptor, typename Parent::
template EdgeMap<_Value> > Parent;
- EdgeMap(const Graph& graph)
- : Parent(graph) {}
- EdgeMap(const Graph& graph, const _Value& value)
- : Parent(graph, value) {}
+ EdgeMap(const Graph& g)
+ : Parent(g) {}
+ EdgeMap(const Graph& g, const _Value& v)
+ : Parent(g, v) {}
EdgeMap& operator=(const EdgeMap& cmap) {
return operator=<EdgeMap>(cmap);
@@ -1105,10 +1105,10 @@
typedef Adaptor Graph;
typedef SubMapExtender<Adaptor, EdgeMapBase<_Value> > Parent;
- EdgeMap(const Graph& graph)
- : Parent(graph) {}
- EdgeMap(const Graph& graph, const _Value& value)
- : Parent(graph, value) {}
+ EdgeMap(const Graph& g)
+ : Parent(g) {}
+ EdgeMap(const Graph& g, const _Value& v)
+ : Parent(g, v) {}
EdgeMap& operator=(const EdgeMap& cmap) {
return operator=<EdgeMap>(cmap);
@@ -1180,9 +1180,9 @@
AlterableUndirGraphAdaptor()
: Parent(), edge_notifier(*this), edge_notifier_proxy(*this) {}
- void setGraph(_Graph& graph) {
- Parent::setGraph(graph);
- edge_notifier_proxy.setNotifier(graph.notifier(GraphEdge()));
+ void setGraph(_Graph& g) {
+ Parent::setGraph(g);
+ edge_notifier_proxy.setNotifier(g.notifier(GraphEdge()));
}
public:
@@ -1220,8 +1220,8 @@
}
}
- void setNotifier(typename Graph::EdgeNotifier& notifier) {
- Parent::attach(notifier);
+ void setNotifier(typename Graph::EdgeNotifier& nf) {
+ Parent::attach(nf);
}
@@ -1235,7 +1235,7 @@
}
virtual void add(const std::vector<GraphEdge>& ge) {
std::vector<Edge> edges;
- for (int i = 0; i < (int)ge.size(); ++i) {
+ for (int i = 0; i < int(ge.size()); ++i) {
edges.push_back(AdaptorBase::Parent::direct(ge[i], true));
edges.push_back(AdaptorBase::Parent::direct(ge[i], false));
}
@@ -1249,7 +1249,7 @@
}
virtual void erase(const std::vector<GraphEdge>& ge) {
std::vector<Edge> edges;
- for (int i = 0; i < (int)ge.size(); ++i) {
+ for (int i = 0; i < int(ge.size()); ++i) {
edges.push_back(AdaptorBase::Parent::direct(ge[i], true));
edges.push_back(AdaptorBase::Parent::direct(ge[i], false));
}
@@ -1821,113 +1821,113 @@
};
- void first(Node& node) const {
- Parent::first(node);
- node.in_node = true;
+ void first(Node& n) const {
+ Parent::first(n);
+ n.in_node = true;
}
- void next(Node& node) const {
- if (node.in_node) {
- node.in_node = false;
+ void next(Node& n) const {
+ if (n.in_node) {
+ n.in_node = false;
} else {
- node.in_node = true;
- Parent::next(node);
+ n.in_node = true;
+ Parent::next(n);
}
}
- void first(Edge& edge) const {
- edge.item.setSecond();
- Parent::first(edge.item.second());
- if (edge.item.second() == INVALID) {
- edge.item.setFirst();
- Parent::first(edge.item.first());
+ void first(Edge& e) const {
+ e.item.setSecond();
+ Parent::first(e.item.second());
+ if (e.item.second() == INVALID) {
+ e.item.setFirst();
+ Parent::first(e.item.first());
}
}
- void next(Edge& edge) const {
- if (edge.item.secondState()) {
- Parent::next(edge.item.second());
- if (edge.item.second() == INVALID) {
- edge.item.setFirst();
- Parent::first(edge.item.first());
+ void next(Edge& e) const {
+ if (e.item.secondState()) {
+ Parent::next(e.item.second());
+ if (e.item.second() == INVALID) {
+ e.item.setFirst();
+ Parent::first(e.item.first());
}
} else {
- Parent::next(edge.item.first());
+ Parent::next(e.item.first());
}
}
- void firstOut(Edge& edge, const Node& node) const {
- if (node.in_node) {
- edge.item.setSecond(node);
+ void firstOut(Edge& e, const Node& n) const {
+ if (n.in_node) {
+ e.item.setSecond(n);
} else {
- edge.item.setFirst();
- Parent::firstOut(edge.item.first(), node);
+ e.item.setFirst();
+ Parent::firstOut(e.item.first(), n);
}
}
- void nextOut(Edge& edge) const {
- if (!edge.item.firstState()) {
- edge.item.setFirst(INVALID);
+ void nextOut(Edge& e) const {
+ if (!e.item.firstState()) {
+ e.item.setFirst(INVALID);
} else {
- Parent::nextOut(edge.item.first());
+ Parent::nextOut(e.item.first());
}
}
- void firstIn(Edge& edge, const Node& node) const {
- if (!node.in_node) {
- edge.item.setSecond(node);
+ void firstIn(Edge& e, const Node& n) const {
+ if (!n.in_node) {
+ e.item.setSecond(n);
} else {
- edge.item.setFirst();
- Parent::firstIn(edge.item.first(), node);
+ e.item.setFirst();
+ Parent::firstIn(e.item.first(), n);
}
}
- void nextIn(Edge& edge) const {
- if (!edge.item.firstState()) {
- edge.item.setFirst(INVALID);
+ void nextIn(Edge& e) const {
+ if (!e.item.firstState()) {
+ e.item.setFirst(INVALID);
} else {
- Parent::nextIn(edge.item.first());
+ Parent::nextIn(e.item.first());
}
}
- Node source(const Edge& edge) const {
- if (edge.item.firstState()) {
- return Node(Parent::source(edge.item.first()), false);
+ Node source(const Edge& e) const {
+ if (e.item.firstState()) {
+ return Node(Parent::source(e.item.first()), false);
} else {
- return Node(edge.item.second(), true);
+ return Node(e.item.second(), true);
}
}
- Node target(const Edge& edge) const {
- if (edge.item.firstState()) {
- return Node(Parent::target(edge.item.first()), true);
+ Node target(const Edge& e) const {
+ if (e.item.firstState()) {
+ return Node(Parent::target(e.item.first()), true);
} else {
- return Node(edge.item.second(), false);
+ return Node(e.item.second(), false);
}
}
- int id(const Node& node) const {
- return (Parent::id(node) << 1) | (node.in_node ? 0 : 1);
+ int id(const Node& n) const {
+ return (Parent::id(n) << 1) | (n.in_node ? 0 : 1);
}
- Node nodeFromId(int id) const {
- return Node(Parent::nodeFromId(id >> 1), (id & 1) == 0);
+ Node nodeFromId(int ix) const {
+ return Node(Parent::nodeFromId(ix >> 1), (ix & 1) == 0);
}
int maxNodeId() const {
return 2 * Parent::maxNodeId() + 1;
}
- int id(const Edge& edge) const {
- if (edge.item.firstState()) {
- return Parent::id(edge.item.first()) << 1;
+ int id(const Edge& e) const {
+ if (e.item.firstState()) {
+ return Parent::id(e.item.first()) << 1;
} else {
- return (Parent::id(edge.item.second()) << 1) | 1;
+ return (Parent::id(e.item.second()) << 1) | 1;
}
}
- Edge edgeFromId(int id) const {
- if ((id & 1) == 0) {
- return Edge(Parent::edgeFromId(id >> 1));
+ Edge edgeFromId(int ix) const {
+ if ((ix & 1) == 0) {
+ return Edge(Parent::edgeFromId(ix >> 1));
} else {
- return Edge(Parent::nodeFromId(id >> 1));
+ return Edge(Parent::nodeFromId(ix >> 1));
}
}
int maxEdgeId() const {
@@ -1938,57 +1938,57 @@
/// \brief Returns true when the node is in-node.
///
/// Returns true when the node is in-node.
- static bool inNode(const Node& node) {
- return node.in_node;
+ static bool inNode(const Node& n) {
+ return n.in_node;
}
/// \brief Returns true when the node is out-node.
///
/// Returns true when the node is out-node.
- static bool outNode(const Node& node) {
- return !node.in_node;
+ static bool outNode(const Node& n) {
+ return !n.in_node;
}
/// \brief Returns true when the edge is edge in the original graph.
///
/// Returns true when the edge is edge in the original graph.
- static bool origEdge(const Edge& edge) {
- return edge.item.firstState();
+ static bool origEdge(const Edge& e) {
+ return e.item.firstState();
}
/// \brief Returns true when the edge binds an in-node and an out-node.
///
/// Returns true when the edge binds an in-node and an out-node.
- static bool bindEdge(const Edge& edge) {
- return edge.item.secondState();
+ static bool bindEdge(const Edge& e) {
+ return e.item.secondState();
}
/// \brief Gives back the in-node created from the \c node.
///
/// Gives back the in-node created from the \c node.
- static Node inNode(const GraphNode& node) {
- return Node(node, true);
+ static Node inNode(const GraphNode& n) {
+ return Node(n, true);
}
/// \brief Gives back the out-node created from the \c node.
///
/// Gives back the out-node created from the \c node.
- static Node outNode(const GraphNode& node) {
- return Node(node, false);
+ static Node outNode(const GraphNode& n) {
+ return Node(n, false);
}
/// \brief Gives back the edge binds the two part of the node.
///
/// Gives back the edge binds the two part of the node.
- static Edge edge(const GraphNode& node) {
- return Edge(node);
+ static Edge edge(const GraphNode& n) {
+ return Edge(n);
}
/// \brief Gives back the edge of the original edge.
///
/// Gives back the edge of the original edge.
- static Edge edge(const GraphEdge& edge) {
- return Edge(edge);
+ static Edge edge(const GraphEdge& e) {
+ return Edge(e);
}
typedef True NodeNumTag;
@@ -2005,17 +2005,18 @@
typedef True FindEdgeTag;
- Edge findEdge(const Node& source, const Node& target,
+ Edge findEdge(const Node& u, const Node& v,
const Edge& prev = INVALID) const {
- if (inNode(source)) {
- if (outNode(target)) {
- if ((GraphNode&)source == (GraphNode&)target && prev == INVALID) {
- return Edge(source);
+ if (inNode(u)) {
+ if (outNode(v)) {
+ if (static_cast<const GraphNode&>(u) ==
+ static_cast<const GraphNode&>(v) && prev == INVALID) {
+ return Edge(u);
}
}
} else {
- if (inNode(target)) {
- return Edge(findEdge(*Parent::graph, source, target, prev));
+ if (inNode(v)) {
+ return Edge(findEdge(*Parent::graph, u, v, prev));
}
}
return INVALID;
@@ -2191,7 +2192,7 @@
virtual void add(const std::vector<GraphNode>& gn) {
std::vector<Node> nodes;
- for (int i = 0; i < (int)gn.size(); ++i) {
+ for (int i = 0; i < int(gn.size()); ++i) {
nodes.push_back(AdaptorBase::Parent::inNode(gn[i]));
nodes.push_back(AdaptorBase::Parent::outNode(gn[i]));
}
@@ -2207,7 +2208,7 @@
virtual void erase(const std::vector<GraphNode>& gn) {
std::vector<Node> nodes;
- for (int i = 0; i < (int)gn.size(); ++i) {
+ for (int i = 0; i < int(gn.size()); ++i) {
nodes.push_back(AdaptorBase::Parent::inNode(gn[i]));
nodes.push_back(AdaptorBase::Parent::outNode(gn[i]));
}
@@ -2253,10 +2254,10 @@
: Parent(), node_notifier(*this), edge_notifier(*this),
node_notifier_proxy(*this), edge_notifier_proxy(*this) {}
- void setGraph(_Graph& graph) {
- Parent::setGraph(graph);
- node_notifier_proxy.setNotifier(graph.notifier(GraphNode()));
- edge_notifier_proxy.setNotifier(graph.notifier(GraphEdge()));
+ void setGraph(_Graph& g) {
+ Parent::setGraph(g);
+ node_notifier_proxy.setNotifier(g.notifier(GraphNode()));
+ edge_notifier_proxy.setNotifier(g.notifier(GraphEdge()));
}
public:
@@ -2307,7 +2308,7 @@
virtual void add(const std::vector<GraphNode>& gn) {
std::vector<Node> nodes;
std::vector<Edge> edges;
- for (int i = 0; i < (int)gn.size(); ++i) {
+ for (int i = 0; i < int(gn.size()); ++i) {
edges.push_back(AdaptorBase::Parent::edge(gn[i]));
nodes.push_back(AdaptorBase::Parent::inNode(gn[i]));
nodes.push_back(AdaptorBase::Parent::outNode(gn[i]));
@@ -2325,7 +2326,7 @@
virtual void erase(const std::vector<GraphNode>& gn) {
std::vector<Node> nodes;
std::vector<Edge> edges;
- for (int i = 0; i < (int)gn.size(); ++i) {
+ for (int i = 0; i < int(gn.size()); ++i) {
edges.push_back(AdaptorBase::Parent::edge(gn[i]));
nodes.push_back(AdaptorBase::Parent::inNode(gn[i]));
nodes.push_back(AdaptorBase::Parent::outNode(gn[i]));
@@ -2335,9 +2336,9 @@
}
virtual void build() {
std::vector<Edge> edges;
- const typename Parent::Notifier* notifier = Parent::notifier();
+ const typename Parent::Notifier* nf = Parent::notifier();
GraphNode it;
- for (notifier->first(it); it != INVALID; notifier->next(it)) {
+ for (nf->first(it); it != INVALID; nf->next(it)) {
edges.push_back(AdaptorBase::Parent::edge(it));
}
adaptor->notifier(Node()).build();
@@ -2345,9 +2346,9 @@
}
virtual void clear() {
std::vector<Edge> edges;
- const typename Parent::Notifier* notifier = Parent::notifier();
+ const typename Parent::Notifier* nf = Parent::notifier();
GraphNode it;
- for (notifier->first(it); it != INVALID; notifier->next(it)) {
+ for (nf->first(it); it != INVALID; nf->next(it)) {
edges.push_back(AdaptorBase::Parent::edge(it));
}
adaptor->notifier(Edge()).erase(edges);
@@ -2385,7 +2386,7 @@
}
virtual void add(const std::vector<GraphEdge>& ge) {
std::vector<Edge> edges;
- for (int i = 0; i < (int)ge.size(); ++i) {
+ for (int i = 0; i < int(ge.size()); ++i) {
edges.push_back(AdaptorBase::edge(ge[i]));
}
adaptor->notifier(Edge()).add(edges);
@@ -2395,25 +2396,25 @@
}
virtual void erase(const std::vector<GraphEdge>& ge) {
std::vector<Edge> edges;
- for (int i = 0; i < (int)ge.size(); ++i) {
+ for (int i = 0; i < int(ge.size()); ++i) {
edges.push_back(AdaptorBase::edge(ge[i]));
}
adaptor->notifier(Edge()).erase(edges);
}
virtual void build() {
std::vector<Edge> edges;
- const typename Parent::Notifier* notifier = Parent::notifier();
+ const typename Parent::Notifier* nf = Parent::notifier();
GraphEdge it;
- for (notifier->first(it); it != INVALID; notifier->next(it)) {
+ for (nf->first(it); it != INVALID; nf->next(it)) {
edges.push_back(AdaptorBase::Parent::edge(it));
}
adaptor->notifier(Edge()).add(edges);
}
virtual void clear() {
std::vector<Edge> edges;
- const typename Parent::Notifier* notifier = Parent::notifier();
+ const typename Parent::Notifier* nf = Parent::notifier();
GraphEdge it;
- for (notifier->first(it); it != INVALID; notifier->next(it)) {
+ for (nf->first(it); it != INVALID; nf->next(it)) {
edges.push_back(AdaptorBase::Parent::edge(it));
}
adaptor->notifier(Edge()).erase(edges);
@@ -2509,8 +2510,8 @@
/// \brief Constructor of the adaptor.
///
/// Constructor of the adaptor.
- SplitGraphAdaptor(_Graph& graph) {
- Parent::setGraph(graph);
+ SplitGraphAdaptor(_Graph& g) {
+ Parent::setGraph(g);
}
/// \brief NodeMap combined from two original NodeMap
Modified: lemon/trunk/lemon/graph_reader.h
==============================================================================
--- lemon/trunk/lemon/graph_reader.h (original)
+++ lemon/trunk/lemon/graph_reader.h Fri Mar 2 19:04:28 2007
@@ -184,27 +184,27 @@
/// \brief Give a new node map reading command to the reader.
///
/// Give a new node map reading command to the reader.
- template <typename Reader, typename Map>
+ template <typename ItemReader, typename Map>
GraphReader& readNodeMap(std::string name, Map& map,
- const Reader& reader = Reader()) {
- nodeset_reader.readNodeMap(name, map, reader);
+ const ItemReader& ir = ItemReader()) {
+ nodeset_reader.readNodeMap(name, map, ir);
return *this;
}
- template <typename Reader, typename Map>
+ template <typename ItemReader, typename Map>
GraphReader& readNodeMap(std::string name, const Map& map,
- const Reader& reader = Reader()) {
- nodeset_reader.readNodeMap(name, map, reader);
+ const ItemReader& ir = ItemReader()) {
+ nodeset_reader.readNodeMap(name, map, ir);
return *this;
}
/// \brief Give a new node map skipping command to the reader.
///
/// Give a new node map skipping command to the reader.
- template <typename Reader>
+ template <typename ItemReader>
GraphReader& skipNodeMap(std::string name,
- const Reader& reader = Reader()) {
- nodeset_reader.skipNodeMap(name, reader);
+ const ItemReader& ir = ItemReader()) {
+ nodeset_reader.skipNodeMap(name, ir);
return *this;
}
@@ -227,27 +227,27 @@
/// \brief Give a new edge map reading command to the reader.
///
/// Give a new edge map reading command to the reader.
- template <typename Reader, typename Map>
+ template <typename ItemReader, typename Map>
GraphReader& readEdgeMap(std::string name, Map& map,
- const Reader& reader = Reader()) {
- edgeset_reader.readEdgeMap(name, map, reader);
+ const ItemReader& ir = ItemReader()) {
+ edgeset_reader.readEdgeMap(name, map, ir);
return *this;
}
- template <typename Reader, typename Map>
+ template <typename ItemReader, typename Map>
GraphReader& readEdgeMap(std::string name, const Map& map,
- const Reader& reader = Reader()) {
- edgeset_reader.readEdgeMap(name, map, reader);
+ const ItemReader& ir = ItemReader()) {
+ edgeset_reader.readEdgeMap(name, map, ir);
return *this;
}
/// \brief Give a new edge map skipping command to the reader.
///
/// Give a new edge map skipping command to the reader.
- template <typename Reader>
+ template <typename ItemReader>
GraphReader& skipEdgeMap(std::string name,
- const Reader& reader = Reader()) {
- edgeset_reader.skipEdgeMap(name, reader);
+ const ItemReader& ir = ItemReader()) {
+ edgeset_reader.skipEdgeMap(name, ir);
return *this;
}
@@ -279,10 +279,10 @@
/// \brief Give a new attribute reading command.
///
/// Give a new attribute reading command.
- template <typename Reader, typename Value>
+ template <typename ItemReader, typename Value>
GraphReader& readAttribute(std::string name, Value& value,
- const Reader& reader) {
- attribute_reader.readAttribute<Reader>(name, value, reader);
+ const ItemReader& ir = ItemReader()) {
+ attribute_reader.readAttribute(name, value, ir);
return *this;
}
@@ -504,27 +504,27 @@
/// \brief Give a new node map reading command to the reader.
///
/// Give a new node map reading command to the reader.
- template <typename Reader, typename Map>
+ template <typename ItemReader, typename Map>
UGraphReader& readNodeMap(std::string name, Map& map,
- const Reader& reader = Reader()) {
- nodeset_reader.readNodeMap(name, map, reader);
+ const ItemReader& ir = ItemReader()) {
+ nodeset_reader.readNodeMap(name, map, ir);
return *this;
}
- template <typename Reader, typename Map>
+ template <typename ItemReader, typename Map>
UGraphReader& readNodeMap(std::string name, const Map& map,
- const Reader& reader = Reader()) {
- nodeset_reader.readNodeMap(name, map, reader);
+ const ItemReader& ir = ItemReader()) {
+ nodeset_reader.readNodeMap(name, map, ir);
return *this;
}
/// \brief Give a new node map skipping command to the reader.
///
/// Give a new node map skipping command to the reader.
- template <typename Reader>
+ template <typename ItemReader>
UGraphReader& skipNodeMap(std::string name,
- const Reader& reader = Reader()) {
- nodeset_reader.skipNodeMap(name, reader);
+ const ItemReader& ir = ItemReader()) {
+ nodeset_reader.skipNodeMap(name, ir);
return *this;
}
@@ -547,27 +547,27 @@
/// \brief Give a new undirected edge map reading command to the reader.
///
/// Give a new undirected edge map reading command to the reader.
- template <typename Reader, typename Map>
+ template <typename ItemReader, typename Map>
UGraphReader& readUEdgeMap(std::string name, Map& map,
- const Reader& reader = Reader()) {
- u_edgeset_reader.readUEdgeMap(name, map, reader);
+ const ItemReader& ir = ItemReader()) {
+ u_edgeset_reader.readUEdgeMap(name, map, ir);
return *this;
}
- template <typename Reader, typename Map>
+ template <typename ItemReader, typename Map>
UGraphReader& readUEdgeMap(std::string name, const Map& map,
- const Reader& reader = Reader()) {
- u_edgeset_reader.readUEdgeMap(name, map, reader);
+ const ItemReader& ir = ItemReader()) {
+ u_edgeset_reader.readUEdgeMap(name, map, ir);
return *this;
}
/// \brief Give a new undirected edge map skipping command to the reader.
///
/// Give a new undirected edge map skipping command to the reader.
- template <typename Reader>
+ template <typename ItemReader>
UGraphReader& skipUEdgeMap(std::string name,
- const Reader& reader = Reader()) {
- u_edgeset_reader.skipUMap(name, reader);
+ const ItemReader& ir = ItemReader()) {
+ u_edgeset_reader.skipUMap(name, ir);
return *this;
}
@@ -591,27 +591,27 @@
/// \brief Give a new edge map reading command to the reader.
///
/// Give a new edge map reading command to the reader.
- template <typename Reader, typename Map>
+ template <typename ItemReader, typename Map>
UGraphReader& readEdgeMap(std::string name, Map& map,
- const Reader& reader = Reader()) {
- u_edgeset_reader.readEdgeMap(name, map, reader);
+ const ItemReader& ir = ItemReader()) {
+ u_edgeset_reader.readEdgeMap(name, map, ir);
return *this;
}
- template <typename Reader, typename Map>
+ template <typename ItemReader, typename Map>
UGraphReader& readEdgeMap(std::string name, const Map& map,
- const Reader& reader = Reader()) {
- u_edgeset_reader.readEdgeMap(name, map, reader);
+ const ItemReader& ir = ItemReader()) {
+ u_edgeset_reader.readEdgeMap(name, map, ir);
return *this;
}
/// \brief Give a new edge map skipping command to the reader.
///
/// Give a new edge map skipping command to the reader.
- template <typename Reader>
+ template <typename ItemReader>
UGraphReader& skipEdgeMap(std::string name,
- const Reader& reader = Reader()) {
- u_edgeset_reader.skipEdgeMap(name, reader);
+ const ItemReader& ir = ItemReader()) {
+ u_edgeset_reader.skipEdgeMap(name, ir);
return *this;
}
@@ -650,10 +650,10 @@
/// \brief Give a new attribute reading command.
///
/// Give a new attribute reading command.
- template <typename Reader, typename Value>
+ template <typename ItemReader, typename Value>
UGraphReader& readAttribute(std::string name, Value& value,
- const Reader& reader) {
- attribute_reader.readAttribute<Reader>(name, value, reader);
+ const ItemReader& ir = ItemReader()) {
+ attribute_reader.readAttribute(name, value, ir);
return *this;
}
Modified: lemon/trunk/lemon/graph_to_eps.h
==============================================================================
--- lemon/trunk/lemon/graph_to_eps.h (original)
+++ lemon/trunk/lemon/graph_to_eps.h Fri Mar 2 19:04:28 2007
@@ -949,14 +949,14 @@
node_shape=_nodeShapes[g.target(*e)];
dim2::Bezier3 bez(s,mm,mm,t);
double t1=0,t2=1;
- for(int i=0;i<INTERPOL_PREC;++i)
+ for(int ii=0;ii<INTERPOL_PREC;++ii)
if(isInsideNode(bez((t1+t2)/2)-t,rn,node_shape)) t2=(t1+t2)/2;
else t1=(t1+t2)/2;
dim2::Point<double> apoint=bez((t1+t2)/2);
rn = _arrowLength+_edgeWidths[*e]*_edgeWidthScale;
rn*=rn;
t2=(t1+t2)/2;t1=0;
- for(int i=0;i<INTERPOL_PREC;++i)
+ for(int ii=0;ii<INTERPOL_PREC;++ii)
if((bez((t1+t2)/2)-apoint).normSquare()>rn) t1=(t1+t2)/2;
else t2=(t1+t2)/2;
dim2::Point<double> linend=bez((t1+t2)/2);
Modified: lemon/trunk/lemon/graph_utils.h
==============================================================================
--- lemon/trunk/lemon/graph_utils.h (original)
+++ lemon/trunk/lemon/graph_utils.h Fri Mar 2 19:04:28 2007
@@ -790,10 +790,10 @@
///
/// Destructor of the GraphCopy
~GraphCopy() {
- for (int i = 0; i < (int)nodeMapCopies.size(); ++i) {
+ for (int i = 0; i < int(nodeMapCopies.size()); ++i) {
delete nodeMapCopies[i];
}
- for (int i = 0; i < (int)edgeMapCopies.size(); ++i) {
+ for (int i = 0; i < int(edgeMapCopies.size()); ++i) {
delete edgeMapCopies[i];
}
@@ -836,9 +836,9 @@
/// \brief Make a copy of the given node.
///
/// Make a copy of the given node.
- GraphCopy& node(TNode& tnode, const Node& node) {
+ GraphCopy& node(TNode& tnode, const Node& snode) {
nodeMapCopies.push_back(new _graph_utils_bits::ItemCopy<Source, Node,
- NodeRefMap, TNode>(tnode, node));
+ NodeRefMap, TNode>(tnode, snode));
return *this;
}
@@ -879,9 +879,9 @@
/// \brief Make a copy of the given edge.
///
/// Make a copy of the given edge.
- GraphCopy& edge(TEdge& tedge, const Edge& edge) {
+ GraphCopy& edge(TEdge& tedge, const Edge& sedge) {
edgeMapCopies.push_back(new _graph_utils_bits::ItemCopy<Source, Edge,
- EdgeRefMap, TEdge>(tedge, edge));
+ EdgeRefMap, TEdge>(tedge, sedge));
return *this;
}
@@ -893,10 +893,10 @@
EdgeRefMap edgeRefMap(source);
_graph_utils_bits::GraphCopySelector<Target>::
copy(target, source, nodeRefMap, edgeRefMap);
- for (int i = 0; i < (int)nodeMapCopies.size(); ++i) {
+ for (int i = 0; i < int(nodeMapCopies.size()); ++i) {
nodeMapCopies[i]->copy(source, nodeRefMap);
}
- for (int i = 0; i < (int)edgeMapCopies.size(); ++i) {
+ for (int i = 0; i < int(edgeMapCopies.size()); ++i) {
edgeMapCopies[i]->copy(source, edgeRefMap);
}
}
@@ -967,9 +967,10 @@
typedef typename Target::Edge Value;
Value operator[](const Key& key) const {
- bool forward = (source.direction(key) ==
- (node_ref[source.source((UEdge)key)] ==
- target.source(uedge_ref[(UEdge)key])));
+ bool forward =
+ (source.direction(key) ==
+ (node_ref[source.source(static_cast<const UEdge&>(key))] ==
+ target.source(uedge_ref[static_cast<const UEdge&>(key)])));
return target.direct(uedge_ref[key], forward);
}
@@ -994,13 +995,13 @@
///
/// Destructor of the GraphCopy
~UGraphCopy() {
- for (int i = 0; i < (int)nodeMapCopies.size(); ++i) {
+ for (int i = 0; i < int(nodeMapCopies.size()); ++i) {
delete nodeMapCopies[i];
}
- for (int i = 0; i < (int)edgeMapCopies.size(); ++i) {
+ for (int i = 0; i < int(edgeMapCopies.size()); ++i) {
delete edgeMapCopies[i];
}
- for (int i = 0; i < (int)uEdgeMapCopies.size(); ++i) {
+ for (int i = 0; i < int(uEdgeMapCopies.size()); ++i) {
delete uEdgeMapCopies[i];
}
@@ -1043,9 +1044,9 @@
/// \brief Make a copy of the given node.
///
/// Make a copy of the given node.
- UGraphCopy& node(TNode& tnode, const Node& node) {
+ UGraphCopy& node(TNode& tnode, const Node& snode) {
nodeMapCopies.push_back(new _graph_utils_bits::ItemCopy<Source, Node,
- NodeRefMap, TNode>(tnode, node));
+ NodeRefMap, TNode>(tnode, snode));
return *this;
}
@@ -1086,9 +1087,9 @@
/// \brief Make a copy of the given edge.
///
/// Make a copy of the given edge.
- UGraphCopy& edge(TEdge& tedge, const Edge& edge) {
+ UGraphCopy& edge(TEdge& tedge, const Edge& sedge) {
edgeMapCopies.push_back(new _graph_utils_bits::ItemCopy<Source, Edge,
- EdgeRefMap, TEdge>(tedge, edge));
+ EdgeRefMap, TEdge>(tedge, sedge));
return *this;
}
@@ -1129,9 +1130,9 @@
/// \brief Make a copy of the given undirected edge.
///
/// Make a copy of the given undirected edge.
- UGraphCopy& uEdge(TUEdge& tuedge, const UEdge& uedge) {
+ UGraphCopy& uEdge(TUEdge& tuedge, const UEdge& suedge) {
uEdgeMapCopies.push_back(new _graph_utils_bits::ItemCopy<Source, UEdge,
- UEdgeRefMap, TUEdge>(tuedge, uedge));
+ UEdgeRefMap, TUEdge>(tuedge, suedge));
return *this;
}
@@ -1144,13 +1145,13 @@
EdgeRefMap edgeRefMap(target, source, uEdgeRefMap, nodeRefMap);
_graph_utils_bits::UGraphCopySelector<Target>::
copy(target, source, nodeRefMap, uEdgeRefMap);
- for (int i = 0; i < (int)nodeMapCopies.size(); ++i) {
+ for (int i = 0; i < int(nodeMapCopies.size()); ++i) {
nodeMapCopies[i]->copy(source, nodeRefMap);
}
- for (int i = 0; i < (int)uEdgeMapCopies.size(); ++i) {
+ for (int i = 0; i < int(uEdgeMapCopies.size()); ++i) {
uEdgeMapCopies[i]->copy(source, uEdgeRefMap);
}
- for (int i = 0; i < (int)edgeMapCopies.size(); ++i) {
+ for (int i = 0; i < int(edgeMapCopies.size()); ++i) {
edgeMapCopies[i]->copy(source, edgeRefMap);
}
}
@@ -1245,9 +1246,10 @@
typedef typename Target::Edge Value;
Value operator[](const Key& key) const {
- bool forward = (source.direction(key) ==
- (node_ref[source.source((UEdge)key)] ==
- target.source(uedge_ref[(UEdge)key])));
+ bool forward =
+ (source.direction(key) ==
+ (node_ref[source.source(static_cast<const UEdge&>(key))] ==
+ target.source(uedge_ref[static_cast<const UEdge&>(key)])));
return target.direct(uedge_ref[key], forward);
}
@@ -1271,19 +1273,19 @@
///
/// Destructor of the GraphCopy
~BpUGraphCopy() {
- for (int i = 0; i < (int)aNodeMapCopies.size(); ++i) {
+ for (int i = 0; i < int(aNodeMapCopies.size()); ++i) {
delete aNodeMapCopies[i];
}
- for (int i = 0; i < (int)bNodeMapCopies.size(); ++i) {
+ for (int i = 0; i < int(bNodeMapCopies.size()); ++i) {
delete bNodeMapCopies[i];
}
- for (int i = 0; i < (int)nodeMapCopies.size(); ++i) {
+ for (int i = 0; i < int(nodeMapCopies.size()); ++i) {
delete nodeMapCopies[i];
}
- for (int i = 0; i < (int)edgeMapCopies.size(); ++i) {
+ for (int i = 0; i < int(edgeMapCopies.size()); ++i) {
delete edgeMapCopies[i];
}
- for (int i = 0; i < (int)uEdgeMapCopies.size(); ++i) {
+ for (int i = 0; i < int(uEdgeMapCopies.size()); ++i) {
delete uEdgeMapCopies[i];
}
@@ -1393,9 +1395,9 @@
/// \brief Make a copy of the given node.
///
/// Make a copy of the given node.
- BpUGraphCopy& node(TNode& tnode, const Node& node) {
+ BpUGraphCopy& node(TNode& tnode, const Node& snode) {
nodeMapCopies.push_back(new _graph_utils_bits::ItemCopy<Source, Node,
- NodeRefMap, TNode>(tnode, node));
+ NodeRefMap, TNode>(tnode, snode));
return *this;
}
@@ -1436,9 +1438,9 @@
/// \brief Make a copy of the given edge.
///
/// Make a copy of the given edge.
- BpUGraphCopy& edge(TEdge& tedge, const Edge& edge) {
+ BpUGraphCopy& edge(TEdge& tedge, const Edge& sedge) {
edgeMapCopies.push_back(new _graph_utils_bits::ItemCopy<Source, Edge,
- EdgeRefMap, TEdge>(tedge, edge));
+ EdgeRefMap, TEdge>(tedge, sedge));
return *this;
}
@@ -1479,9 +1481,9 @@
/// \brief Make a copy of the given undirected edge.
///
/// Make a copy of the given undirected edge.
- BpUGraphCopy& uEdge(TUEdge& tuedge, const UEdge& uedge) {
+ BpUGraphCopy& uEdge(TUEdge& tuedge, const UEdge& suedge) {
uEdgeMapCopies.push_back(new _graph_utils_bits::ItemCopy<Source, UEdge,
- UEdgeRefMap, TUEdge>(tuedge, uedge));
+ UEdgeRefMap, TUEdge>(tuedge, suedge));
return *this;
}
@@ -1496,19 +1498,19 @@
EdgeRefMap edgeRefMap(target, source, uEdgeRefMap, nodeRefMap);
_graph_utils_bits::BpUGraphCopySelector<Target>::
copy(target, source, aNodeRefMap, bNodeRefMap, uEdgeRefMap);
- for (int i = 0; i < (int)aNodeMapCopies.size(); ++i) {
+ for (int i = 0; i < int(aNodeMapCopies.size()); ++i) {
aNodeMapCopies[i]->copy(source, aNodeRefMap);
}
- for (int i = 0; i < (int)bNodeMapCopies.size(); ++i) {
+ for (int i = 0; i < int(bNodeMapCopies.size()); ++i) {
bNodeMapCopies[i]->copy(source, bNodeRefMap);
}
- for (int i = 0; i < (int)nodeMapCopies.size(); ++i) {
+ for (int i = 0; i < int(nodeMapCopies.size()); ++i) {
nodeMapCopies[i]->copy(source, nodeRefMap);
}
- for (int i = 0; i < (int)uEdgeMapCopies.size(); ++i) {
+ for (int i = 0; i < int(uEdgeMapCopies.size()); ++i) {
uEdgeMapCopies[i]->copy(source, uEdgeRefMap);
}
- for (int i = 0; i < (int)edgeMapCopies.size(); ++i) {
+ for (int i = 0; i < int(edgeMapCopies.size()); ++i) {
edgeMapCopies[i]->copy(source, edgeRefMap);
}
}
@@ -1777,7 +1779,7 @@
/// Erase more keys from the map. It is called by the
/// \c AlterationNotifier.
virtual void erase(const std::vector<Key>& keys) {
- for (int i = 0; i < (int)keys.size(); ++i) {
+ for (int i = 0; i < int(keys.size()); ++i) {
Value val = Map::operator[](keys[i]);
typename Container::iterator it = invMap.find(val);
if (it != invMap.end() && it->second == keys[i]) {
@@ -1873,8 +1875,8 @@
/// Constructor for descriptor map.
explicit DescriptorMap(const Graph& _graph) : Map(_graph) {
Item it;
- const typename Map::Notifier* notifier = Map::notifier();
- for (notifier->first(it); it != INVALID; notifier->next(it)) {
+ const typename Map::Notifier* nf = Map::notifier();
+ for (nf->first(it); it != INVALID; nf->next(it)) {
Map::set(it, invMap.size());
invMap.push_back(it);
}
@@ -1898,7 +1900,7 @@
/// \c AlterationNotifier.
virtual void add(const std::vector<Item>& items) {
Map::add(items);
- for (int i = 0; i < (int)items.size(); ++i) {
+ for (int i = 0; i < int(items.size()); ++i) {
Map::set(items[i], invMap.size());
invMap.push_back(items[i]);
}
@@ -1920,7 +1922,7 @@
/// Erase more keys from the map. It is called by the
/// \c AlterationNotifier.
virtual void erase(const std::vector<Item>& items) {
- for (int i = 0; i < (int)items.size(); ++i) {
+ for (int i = 0; i < int(items.size()); ++i) {
Map::set(invMap.back(), Map::operator[](items[i]));
invMap[Map::operator[](items[i])] = invMap.back();
invMap.pop_back();
@@ -1935,8 +1937,8 @@
virtual void build() {
Map::build();
Item it;
- const typename Map::Notifier* notifier = Map::notifier();
- for (notifier->first(it); it != INVALID; notifier->next(it)) {
+ const typename Map::Notifier* nf = Map::notifier();
+ for (nf->first(it); it != INVALID; nf->next(it)) {
Map::set(it, invMap.size());
invMap.push_back(it);
}
@@ -2280,7 +2282,7 @@
virtual void add(const std::vector<Key>& keys) {
Parent::add(keys);
- for (int i = 0; i < (int)keys.size(); ++i) {
+ for (int i = 0; i < int(keys.size()); ++i) {
Parent::set(keys[i], 0);
}
}
@@ -2313,7 +2315,7 @@
}
virtual void add(const std::vector<Edge>& edges) {
- for (int i = 0; i < (int)edges.size(); ++i) {
+ for (int i = 0; i < int(edges.size()); ++i) {
++deg[graph.target(edges[i])];
}
}
@@ -2323,7 +2325,7 @@
}
virtual void erase(const std::vector<Edge>& edges) {
- for (int i = 0; i < (int)edges.size(); ++i) {
+ for (int i = 0; i < int(edges.size()); ++i) {
--deg[graph.target(edges[i])];
}
}
@@ -2392,7 +2394,7 @@
}
virtual void add(const std::vector<Key>& keys) {
Parent::add(keys);
- for (int i = 0; i < (int)keys.size(); ++i) {
+ for (int i = 0; i < int(keys.size()); ++i) {
Parent::set(keys[i], 0);
}
}
@@ -2425,7 +2427,7 @@
}
virtual void add(const std::vector<Edge>& edges) {
- for (int i = 0; i < (int)edges.size(); ++i) {
+ for (int i = 0; i < int(edges.size()); ++i) {
++deg[graph.source(edges[i])];
}
}
@@ -2435,7 +2437,7 @@
}
virtual void erase(const std::vector<Edge>& edges) {
- for (int i = 0; i < (int)edges.size(); ++i) {
+ for (int i = 0; i < int(edges.size()); ++i) {
--deg[graph.source(edges[i])];
}
}
Modified: lemon/trunk/lemon/graph_writer.h
==============================================================================
--- lemon/trunk/lemon/graph_writer.h (original)
+++ lemon/trunk/lemon/graph_writer.h Fri Mar 2 19:04:28 2007
@@ -158,8 +158,8 @@
///
/// This function issues a new <i> node map writing command</i> to the writer.
template <typename Map>
- GraphWriter& writeNodeMap(std::string name, const Map& map) {
- nodeset_writer.writeNodeMap(name, map);
+ GraphWriter& writeNodeMap(std::string label, const Map& map) {
+ nodeset_writer.writeNodeMap(label, map);
return *this;
}
@@ -167,10 +167,10 @@
/// \brief Issue a new node map writing command for the writer.
///
/// This function issues a new <i> node map writing command</i> to the writer.
- template <typename Writer, typename Map>
- GraphWriter& writeNodeMap(std::string name, const Map& map,
- const Writer& writer = Writer()) {
- nodeset_writer.writeNodeMap(name, map, writer);
+ template <typename ItemWriter, typename Map>
+ GraphWriter& writeNodeMap(std::string label, const Map& map,
+ const ItemWriter& iw = ItemWriter()) {
+ nodeset_writer.writeNodeMap(label, map, iw);
return *this;
}
@@ -179,8 +179,8 @@
///
/// This function issues a new <i> edge map writing command</i> to the writer.
template <typename Map>
- GraphWriter& writeEdgeMap(std::string name, const Map& map) {
- edgeset_writer.writeEdgeMap(name, map);
+ GraphWriter& writeEdgeMap(std::string label, const Map& map) {
+ edgeset_writer.writeEdgeMap(label, map);
return *this;
}
@@ -188,10 +188,10 @@
/// \brief Issue a new edge map writing command for the writer.
///
/// This function issues a new <i> edge map writing command</i> to the writer.
- template <typename Writer, typename Map>
- GraphWriter& writeEdgeMap(std::string name, const Map& map,
- const Writer& writer = Writer()) {
- edgeset_writer.writeEdgeMap(name, map, writer);
+ template <typename ItemWriter, typename Map>
+ GraphWriter& writeEdgeMap(std::string label, const Map& map,
+ const ItemWriter& iw = ItemWriter()) {
+ edgeset_writer.writeEdgeMap(label, map, iw);
return *this;
}
@@ -199,8 +199,8 @@
///
/// This function issues a new <i> labeled node writing command</i>
/// to the writer.
- GraphWriter& writeNode(std::string name, const Node& node) {
- node_writer.writeNode(name, node);
+ GraphWriter& writeNode(std::string label, const Node& node) {
+ node_writer.writeNode(label, node);
return *this;
}
@@ -208,8 +208,8 @@
///
/// This function issues a new <i> labeled edge writing command</i>
/// to the writer.
- GraphWriter& writeEdge(std::string name, const Edge& edge) {
- edge_writer.writeEdge(name, edge);
+ GraphWriter& writeEdge(std::string label, const Edge& edge) {
+ edge_writer.writeEdge(label, edge);
}
/// \brief Issue a new attribute writing command.
@@ -217,8 +217,8 @@
/// This function issues a new <i> attribute writing command</i>
/// to the writer.
template <typename Value>
- GraphWriter& writeAttribute(std::string name, const Value& value) {
- attribute_writer.writeAttribute(name, value);
+ GraphWriter& writeAttribute(std::string label, const Value& value) {
+ attribute_writer.writeAttribute(label, value);
return *this;
}
@@ -226,10 +226,10 @@
///
/// This function issues a new <i> attribute writing command</i>
/// to the writer.
- template <typename Writer, typename Value>
- GraphWriter& writeAttribute(std::string name, const Value& value,
- const Writer& writer) {
- attribute_writer.writeAttribute<Writer>(name, value, writer);
+ template <typename ItemWriter, typename Value>
+ GraphWriter& writeAttribute(std::string label, const Value& value,
+ const ItemWriter& iw = ItemWriter()) {
+ attribute_writer.writeAttribute(label, value, iw);
return *this;
}
@@ -412,8 +412,8 @@
/// This function issues a new <i> node map writing command</i> to
/// the writer.
template <typename Map>
- UGraphWriter& writeNodeMap(std::string name, const Map& map) {
- nodeset_writer.writeNodeMap(name, map);
+ UGraphWriter& writeNodeMap(std::string label, const Map& map) {
+ nodeset_writer.writeNodeMap(label, map);
return *this;
}
@@ -421,10 +421,10 @@
///
/// This function issues a new <i> node map writing command</i> to
/// the writer.
- template <typename Writer, typename Map>
- UGraphWriter& writeNodeMap(std::string name, const Map& map,
- const Writer& writer = Writer()) {
- nodeset_writer.writeNodeMap(name, map, writer);
+ template <typename ItemWriter, typename Map>
+ UGraphWriter& writeNodeMap(std::string label, const Map& map,
+ const ItemWriter& iw = ItemWriter()) {
+ nodeset_writer.writeNodeMap(label, map, iw);
return *this;
}
@@ -433,8 +433,8 @@
/// This function issues a new <i> edge map writing command</i> to
/// the writer.
template <typename Map>
- UGraphWriter& writeEdgeMap(std::string name, const Map& map) {
- u_edgeset_writer.writeEdgeMap(name, map);
+ UGraphWriter& writeEdgeMap(std::string label, const Map& map) {
+ u_edgeset_writer.writeEdgeMap(label, map);
return *this;
}
@@ -442,10 +442,10 @@
///
/// This function issues a new <i> edge map writing command</i> to
/// the writer.
- template <typename Writer, typename Map>
- UGraphWriter& writeEdgeMap(std::string name, const Map& map,
- const Writer& writer = Writer()) {
- u_edgeset_writer.writeEdgeMap(name, map, writer);
+ template <typename ItemWriter, typename Map>
+ UGraphWriter& writeEdgeMap(std::string label, const Map& map,
+ const ItemWriter& iw = ItemWriter()) {
+ u_edgeset_writer.writeEdgeMap(label, map, iw);
return *this;
}
@@ -454,8 +454,8 @@
/// This function issues a new <i> undirected edge map writing
/// command</i> to the writer.
template <typename Map>
- UGraphWriter& writeUEdgeMap(std::string name, const Map& map) {
- u_edgeset_writer.writeUEdgeMap(name, map);
+ UGraphWriter& writeUEdgeMap(std::string label, const Map& map) {
+ u_edgeset_writer.writeUEdgeMap(label, map);
return *this;
}
@@ -463,10 +463,10 @@
///
/// This function issues a new <i> undirected edge map writing
/// command</i> to the writer.
- template <typename Writer, typename Map>
- UGraphWriter& writeUEdgeMap(std::string name, const Map& map,
- const Writer& writer = Writer()) {
- u_edgeset_writer.writeUEdgeMap(name, map, writer);
+ template <typename ItemWriter, typename Map>
+ UGraphWriter& writeUEdgeMap(std::string label, const Map& map,
+ const ItemWriter& iw = ItemWriter()) {
+ u_edgeset_writer.writeUEdgeMap(label, map, iw);
return *this;
}
@@ -474,8 +474,8 @@
///
/// This function issues a new <i> labeled node writing
/// command</i> to the writer.
- UGraphWriter& writeNode(std::string name, const Node& node) {
- node_writer.writeNode(name, node);
+ UGraphWriter& writeNode(std::string label, const Node& node) {
+ node_writer.writeNode(label, node);
return *this;
}
@@ -483,8 +483,8 @@
///
/// This function issues a new <i> labeled edge writing
/// command</i> to the writer.
- UGraphWriter& writeEdge(std::string name, const Edge& edge) {
- u_edge_writer.writeEdge(name, edge);
+ UGraphWriter& writeEdge(std::string label, const Edge& edge) {
+ u_edge_writer.writeEdge(label, edge);
}
/// \brief Issue a new labeled undirected edge writing command to
@@ -492,8 +492,8 @@
///
/// Issue a new <i>labeled undirected edge writing command</i> to
/// the writer.
- UGraphWriter& writeUEdge(std::string name, const UEdge& edge) {
- u_edge_writer.writeUEdge(name, edge);
+ UGraphWriter& writeUEdge(std::string label, const UEdge& edge) {
+ u_edge_writer.writeUEdge(label, edge);
}
/// \brief Issue a new attribute writing command.
@@ -501,8 +501,8 @@
/// This function issues a new <i> attribute writing
/// command</i> to the writer.
template <typename Value>
- UGraphWriter& writeAttribute(std::string name, const Value& value) {
- attribute_writer.writeAttribute(name, value);
+ UGraphWriter& writeAttribute(std::string label, const Value& value) {
+ attribute_writer.writeAttribute(label, value);
return *this;
}
@@ -510,10 +510,10 @@
///
/// This function issues a new <i> attribute writing
/// command</i> to the writer.
- template <typename Writer, typename Value>
- UGraphWriter& writeAttribute(std::string name, const Value& value,
- const Writer& writer) {
- attribute_writer.writeAttribute<Writer>(name, value, writer);
+ template <typename ItemWriter, typename Value>
+ UGraphWriter& writeAttribute(std::string label, const Value& value,
+ const ItemWriter& iw = ItemWriter()) {
+ attribute_writer.writeAttribute(label, value, iw);
return *this;
}
Modified: lemon/trunk/lemon/grid_ugraph.h
==============================================================================
--- lemon/trunk/lemon/grid_ugraph.h (original)
+++ lemon/trunk/lemon/grid_ugraph.h Fri Mar 2 19:04:28 2007
@@ -49,10 +49,10 @@
protected:
- void construct(int width, int height) {
- _height = height; _width = width;
- _nodeNum = height * width; _edgeNum = 2 * _nodeNum - width - height;
- _edgeLimit = _nodeNum - width;
+ void construct(int w, int h) {
+ _height = h; _width = w;
+ _nodeNum = h * w; _edgeNum = 2 * _nodeNum - w - h;
+ _edgeLimit = _nodeNum - w;
}
Edge _down(Node n) const {
Modified: lemon/trunk/lemon/hao_orlin.h
==============================================================================
--- lemon/trunk/lemon/hao_orlin.h (original)
+++ lemon/trunk/lemon/hao_orlin.h Fri Mar 2 19:04:28 2007
@@ -197,7 +197,6 @@
template <typename ResGraph>
void findMinCut(const Node& target, bool out, ResGraph& res_graph) {
- typedef typename Graph::Node Node;
typedef typename ResGraph::Edge ResEdge;
typedef typename ResGraph::OutEdgeIt ResOutEdgeIt;
@@ -327,7 +326,7 @@
--_level_size[(*_dist)[_target]];
_dormant[0].push_front(_target);
(*_source_set)[_target] = true;
- if ((int)_dormant[0].size() == _node_num){
+ if (int(_dormant[0].size()) == _node_num){
_dormant[0].clear();
return false;
}
Modified: lemon/trunk/lemon/hypercube_graph.h
==============================================================================
--- lemon/trunk/lemon/hypercube_graph.h (original)
+++ lemon/trunk/lemon/hypercube_graph.h Fri Mar 2 19:04:28 2007
@@ -154,7 +154,7 @@
}
bool projection(Node node, int n) const {
- return (bool)(node.id & (1 << n));
+ return static_cast<bool>(node.id & (1 << n));
}
int dimension(Edge edge) const {
@@ -165,8 +165,8 @@
return node.id;
}
- Node operator()(int index) const {
- return Node(index);
+ Node operator()(int ix) const {
+ return Node(ix);
}
private:
@@ -236,8 +236,8 @@
/// \brief Gives back the node by its index.
///
/// Gives back the node by its index.
- Node operator()(int index) const {
- return Parent::operator()(index);
+ Node operator()(int ix) const {
+ return Parent::operator()(ix);
}
/// \brief Number of nodes.
Modified: lemon/trunk/lemon/iterable_maps.h
==============================================================================
--- lemon/trunk/lemon/iterable_maps.h (original)
+++ lemon/trunk/lemon/iterable_maps.h Fri Mar 2 19:04:28 2007
@@ -97,7 +97,7 @@
public:
Reference& operator=(const Reference& value) {
- _map.set(_key, (bool)value);
+ _map.set(_key, static_cast<bool>(value));
return *this;
}
@@ -247,7 +247,7 @@
/// keys which mapped to false.
/// \param _map The IterableIntMap
explicit FalseIt(const IterableBoolMap& _map)
- : Parent(_map.sep < (int)_map.array.size() ?
+ : Parent(_map.sep < int(_map.array.size()) ?
_map.array.back() : INVALID), map(&_map) {}
/// \brief Invalid constructor \& conversion.
@@ -288,7 +288,7 @@
/// \param value Which elements should be iterated.
ItemIt(const IterableBoolMap& _map, bool value)
: Parent(value ? (_map.sep > 0 ? _map.array[_map.sep - 1] : INVALID) :
- (_map.sep < (int)_map.array.size() ?
+ (_map.sep < int(_map.array.size()) ?
_map.array.back() : INVALID)), map(&_map) {}
/// \brief Invalid constructor \& conversion.
@@ -321,7 +321,7 @@
virtual void add(const std::vector<Key>& keys) {
Parent::add(keys);
- for (int i = 0; i < (int)keys.size(); ++i) {
+ for (int i = 0; i < int(keys.size()); ++i) {
Parent::set(keys[i], array.size());
array.push_back(keys[i]);
}
@@ -345,7 +345,7 @@
}
virtual void erase(const std::vector<Key>& keys) {
- for (int i = 0; i < (int)keys.size(); ++i) {
+ for (int i = 0; i < int(keys.size()); ++i) {
int pos = position(keys[i]);
if (pos < sep) {
--sep;
@@ -456,7 +456,7 @@
void lace(const Key& key) {
typename Parent::Value& node = Parent::operator[](key);
if (node.value < 0) return;
- if (node.value >= (int)first.size()) {
+ if (node.value >= int(first.size())) {
first.resize(node.value + 1, INVALID);
}
node.prev = INVALID;
@@ -484,7 +484,7 @@
public:
Reference& operator=(const Reference& value) {
- _map.set(_key, (const int&)value);
+ _map.set(_key, static_cast<const int&>(value));
return *this;
}
@@ -617,7 +617,7 @@
/// \param map The IterableIntMap
/// \param value The value
ItemIt(const IterableIntMap& map, int value) : _map(&map) {
- if (value < 0 || value >= (int)_map->first.size()) {
+ if (value < 0 || value >= int(_map->first.size())) {
Parent::operator=(INVALID);
} else {
Parent::operator=(_map->first[value]);
@@ -646,7 +646,7 @@
}
virtual void erase(const std::vector<Key>& keys) {
- for (int i = 0; i < (int)keys.size(); ++i) {
+ for (int i = 0; i < int(keys.size()); ++i) {
unlace(keys[i]);
}
Parent::erase(keys);
@@ -884,7 +884,7 @@
virtual void add(const std::vector<Key>& keys) {
Parent::add(keys);
- for (int i = 0; i < (int)keys.size(); ++i) {
+ for (int i = 0; i < int(keys.size()); ++i) {
lace(keys[i]);
}
}
@@ -895,7 +895,7 @@
}
virtual void erase(const std::vector<Key>& keys) {
- for (int i = 0; i < (int)keys.size(); ++i) {
+ for (int i = 0; i < int(keys.size()); ++i) {
unlace(keys[i]);
}
Parent::erase(keys);
Modified: lemon/trunk/lemon/johnson.h
==============================================================================
--- lemon/trunk/lemon/johnson.h (original)
+++ lemon/trunk/lemon/johnson.h Fri Mar 2 19:04:28 2007
@@ -563,9 +563,9 @@
BellmanFordType bellmanford(*graph, *length);
- NullMap<Node, Edge> predMap;
+ NullMap<Node, Edge> pm;
- bellmanford.predMap(predMap);
+ bellmanford.predMap(pm);
bellmanford.init(OperationTraits::zero());
bellmanford.start();
@@ -590,9 +590,9 @@
BellmanFordType bellmanford(*graph, *length);
- NullMap<Node, Edge> predMap;
+ NullMap<Node, Edge> pm;
- bellmanford.predMap(predMap);
+ bellmanford.predMap(pm);
bellmanford.init(OperationTraits::zero());
if (!bellmanford.checkedStart()) return false;
Modified: lemon/trunk/lemon/kruskal.h
==============================================================================
--- lemon/trunk/lemon/kruskal.h (original)
+++ lemon/trunk/lemon/kruskal.h Fri Mar 2 19:04:28 2007
@@ -102,8 +102,9 @@
// ,typename OUT::Key = OUT::Key()
// //,typename OUT::Key = typename GR::Edge()
const typename IN::value_type::first_type * =
- (const typename IN::value_type::first_type *)(0),
- const typename OUT::Key * = (const typename OUT::Key *)(0)
+ reinterpret_cast<const typename IN::value_type::first_type*>(0),
+ const typename OUT::Key * =
+ reinterpret_cast<const typename OUT::Key*>(0)
)
#endif
{
@@ -170,8 +171,9 @@
// typename IN::value_type::first_type = typename GR::Edge(),
// typename OUT::Key = GR::Edge()
const typename IN::value_type::first_type * =
- (const typename IN::value_type::first_type *)(0),
- const typename OUT::Key * = (const typename OUT::Key *)(0)
+ reinterpret_cast<const typename IN::value_type::first_type*>(0),
+ const typename OUT::Key * =
+ reinterpret_cast<const typename OUT::Key*>(0)
)
{
NonConstMapWr<OUT> map_wr(out_map);
@@ -357,8 +359,10 @@
// typename IN::Key = typename GR::Edge(),
//typename IN::Key = typename IN::Key (),
// typename RET::Key = typename GR::Edge()
- const typename IN::Key * = (const typename IN::Key *)(0),
- const typename RET::Key * = (const typename RET::Key *)(0)
+ const typename IN::Key * =
+ reinterpret_cast<const typename IN::Key*>(0),
+ const typename RET::Key * =
+ reinterpret_cast<const typename RET::Key*>(0)
)
{
return kruskal(g,
@@ -407,7 +411,7 @@
const IN& in,
RET out,
const typename RET::value_type * =
- (const typename RET::value_type *)(0)
+ reinterpret_cast<const typename RET::value_type*>(0)
)
{
KruskalSequenceOutput<RET> _out(out);
Modified: lemon/trunk/lemon/lemon_reader.h
==============================================================================
--- lemon/trunk/lemon/lemon_reader.h (original)
+++ lemon/trunk/lemon/lemon_reader.h Fri Mar 2 19:04:28 2007
@@ -533,7 +533,7 @@
virtual std::streambuf* setbuf(char *buf, std::streamsize len) {
if (base()) return 0;
- if (buf != 0 && len >= (int)sizeof(small_buf)) {
+ if (buf != 0 && len >= int(sizeof(small_buf))) {
setb(buf, len);
} else {
setb(small_buf, sizeof(small_buf));
@@ -709,8 +709,8 @@
char buf[2048];
FilterStreamBuf buffer(*is, line_num);
buffer.pubsetbuf(buf, sizeof(buf));
- std::istream is(&buffer);
- it->first->read(is);
+ std::istream ss(&buffer);
+ it->first->read(ss);
break;
}
}
@@ -797,51 +797,51 @@
///
/// Add a new node map reader command for the reader.
template <typename Map>
- NodeSetReader& readNodeMap(std::string name, Map& map) {
+ NodeSetReader& readNodeMap(std::string label, Map& map) {
return _readMap<
typename Traits::template Reader<typename Map::Value>, Map,
- typename _reader_bits::Arg<Map>::Type>(name, map);
+ typename _reader_bits::Arg<Map>::Type>(label, map);
}
template <typename Map>
- NodeSetReader& readNodeMap(std::string name, const Map& map) {
+ NodeSetReader& readNodeMap(std::string label, const Map& map) {
return _readMap<
typename Traits::template Reader<typename Map::Value>, Map,
- typename _reader_bits::Arg<Map>::Type>(name, map);
+ typename _reader_bits::Arg<Map>::Type>(label, map);
}
/// \brief Add a new node map reader command for the reader.
///
/// Add a new node map reader command for the reader.
- template <typename Reader, typename Map>
- NodeSetReader& readNodeMap(std::string name, Map& map,
- const Reader& reader = Reader()) {
- return _readMap<Reader, Map, typename _reader_bits::Arg<Map>::Type>
- (name, map, reader);
+ template <typename ItemReader, typename Map>
+ NodeSetReader& readNodeMap(std::string label, Map& map,
+ const ItemReader& ir = ItemReader()) {
+ return _readMap<ItemReader, Map, typename _reader_bits::Arg<Map>::Type>
+ (label, map, ir);
}
- template <typename Reader, typename Map>
- NodeSetReader& readNodeMap(std::string name, const Map& map,
- const Reader& reader = Reader()) {
- return _readMap<Reader, Map, typename _reader_bits::Arg<Map>::Type>
- (name, map, reader);
+ template <typename ItemReader, typename Map>
+ NodeSetReader& readNodeMap(std::string label, const Map& map,
+ const ItemReader& ir = ItemReader()) {
+ return _readMap<ItemReader, Map, typename _reader_bits::Arg<Map>::Type>
+ (label, map, ir);
}
private:
- template <typename Reader, typename Map, typename MapParameter>
- NodeSetReader& _readMap(std::string name, MapParameter map,
- const Reader& reader = Reader()) {
+ template <typename ItemReader, typename Map, typename MapParameter>
+ NodeSetReader& _readMap(std::string label, MapParameter map,
+ const ItemReader& ir = ItemReader()) {
checkConcept<concepts::WriteMap<Node, typename Map::Value>, Map>();
- checkConcept<_reader_bits::ItemReader<typename Map::Value>, Reader>();
- if (readers.find(name) != readers.end()) {
+ checkConcept<_reader_bits::ItemReader<typename Map::Value>, ItemReader>();
+ if (readers.find(label) != readers.end()) {
ErrorMessage msg;
- msg << "Multiple read rule for node map: " << name;
+ msg << "Multiple read rule for node map: " << label;
throw IoParameterError(msg.message());
}
readers.insert(
- make_pair(name, new _reader_bits::
- MapReader<Node, Map, Reader>(map, reader)));
+ make_pair(label, new _reader_bits::
+ MapReader<Node, Map, ItemReader>(map, ir)));
return *this;
}
@@ -850,16 +850,16 @@
/// \brief Add a new node map skipper command for the reader.
///
/// Add a new node map skipper command for the reader.
- template <typename Reader>
- NodeSetReader& skipNodeMap(std::string name,
- const Reader& reader = Reader()) {
- if (readers.find(name) != readers.end()) {
+ template <typename ItemReader>
+ NodeSetReader& skipNodeMap(std::string label,
+ const ItemReader& ir = ItemReader()) {
+ if (readers.find(label) != readers.end()) {
ErrorMessage msg;
- msg << "Multiple read rule for node map: " << name;
+ msg << "Multiple read rule for node map: " << label;
throw IoParameterError(msg.message());
}
- readers.insert(make_pair(name, new _reader_bits::
- SkipReader<Node, Reader>(reader)));
+ readers.insert(make_pair(label, new _reader_bits::
+ SkipReader<Node, ItemReader>(ir)));
return *this;
}
@@ -885,21 +885,23 @@
std::vector<_reader_bits::MapReaderBase<Node>* > index;
std::string line;
- getline(is, line);
- std::istringstream ls(line);
- std::string id;
- while (ls >> id) {
- typename MapReaders::iterator it = readers.find(id);
- if (it != readers.end()) {
- it->second->touch();
- index.push_back(it->second);
- } else {
- index.push_back(&skipper);
- }
- if (id == "label") {
- inverter.reset(index.back()->getInverter());
- index.back() = inverter.get();
- }
+ {
+ getline(is, line);
+ std::istringstream ls(line);
+ std::string id;
+ while (ls >> id) {
+ typename MapReaders::iterator it = readers.find(id);
+ if (it != readers.end()) {
+ it->second->touch();
+ index.push_back(it->second);
+ } else {
+ index.push_back(&skipper);
+ }
+ if (id == "label") {
+ inverter.reset(index.back()->getInverter());
+ index.back() = inverter.get();
+ }
+ }
}
for (typename MapReaders::iterator it = readers.begin();
it != readers.end(); ++it) {
@@ -912,7 +914,7 @@
while (getline(is, line)) {
Node node = graph.addNode();
std::istringstream ls(line);
- for (int i = 0; i < (int)index.size(); ++i) {
+ for (int i = 0; i < int(index.size()); ++i) {
index[i]->read(ls, node);
}
}
@@ -1027,51 +1029,51 @@
///
/// Add a new edge map reader command for the reader.
template <typename Map>
- EdgeSetReader& readEdgeMap(std::string name, Map& map) {
+ EdgeSetReader& readEdgeMap(std::string label, Map& map) {
return _readMap<
typename Traits::template Reader<typename Map::Value>, Map,
- typename _reader_bits::Arg<Map>::Type>(name, map);
+ typename _reader_bits::Arg<Map>::Type>(label, map);
}
template <typename Map>
- EdgeSetReader& readEdgeMap(std::string name, const Map& map) {
+ EdgeSetReader& readEdgeMap(std::string label, const Map& map) {
return _readMap<
typename Traits::template Reader<typename Map::Value>, Map,
- typename _reader_bits::Arg<Map>::Type>(name, map);
+ typename _reader_bits::Arg<Map>::Type>(label, map);
}
/// \brief Add a new edge map reader command for the reader.
///
/// Add a new edge map reader command for the reader.
- template <typename Reader, typename Map>
- EdgeSetReader& readEdgeMap(std::string name, Map& map,
- const Reader& reader = Reader()) {
- return _readMap<Reader, Map,
- typename _reader_bits::Arg<Map>::Type>(name, map, reader);
+ template <typename ItemReader, typename Map>
+ EdgeSetReader& readEdgeMap(std::string label, Map& map,
+ const ItemReader& ir = ItemReader()) {
+ return _readMap<ItemReader, Map,
+ typename _reader_bits::Arg<Map>::Type>(label, map, ir);
}
- template <typename Reader, typename Map>
- EdgeSetReader& readEdgeMap(std::string name, const Map& map,
- const Reader& reader = Reader()) {
- return _readMap<Reader, Map,
- typename _reader_bits::Arg<Map>::Type>(name, map, reader);
+ template <typename ItemReader, typename Map>
+ EdgeSetReader& readEdgeMap(std::string label, const Map& map,
+ const ItemReader& ir = ItemReader()) {
+ return _readMap<ItemReader, Map,
+ typename _reader_bits::Arg<Map>::Type>(label, map, ir);
}
private:
- template <typename Reader, typename Map, typename MapParameter>
- EdgeSetReader& _readMap(std::string name, MapParameter map,
- const Reader& reader = Reader()) {
+ template <typename ItemReader, typename Map, typename MapParameter>
+ EdgeSetReader& _readMap(std::string label, MapParameter map,
+ const ItemReader& ir = ItemReader()) {
checkConcept<concepts::WriteMap<Edge, typename Map::Value>, Map>();
- checkConcept<_reader_bits::ItemReader<typename Map::Value>, Reader>();
- if (readers.find(name) != readers.end()) {
+ checkConcept<_reader_bits::ItemReader<typename Map::Value>, ItemReader>();
+ if (readers.find(label) != readers.end()) {
ErrorMessage msg;
- msg << "Multiple read rule for edge map: " << name;
+ msg << "Multiple read rule for edge map: " << label;
throw IoParameterError(msg.message());
}
readers.insert(
- make_pair(name, new _reader_bits::
- MapReader<Edge, Map, Reader>(map, reader)));
+ make_pair(label, new _reader_bits::
+ MapReader<Edge, Map, ItemReader>(map, ir)));
return *this;
}
@@ -1080,16 +1082,16 @@
/// \brief Add a new edge map skipper command for the reader.
///
/// Add a new edge map skipper command for the reader.
- template <typename Reader>
- EdgeSetReader& skipEdgeMap(std::string name,
- const Reader& reader = Reader()) {
- if (readers.find(name) != readers.end()) {
+ template <typename ItemReader>
+ EdgeSetReader& skipEdgeMap(std::string label,
+ const ItemReader& ir = ItemReader()) {
+ if (readers.find(label) != readers.end()) {
ErrorMessage msg;
- msg << "Multiple read rule for edge map: " << name;
+ msg << "Multiple read rule for edge map: " << label;
throw IoParameterError(msg.message());
}
- readers.insert(make_pair(name, new _reader_bits::
- SkipReader<Edge, Reader>(reader)));
+ readers.insert(make_pair(label, new _reader_bits::
+ SkipReader<Edge, ItemReader>(ir)));
return *this;
}
@@ -1118,21 +1120,23 @@
std::vector<_reader_bits::MapReaderBase<Edge>* > index;
std::string line;
- getline(is, line);
- std::istringstream ls(line);
- std::string id;
- while (ls >> id) {
- typename MapReaders::iterator it = readers.find(id);
- if (it != readers.end()) {
- index.push_back(it->second);
- it->second->touch();
- } else {
- index.push_back(&skipper);
- }
- if (id == "label") {
- inverter.reset(index.back()->getInverter());
- index.back() = inverter.get();
- }
+ {
+ getline(is, line);
+ std::istringstream ls(line);
+ std::string id;
+ while (ls >> id) {
+ typename MapReaders::iterator it = readers.find(id);
+ if (it != readers.end()) {
+ index.push_back(it->second);
+ it->second->touch();
+ } else {
+ index.push_back(&skipper);
+ }
+ if (id == "label") {
+ inverter.reset(index.back()->getInverter());
+ index.back() = inverter.get();
+ }
+ }
}
for (typename MapReaders::iterator it = readers.begin();
it != readers.end(); ++it) {
@@ -1147,7 +1151,7 @@
Node from = nodeLabelReader->read(ls);
Node to = nodeLabelReader->read(ls);
Edge edge = graph.addEdge(from, to);
- for (int i = 0; i < (int)index.size(); ++i) {
+ for (int i = 0; i < int(index.size()); ++i) {
index[i]->read(ls, edge);
}
}
@@ -1271,51 +1275,51 @@
///
/// Add a new edge undirected map reader command for the reader.
template <typename Map>
- UEdgeSetReader& readUEdgeMap(std::string name, Map& map) {
+ UEdgeSetReader& readUEdgeMap(std::string label, Map& map) {
return _readMap<
typename Traits::template Reader<typename Map::Value>, Map,
- typename _reader_bits::Arg<Map>::Type>(name, map);
+ typename _reader_bits::Arg<Map>::Type>(label, map);
}
template <typename Map>
- UEdgeSetReader& readUEdgeMap(std::string name, const Map& map) {
+ UEdgeSetReader& readUEdgeMap(std::string label, const Map& map) {
return _readMap<
typename Traits::template Reader<typename Map::Value>, Map,
- typename _reader_bits::Arg<Map>::Type>(name, map);
+ typename _reader_bits::Arg<Map>::Type>(label, map);
}
/// \brief Add a new undirected edge map reader command for the reader.
///
/// Add a new edge undirected map reader command for the reader.
- template <typename Reader, typename Map>
- UEdgeSetReader& readUEdgeMap(std::string name, Map& map,
- const Reader& reader = Reader()) {
- return _readMap<Reader, Map, typename _reader_bits::Arg<Map>::Type>
- (name, map, reader);
+ template <typename ItemReader, typename Map>
+ UEdgeSetReader& readUEdgeMap(std::string label, Map& map,
+ const ItemReader& ir = ItemReader()) {
+ return _readMap<ItemReader, Map, typename _reader_bits::Arg<Map>::Type>
+ (label, map, ir);
}
- template <typename Reader, typename Map>
- UEdgeSetReader& readUEdgeMap(std::string name, const Map& map,
- const Reader& reader = Reader()) {
- return _readMap<Reader, Map, typename _reader_bits::Arg<Map>::Type >
- (name, map, reader);
+ template <typename ItemReader, typename Map>
+ UEdgeSetReader& readUEdgeMap(std::string label, const Map& map,
+ const ItemReader& ir = ItemReader()) {
+ return _readMap<ItemReader, Map, typename _reader_bits::Arg<Map>::Type >
+ (label, map, ir);
}
private:
- template <typename Reader, typename Map, typename MapParameter>
- UEdgeSetReader& _readMap(std::string name, MapParameter map,
- const Reader& reader = Reader()) {
+ template <typename ItemReader, typename Map, typename MapParameter>
+ UEdgeSetReader& _readMap(std::string label, MapParameter map,
+ const ItemReader& ir = ItemReader()) {
checkConcept<concepts::WriteMap<UEdge, typename Map::Value>, Map>();
- checkConcept<_reader_bits::ItemReader<typename Map::Value>, Reader>();
- if (readers.find(name) != readers.end()) {
+ checkConcept<_reader_bits::ItemReader<typename Map::Value>, ItemReader>();
+ if (readers.find(label) != readers.end()) {
ErrorMessage msg;
- msg << "Multiple read rule for edge map: " << name;
+ msg << "Multiple read rule for edge map: " << label;
throw IoParameterError(msg.message());
}
readers.insert(
- make_pair(name, new _reader_bits::
- MapReader<UEdge, Map, Reader>(map, reader)));
+ make_pair(label, new _reader_bits::
+ MapReader<UEdge, Map, ItemReader>(map, ir)));
return *this;
}
@@ -1324,16 +1328,16 @@
/// \brief Add a new undirected edge map skipper command for the reader.
///
/// Add a new undirected edge map skipper command for the reader.
- template <typename Reader>
- UEdgeSetReader& skipUEdgeMap(std::string name,
- const Reader& reader = Reader()) {
- if (readers.find(name) != readers.end()) {
+ template <typename ItemReader>
+ UEdgeSetReader& skipUEdgeMap(std::string label,
+ const ItemReader& ir = ItemReader()) {
+ if (readers.find(label) != readers.end()) {
ErrorMessage msg;
- msg << "Multiple read rule for node map: " << name;
+ msg << "Multiple read rule for node map: " << label;
throw IoParameterError(msg.message());
}
- readers.insert(make_pair(name, new _reader_bits::
- SkipReader<UEdge, Reader>(reader)));
+ readers.insert(make_pair(label, new _reader_bits::
+ SkipReader<UEdge, ItemReader>(ir)));
return *this;
}
@@ -1341,47 +1345,47 @@
///
/// Add a new directed edge map reader command for the reader.
template <typename Map>
- UEdgeSetReader& readEdgeMap(std::string name, Map& map) {
+ UEdgeSetReader& readEdgeMap(std::string label, Map& map) {
return _readDirMap<
typename Traits::template Reader<typename Map::Value>, Map,
- typename _reader_bits::Arg<Map>::Type>(name, map);
+ typename _reader_bits::Arg<Map>::Type>(label, map);
}
template <typename Map>
- UEdgeSetReader& readEdgeMap(std::string name, const Map& map) {
+ UEdgeSetReader& readEdgeMap(std::string label, const Map& map) {
return _readDirMap<
typename Traits::template Reader<typename Map::Value>, Map,
- typename _reader_bits::Arg<Map>::Type>(name, map);
+ typename _reader_bits::Arg<Map>::Type>(label, map);
}
/// \brief Add a new directed edge map reader command for the reader.
///
/// Add a new directed edge map reader command for the reader.
- template <typename Reader, typename Map>
- UEdgeSetReader& readEdgeMap(std::string name, Map& map,
- const Reader& reader = Reader()) {
- return _readDirMap<Reader, Map, typename _reader_bits::Arg<Map>::Type>
- (name, map, reader);
+ template <typename ItemReader, typename Map>
+ UEdgeSetReader& readEdgeMap(std::string label, Map& map,
+ const ItemReader& ir = ItemReader()) {
+ return _readDirMap<ItemReader, Map,
+ typename _reader_bits::Arg<Map>::Type>(label, map, ir);
}
- template <typename Reader, typename Map>
- UEdgeSetReader& readEdgeMap(std::string name, const Map& map,
- const Reader& reader = Reader()) {
- return _readDirMap<Reader, Map, typename _reader_bits::Arg<Map>::Type>
- (name, map, reader);
+ template <typename ItemReader, typename Map>
+ UEdgeSetReader& readEdgeMap(std::string label, const Map& map,
+ const ItemReader& ir = ItemReader()) {
+ return _readDirMap<ItemReader, Map,
+ typename _reader_bits::Arg<Map>::Type>(label, map, ir);
}
private:
- template <typename Reader, typename Map, typename MapParameter>
- UEdgeSetReader& _readDirMap(std::string name, MapParameter map,
- const Reader& reader = Reader()) {
- checkConcept<_reader_bits::ItemReader<typename Map::Value>, Reader>();
+ template <typename ItemReader, typename Map, typename MapParameter>
+ UEdgeSetReader& _readDirMap(std::string label, MapParameter map,
+ const ItemReader& ir = ItemReader()) {
+ checkConcept<_reader_bits::ItemReader<typename Map::Value>, ItemReader>();
checkConcept<concepts::WriteMap<Edge, typename Map::Value>, Map>();
- readUEdgeMap("+" + name,
- _reader_bits::forwardComposeMap(graph, map), reader);
- readUEdgeMap("-" + name,
- _reader_bits::backwardComposeMap(graph, map), reader);
+ readUEdgeMap("+" + label,
+ _reader_bits::forwardComposeMap(graph, map), ir);
+ readUEdgeMap("-" + label,
+ _reader_bits::backwardComposeMap(graph, map), ir);
return *this;
}
@@ -1390,11 +1394,11 @@
/// \brief Add a new directed edge map skipper command for the reader.
///
/// Add a new directed edge map skipper command for the reader.
- template <typename Reader>
- UEdgeSetReader& skipEdgeMap(std::string name,
- const Reader& reader = Reader()) {
- skipUEdgeMap("+" + name, reader);
- skipUEdgeMap("-" + name, reader);
+ template <typename ItemReader>
+ UEdgeSetReader& skipEdgeMap(std::string label,
+ const ItemReader& ir = ItemReader()) {
+ skipUEdgeMap("+" + label, ir);
+ skipUEdgeMap("-" + label, ir);
return *this;
}
@@ -1423,36 +1427,38 @@
std::vector<_reader_bits::MapReaderBase<UEdge>* > index;
std::string line;
- getline(is, line);
- std::istringstream ls(line);
- std::string id;
- while (ls >> id) {
- typename MapReaders::iterator it = readers.find(id);
- if (it != readers.end()) {
- index.push_back(it->second);
- it->second->touch();
- } else {
- index.push_back(&skipper);
- }
- if (id == "label") {
- inverter.reset(index.back()->getInverter());
- index.back() = inverter.get();
- }
- }
- for (typename MapReaders::iterator it = readers.begin();
- it != readers.end(); ++it) {
- if (!it->second->touched()) {
- ErrorMessage msg;
- msg << "Map not found in file: " << it->first;
- throw IoParameterError(msg.message());
- }
+ {
+ getline(is, line);
+ std::istringstream ls(line);
+ std::string id;
+ while (ls >> id) {
+ typename MapReaders::iterator it = readers.find(id);
+ if (it != readers.end()) {
+ index.push_back(it->second);
+ it->second->touch();
+ } else {
+ index.push_back(&skipper);
+ }
+ if (id == "label") {
+ inverter.reset(index.back()->getInverter());
+ index.back() = inverter.get();
+ }
+ }
+ for (typename MapReaders::iterator it = readers.begin();
+ it != readers.end(); ++it) {
+ if (!it->second->touched()) {
+ ErrorMessage msg;
+ msg << "Map not found in file: " << it->first;
+ throw IoParameterError(msg.message());
+ }
+ }
}
while (getline(is, line)) {
std::istringstream ls(line);
Node from = nodeLabelReader->read(ls);
Node to = nodeLabelReader->read(ls);
UEdge edge = graph.addEdge(from, to);
- for (int i = 0; i < (int)index.size(); ++i) {
+ for (int i = 0; i < int(index.size()); ++i) {
index[i]->read(ls, edge);
}
}
@@ -1563,13 +1569,13 @@
/// \brief Add a node reader command for the NodeReader.
///
/// Add a node reader command for the NodeReader.
- void readNode(const std::string& name, Node& item) {
- if (readers.find(name) != readers.end()) {
+ void readNode(std::string label, Node& item) {
+ if (readers.find(label) != readers.end()) {
ErrorMessage msg;
- msg << "Multiple read rule for node: " << name;
+ msg << "Multiple read rule for node: " << label;
throw IoParameterError(msg.message());
}
- readers.insert(make_pair(name, _reader_bits::ItemStore<Node>(item)));
+ readers.insert(make_pair(label, _reader_bits::ItemStore<Node>(item)));
}
protected:
@@ -1676,13 +1682,13 @@
/// \brief Add an edge reader command for the EdgeReader.
///
/// Add an edge reader command for the EdgeReader.
- void readEdge(const std::string& name, Edge& item) {
- if (readers.find(name) != readers.end()) {
+ void readEdge(std::string label, Edge& item) {
+ if (readers.find(label) != readers.end()) {
ErrorMessage msg;
- msg << "Multiple read rule for edge: " << name;
+ msg << "Multiple read rule for edge: " << label;
throw IoParameterError(msg.message());
}
- readers.insert(make_pair(name, _reader_bits::ItemStore<Edge>(item)));
+ readers.insert(make_pair(label, _reader_bits::ItemStore<Edge>(item)));
}
protected:
@@ -1794,26 +1800,26 @@
/// \brief Add an undirected edge reader command for the UEdgeReader.
///
/// Add an undirected edge reader command for the UEdgeReader.
- void readUEdge(const std::string& name, UEdge& item) {
- if (uEdgeReaders.find(name) != uEdgeReaders.end()) {
+ void readUEdge(std::string label, UEdge& item) {
+ if (uEdgeReaders.find(label) != uEdgeReaders.end()) {
ErrorMessage msg;
- msg << "Multiple read rule for undirected edge: " << name;
+ msg << "Multiple read rule for undirected edge: " << label;
throw IoParameterError(msg.message());
}
- uEdgeReaders.insert(make_pair(name, _reader_bits::
+ uEdgeReaders.insert(make_pair(label, _reader_bits::
ItemStore<UEdge>(item)));
}
/// \brief Add an edge reader command for the UEdgeReader.
///
/// Add an edge reader command for the UEdgeReader.
- void readEdge(const std::string& name, Edge& item) {
- if (edgeReaders.find(name) != edgeReaders.end()) {
+ void readEdge(std::string label, Edge& item) {
+ if (edgeReaders.find(label) != edgeReaders.end()) {
ErrorMessage msg;
- msg << "Multiple read rule for edge: " << name;
+ msg << "Multiple read rule for edge: " << label;
throw IoParameterError(msg.message());
}
- edgeReaders.insert(make_pair(name, _reader_bits::ItemStore<Edge>(item)));
+ edgeReaders.insert(make_pair(label, _reader_bits::ItemStore<Edge>(item)));
}
protected:
@@ -1953,17 +1959,17 @@
/// \brief Add an attribute reader command for the reader.
///
/// Add an attribute reader command for the reader.
- template <typename Reader, typename Value>
- AttributeReader& readAttribute(const std::string& name, Value& value,
- const Reader& reader = Reader()) {
- checkConcept<_reader_bits::ItemReader<Value>, Reader>();
- if (readers.find(name) != readers.end()) {
+ template <typename ItemReader, typename Value>
+ AttributeReader& readAttribute(std::string label, Value& value,
+ const ItemReader& ir = ItemReader()) {
+ checkConcept<_reader_bits::ItemReader<Value>, ItemReader>();
+ if (readers.find(label) != readers.end()) {
ErrorMessage msg;
- msg << "Multiple read rule for attribute: " << name;
+ msg << "Multiple read rule for attribute: " << label;
throw IoParameterError(msg.message());
}
- readers.insert(make_pair(name, new _reader_bits::
- ValueReader<Value, Reader>(value, reader)));
+ readers.insert(make_pair(label, new _reader_bits::
+ ValueReader<Value, ItemReader>(value, ir)));
return *this;
}
Modified: lemon/trunk/lemon/lemon_writer.h
==============================================================================
--- lemon/trunk/lemon/lemon_writer.h (original)
+++ lemon/trunk/lemon/lemon_writer.h Fri Mar 2 19:04:28 2007
@@ -472,22 +472,22 @@
///
/// Add a new node map writer command for the writer.
template <typename Map>
- NodeSetWriter& writeNodeMap(std::string name, const Map& map) {
+ NodeSetWriter& writeNodeMap(std::string label, const Map& map) {
return writeNodeMap<typename Traits::
- template Writer<typename Map::Value>, Map>(name, map);
+ template Writer<typename Map::Value>, Map>(label, map);
}
/// \brief Add a new node map writer command for the writer.
///
/// Add a new node map writer command for the writer.
- template <typename Writer, typename Map>
- NodeSetWriter& writeNodeMap(std::string name, const Map& map,
- const Writer& writer = Writer()) {
+ template <typename ItemWriter, typename Map>
+ NodeSetWriter& writeNodeMap(std::string label, const Map& map,
+ const ItemWriter& iw = ItemWriter()) {
checkConcept<concepts::ReadMap<Node, typename Map::Value>, Map>();
- checkConcept<_writer_bits::ItemWriter<typename Map::Value>, Writer>();
+ checkConcept<_writer_bits::ItemWriter<typename Map::Value>,ItemWriter>();
writers.push_back(
- make_pair(name, new _writer_bits::
- MapWriter<Node, Map, Writer>(map, writer)));
+ make_pair(label, new _writer_bits::
+ MapWriter<Node, Map, ItemWriter>(map, iw)));
return *this;
}
@@ -504,7 +504,7 @@
///
/// Write the content of the section.
virtual void write(std::ostream& os) {
- for (int i = 0; i < (int)writers.size(); ++i) {
+ for (int i = 0; i < int(writers.size()); ++i) {
if (writers[i].first == "label") {
labelMap = writers[i].second;
forceLabelMap = false;
@@ -528,7 +528,7 @@
if (forceLabelMap) {
os << "label\t";
}
- for (int i = 0; i < (int)writers.size(); ++i) {
+ for (int i = 0; i < int(writers.size()); ++i) {
os << writers[i].first << '\t';
}
os << std::endl;
@@ -537,7 +537,7 @@
if (forceLabelMap) {
os << graph.id(*it) << '\t';
}
- for (int i = 0; i < (int)writers.size(); ++i) {
+ for (int i = 0; i < int(writers.size()); ++i) {
writers[i].second->write(os, *it);
os << '\t';
}
@@ -661,22 +661,22 @@
///
/// Add a new edge map writer command for the writer.
template <typename Map>
- EdgeSetWriter& writeEdgeMap(std::string name, const Map& map) {
+ EdgeSetWriter& writeEdgeMap(std::string label, const Map& map) {
return writeEdgeMap<typename Traits::
- template Writer<typename Map::Value>, Map>(name, map);
+ template Writer<typename Map::Value>, Map>(label, map);
}
/// \brief Add a new edge map writer command for the writer.
///
/// Add a new edge map writer command for the writer.
- template <typename Writer, typename Map>
- EdgeSetWriter& writeEdgeMap(std::string name, const Map& map,
- const Writer& writer = Writer()) {
+ template <typename ItemWriter, typename Map>
+ EdgeSetWriter& writeEdgeMap(std::string label, const Map& map,
+ const ItemWriter& iw = ItemWriter()) {
checkConcept<concepts::ReadMap<Edge, typename Map::Value>, Map>();
- checkConcept<_writer_bits::ItemWriter<typename Map::Value>, Writer>();
+ checkConcept<_writer_bits::ItemWriter<typename Map::Value>, ItemWriter>();
writers.push_back(
- make_pair(name, new _writer_bits::
- MapWriter<Edge, Map, Writer>(map, writer)));
+ make_pair(label, new _writer_bits::
+ MapWriter<Edge, Map, ItemWriter>(map, iw)));
return *this;
}
@@ -696,7 +696,7 @@
if (!nodeLabelWriter->isLabelWriter()) {
throw DataFormatError("Cannot find nodeset or label map");
}
- for (int i = 0; i < (int)writers.size(); ++i) {
+ for (int i = 0; i < int(writers.size()); ++i) {
if (writers[i].first == "label") {
labelMap = writers[i].second;
forceLabelMap = false;
@@ -721,7 +721,7 @@
if (forceLabelMap) {
os << "label\t";
}
- for (int i = 0; i < (int)writers.size(); ++i) {
+ for (int i = 0; i < int(writers.size()); ++i) {
os << writers[i].first << '\t';
}
os << std::endl;
@@ -734,7 +734,7 @@
if (forceLabelMap) {
os << graph.id(*it) << '\t';
}
- for (int i = 0; i < (int)writers.size(); ++i) {
+ for (int i = 0; i < int(writers.size()); ++i) {
writers[i].second->write(os, *it);
os << '\t';
}
@@ -867,22 +867,22 @@
///
/// Add a new undirected map writer command for the writer.
template <typename Map>
- UEdgeSetWriter& writeUEdgeMap(std::string name, const Map& map) {
+ UEdgeSetWriter& writeUEdgeMap(std::string label, const Map& map) {
return writeUEdgeMap<typename Traits::
- template Writer<typename Map::Value>, Map>(name, map);
+ template Writer<typename Map::Value>, Map>(label, map);
}
/// \brief Add a new undirected map writer command for the writer.
///
/// Add a new undirected map writer command for the writer.
- template <typename Writer, typename Map>
- UEdgeSetWriter& writeUEdgeMap(std::string name, const Map& map,
- const Writer& writer = Writer()) {
+ template <typename ItemWriter, typename Map>
+ UEdgeSetWriter& writeUEdgeMap(std::string label, const Map& map,
+ const ItemWriter& iw = ItemWriter()) {
checkConcept<concepts::ReadMap<UEdge, typename Map::Value>, Map>();
- checkConcept<_writer_bits::ItemWriter<typename Map::Value>, Writer>();
+ checkConcept<_writer_bits::ItemWriter<typename Map::Value>, ItemWriter>();
writers.push_back(
- make_pair(name, new _writer_bits::
- MapWriter<UEdge, Map, Writer>(map, writer)));
+ make_pair(label, new _writer_bits::
+ MapWriter<UEdge, Map, ItemWriter>(map, iw)));
return *this;
}
@@ -890,23 +890,23 @@
///
/// Add a new directed map writer command for the writer.
template <typename Map>
- UEdgeSetWriter& writeEdgeMap(std::string name, const Map& map) {
+ UEdgeSetWriter& writeEdgeMap(std::string label, const Map& map) {
return writeEdgeMap<typename Traits::
- template Writer<typename Map::Value>, Map>(name, map);
+ template Writer<typename Map::Value>, Map>(label, map);
}
/// \brief Add a new directed map writer command for the writer.
///
/// Add a new directed map writer command for the writer.
- template <typename Writer, typename Map>
- UEdgeSetWriter& writeEdgeMap(std::string name, const Map& map,
- const Writer& writer = Writer()) {
+ template <typename ItemWriter, typename Map>
+ UEdgeSetWriter& writeEdgeMap(std::string label, const Map& map,
+ const ItemWriter& iw = ItemWriter()) {
checkConcept<concepts::ReadMap<Edge, typename Map::Value>, Map>();
- checkConcept<_writer_bits::ItemWriter<typename Map::Value>, Writer>();
+ checkConcept<_writer_bits::ItemWriter<typename Map::Value>, ItemWriter>();
writeUEdgeMap("+" + name,
- _writer_bits::forwardComposeMap(graph, map), writer);
+ _writer_bits::forwardComposeMap(graph, map), iw);
writeUEdgeMap("-" + name,
- _writer_bits::backwardComposeMap(graph, map), writer);
+ _writer_bits::backwardComposeMap(graph, map), iw);
return *this;
}
@@ -926,7 +926,7 @@
if (!nodeLabelWriter->isLabelWriter()) {
throw DataFormatError("Cannot find nodeset or label map");
}
- for (int i = 0; i < (int)writers.size(); ++i) {
+ for (int i = 0; i < int(writers.size()); ++i) {
if (writers[i].first == "label") {
labelMap = writers[i].second;
forceLabelMap = false;
@@ -951,7 +951,7 @@
if (forceLabelMap) {
os << "label\t";
}
- for (int i = 0; i < (int)writers.size(); ++i) {
+ for (int i = 0; i < int(writers.size()); ++i) {
os << writers[i].first << '\t';
}
os << std::endl;
@@ -964,7 +964,7 @@
if (forceLabelMap) {
os << graph.id(*it) << '\t';
}
- for (int i = 0; i < (int)writers.size(); ++i) {
+ for (int i = 0; i < int(writers.size()); ++i) {
writers[i].second->write(os, *it);
os << '\t';
}
@@ -1080,8 +1080,8 @@
/// \brief Add a node writer command for the NodeWriter.
///
/// Add a node writer command for the NodeWriter.
- void writeNode(const std::string& name, const Node& item) {
- writers.push_back(make_pair(name, &item));
+ void writeNode(std::string label, const Node& item) {
+ writers.push_back(make_pair(label, &item));
}
protected:
@@ -1100,7 +1100,7 @@
if (!labelWriter->isLabelWriter()) {
throw DataFormatError("Cannot find nodeset or label map");
}
- for (int i = 0; i < (int)writers.size(); ++i) {
+ for (int i = 0; i < int(writers.size()); ++i) {
os << writers[i].first << ' ';
labelWriter->write(os, *(writers[i].second));
os << std::endl;
@@ -1164,8 +1164,8 @@
/// \brief Add an edge writer command for the EdgeWriter.
///
/// Add an edge writer command for the EdgeWriter.
- void writeEdge(const std::string& name, const Edge& item) {
- writers.push_back(make_pair(name, &item));
+ void writeEdge(std::string label, const Edge& item) {
+ writers.push_back(make_pair(label, &item));
}
protected:
@@ -1184,7 +1184,7 @@
if (!labelWriter->isLabelWriter()) {
throw DataFormatError("Cannot find edgeset or label map");
}
- for (int i = 0; i < (int)writers.size(); ++i) {
+ for (int i = 0; i < int(writers.size()); ++i) {
os << writers[i].first << ' ';
labelWriter->write(os, *(writers[i].second));
os << std::endl;
@@ -1256,15 +1256,15 @@
/// \brief Add an edge writer command for the UEdgeWriter.
///
/// Add an edge writer command for the UEdgeWriter.
- void writeEdge(const std::string& name, const Edge& item) {
- edgeWriters.push_back(make_pair(name, &item));
+ void writeEdge(std::string label, const Edge& item) {
+ edgeWriters.push_back(make_pair(label, &item));
}
/// \brief Add an undirected edge writer command for the UEdgeWriter.
///
/// Add an undirected edge writer command for the UEdgeWriter.
- void writeUEdge(const std::string& name, const UEdge& item) {
- uEdgeWriters.push_back(make_pair(name, &item));
+ void writeUEdge(std::string label, const UEdge& item) {
+ uEdgeWriters.push_back(make_pair(label, &item));
}
protected:
@@ -1286,12 +1286,12 @@
if (!uEdgeLabelWriter->isLabelWriter()) {
throw DataFormatError("Cannot find undirected edgeset or label map");
}
- for (int i = 0; i < (int)uEdgeWriters.size(); ++i) {
+ for (int i = 0; i < int(uEdgeWriters.size()); ++i) {
os << uEdgeWriters[i].first << ' ';
uEdgeLabelWriter->write(os, *(uEdgeWriters[i].second));
os << std::endl;
}
- for (int i = 0; i < (int)edgeWriters.size(); ++i) {
+ for (int i = 0; i < int(edgeWriters.size()); ++i) {
os << edgeWriters[i].first << ' ';
edgeLabelWriter->write(os, *(edgeWriters[i].second));
os << std::endl;
@@ -1363,7 +1363,7 @@
///
/// Add an attribute writer command for the writer.
template <typename Value>
- AttributeWriter& writeAttribute(const std::string& name,
+ AttributeWriter& writeAttribute(std::string label,
const Value& value) {
return
writeAttribute<typename Traits::template Writer<Value> >(name, value);
@@ -1372,13 +1372,12 @@
/// \brief Add an attribute writer command for the writer.
///
/// Add an attribute writer command for the writer.
- template <typename Writer, typename Value>
- AttributeWriter& writeAttribute(const std::string& name,
- const Value& value,
- const Writer& writer = Writer()) {
- checkConcept<_writer_bits::ItemWriter<Value>, Writer>();
- writers.push_back(make_pair(name, new _writer_bits::
- ValueWriter<Value, Writer>(value, writer)));
+ template <typename ItemWriter, typename Value>
+ AttributeWriter& writeAttribute(std::string label, const Value& value,
+ const ItemWriter& iw = ItemWriter()) {
+ checkConcept<_writer_bits::ItemWriter<Value>, ItemWriter>();
+ writers.push_back(make_pair(label, new _writer_bits::
+ ValueWriter<Value, ItemWriter>(value, iw)));
return *this;
}
Modified: lemon/trunk/lemon/list_graph.h
==============================================================================
--- lemon/trunk/lemon/list_graph.h (original)
+++ lemon/trunk/lemon/list_graph.h Fri Mar 2 19:04:28 2007
@@ -522,16 +522,15 @@
snapshot.eraseNode(node);
}
virtual void erase(const std::vector<Node>& nodes) {
- for (int i = 0; i < (int)nodes.size(); ++i) {
+ for (int i = 0; i < int(nodes.size()); ++i) {
snapshot.eraseNode(nodes[i]);
}
}
virtual void build() {
- NodeNotifier* _notifier = notifier();
Node node;
std::vector<Node> nodes;
- for (_notifier->first(node); node != INVALID;
- _notifier->next(node)) {
+ for (notifier()->first(node); node != INVALID;
+ notifier()->next(node)) {
nodes.push_back(node);
}
for (int i = nodes.size() - 1; i >= 0; --i) {
@@ -539,10 +538,9 @@
}
}
virtual void clear() {
- NodeNotifier* _notifier = notifier();
Node node;
- for (_notifier->first(node); node != INVALID;
- _notifier->next(node)) {
+ for (notifier()->first(node); node != INVALID;
+ notifier()->next(node)) {
snapshot.eraseNode(node);
}
}
@@ -574,16 +572,15 @@
snapshot.eraseEdge(edge);
}
virtual void erase(const std::vector<Edge>& edges) {
- for (int i = 0; i < (int)edges.size(); ++i) {
+ for (int i = 0; i < int(edges.size()); ++i) {
snapshot.eraseEdge(edges[i]);
}
}
virtual void build() {
- EdgeNotifier* _notifier = notifier();
Edge edge;
std::vector<Edge> edges;
- for (_notifier->first(edge); edge != INVALID;
- _notifier->next(edge)) {
+ for (notifier()->first(edge); edge != INVALID;
+ notifier()->next(edge)) {
edges.push_back(edge);
}
for (int i = edges.size() - 1; i >= 0; --i) {
@@ -591,9 +588,9 @@
}
}
virtual void clear() {
- EdgeNotifier* _notifier = notifier();
Edge edge;
- for (_notifier->first(edge); edge != INVALID; _notifier->next(edge)) {
+ for (notifier()->first(edge); edge != INVALID;
+ notifier()->next(edge)) {
snapshot.eraseEdge(edge);
}
}
@@ -1269,16 +1266,15 @@
snapshot.eraseNode(node);
}
virtual void erase(const std::vector<Node>& nodes) {
- for (int i = 0; i < (int)nodes.size(); ++i) {
+ for (int i = 0; i < int(nodes.size()); ++i) {
snapshot.eraseNode(nodes[i]);
}
}
virtual void build() {
- NodeNotifier* _notifier = notifier();
Node node;
std::vector<Node> nodes;
- for (_notifier->first(node); node != INVALID;
- _notifier->next(node)) {
+ for (notifier()->first(node); node != INVALID;
+ notifier()->next(node)) {
nodes.push_back(node);
}
for (int i = nodes.size() - 1; i >= 0; --i) {
@@ -1286,10 +1282,9 @@
}
}
virtual void clear() {
- NodeNotifier* _notifier = notifier();
Node node;
- for (_notifier->first(node); node != INVALID;
- _notifier->next(node)) {
+ for (notifier()->first(node); node != INVALID;
+ notifier()->next(node)) {
snapshot.eraseNode(node);
}
}
@@ -1321,16 +1316,15 @@
snapshot.eraseUEdge(edge);
}
virtual void erase(const std::vector<UEdge>& edges) {
- for (int i = 0; i < (int)edges.size(); ++i) {
+ for (int i = 0; i < int(edges.size()); ++i) {
snapshot.eraseUEdge(edges[i]);
}
}
virtual void build() {
- UEdgeNotifier* _notifier = notifier();
UEdge edge;
std::vector<UEdge> edges;
- for (_notifier->first(edge); edge != INVALID;
- _notifier->next(edge)) {
+ for (notifier()->first(edge); edge != INVALID;
+ notifier()->next(edge)) {
edges.push_back(edge);
}
for (int i = edges.size() - 1; i >= 0; --i) {
@@ -1338,10 +1332,9 @@
}
}
virtual void clear() {
- UEdgeNotifier* _notifier = notifier();
UEdge edge;
- for (_notifier->first(edge); edge != INVALID;
- _notifier->next(edge)) {
+ for (notifier()->first(edge); edge != INVALID;
+ notifier()->next(edge)) {
snapshot.eraseUEdge(edge);
}
}
@@ -1575,29 +1568,29 @@
}
void first(UEdge& edge) const {
- int aNodeId = first_anode;
- while (aNodeId != -1 && aNodes[aNodeId].first_edge == -1) {
- aNodeId = aNodes[aNodeId].next != -1 ?
- aNodes[aNodeId].next >> 1 : -1;
+ int aid = first_anode;
+ while (aid != -1 && aNodes[aid].first_edge == -1) {
+ aid = aNodes[aid].next != -1 ?
+ aNodes[aid].next >> 1 : -1;
}
- if (aNodeId != -1) {
- edge.id = aNodes[aNodeId].first_edge;
+ if (aid != -1) {
+ edge.id = aNodes[aid].first_edge;
} else {
edge.id = -1;
}
}
void next(UEdge& edge) const {
- int aNodeId = edges[edge.id].aNode >> 1;
+ int aid = edges[edge.id].aNode >> 1;
edge.id = edges[edge.id].next_out;
if (edge.id == -1) {
- aNodeId = aNodes[aNodeId].next != -1 ?
- aNodes[aNodeId].next >> 1 : -1;
- while (aNodeId != -1 && aNodes[aNodeId].first_edge == -1) {
- aNodeId = aNodes[aNodeId].next != -1 ?
- aNodes[aNodeId].next >> 1 : -1;
+ aid = aNodes[aid].next != -1 ?
+ aNodes[aid].next >> 1 : -1;
+ while (aid != -1 && aNodes[aid].first_edge == -1) {
+ aid = aNodes[aid].next != -1 ?
+ aNodes[aid].next >> 1 : -1;
}
- if (aNodeId != -1) {
- edge.id = aNodes[aNodeId].first_edge;
+ if (aid != -1) {
+ edge.id = aNodes[aid].first_edge;
} else {
edge.id = -1;
}
@@ -1677,45 +1670,45 @@
}
Node addANode() {
- int aNodeId;
+ int aid;
if (first_free_anode == -1) {
- aNodeId = aNodes.size();
+ aid = aNodes.size();
aNodes.push_back(NodeT());
} else {
- aNodeId = first_free_anode;
+ aid = first_free_anode;
first_free_anode = aNodes[first_free_anode].next;
}
if (first_anode != -1) {
- aNodes[aNodeId].next = first_anode << 1;
- aNodes[first_anode].prev = aNodeId << 1;
+ aNodes[aid].next = first_anode << 1;
+ aNodes[first_anode].prev = aid << 1;
} else {
- aNodes[aNodeId].next = -1;
+ aNodes[aid].next = -1;
}
- aNodes[aNodeId].prev = -1;
- first_anode = aNodeId;
- aNodes[aNodeId].first_edge = -1;
- return Node(aNodeId << 1);
+ aNodes[aid].prev = -1;
+ first_anode = aid;
+ aNodes[aid].first_edge = -1;
+ return Node(aid << 1);
}
Node addBNode() {
- int bNodeId;
+ int bid;
if (first_free_bnode == -1) {
- bNodeId = bNodes.size();
+ bid = bNodes.size();
bNodes.push_back(NodeT());
} else {
- bNodeId = first_free_bnode;
+ bid = first_free_bnode;
first_free_bnode = bNodes[first_free_bnode].next;
}
if (first_bnode != -1) {
- bNodes[bNodeId].next = (first_bnode << 1) + 1;
- bNodes[first_bnode].prev = (bNodeId << 1) + 1;
+ bNodes[bid].next = (first_bnode << 1) + 1;
+ bNodes[first_bnode].prev = (bid << 1) + 1;
} else {
- bNodes[bNodeId].next = -1;
+ bNodes[bid].next = -1;
}
- bNodes[bNodeId].prev = -1;
- first_bnode = bNodeId;
- bNodes[bNodeId].first_edge = -1;
- return Node((bNodeId << 1) + 1);
+ bNodes[bid].prev = -1;
+ first_bnode = bid;
+ bNodes[bid].first_edge = -1;
+ return Node((bid << 1) + 1);
}
UEdge addEdge(const Node& source, const Node& target) {
@@ -1752,31 +1745,31 @@
void erase(const Node& node) {
if (aNode(node)) {
- int aNodeId = node.id >> 1;
- if (aNodes[aNodeId].prev != -1) {
- aNodes[aNodes[aNodeId].prev >> 1].next = aNodes[aNodeId].next;
+ int aid = node.id >> 1;
+ if (aNodes[aid].prev != -1) {
+ aNodes[aNodes[aid].prev >> 1].next = aNodes[aid].next;
} else {
first_anode =
- aNodes[aNodeId].next != -1 ? aNodes[aNodeId].next >> 1 : -1;
+ aNodes[aid].next != -1 ? aNodes[aid].next >> 1 : -1;
}
- if (aNodes[aNodeId].next != -1) {
- aNodes[aNodes[aNodeId].next >> 1].prev = aNodes[aNodeId].prev;
+ if (aNodes[aid].next != -1) {
+ aNodes[aNodes[aid].next >> 1].prev = aNodes[aid].prev;
}
- aNodes[aNodeId].next = first_free_anode;
- first_free_anode = aNodeId;
+ aNodes[aid].next = first_free_anode;
+ first_free_anode = aid;
} else {
- int bNodeId = node.id >> 1;
- if (bNodes[bNodeId].prev != -1) {
- bNodes[bNodes[bNodeId].prev >> 1].next = bNodes[bNodeId].next;
+ int bid = node.id >> 1;
+ if (bNodes[bid].prev != -1) {
+ bNodes[bNodes[bid].prev >> 1].next = bNodes[bid].next;
} else {
first_bnode =
- bNodes[bNodeId].next != -1 ? bNodes[bNodeId].next >> 1 : -1;
+ bNodes[bid].next != -1 ? bNodes[bid].next >> 1 : -1;
}
- if (bNodes[bNodeId].next != -1) {
- bNodes[bNodes[bNodeId].next >> 1].prev = bNodes[bNodeId].prev;
+ if (bNodes[bid].next != -1) {
+ bNodes[bNodes[bid].next >> 1].prev = bNodes[bid].prev;
}
- bNodes[bNodeId].next = first_free_bnode;
- first_free_bnode = bNodeId;
+ bNodes[bid].next = first_free_bnode;
+ first_free_bnode = bid;
}
}
@@ -2051,16 +2044,15 @@
snapshot.eraseNode(node);
}
virtual void erase(const std::vector<Node>& nodes) {
- for (int i = 0; i < (int)nodes.size(); ++i) {
+ for (int i = 0; i < int(nodes.size()); ++i) {
snapshot.eraseNode(nodes[i]);
}
}
virtual void build() {
- NodeNotifier* _notifier = notifier();
Node node;
std::vector<Node> nodes;
- for (_notifier->first(node); node != INVALID;
- _notifier->next(node)) {
+ for (notifier()->first(node); node != INVALID;
+ notifier()->next(node)) {
nodes.push_back(node);
}
for (int i = nodes.size() - 1; i >= 0; --i) {
@@ -2068,10 +2060,9 @@
}
}
virtual void clear() {
- NodeNotifier* _notifier = notifier();
Node node;
- for (_notifier->first(node); node != INVALID;
- _notifier->next(node)) {
+ for (notifier()->first(node); node != INVALID;
+ notifier()->next(node)) {
snapshot.eraseNode(node);
}
}
@@ -2103,16 +2094,15 @@
snapshot.eraseUEdge(edge);
}
virtual void erase(const std::vector<UEdge>& edges) {
- for (int i = 0; i < (int)edges.size(); ++i) {
+ for (int i = 0; i < int(edges.size()); ++i) {
snapshot.eraseUEdge(edges[i]);
}
}
virtual void build() {
- UEdgeNotifier* _notifier = notifier();
UEdge edge;
std::vector<UEdge> edges;
- for (_notifier->first(edge); edge != INVALID;
- _notifier->next(edge)) {
+ for (notifier()->first(edge); edge != INVALID;
+ notifier()->next(edge)) {
edges.push_back(edge);
}
for (int i = edges.size() - 1; i >= 0; --i) {
@@ -2120,10 +2110,9 @@
}
}
virtual void clear() {
- UEdgeNotifier* _notifier = notifier();
UEdge edge;
- for (_notifier->first(edge); edge != INVALID;
- _notifier->next(edge)) {
+ for (notifier()->first(edge); edge != INVALID;
+ notifier()->next(edge)) {
snapshot.eraseUEdge(edge);
}
}
Modified: lemon/trunk/lemon/lp_base.h
==============================================================================
--- lemon/trunk/lemon/lp_base.h (original)
+++ lemon/trunk/lemon/lp_base.h Fri Mar 2 19:04:28 2007
@@ -199,20 +199,20 @@
protected:
- int _lpId(const Col& col) const {
- return cols.floatingId(id(col));
+ int _lpId(const Col& c) const {
+ return cols.floatingId(id(c));
}
- int _lpId(const Row& row) const {
- return rows.floatingId(id(row));
+ int _lpId(const Row& r) const {
+ return rows.floatingId(id(r));
}
- Col _item(int id, Col) const {
- return Col(cols.fixId(id));
+ Col _item(int i, Col) const {
+ return Col(cols.fixId(i));
}
- Row _item(int id, Row) const {
- return Row(rows.fixId(id));
+ Row _item(int i, Row) const {
+ return Row(rows.fixId(i));
}
@@ -891,10 +891,10 @@
///\param obj is the corresponding component of the objective
///function. It is 0 by default.
///\return The created column.
- Col addCol(const DualExpr &e, Value obj=0) {
+ Col addCol(const DualExpr &e, Value o = 0) {
Col c=addCol();
col(c,e);
- objCoeff(c,obj);
+ objCoeff(c,o);
return c;
}
Modified: lemon/trunk/lemon/lp_glpk.cc
==============================================================================
--- lemon/trunk/lemon/lp_glpk.cc (original)
+++ lemon/trunk/lemon/lp_glpk.cc Fri Mar 2 19:04:28 2007
@@ -103,28 +103,28 @@
void LpGlpk::_eraseCol(int i) {
- int cols[2];
- cols[1]=i;
- lpx_del_cols(lp, 1, cols);
+ int ca[2];
+ ca[1]=i;
+ lpx_del_cols(lp, 1, ca);
}
void LpGlpk::_eraseRow(int i) {
- int rows[2];
- rows[1]=i;
- lpx_del_rows(lp, 1, rows);
+ int ra[2];
+ ra[1]=i;
+ lpx_del_rows(lp, 1, ra);
}
- void LpGlpk::_getColName(int col, std::string & name) const
+ void LpGlpk::_getColName(int c, std::string & name) const
{
- char *n = lpx_get_col_name(lp,col);
+ char *n = lpx_get_col_name(lp,c);
name = n?n:"";
}
- void LpGlpk::_setColName(int col, const std::string & name)
+ void LpGlpk::_setColName(int c, const std::string & name)
{
- lpx_set_col_name(lp,col,const_cast<char*>(name.c_str()));
+ lpx_set_col_name(lp,c,const_cast<char*>(name.c_str()));
}
@@ -151,14 +151,14 @@
lpx_set_mat_row(lp, i, values.size() - 1, &indices[0], &values[0]);
}
- void LpGlpk::_getRowCoeffs(int i, RowIterator b) const
+ void LpGlpk::_getRowCoeffs(int ix, RowIterator b) const
{
- int length = lpx_get_mat_row(lp, i, 0, 0);
+ int length = lpx_get_mat_row(lp, ix, 0, 0);
std::vector<int> indices(length + 1);
std::vector<Value> values(length + 1);
- lpx_get_mat_row(lp, i, &indices[0], &values[0]);
+ lpx_get_mat_row(lp, ix, &indices[0], &values[0]);
for (int i = 1; i <= length; ++i) {
*b = std::make_pair(indices[i], values[i]);
@@ -166,7 +166,7 @@
}
}
- void LpGlpk::_setColCoeffs(int i, ConstColIterator b, ConstColIterator e) {
+ void LpGlpk::_setColCoeffs(int ix, ConstColIterator b, ConstColIterator e) {
std::vector<int> indices;
std::vector<Value> values;
@@ -179,17 +179,17 @@
values.push_back(it->second);
}
- lpx_set_mat_col(lp, i, values.size() - 1, &indices[0], &values[0]);
+ lpx_set_mat_col(lp, ix, values.size() - 1, &indices[0], &values[0]);
}
- void LpGlpk::_getColCoeffs(int i, ColIterator b) const
+ void LpGlpk::_getColCoeffs(int ix, ColIterator b) const
{
- int length = lpx_get_mat_col(lp, i, 0, 0);
+ int length = lpx_get_mat_col(lp, ix, 0, 0);
std::vector<int> indices(length + 1);
std::vector<Value> values(length + 1);
- lpx_get_mat_col(lp, i, &indices[0], &values[0]);
+ lpx_get_mat_col(lp, ix, &indices[0], &values[0]);
for (int i = 1; i <= length; ++i) {
*b = std::make_pair(indices[i], values[i]);
@@ -197,23 +197,23 @@
}
}
- void LpGlpk::_setCoeff(int row, int col, Value value)
+ void LpGlpk::_setCoeff(int ix, int jx, Value value)
{
if (lpx_get_num_cols(lp) < lpx_get_num_rows(lp)) {
- int length=lpx_get_mat_row(lp, row, 0, 0);
+ int length=lpx_get_mat_row(lp, ix, 0, 0);
std::vector<int> indices(length + 2);
std::vector<Value> values(length + 2);
- lpx_get_mat_row(lp, row, &indices[0], &values[0]);
+ lpx_get_mat_row(lp, ix, &indices[0], &values[0]);
//The following code does not suppose that the elements of the
//array indices are sorted
bool found=false;
for (int i = 1; i <= length; ++i) {
- if (indices[i]==col){
+ if (indices[i]==jx){
found=true;
values[i]=value;
break;
@@ -221,26 +221,26 @@
}
if (!found){
++length;
- indices[length]=col;
+ indices[length]=jx;
values[length]=value;
}
- lpx_set_mat_row(lp, row, length, &indices[0], &values[0]);
+ lpx_set_mat_row(lp, ix, length, &indices[0], &values[0]);
} else {
- int length=lpx_get_mat_col(lp, col, 0, 0);
+ int length=lpx_get_mat_col(lp, jx, 0, 0);
std::vector<int> indices(length + 2);
std::vector<Value> values(length + 2);
- lpx_get_mat_col(lp, col, &indices[0], &values[0]);
+ lpx_get_mat_col(lp, jx, &indices[0], &values[0]);
//The following code does not suppose that the elements of the
//array indices are sorted
bool found=false;
for (int i = 1; i <= length; ++i) {
- if (indices[i]==col){
+ if (indices[i]==jx){
found=true;
values[i]=value;
break;
@@ -248,28 +248,28 @@
}
if (!found){
++length;
- indices[length]=row;
+ indices[length]=ix;
values[length]=value;
}
- lpx_set_mat_col(lp, col, length, &indices[0], &values[0]);
+ lpx_set_mat_col(lp, jx, length, &indices[0], &values[0]);
}
}
- LpGlpk::Value LpGlpk::_getCoeff(int row, int col) const
+ LpGlpk::Value LpGlpk::_getCoeff(int ix, int jx) const
{
- int length=lpx_get_mat_row(lp, row, 0, 0);
+ int length=lpx_get_mat_row(lp, ix, 0, 0);
std::vector<int> indices(length + 1);
std::vector<Value> values(length + 1);
- lpx_get_mat_row(lp, row, &indices[0], &values[0]);
+ lpx_get_mat_row(lp, ix, &indices[0], &values[0]);
//The following code does not suppose that the elements of the
//array indices are sorted
for (int i = 1; i <= length; ++i) {
- if (indices[i]==col){
+ if (indices[i]==jx){
return values[i];
}
}
Modified: lemon/trunk/lemon/lp_soplex.cc
==============================================================================
--- lemon/trunk/lemon/lp_soplex.cc (original)
+++ lemon/trunk/lemon/lp_soplex.cc Fri Mar 2 19:04:28 2007
@@ -44,15 +44,15 @@
LpSolverBase &LpSoplex::_copyLp() {
LpSoplex* newlp = new LpSoplex();
- ((soplex::SPxLP&)*(newlp->soplex)) = *soplex;
+ (*static_cast<soplex::SPxLP*>(newlp->soplex)) = *soplex;
return *newlp;
}
int LpSoplex::_addCol() {
- soplex::LPCol col;
- col.setLower(-soplex::infinity);
- col.setUpper(soplex::infinity);
- soplex->addCol(col);
+ soplex::LPCol c;
+ c.setLower(-soplex::infinity);
+ c.setUpper(soplex::infinity);
+ soplex->addCol(c);
colNames.push_back(std::string());
primal_value.push_back(0.0);
@@ -62,10 +62,10 @@
}
int LpSoplex::_addRow() {
- soplex::LPRow row;
- row.setLhs(-soplex::infinity);
- row.setRhs(soplex::infinity);
- soplex->addRow(row);
+ soplex::LPRow r;
+ r.setLhs(-soplex::infinity);
+ r.setRhs(soplex::infinity);
+ soplex->addRow(r);
dual_value.push_back(0.0);
solved = false;
@@ -92,15 +92,15 @@
solved = false;
}
- void LpSoplex::_getColName(int col, std::string &name) const {
- name = colNames[col];
+ void LpSoplex::_getColName(int c, std::string &name) const {
+ name = colNames[c];
}
- void LpSoplex::_setColName(int col, const std::string &name) {
- invColNames.erase(colNames[col]);
- colNames[col] = name;
+ void LpSoplex::_setColName(int c, const std::string &name) {
+ invColNames.erase(colNames[c]);
+ colNames[c] = name;
if (!name.empty()) {
- invColNames.insert(std::make_pair(name, col));
+ invColNames.insert(std::make_pair(name, c));
}
}
Modified: lemon/trunk/lemon/matrix_maps.h
==============================================================================
--- lemon/trunk/lemon/matrix_maps.h (original)
+++ lemon/trunk/lemon/matrix_maps.h Fri Mar 2 19:04:28 2007
@@ -349,19 +349,19 @@
}
virtual void add(const Key& key) {
- if (size(Parent::notifier()->id(key) + 1) >= (int)values.size()) {
+ if (size(Parent::notifier()->id(key) + 1) >= int(values.size())) {
values.resize(size(Parent::notifier()->id(key) + 1));
}
}
virtual void add(const std::vector<Key>& keys) {
int new_size = 0;
- for (int i = 0; i < (int)keys.size(); ++i) {
+ for (int i = 0; i < int(keys.size()); ++i) {
if (size(Parent::notifier()->id(keys[i]) + 1) >= new_size) {
new_size = size(Parent::notifier()->id(keys[i]) + 1);
}
}
- if (new_size > (int)values.size()) {
+ if (new_size > int(values.size())) {
values.resize(new_size);
}
}
@@ -504,19 +504,19 @@
}
virtual void add(const Key& key) {
- if (size(Parent::notifier()->id(key) + 1) >= (int)values.size()) {
+ if (size(Parent::notifier()->id(key) + 1) >= int(values.size())) {
values.resize(size(Parent::notifier()->id(key) + 1));
}
}
virtual void add(const std::vector<Key>& keys) {
int new_size = 0;
- for (int i = 0; i < (int)keys.size(); ++i) {
+ for (int i = 0; i < int(keys.size()); ++i) {
if (size(Parent::notifier()->id(keys[i]) + 1) >= new_size) {
new_size = size(Parent::notifier()->id(keys[i]) + 1);
}
}
- if (new_size > (int)values.size()) {
+ if (new_size > int(values.size())) {
values.resize(new_size);
}
}
@@ -915,17 +915,17 @@
///It adds a new FirstKey to the map. It is called by the observer
///class belongs to the FirstKey type.
void addFirstKey(const FirstKey& firstKey) {
- int size = (int)values.size();
+ int size = int(values.size());
if( _first_key_proxy.notifier()->id(firstKey)+1 >= size ){
values.resize(_first_key_proxy.notifier()->id(firstKey)+1);
- if( (int)values[0].size() != 0 ){
- int innersize = (int)values[0].size();
- for(int i=size; i!=(int)values.size();++i){
+ if( int(values[0].size()) != 0 ){
+ int innersize = int(values[0].size());
+ for(int i = size; i < int(values.size());++i){
(values[i]).resize(innersize);
}
}else if(_second_key_proxy.notifier()->maxId() >= 0){
int innersize = _second_key_proxy.notifier()->maxId();
- for(int i = 0; i != (int)values.size(); ++i){
+ for(int i = 0; i < int(values.size()); ++i){
values[0].resize(innersize);
}
}
@@ -938,23 +938,23 @@
///observer class belongs to the FirstKey type.
void addFirstKeys(const std::vector<FirstKey>& firstKeys){
int max = values.size() - 1;
- for(int i=0; i != (int)firstKeys.size(); ++i){
+ for(int i = 0; i < int(firstKeys.size()); ++i){
int id = _first_key_proxy.notifier()->id(firstKeys[i]);
if(max < id){
max = id;
}
}
- int size = (int)values.size();
+ int size = int(values.size());
if(max >= size){
values.resize(max + 1);
- if( (int)values[0].size() != 0){
- int innersize = (int)values[0].size();
- for(int i = size; i != (max + 1); ++i){
+ if( int(values[0].size()) != 0){
+ int innersize = int(values[0].size());
+ for(int i = size; i < (max + 1); ++i){
values[i].resize(innersize);
}
}else if(_second_key_proxy.notifier()->maxId() >= 0){
int innersize = _second_key_proxy.notifier()->maxId();
- for(int i = 0; i != (int)values.size(); ++i){
+ for(int i = 0; i < int(values.size()); ++i){
values[i].resize(innersize);
}
}
@@ -970,8 +970,8 @@
return;
}
int id = _second_key_proxy.notifier()->id(secondKey);
- if(id >= (int)values[0].size()){
- for(int i=0;i!=(int)values.size();++i){
+ if(id >= int(values[0].size())){
+ for(int i = 0; i < int(values.size());++i){
values[i].resize(id+1);
}
}
@@ -986,14 +986,14 @@
return;
}
int max = values[0].size();
- for(int i = 0; i != (int)secondKeys.size(); ++i){
+ for(int i = 0; i < int(secondKeys.size()); ++i){
int id = _second_key_proxy.notifier()->id(secondKeys[i]);
if(max < id){
max = id;
}
}
- if(max > (int)values[0].size()){
- for(int i = 0; i != (int)values.size(); ++i){
+ if(max > int(values[0].size())){
+ for(int i = 0; i < int(values.size()); ++i){
values[i].resize(max + 1);
}
}
@@ -1005,7 +1005,7 @@
///class belongs to the FirstKey type.
void eraseFirstKey(const FirstKey& first) {
int id = _first_key_proxy.notifier()->id(first);
- for(int i = 0; i != (int)values[id].size(); ++i){
+ for(int i = 0; i < int(values[id].size()); ++i){
values[id][i] = Value();
}
}
@@ -1015,9 +1015,9 @@
///Erase more FirstKey from the map. It called by the observer
///class belongs to the FirstKey type.
void eraseFirstKeys(const std::vector<FirstKey>& firstKeys) {
- for(int j = 0; j != (int)firstKeys.size(); ++j){
+ for(int j = 0; j < int(firstKeys.size()); ++j){
int id = _first_key_proxy.notifier()->id(firstKeys[j]);
- for(int i = 0; i != (int)values[id].size(); ++i){
+ for(int i = 0; i < int(values[id].size()); ++i){
values[id][i] = Value();
}
}
@@ -1032,7 +1032,7 @@
return;
}
int id = _second_key_proxy.notifier()->id(second);
- for(int i = 0; i != (int)values.size(); ++i){
+ for(int i = 0; i < int(values.size()); ++i){
values[i][id] = Value();
}
}
@@ -1045,9 +1045,9 @@
if(values.size() == 0){
return;
}
- for(int j = 0; j != (int)secondKeys.size(); ++j){
+ for(int j = 0; j < int(secondKeys.size()); ++j){
int id = _second_key_proxy.notifier()->id(secondKeys[j]);
- for(int i = 0; i != (int)values.size(); ++i){
+ for(int i = 0; i < int(values.size()); ++i){
values[i][id] = Value();
}
}
@@ -1059,7 +1059,7 @@
///to the FirstKey or SecondKey type.
void build() {
values.resize(_first_key_proxy.notifier()->maxId());
- for(int i=0; i!=(int)values.size(); ++i){
+ for(int i = 0; i< int(values.size()); ++i){
values[i].resize(_second_key_proxy.notifier()->maxId());
}
}
@@ -1069,7 +1069,7 @@
///It erases all items from the map. It is called by the observer class
///belongs to the FirstKey or SecondKey type.
void clear() {
- for(int i=0; i!=(int)values.size(); ++i) {
+ for(int i = 0; i < int(values.size()); ++i) {
values[i].clear();
}
values.clear();
Modified: lemon/trunk/lemon/max_matching.h
==============================================================================
--- lemon/trunk/lemon/max_matching.h (original)
+++ lemon/trunk/lemon/max_matching.h Fri Mar 2 19:04:28 2007
@@ -355,7 +355,8 @@
template <typename Graph>
void MaxMatching<Graph>::lateShrink(Node v, typename Graph::template
- NodeMap<Node>& ear, UFE& blossom, UFE& tree) {
+ NodeMap<Node>& ear, UFE& blossom,
+ UFE& tree) {
//We have one tree which we grow, and also shrink but only if it cannot be
//postponed. If we augment then we return to the "for" cycle of
//runEdmonds().
@@ -372,7 +373,8 @@
Node y=g.runningNode(e);
//growOrAugment grows if y is covered by the matching and
//augments if not. In this latter case it returns 1.
- if ( position[y]==C && growOrAugment(y, x, ear, blossom, tree, Q) ) return;
+ if ( position[y]==C && growOrAugment(y, x, ear, blossom, tree, Q) )
+ return;
}
R.push(x);
}
@@ -389,15 +391,16 @@
shrink( x, y, ear, blossom, tree, Q);
while ( !Q.empty() ) {
- Node x=Q.front();
+ Node z=Q.front();
Q.pop();
- for( IncEdgeIt e(g,x); e!= INVALID; ++e ) {
- Node y=g.runningNode(e);
+ for( IncEdgeIt f(g,z); f!= INVALID; ++f ) {
+ Node w=g.runningNode(f);
//growOrAugment grows if y is covered by the matching and
//augments if not. In this latter case it returns 1.
- if ( position[y]==C && growOrAugment(y, x, ear, blossom, tree, Q) ) return;
+ if ( position[w]==C && growOrAugment(w, z, ear, blossom, tree, Q) )
+ return;
}
- R.push(x);
+ R.push(z);
}
} //for e
} // while ( !R.empty() )
Modified: lemon/trunk/lemon/nagamochi_ibaraki.h
==============================================================================
--- lemon/trunk/lemon/nagamochi_ibaraki.h (original)
+++ lemon/trunk/lemon/nagamochi_ibaraki.h Fri Mar 2 19:04:28 2007
@@ -438,17 +438,17 @@
/// it will allocate one. The destuctor deallocates this
/// automatically allocated map, of course.
/// \return <tt> (*this) </tt>
- MaxCardinalitySearch &heap(Heap& heap, HeapCrossRef &crossRef) {
+ MaxCardinalitySearch &heap(Heap& hp, HeapCrossRef &cr) {
if(local_heap_cross_ref) {
delete _heap_cross_ref;
local_heap_cross_ref = false;
}
- _heap_cross_ref = &crossRef;
+ _heap_cross_ref = &cr;
if(local_heap) {
delete _heap;
local_heap = false;
}
- _heap = &heap;
+ _heap = &hp;
return *this;
}
@@ -1168,18 +1168,18 @@
/// it will allocate one. The destuctor deallocates this
/// automatically allocated heap and cross reference, of course.
/// \return <tt> (*this) </tt>
- NagamochiIbaraki &heap(Heap& heap, HeapCrossRef &crossRef)
+ NagamochiIbaraki &heap(Heap& hp, HeapCrossRef &cr)
{
if (local_heap_cross_ref) {
delete _heap_cross_ref;
local_heap_cross_ref=false;
}
- _heap_cross_ref = &crossRef;
+ _heap_cross_ref = &cr;
if (local_heap) {
delete _heap;
local_heap=false;
}
- _heap = &heap;
+ _heap = &hp;
return *this;
}
@@ -1318,11 +1318,11 @@
}
}
- if ((int)nodes.size() < _node_num) {
+ if (int(nodes.size()) < _node_num) {
_aux_graph->clear();
_node_num = 1;
_cut.clear();
- for (int i = 0; i < (int)nodes.size(); ++i) {
+ for (int i = 0; i < int(nodes.size()); ++i) {
typename Graph::Node n = (*_first)[nodes[i]];
while (n != INVALID) {
_cut.push_back(n);
@@ -1360,7 +1360,8 @@
}
}
- if (ufe.size((typename Ufe::ClassIt)(ufe)) == _node_num) {
+ typedef typename Ufe::ClassIt UfeCIt;
+ if (ufe.size(UfeCIt(ufe)) == _node_num) {
_aux_graph->clear();
_node_num = 1;
return true;
@@ -1372,7 +1373,7 @@
for (typename Ufe::ClassIt c(ufe); c != INVALID; ++c) {
if (ufe.size(c) == 1) continue;
for (typename Ufe::ItemIt r(ufe, c); r != INVALID; ++r) {
- if ((Node)r == (Node)c) continue;
+ if (static_cast<Node>(r) == static_cast<Node>(c)) continue;
_next->set((*_last)[c], (*_first)[r]);
_last->set(c, (*_last)[r]);
remnodes.push_back(r);
@@ -1407,7 +1408,7 @@
remedges.push_back(e);
}
- for (int i = 0; i < (int)remedges.size(); ++i) {
+ for (int i = 0; i < int(remedges.size()); ++i) {
_aux_graph->erase(remedges[i]);
}
@@ -1415,12 +1416,12 @@
{
int i = 0;
- while (i < (int)addedges.size()) {
+ while (i < int(addedges.size())) {
Node sn = addedges[i].source;
Node tn = addedges[i].target;
Value ec = addedges[i].capacity;
++i;
- while (i < (int)addedges.size() &&
+ while (i < int(addedges.size()) &&
sn == addedges[i].source && tn == addedges[i].target) {
ec += addedges[i].capacity;
++i;
@@ -1442,7 +1443,7 @@
}
- for (int i = 0; i < (int)remnodes.size(); ++i) {
+ for (int i = 0; i < int(remnodes.size()); ++i) {
_aux_graph->erase(remnodes[i]);
}
@@ -1500,7 +1501,7 @@
/// map have been set false previously.
template <typename NodeMap>
Value quickMinCut(NodeMap& nodeMap) const {
- for (int i = 0; i < (int)_cut.size(); ++i) {
+ for (int i = 0; i < int(_cut.size()); ++i) {
nodeMap.set(_cut[i], true);
}
return minCut();
Modified: lemon/trunk/lemon/path.h
==============================================================================
--- lemon/trunk/lemon/path.h (original)
+++ lemon/trunk/lemon/path.h Fri Mar 2 19:04:28 2007
@@ -140,7 +140,7 @@
///
/// \pre n is in the [0..length() - 1] range
const Edge& nth(int n) const {
- return n < (int)head.size() ? *(head.rbegin() + n) :
+ return n < int(head.size()) ? *(head.rbegin() + n) :
*(tail.begin() + (n - head.size()));
}
Modified: lemon/trunk/lemon/polynomial.h
==============================================================================
--- lemon/trunk/lemon/polynomial.h (original)
+++ lemon/trunk/lemon/polynomial.h Fri Mar 2 19:04:28 2007
@@ -50,7 +50,7 @@
///\e
template<class U> Polynomial(const Polynomial<U> &u) : _coeff(u.deg()+1)
{
- for(int i=0;i<(int)_coeff.size();i++) _coeff[i]=u[i];
+ for(int i=0;i<int(_coeff.size());i++) _coeff[i]=u[i];
}
///Query the degree of the polynomial.
@@ -111,7 +111,7 @@
///Derivate the polynomial (in place)
Polynomial &derivateMyself()
{
- for(int i=1;i<(int)_coeff.size();i++) _coeff[i-1]=i*_coeff[i];
+ for(int i=1;i<int(_coeff.size());i++) _coeff[i-1]=i*_coeff[i];
_coeff.pop_back();
return *this;
}
@@ -120,7 +120,7 @@
Polynomial derivate() const
{
Polynomial tmp(deg()-1);
- for(int i=1;i<(int)_coeff.size();i++) tmp[i-1]=i*_coeff[i];
+ for(int i=1;i<int(_coeff.size());i++) tmp[i-1]=i*_coeff[i];
return tmp;
}
@@ -138,7 +138,7 @@
{
Polynomial tmp(deg()+1);
tmp[0]=0;
- for(int i=0;i<(int)_coeff.size();i++) tmp[i+1]=_coeff[i]/(i+1);
+ for(int i=0;i<int(_coeff.size());i++) tmp[i+1]=_coeff[i]/(i+1);
return tmp;
}
@@ -147,7 +147,7 @@
Polynomial &operator+=(const Polynomial<U> &p)
{
if(p.deg()>deg()) _coeff.resize(p.deg()+1);
- for(int i=0;i<=(int)std::min(deg(),p.deg());i++)
+ for(int i=0;i<=int(std::min(deg(),p.deg()));i++)
_coeff[i]+=p[i];
return *this;
}
Modified: lemon/trunk/lemon/preflow.h
==============================================================================
--- lemon/trunk/lemon/preflow.h (original)
+++ lemon/trunk/lemon/preflow.h Fri Mar 2 19:04:28 2007
@@ -234,8 +234,8 @@
///give minimum value cuts unless calling \ref phase2().
void phase1()
{
- int heur0=(int)(H0*_node_num); //time while running 'bound decrease'
- int heur1=(int)(H1*_node_num); //time while running 'highest label'
+ int heur0=int(H0*_node_num); //time while running 'bound decrease'
+ int heur1=int(H1*_node_num); //time while running 'highest label'
int heur=heur1; //starting time interval (#of relabels)
int numrelabel=0;
Modified: lemon/trunk/lemon/radix_heap.h
==============================================================================
--- lemon/trunk/lemon/radix_heap.h (original)
+++ lemon/trunk/lemon/radix_heap.h Fri Mar 2 19:04:28 2007
@@ -150,12 +150,12 @@
private:
- bool upper(int box, Prio prio) {
- return prio < boxes[box].min;
+ bool upper(int box, Prio pr) {
+ return pr < boxes[box].min;
}
- bool lower(int box, Prio prio) {
- return prio >= boxes[box].min + boxes[box].size;
+ bool lower(int box, Prio pr) {
+ return pr >= boxes[box].min + boxes[box].size;
}
/// \brief Remove item from the box list.
@@ -187,8 +187,8 @@
/// \brief Add a new box to the box list.
void extend() {
int min = boxes.back().min + boxes.back().size;
- int size = 2 * boxes.back().size;
- boxes.push_back(RadixBox(min, size));
+ int bs = 2 * boxes.back().size;
+ boxes.push_back(RadixBox(min, bs));
}
/// \brief Move an item up into the proper box.
@@ -200,9 +200,9 @@
}
/// \brief Find up the proper box for the item with the given prio.
- int findUp(int start, int prio) {
- while (lower(start, prio)) {
- if (++start == (int)boxes.size()) {
+ int findUp(int start, int pr) {
+ while (lower(start, pr)) {
+ if (++start == int(boxes.size())) {
extend();
}
}
@@ -218,8 +218,8 @@
}
/// \brief Find up the proper box for the item with the given prio.
- int findDown(int start, int prio) {
- while (upper(start, prio)) {
+ int findDown(int start, int pr) {
+ while (upper(start, pr)) {
if (--start < 0) throw UnderFlowPriorityError();
}
return start;
@@ -260,7 +260,7 @@
}
void relocate_last(int index) {
- if (index != (int)data.size() - 1) {
+ if (index != int(data.size()) - 1) {
data[index] = data.back();
if (data[index].prev != -1) {
data[data[index].prev].next = index;
Modified: lemon/trunk/lemon/radix_sort.h
==============================================================================
--- lemon/trunk/lemon/radix_sort.h (original)
+++ lemon/trunk/lemon/radix_sort.h Fri Mar 2 19:04:28 2007
@@ -264,7 +264,7 @@
void counterIntroSort(Key *first, Key *last, Key *target,
int byte, Functor functor) {
const int size =
- (unsigned int)std::numeric_limits<unsigned char>::max() + 1;
+ unsigned(std::numeric_limits<unsigned char>::max()) + 1;
std::vector<int> counter(size);
for (int i = 0; i < size; ++i) {
counter[i] = 0;
@@ -290,7 +290,7 @@
void signedCounterIntroSort(Key *first, Key *last, Key *target,
int byte, Functor functor) {
const int size =
- (unsigned int)std::numeric_limits<unsigned char>::max() + 1;
+ unsigned(std::numeric_limits<unsigned char>::max()) + 1;
std::vector<int> counter(size);
for (int i = 0; i < size; ++i) {
counter[i] = 0;
@@ -330,7 +330,7 @@
try {
bool dir = true;
std::copy(first, last, buffer);
- for (int i = 0; i < (int)sizeof(Value) - 1; ++i) {
+ for (int i = 0; i < int(sizeof(Value)) - 1; ++i) {
if (dir) {
counterIntroSort(buffer, buffer + length, buffer + length,
i, functor);
@@ -368,7 +368,7 @@
try {
bool dir = true;
std::copy(first, last, buffer);
- for (int i = 0; i < (int)sizeof(Value); ++i) {
+ for (int i = 0; i < int(sizeof(Value)); ++i) {
if (dir) {
counterIntroSort(buffer, buffer + length,
buffer + length, i, functor);
Modified: lemon/trunk/lemon/random.h
==============================================================================
--- lemon/trunk/lemon/random.h (original)
+++ lemon/trunk/lemon/random.h Fri Mar 2 19:04:28 2007
@@ -121,19 +121,19 @@
static const int length = 312;
static const int shift = 156;
- static const Word mul = (Word)0x5851F42Du << 32 | (Word)0x4C957F2Du;
- static const Word arrayInit = (Word)0x00000000u << 32 |(Word)0x012BD6AAu;
- static const Word arrayMul1 = (Word)0x369DEA0Fu << 32 |(Word)0x31A53F85u;
- static const Word arrayMul2 = (Word)0x27BB2EE6u << 32 |(Word)0x87B0B0FDu;
+ static const Word mul = Word(0x5851F42Du) << 32 | Word(0x4C957F2Du);
+ static const Word arrayInit = Word(0x00000000u) << 32 |Word(0x012BD6AAu);
+ static const Word arrayMul1 = Word(0x369DEA0Fu) << 32 |Word(0x31A53F85u);
+ static const Word arrayMul2 = Word(0x27BB2EE6u) << 32 |Word(0x87B0B0FDu);
- static const Word mask = (Word)0xB5026F5Au << 32 | (Word)0xA96619E9u;
- static const Word loMask = ((Word)1u << 31) - 1;
+ static const Word mask = Word(0xB5026F5Au) << 32 | Word(0xA96619E9u);
+ static const Word loMask = (Word(1u) << 31) - 1;
static const Word hiMask = ~loMask;
static Word tempering(Word rnd) {
- rnd ^= (rnd >> 29) & ((Word)0x55555555u << 32 | (Word)0x55555555u);
- rnd ^= (rnd << 17) & ((Word)0x71D67FFFu << 32 | (Word)0xEDA60000u);
- rnd ^= (rnd << 37) & ((Word)0xFFF7EEE0u << 32 | (Word)0x00000000u);
+ rnd ^= (rnd >> 29) & (Word(0x55555555u) << 32 | Word(0x55555555u));
+ rnd ^= (rnd << 17) & (Word(0x71D67FFFu) << 32 | Word(0xEDA60000u));
+ rnd ^= (rnd << 37) & (Word(0xFFF7EEE0u) << 32 | Word(0x00000000u));
rnd ^= (rnd >> 43);
return rnd;
}
@@ -216,7 +216,7 @@
}
}
- state[length - 1] = (Word)1 << (bits - 1);
+ state[length - 1] = Word(1) << (bits - 1);
}
void copyState(const RandomCore& other) {
@@ -273,14 +273,14 @@
struct Masker {
static Result mask(const Result& result) {
return Masker<Result, (shift + 1) / 2>::
- mask((Result)(result | (result >> shift)));
+ mask(static_cast<Result>(result | (result >> shift)));
}
};
template <typename Result>
struct Masker<Result, 1> {
static Result mask(const Result& result) {
- return (Result)(result | (result >> 1));
+ return static_cast<Result>(result | (result >> 1));
}
};
@@ -291,7 +291,7 @@
static const int bits = std::numeric_limits<Word>::digits;
static Result convert(RandomCore<Word>& rnd) {
- return (Result)(rnd() >> (bits - rest)) << shift;
+ return static_cast<Result>(rnd() >> (bits - rest)) << shift;
}
};
@@ -301,7 +301,7 @@
static const int bits = std::numeric_limits<Word>::digits;
static Result convert(RandomCore<Word>& rnd) {
- return ((Result)rnd() << shift) |
+ return (static_cast<Result>(rnd()) << shift) |
IntConversion<Result, Word, rest - bits, shift + bits>::convert(rnd);
}
};
@@ -312,7 +312,7 @@
std::numeric_limits<Result>::digits>
struct Mapping {
static Result map(RandomCore<Word>& rnd, const Result& bound) {
- Word max = (Word)(bound - 1);
+ Word max = Word(bound - 1);
Result mask = Masker<Result>::mask(bound - 1);
Result num;
do {
@@ -325,7 +325,7 @@
template <typename Result, typename Word>
struct Mapping<Result, Word, false> {
static Result map(RandomCore<Word>& rnd, const Result& bound) {
- Word max = (Word)(bound - 1);
+ Word max = Word(bound - 1);
Word mask = Masker<Word, (std::numeric_limits<Result>::digits + 1) / 2>
::mask(max);
Word num;
@@ -341,7 +341,7 @@
static const Result multiplier() {
Result res = ShiftMultiplier<Result, exp / 2>::multiplier();
res *= res;
- if ((exp & 1) == 1) res *= (Result)2.0;
+ if ((exp & 1) == 1) res *= static_cast<Result>(2.0);
return res;
}
};
@@ -351,7 +351,7 @@
static const Result multiplier() {
Result res = ShiftMultiplier<Result, exp / 2>::multiplier();
res *= res;
- if ((exp & 1) == 1) res *= (Result)0.5;
+ if ((exp & 1) == 1) res *= static_cast<Result>(0.5);
return res;
}
};
@@ -359,35 +359,35 @@
template <typename Result>
struct ShiftMultiplier<Result, 0, true> {
static const Result multiplier() {
- return (Result)1.0;
+ return static_cast<Result>(1.0);
}
};
template <typename Result>
struct ShiftMultiplier<Result, -20, true> {
static const Result multiplier() {
- return (Result)(1.0/1048576.0);
+ return static_cast<Result>(1.0/1048576.0);
}
};
template <typename Result>
struct ShiftMultiplier<Result, -32, true> {
static const Result multiplier() {
- return (Result)(1.0/424967296.0);
+ return static_cast<Result>(1.0/424967296.0);
}
};
template <typename Result>
struct ShiftMultiplier<Result, -53, true> {
static const Result multiplier() {
- return (Result)(1.0/9007199254740992.0);
+ return static_cast<Result>(1.0/9007199254740992.0);
}
};
template <typename Result>
struct ShiftMultiplier<Result, -64, true> {
static const Result multiplier() {
- return (Result)(1.0/18446744073709551616.0);
+ return static_cast<Result>(1.0/18446744073709551616.0);
}
};
@@ -406,7 +406,7 @@
static Result convert(RandomCore<Word>& rnd) {
return Shifting<Result, - shift - rest>::
- shift((Result)(rnd() >> (bits - rest)));
+ shift(static_cast<Result>(rnd() >> (bits - rest)));
}
};
@@ -415,8 +415,10 @@
static const int bits = std::numeric_limits<Word>::digits;
static Result convert(RandomCore<Word>& rnd) {
- return Shifting<Result, - shift - bits>::shift((Result)rnd()) +
- RealConversion<Result, Word, rest-bits, shift + bits>::convert(rnd);
+ return Shifting<Result, - shift - bits>::
+ shift(static_cast<Result>(rnd())) +
+ RealConversion<Result, Word, rest-bits, shift + bits>::
+ convert(rnd);
}
};
@@ -427,7 +429,7 @@
static void init(RandomCore<Word>& rnd, Iterator begin, Iterator end) {
std::vector<Word> ws;
for (Iterator it = begin; it != end; ++it) {
- ws.push_back((Word)*it);
+ ws.push_back(Word(*it));
}
rnd.initState(ws.begin(), ws.end());
}
Modified: lemon/trunk/lemon/smart_graph.h
==============================================================================
--- lemon/trunk/lemon/smart_graph.h (original)
+++ lemon/trunk/lemon/smart_graph.h Fri Mar 2 19:04:28 2007
@@ -641,7 +641,7 @@
void saveSnapshot(Snapshot &s)
{
- s.g = this;
+ s.graph = this;
s.node_num = nodes.size();
s.edge_num = edges.size();
}
@@ -688,7 +688,7 @@
///the validity of the snapshot is not stored.
class Snapshot
{
- SmartUGraph *g;
+ SmartUGraph *graph;
protected:
friend class SmartUGraph;
unsigned int node_num;
@@ -699,7 +699,7 @@
///Default constructor.
///To actually make a snapshot you must call save().
///
- Snapshot() : g(0) {}
+ Snapshot() : graph(0) {}
///Constructor that immediately makes a snapshot
///This constructor immediately makes a snapshot of the graph.
@@ -729,7 +729,7 @@
///by restore().
void restore()
{
- g->restoreSnapshot(*this);
+ graph->restoreSnapshot(*this);
}
};
};
Modified: lemon/trunk/lemon/steiner.h
==============================================================================
--- lemon/trunk/lemon/steiner.h (original)
+++ lemon/trunk/lemon/steiner.h Fri Mar 2 19:04:28 2007
@@ -204,13 +204,13 @@
SmartUGraph::UEdgeMap<UEdge> cross(aux_graph);
{
int i = 0;
- while (i < (int)externals.size()) {
+ while (i < int(externals.size())) {
int sn = externals[i].source;
int tn = externals[i].target;
Value ev = externals[i].value;
UEdge ee = externals[i].uedge;
++i;
- while (i < (int)externals.size() &&
+ while (i < int(externals.size()) &&
sn == externals[i].source && tn == externals[i].target) {
if (externals[i].value < ev) {
ev = externals[i].value;
Modified: lemon/trunk/lemon/ugraph_adaptor.h
==============================================================================
--- lemon/trunk/lemon/ugraph_adaptor.h (original)
+++ lemon/trunk/lemon/ugraph_adaptor.h Fri Mar 2 19:04:28 2007
@@ -99,18 +99,18 @@
int uEdgeNum() const { return graph->uEdgeNum(); }
typedef FindEdgeTagIndicator<Graph> FindEdgeTag;
- Edge findEdge(const Node& source, const Node& target,
+ Edge findEdge(const Node& u, const Node& v,
const Edge& prev = INVALID) {
- return graph->findEdge(source, target, prev);
+ return graph->findEdge(u, v, prev);
}
- UEdge findUEdge(const Node& source, const Node& target,
+ UEdge findUEdge(const Node& u, const Node& v,
const UEdge& prev = INVALID) {
- return graph->findUEdge(source, target, prev);
+ return graph->findUEdge(u, v, prev);
}
Node addNode() const { return graph->addNode(); }
- UEdge addEdge(const Node& source, const Node& target) const {
- return graph->addEdge(source, target);
+ UEdge addEdge(const Node& u, const Node& v) const {
+ return graph->addEdge(u, v);
}
void erase(const Node& i) const { graph->erase(i); }
@@ -125,16 +125,16 @@
int id(const Edge& e) const { return graph->id(e); }
int id(const UEdge& e) const { return graph->id(e); }
- Node fromNodeId(int id) const {
- return graph->fromNodeId(id);
+ Node fromNodeId(int ix) const {
+ return graph->fromNodeId(ix);
}
- Edge fromEdgeId(int id) const {
- return graph->fromEdgeId(id);
+ Edge fromEdgeId(int ix) const {
+ return graph->fromEdgeId(ix);
}
- UEdge fromUEdgeId(int id) const {
- return graph->fromUEdgeId(id);
+ UEdge fromUEdgeId(int ix) const {
+ return graph->fromUEdgeId(ix);
}
int maxNodeId() const {
@@ -395,25 +395,25 @@
typedef False EdgeNumTag;
typedef FindEdgeTagIndicator<Graph> FindEdgeTag;
- Edge findEdge(const Node& source, const Node& target,
+ Edge findEdge(const Node& u, const Node& v,
const Edge& prev = INVALID) {
- if (!(*node_filter_map)[source] || !(*node_filter_map)[target]) {
+ if (!(*node_filter_map)[u] || !(*node_filter_map)[v]) {
return INVALID;
}
- Edge edge = Parent::findEdge(source, target, prev);
+ Edge edge = Parent::findEdge(u, v, prev);
while (edge != INVALID && !(*uedge_filter_map)[edge]) {
- edge = Parent::findEdge(source, target, edge);
+ edge = Parent::findEdge(u, v, edge);
}
return edge;
}
- UEdge findUEdge(const Node& source, const Node& target,
+ UEdge findUEdge(const Node& u, const Node& v,
const UEdge& prev = INVALID) {
- if (!(*node_filter_map)[source] || !(*node_filter_map)[target]) {
+ if (!(*node_filter_map)[u] || !(*node_filter_map)[v]) {
return INVALID;
}
- UEdge uedge = Parent::findUEdge(source, target, prev);
+ UEdge uedge = Parent::findUEdge(u, v, prev);
while (uedge != INVALID && !(*uedge_filter_map)[uedge]) {
- uedge = Parent::findUEdge(source, target, uedge);
+ uedge = Parent::findUEdge(u, v, uedge);
}
return uedge;
}
@@ -428,10 +428,10 @@
typedef SubMapExtender<Adaptor, typename Parent::
template NodeMap<_Value> > Parent;
- NodeMap(const Graph& graph)
- : Parent(graph) {}
- NodeMap(const Graph& graph, const _Value& value)
- : Parent(graph, value) {}
+ NodeMap(const Graph& g)
+ : Parent(g) {}
+ NodeMap(const Graph& g, const _Value& v)
+ : Parent(g, v) {}
NodeMap& operator=(const NodeMap& cmap) {
return operator=<NodeMap>(cmap);
@@ -454,10 +454,10 @@
typedef SubMapExtender<Adaptor, typename Parent::
template EdgeMap<_Value> > Parent;
- EdgeMap(const Graph& graph)
- : Parent(graph) {}
- EdgeMap(const Graph& graph, const _Value& value)
- : Parent(graph, value) {}
+ EdgeMap(const Graph& g)
+ : Parent(g) {}
+ EdgeMap(const Graph& g, const _Value& v)
+ : Parent(g, v) {}
EdgeMap& operator=(const EdgeMap& cmap) {
return operator=<EdgeMap>(cmap);
@@ -480,10 +480,10 @@
typedef SubMapExtender<Adaptor, typename Parent::
template UEdgeMap<_Value> > Parent;
- UEdgeMap(const Graph& graph)
- : Parent(graph) {}
- UEdgeMap(const Graph& graph, const _Value& value)
- : Parent(graph, value) {}
+ UEdgeMap(const Graph& g)
+ : Parent(g) {}
+ UEdgeMap(const Graph& g, const _Value& v)
+ : Parent(g, v) {}
UEdgeMap& operator=(const UEdgeMap& cmap) {
return operator=<UEdgeMap>(cmap);
@@ -622,19 +622,19 @@
typedef False EdgeNumTag;
typedef FindEdgeTagIndicator<Graph> FindEdgeTag;
- Edge findEdge(const Node& source, const Node& target,
+ Edge findEdge(const Node& u, const Node& v,
const Edge& prev = INVALID) {
- Edge edge = Parent::findEdge(source, target, prev);
+ Edge edge = Parent::findEdge(u, v, prev);
while (edge != INVALID && !(*uedge_filter_map)[edge]) {
- edge = Parent::findEdge(source, target, edge);
+ edge = Parent::findEdge(u, v, edge);
}
return edge;
}
- UEdge findUEdge(const Node& source, const Node& target,
+ UEdge findUEdge(const Node& u, const Node& v,
const UEdge& prev = INVALID) {
- UEdge uedge = Parent::findUEdge(source, target, prev);
+ UEdge uedge = Parent::findUEdge(u, v, prev);
while (uedge != INVALID && !(*uedge_filter_map)[uedge]) {
- uedge = Parent::findUEdge(source, target, uedge);
+ uedge = Parent::findUEdge(u, v, uedge);
}
return uedge;
}
@@ -649,10 +649,10 @@
typedef SubMapExtender<Adaptor, typename Parent::
template NodeMap<_Value> > Parent;
- NodeMap(const Graph& graph)
- : Parent(graph) {}
- NodeMap(const Graph& graph, const _Value& value)
- : Parent(graph, value) {}
+ NodeMap(const Graph& g)
+ : Parent(g) {}
+ NodeMap(const Graph& g, const _Value& v)
+ : Parent(g, v) {}
NodeMap& operator=(const NodeMap& cmap) {
return operator=<NodeMap>(cmap);
@@ -675,10 +675,10 @@
typedef SubMapExtender<Adaptor, typename Parent::
template EdgeMap<_Value> > Parent;
- EdgeMap(const Graph& graph)
- : Parent(graph) {}
- EdgeMap(const Graph& graph, const _Value& value)
- : Parent(graph, value) {}
+ EdgeMap(const Graph& g)
+ : Parent(g) {}
+ EdgeMap(const Graph& g, const _Value& v)
+ : Parent(g, v) {}
EdgeMap& operator=(const EdgeMap& cmap) {
return operator=<EdgeMap>(cmap);
@@ -701,10 +701,10 @@
typedef SubMapExtender<Adaptor, typename Parent::
template UEdgeMap<_Value> > Parent;
- UEdgeMap(const Graph& graph)
- : Parent(graph) {}
- UEdgeMap(const Graph& graph, const _Value& value)
- : Parent(graph, value) {}
+ UEdgeMap(const Graph& g)
+ : Parent(g) {}
+ UEdgeMap(const Graph& g, const _Value& v)
+ : Parent(g, v) {}
UEdgeMap& operator=(const UEdgeMap& cmap) {
return operator=<UEdgeMap>(cmap);
@@ -943,20 +943,20 @@
int edgeNum() const { return graph->uEdgeNum(); }
typedef FindEdgeTagIndicator<Graph> FindEdgeTag;
- Edge findEdge(const Node& source, const Node& target,
+ Edge findEdge(const Node& u, const Node& v,
const Edge& prev = INVALID) {
Edge edge = prev;
bool d = edge == INVALID ? true : (*direction)[edge];
if (d) {
- edge = graph->findUEdge(source, target, edge);
+ edge = graph->findUEdge(u, v, edge);
while (edge != INVALID && !(*direction)[edge]) {
- graph->findUEdge(source, target, edge);
+ graph->findUEdge(u, v, edge);
}
if (edge != INVALID) return edge;
}
- graph->findUEdge(target, source, edge);
+ graph->findUEdge(v, u, edge);
while (edge != INVALID && (*direction)[edge]) {
- graph->findUEdge(source, target, edge);
+ graph->findUEdge(u, v, edge);
}
return edge;
}
@@ -965,9 +965,9 @@
return Node(graph->addNode());
}
- Edge addEdge(const Node& source, const Node& target) const {
- Edge edge = graph->addEdge(source, target);
- direction->set(edge, graph->source(edge) == source);
+ Edge addEdge(const Node& u, const Node& v) const {
+ Edge edge = graph->addEdge(u, v);
+ direction->set(edge, graph->source(edge) == u);
return edge;
}
Modified: lemon/trunk/lemon/unionfind.h
==============================================================================
--- lemon/trunk/lemon/unionfind.h (original)
+++ lemon/trunk/lemon/unionfind.h Fri Mar 2 19:04:28 2007
@@ -408,10 +408,10 @@
items[items[k].nextClass].prevClass = nk;
}
- int idx = items[k].nextItem;
- while (idx != k) {
- items[idx].parent = nk;
- idx = items[idx].nextItem;
+ int l = items[k].nextItem;
+ while (l != k) {
+ items[l].parent = nk;
+ l = items[l].nextItem;
}
items[nk].parent = items[k].parent + 1;
Modified: lemon/trunk/test/all_pairs_shortest_path_test.cc
==============================================================================
--- lemon/trunk/test/all_pairs_shortest_path_test.cc (original)
+++ lemon/trunk/test/all_pairs_shortest_path_test.cc Fri Mar 2 19:04:28 2007
@@ -48,7 +48,7 @@
typedef Graph::NodeMap<int> DistMap;
const int n = argc > 1 ? atoi(argv[1]) : 20;
- const int e = argc > 2 ? atoi(argv[2]) : (int)(n * log((double)n));
+ const int e = argc > 2 ? atoi(argv[2]) : int(n * log(double(n)));
const int m = argc > 3 ? atoi(argv[3]) : 100;
Graph graph;
Modified: lemon/trunk/test/arborescence_test.cc
==============================================================================
--- lemon/trunk/test/arborescence_test.cc (original)
+++ lemon/trunk/test/arborescence_test.cc Fri Mar 2 19:04:28 2007
@@ -19,24 +19,24 @@
using namespace lemon;
using namespace std;
-const int n = 10;
-const int e = 22;
+const int NODES = 10;
+const int EDGES = 22;
int sourceNode = 0;
-int sources[e] = {
+int sources[EDGES] = {
1, 0, 2, 4, 4, 3, 9, 8, 9, 8,
4, 2, 0, 6, 4, 1, 7, 2, 8, 6,
1, 0
};
-int targets[e] = {
+int targets[EDGES] = {
8, 3, 1, 1, 4, 9, 8, 1, 8, 0,
3, 2, 1, 3, 1, 1, 2, 6, 3, 9,
1, 3
};
-double costs[e] = {
+double costs[EDGES] = {
107.444, 70.3069, 46.0496, 28.3962, 91.4325,
76.9443, 61.986, 39.3754, 74.9575, 39.3153,
45.7094, 34.6184, 100.156, 95.726, 22.3429,
@@ -56,11 +56,11 @@
CostMap cost(graph);
vector<Node> nodes;
- for (int i = 0; i < n; ++i) {
+ for (int i = 0; i < NODES; ++i) {
nodes.push_back(graph.addNode());
}
- for (int i = 0; i < e; ++i) {
+ for (int i = 0; i < EDGES; ++i) {
Edge edge = graph.addEdge(nodes[sources[i]], nodes[targets[i]]);
cost[edge] = costs[i];
}
@@ -85,7 +85,7 @@
for (EdgeIt it(graph); it != INVALID; ++it) {
if (mca.reached(graph.source(it))) {
double sum = 0.0;
- for (int i = 0; i < (int)dualSolution.size(); ++i) {
+ for (int i = 0; i < int(dualSolution.size()); ++i) {
if (dualSolution[i].second.find(graph.target(it))
!= dualSolution[i].second.end() &&
dualSolution[i].second.find(graph.source(it))
Modified: lemon/trunk/test/bipartite_matching_test.cc
==============================================================================
--- lemon/trunk/test/bipartite_matching_test.cc (original)
+++ lemon/trunk/test/bipartite_matching_test.cc Fri Mar 2 19:04:28 2007
@@ -19,22 +19,22 @@
typedef SmartBpUGraph Graph;
BPUGRAPH_TYPEDEFS(Graph);
-const int n = 10;
-const int m = 10;
-const int e = 52;
-const int c = 100;
+const int N = 10;
+const int M = 10;
+const int E = 52;
+const int C = 100;
-const int sa[e] = { 6, 5, 6, 4, 1, 0, 9, 5, 2, 4, 4, 3, 5,
+const int sa[E] = { 6, 5, 6, 4, 1, 0, 9, 5, 2, 4, 4, 3, 5,
2, 3, 8, 3, 4, 9, 6, 9, 4, 3, 1, 5, 8,
4, 8, 9, 2, 2, 3, 0, 5, 2, 3, 6, 3, 8,
8, 4, 0, 9, 9, 6, 2, 1, 2, 7, 1, 9, 4};
-const int ta[e] = { 2, 7, 4, 8, 6, 3, 4, 1, 7, 7, 0, 1, 6,
+const int ta[E] = { 2, 7, 4, 8, 6, 3, 4, 1, 7, 7, 0, 1, 6,
3, 2, 6, 8, 3, 5, 6, 3, 1, 8, 7, 2, 0,
6, 9, 6, 7, 8, 3, 3, 4, 5, 8, 6, 4, 1,
4, 3, 3, 8, 7, 7, 3, 7, 7, 3, 5, 1, 6};
-const int wa[e] = { 3, 99, 85, 16, 79, 52, 83, 99, 62, 6, 42, 6, 95,
+const int wa[E] = { 3, 99, 85, 16, 79, 52, 83, 99, 62, 6, 42, 6, 95,
13, 34, 9, 5, 38, 39, 75, 99, 12, 73, 35, 93, 43,
54, 91, 45, 26, 77, 47, 11, 22, 50, 74, 37, 64, 91,
60, 6, 92, 29, 46, 34, 84, 67, 34, 45, 0, 39, 47};
@@ -52,15 +52,15 @@
int max_cardinality_max_weight;
int min_cost_matching;
- for (int i = 0; i < n; ++i) {
+ for (int i = 0; i < N; ++i) {
Node node = graph.addANode();
aNodes.push_back(node);
}
- for (int i = 0; i < m; ++i) {
+ for (int i = 0; i < M; ++i) {
Node node = graph.addBNode();
bNodes.push_back(node);
}
- for (int i = 0; i < e; ++i) {
+ for (int i = 0; i < E; ++i) {
Node aNode = aNodes[sa[i]];
Node bNode = bNodes[ta[i]];
UEdge uedge = graph.addEdge(aNode, bNode);
@@ -288,7 +288,7 @@
}
Graph::UEdgeMap<int> cost(graph);
- cost = subMap(constMap<UEdge>(c), weight);
+ cost = subMap(constMap<UEdge>(C), weight);
{
MinCostMaxBipartiteMatching<Graph> bpmatch(graph, cost);
@@ -303,7 +303,7 @@
min_cost_matching = bpmatch.matchingCost();
check(max_cardinality == bpmatch.matchingSize(), "WRONG SIZE");
- check(max_cardinality * c - max_cardinality_max_weight
+ check(max_cardinality * C - max_cardinality_max_weight
== bpmatch.matchingCost(), "WRONG SIZE");
for (UEdgeIt it(graph); it != INVALID; ++it) {
@@ -326,7 +326,7 @@
min_cost_matching = bpmatch.matchingCost();
check(max_cardinality == bpmatch.matchingSize(), "WRONG SIZE");
- check(max_cardinality * c - max_cardinality_max_weight
+ check(max_cardinality * C - max_cardinality_max_weight
== bpmatch.matchingCost(), "WRONG SIZE");
}
Modified: lemon/trunk/test/lp_test.cc
==============================================================================
--- lemon/trunk/test/lp_test.cc (original)
+++ lemon/trunk/test/lp_test.cc Fri Mar 2 19:04:28 2007
@@ -261,9 +261,9 @@
check(lp.primalStatus()==stat, buf.str());
if (stat == LpSolverBase::OPTIMAL) {
- std::ostringstream buf;
- buf << "Wrong optimal value: the right optimum is " << exp_opt;
- check(std::abs(lp.primalValue()-exp_opt) < 1e-3, buf.str());
+ std::ostringstream sbuf;
+ sbuf << "Wrong optimal value: the right optimum is " << exp_opt;
+ check(std::abs(lp.primalValue()-exp_opt) < 1e-3, sbuf.str());
//+ecvt(exp_opt,2)
}
}
Modified: lemon/trunk/test/map_test.h
==============================================================================
--- lemon/trunk/test/map_test.h (original)
+++ lemon/trunk/test/map_test.h Fri Mar 2 19:04:28 2007
@@ -45,7 +45,7 @@
}
typedef typename Graph::template NodeMap<int> IntNodeMap;
IntNodeMap map(graph, 42);
- for (int i = 0; i < (int)nodes.size(); ++i) {
+ for (int i = 0; i < int(nodes.size()); ++i) {
check(map[nodes[i]] == 42, "Wrong map constructor.");
}
for (int i = 0; i < num; ++i) {
@@ -53,7 +53,7 @@
map[nodes.back()] = 23;
}
map = constMap<Node>(12);
- for (int i = 0; i < (int)nodes.size(); ++i) {
+ for (int i = 0; i < int(nodes.size()); ++i) {
check(map[nodes[i]] == 12, "Wrong map constructor.");
}
graph.clear();
@@ -83,7 +83,7 @@
typedef typename Graph::template EdgeMap<int> IntEdgeMap;
IntEdgeMap map(graph, 42);
- for (int i = 0; i < (int)edges.size(); ++i) {
+ for (int i = 0; i < int(edges.size()); ++i) {
check(map[edges[i]] == 42, "Wrong map constructor.");
}
@@ -94,7 +94,7 @@
}
}
map = constMap<Edge>(12);
- for (int i = 0; i < (int)edges.size(); ++i) {
+ for (int i = 0; i < int(edges.size()); ++i) {
check(map[edges[i]] == 12, "Wrong map constructor.");
}
graph.clear();
Modified: lemon/trunk/test/max_matching_test.cc
==============================================================================
--- lemon/trunk/test/max_matching_test.cc (original)
+++ lemon/trunk/test/max_matching_test.cc Fri Mar 2 19:04:28 2007
@@ -74,7 +74,7 @@
for(NodeIt v(g); v!=INVALID; ++v) {
if ( mate[v]!=INVALID ) ++s;
}
- int size=(int)s/2; //size will be used as the size of a maxmatching
+ int size=int(s/2); //size will be used as the size of a maxmatching
for(NodeIt v(g); v!=INVALID; ++v) {
max_matching.mate(v);
@@ -92,7 +92,7 @@
for(NodeIt v(g); v!=INVALID; ++v) {
if ( mate[v]!=INVALID ) ++s;
}
- check ( (int)s/2 == size, "The size does not equal!" );
+ check ( int(s/2) == size, "The size does not equal!" );
Graph::NodeMap<MaxMatching<Graph>::pos_enum> pos1(g);
max_matching.writePos(pos1);
@@ -103,7 +103,7 @@
for(NodeIt v(g); v!=INVALID; ++v) {
if ( mate[v]!=INVALID ) ++s;
}
- check ( (int)s/2 == size, "The size does not equal!" );
+ check ( int(s/2) == size, "The size does not equal!" );
Graph::NodeMap<MaxMatching<Graph>::pos_enum> pos2(g);
max_matching.writePos(pos2);
@@ -115,7 +115,7 @@
for(NodeIt v(g); v!=INVALID; ++v) {
if ( mate[v]!=INVALID ) ++s;
}
- check ( (int)s/2 == size, "The size does not equal!" );
+ check ( int(s/2) == size, "The size does not equal!" );
Graph::NodeMap<MaxMatching<Graph>::pos_enum> pos(g);
max_matching.writePos(pos);
@@ -176,7 +176,7 @@
for(NodeIt v(g); v!=INVALID; ++v) {
if ( pos[v]==max_matching.A ) ++barrier;
}
- int expected_size=(int)( countNodes(g)-num_comp+barrier)/2;
+ int expected_size=int( countNodes(g)-num_comp+barrier)/2;
check ( size==expected_size, "The size of the matching is wrong." );
return 0;
Modified: lemon/trunk/test/mip_test.cc
==============================================================================
--- lemon/trunk/test/mip_test.cc (original)
+++ lemon/trunk/test/mip_test.cc Fri Mar 2 19:04:28 2007
@@ -30,9 +30,9 @@
check(lp.mipStatus()==stat, buf.str());
if (stat == MipSolverBase::OPTIMAL) {
- std::ostringstream buf;
+ std::ostringstream sbuf;
buf << "Wrong optimal value: the right optimum is " << exp_opt;
- check(std::abs(lp.primalValue()-exp_opt) < 1e-3, buf.str());
+ check(std::abs(lp.primalValue()-exp_opt) < 1e-3, sbuf.str());
//+ecvt(exp_opt,2)
}
}
Modified: lemon/trunk/test/radix_sort_test.cc
==============================================================================
--- lemon/trunk/test/radix_sort_test.cc (original)
+++ lemon/trunk/test/radix_sort_test.cc Fri Mar 2 19:04:28 2007
@@ -32,6 +32,8 @@
using namespace std;
using namespace lemon;
+typedef unsigned char uchar;
+
void checkRadixSort() {
{
int n = 10000;
@@ -48,7 +50,7 @@
int n = 10000;
vector<unsigned char> data1(n), data2(n);
for (int i = 0; i < n; ++i) {
- data1[i] = data2[i] = rnd[(unsigned char)200];
+ data1[i] = data2[i] = rnd[uchar(200)];
}
radixSort(data1.begin(), data1.end());
sort(data2.begin(), data2.end());
@@ -75,7 +77,7 @@
int n = 10000;
vector<unsigned char> data1(n), data2(n);
for (int i = 0; i < n; ++i) {
- data1[i] = data2[i] = rnd[(unsigned char)200];
+ data1[i] = data2[i] = rnd[uchar(200)];
}
counterSort(data1.begin(), data1.end());
sort(data2.begin(), data2.end());
@@ -96,7 +98,7 @@
typedef Graph::Edge Edge;
const int n = 100;
- const int e = (int)(n * log((double)n));
+ const int e = int(n * log(double(n)));
Graph graph;
vector<Node> nodes;
@@ -117,12 +119,12 @@
Graph::EdgeMap<bool> was(graph, false);
- for (int i = 0; i < (int)edges.size(); ++i) {
+ for (int i = 0; i < int(edges.size()); ++i) {
check(!was[edges[i]], "Test failed");
was[edges[i]] = true;
}
- for (int i = 1; i < (int)edges.size(); ++i) {
+ for (int i = 1; i < int(edges.size()); ++i) {
check(graph.id(graph.source(edges[i - 1])) <=
graph.id(graph.source(edges[i])), "Test failed");
}
@@ -135,7 +137,7 @@
typedef Graph::Edge Edge;
const int n = 100;
- const int e = (int)(n * log((double)n));
+ const int e = int(n * log(double(n)));
Graph graph;
vector<Node> nodes;
@@ -160,12 +162,12 @@
Graph::EdgeMap<bool> was(graph, false);
- for (int i = 0; i < (int)edges.size(); ++i) {
+ for (int i = 0; i < int(edges.size()); ++i) {
check(!was[edges[i]], "Test failed");
was[edges[i]] = true;
}
- for (int i = 1; i < (int)edges.size(); ++i) {
+ for (int i = 1; i < int(edges.size()); ++i) {
check(graph.id(graph.target(edges[i - 1])) <
graph.id(graph.target(edges[i])) ||
(graph.id(graph.target(edges[i - 1])) ==
More information about the Lemon-commits
mailing list