[PPL-devel] [GIT] ppl/ppl(master): Avoid dummy parameter in constructor for Threshold_Watcher::Initialize.

Enea Zaffanella zaffanella at cs.unipr.it
Sun Jul 12 11:18:05 CEST 2009


Module: ppl/ppl
Branch: master
Commit: 0742e3828ce42ee511948a17efd4af8efb098c11
URL:    http://www.cs.unipr.it/git/gitweb.cgi?p=ppl/ppl.git;a=commit;h=0742e3828ce42ee511948a17efd4af8efb098c11

Author: Enea Zaffanella <zaffanella at cs.unipr.it>
Date:   Sun Jul 12 11:12:29 2009 +0200

Avoid dummy parameter in constructor for Threshold_Watcher::Initialize.
Renamed `initialize' to `init' to avoid visual clash with `Initialize'.

---

 Watchdog/src/Threshold_Watcher.defs.hh      |    4 +---
 Watchdog/src/Threshold_Watcher.templates.hh |   12 ++++++------
 tests/Polyhedron/weightwatch1.cc            |    4 ++--
 3 files changed, 9 insertions(+), 11 deletions(-)

diff --git a/Watchdog/src/Threshold_Watcher.defs.hh b/Watchdog/src/Threshold_Watcher.defs.hh
index e2f8f55..6d11c18 100644
--- a/Watchdog/src/Threshold_Watcher.defs.hh
+++ b/Watchdog/src/Threshold_Watcher.defs.hh
@@ -54,12 +54,10 @@ private:
   Threshold_Watcher& operator=(const Threshold_Watcher&);
 
   struct Initialize {
-    Initialize(int) {
-    }
     //! The ordered queue of pending thresholds.
     WW_Pending_List pending;
   };
-  static Initialize initialize;
+  static Initialize init;
 
   // Handle the addition of a new threshold.
   static typename WW_Pending_List::Iterator
diff --git a/Watchdog/src/Threshold_Watcher.templates.hh b/Watchdog/src/Threshold_Watcher.templates.hh
index a133775..9c55f79 100644
--- a/Watchdog/src/Threshold_Watcher.templates.hh
+++ b/Watchdog/src/Threshold_Watcher.templates.hh
@@ -31,15 +31,15 @@ Threshold_Watcher<Traits>::add_threshold(typename Traits::Threshold threshold,
                                          const Handler& handler,
                                          bool& expired_flag) {
   Traits::check_function = Threshold_Watcher::check;
-  return initialize.pending.insert(threshold, handler, expired_flag);
+  return init.pending.insert(threshold, handler, expired_flag);
 }
 
 template <typename Traits>
 typename Threshold_Watcher<Traits>::WW_Pending_List::Iterator
 Threshold_Watcher<Traits>
 ::remove_threshold(typename WW_Pending_List::Iterator position) {
-  typename WW_Pending_List::Iterator i = initialize.pending.erase(position);
-  if (initialize.pending.empty())
+  typename WW_Pending_List::Iterator i = init.pending.erase(position);
+  if (init.pending.empty())
     Traits::check_function = 0;
   return i;
 }
@@ -54,14 +54,14 @@ Threshold_Watcher<Traits>::~Threshold_Watcher() {
 template <typename Traits>
 void
 Threshold_Watcher<Traits>::check() {
-  typename WW_Pending_List::Iterator i = initialize.pending.begin();
-  assert(i != initialize.pending.end());
+  typename WW_Pending_List::Iterator i = init.pending.begin();
+  assert(i != init.pending.end());
   const typename Traits::Threshold& current = Traits::get();
   while (!Traits::less_than(current, i->deadline())) {
     i->handler().act();
     i->expired_flag() = true;
     i = remove_threshold(i);
-    if (i == initialize.pending.end())
+    if (i == init.pending.end())
       break;
   }
 }
diff --git a/tests/Polyhedron/weightwatch1.cc b/tests/Polyhedron/weightwatch1.cc
index 1386131..ff8960b 100644
--- a/tests/Polyhedron/weightwatch1.cc
+++ b/tests/Polyhedron/weightwatch1.cc
@@ -29,8 +29,8 @@ namespace {
 typedef
 Parma_Watchdog_Library::Threshold_Watcher<Weightwatch_Traits> Weightwatch;
 
-template <>
-Weightwatch::Initialize Weightwatch::initialize(0);
+template <> Weightwatch::Initialize
+Weightwatch::init = Weightwatch::Initialize();
 
 
 class Deterministic_Timeout




More information about the PPL-devel mailing list