[Lemon-commits] [lemon_svn] marci: r441 - hugo/trunk/src/work/marci
Lemon SVN
svn at lemon.cs.elte.hu
Mon Nov 6 20:39:28 CET 2006
Author: marci
Date: Wed Apr 14 15:57:48 2004
New Revision: 441
Modified:
hugo/trunk/src/work/marci/graph_wrapper.h
hugo/trunk/src/work/marci/time_measure.h
Log:
gw, kiszedtem ami nem kell
Modified: hugo/trunk/src/work/marci/graph_wrapper.h
==============================================================================
--- hugo/trunk/src/work/marci/graph_wrapper.h (original)
+++ hugo/trunk/src/work/marci/graph_wrapper.h Wed Apr 14 15:57:48 2004
@@ -462,19 +462,27 @@
return i;
}
-
- Node aNode(const OutEdgeIt& e) const { return Node(graph->aNode(e.e)); }
- Node aNode(const InEdgeIt& e) const { return Node(graph->aNode(e.e)); }
- Node bNode(const OutEdgeIt& e) const { return Node(graph->bNode(e.e)); }
- Node bNode(const InEdgeIt& e) const { return Node(graph->bNode(e.e)); }
-
// template<typename I> I& next(I &i) const {
// graph->next(i);
// // while (graph->valid(i) && !filter_map-get(i)) { graph->next(i); }
// while (graph->valid(i) && !(*edge_filter_map)[i]) { graph->next(i); }
// return i;
-// }
-
+// }
+
+ Node aNode(const OutEdgeIt& e) const { return Node(graph->aNode(e.e)); }
+ Node aNode(const InEdgeIt& e) const { return Node(graph->aNode(e.e)); }
+ Node bNode(const OutEdgeIt& e) const { return Node(graph->bNode(e.e)); }
+ Node bNode(const InEdgeIt& e) const { return Node(graph->bNode(e.e)); }
+
+ void hide(const Node& n) const { node_filter_map->set(n, false); }
+ void hide(const Edge& e) const { edge_filter_map->set(e, false); }
+
+ void unHide(const Node& n) const { node_filter_map->set(n, true); }
+ void unHide(const Edge& e) const { edge_filter_map->set(e, true); }
+
+ bool hidden(const Node& n) const { return (*node_filter_map)[n]; }
+ bool hidden(const Edge& e) const { return (*edge_filter_map)[e]; }
+
template< typename It > It first() const {
It e; this->first(e); return e; }
Modified: hugo/trunk/src/work/marci/time_measure.h
==============================================================================
--- hugo/trunk/src/work/marci/time_measure.h (original)
+++ hugo/trunk/src/work/marci/time_measure.h Wed Apr 14 15:57:48 2004
@@ -8,123 +8,127 @@
#include <iostream>
#include <unistd.h>
-double currTime() {
- timeval tv;
- //timezone tz;
- gettimeofday(&tv, 0);
- return double(tv.tv_sec)+double(tv.tv_usec)/1000000.0;
-}
-
-class TimeStamp
-{
- tms ts;
- double real_time;
-
-public:
-
- tms &getTms() {return ts;}
- const tms &getTms() const {return ts;}
- double getRealTime() const {return real_time;}
- void stamp()
- {
- timeval tv;
- times(&ts);
- gettimeofday(&tv, 0);real_time=tv.tv_sec+double(tv.tv_usec)/1e6;
- }
-
- TimeStamp()
- { ts.tms_utime=ts.tms_stime=ts.tms_cutime=ts.tms_cstime=0; real_time=0;}
-
- TimeStamp(void *) { stamp();}
-
- TimeStamp &operator+=(const TimeStamp &b)
- {
- ts.tms_utime+=b.ts.tms_utime;
- ts.tms_stime+=b.ts.tms_stime;
- ts.tms_cutime+=b.ts.tms_cutime;
- ts.tms_cstime+=b.ts.tms_cstime;
- real_time+=b.real_time;
- return *this;
- }
- TimeStamp operator+(const TimeStamp &b) const
- {
- TimeStamp t(*this);
- return t+=b;
- }
- TimeStamp &operator-=(const TimeStamp &b)
- {
- ts.tms_utime-=b.ts.tms_utime;
- ts.tms_stime-=b.ts.tms_stime;
- ts.tms_cutime-=b.ts.tms_cutime;
- ts.tms_cstime-=b.ts.tms_cstime;
- real_time-=b.real_time;
- return *this;
- }
- TimeStamp operator-(const TimeStamp &b) const
- {
- TimeStamp t(*this);
- return t-=b;
- }
+namespace hugo {
- TimeStamp Ellapsed() const
- {
- TimeStamp t(NULL);
- return t-*this;
- }
-
- friend std::ostream& operator<<(std::ostream& os,const TimeStamp &t);
-
- double getUserTime() const
- {
- return double(ts.tms_utime)/sysconf(_SC_CLK_TCK);
- }
- double getSystemTime() const
- {
- return double(ts.tms_stime)/sysconf(_SC_CLK_TCK);
- }
- double getCUserTime() const
- {
- return double(ts.tms_cutime)/sysconf(_SC_CLK_TCK);
- }
- double getCSystemTime() const
- {
- return double(ts.tms_cstime)/sysconf(_SC_CLK_TCK);
- }
-};
-
-class Timer
-{
- TimeStamp start_time;
-
- void _reset() {start_time.stamp();}
-
-public:
- Timer() {_reset();}
-
- operator TimeStamp ()
- {
- TimeStamp t;
- t.stamp();
- return t-start_time;
- }
-
- TimeStamp reset()
- {
- TimeStamp t(start_time);
- _reset();
- return start_time-t;
+// double currTime() {
+// timeval tv;
+// //timezone tz;
+// gettimeofday(&tv, 0);
+// return double(tv.tv_sec)+double(tv.tv_usec)/1000000.0;
+// }
+
+ class TimeStamp
+ {
+ tms ts;
+ double real_time;
+
+ public:
+
+ tms &getTms() {return ts;}
+ const tms &getTms() const {return ts;}
+ double getRealTime() const {return real_time;}
+ void stamp()
+ {
+ timeval tv;
+ times(&ts);
+ gettimeofday(&tv, 0);real_time=tv.tv_sec+double(tv.tv_usec)/1e6;
+ }
+
+ TimeStamp()
+ { ts.tms_utime=ts.tms_stime=ts.tms_cutime=ts.tms_cstime=0; real_time=0;}
+
+ TimeStamp(void *) { stamp();}
+
+ TimeStamp &operator+=(const TimeStamp &b)
+ {
+ ts.tms_utime+=b.ts.tms_utime;
+ ts.tms_stime+=b.ts.tms_stime;
+ ts.tms_cutime+=b.ts.tms_cutime;
+ ts.tms_cstime+=b.ts.tms_cstime;
+ real_time+=b.real_time;
+ return *this;
+ }
+ TimeStamp operator+(const TimeStamp &b) const
+ {
+ TimeStamp t(*this);
+ return t+=b;
+ }
+ TimeStamp &operator-=(const TimeStamp &b)
+ {
+ ts.tms_utime-=b.ts.tms_utime;
+ ts.tms_stime-=b.ts.tms_stime;
+ ts.tms_cutime-=b.ts.tms_cutime;
+ ts.tms_cstime-=b.ts.tms_cstime;
+ real_time-=b.real_time;
+ return *this;
+ }
+ TimeStamp operator-(const TimeStamp &b) const
+ {
+ TimeStamp t(*this);
+ return t-=b;
+ }
+
+ TimeStamp Ellapsed() const
+ {
+ TimeStamp t(NULL);
+ return t-*this;
+ }
+
+ friend std::ostream& operator<<(std::ostream& os,const TimeStamp &t);
+
+ double getUserTime() const
+ {
+ return double(ts.tms_utime)/sysconf(_SC_CLK_TCK);
+ }
+ double getSystemTime() const
+ {
+ return double(ts.tms_stime)/sysconf(_SC_CLK_TCK);
+ }
+ double getCUserTime() const
+ {
+ return double(ts.tms_cutime)/sysconf(_SC_CLK_TCK);
+ }
+ double getCSystemTime() const
+ {
+ return double(ts.tms_cstime)/sysconf(_SC_CLK_TCK);
+ }
+ };
+
+ class Timer
+ {
+ TimeStamp start_time;
+
+ void _reset() {start_time.stamp();}
+
+ public:
+ Timer() {_reset();}
+
+ operator TimeStamp ()
+ {
+ TimeStamp t;
+ t.stamp();
+ return t-start_time;
+ }
+
+ TimeStamp reset()
+ {
+ TimeStamp t(start_time);
+ _reset();
+ return start_time-t;
+ }
+ };
+
+ inline std::ostream& operator<<(std::ostream& os,const TimeStamp &t)
+ {
+ long cls = sysconf(_SC_CLK_TCK);
+ os << "u: " << double(t.getTms().tms_utime)/cls <<
+ "s, s: " << double(t.getTms().tms_stime)/cls <<
+ "s, cu: " << double(t.getTms().tms_cutime)/cls <<
+ "s, cs: " << double(t.getTms().tms_cstime)/cls <<
+ "s, real: " << t.getRealTime() << "s";
+ return os;
}
-};
-inline std::ostream& operator<<(std::ostream& os,const TimeStamp &t)
-{
- long cls = sysconf(_SC_CLK_TCK);
- os << "u: " << double(t.getTms().tms_utime)/cls <<
- "s, s: " << double(t.getTms().tms_stime)/cls <<
- "s, cu: " << double(t.getTms().tms_cutime)/cls <<
- "s, cs: " << double(t.getTms().tms_cstime)/cls <<
- "s, real: " << t.getRealTime() << "s";
- return os;
-}
+} //namespace hugo
#endif //HUGO_TIME_MEASURE_H
More information about the Lemon-commits
mailing list