From 1415a2530229660ea5c580aaa9964db0d1857a9a Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Fri, 12 Apr 2013 16:22:35 -0700 Subject: [PATCH] fix for warnings produced by CounterStats refactor --- libraries/shared/src/CounterStats.cpp | 27 +++++++++++++++++++++++++++ libraries/shared/src/CounterStats.h | 22 +++++----------------- 2 files changed, 32 insertions(+), 17 deletions(-) diff --git a/libraries/shared/src/CounterStats.cpp b/libraries/shared/src/CounterStats.cpp index 050ee6159b..20281c113e 100644 --- a/libraries/shared/src/CounterStats.cpp +++ b/libraries/shared/src/CounterStats.cpp @@ -33,6 +33,33 @@ // int sampleAt; +CounterStatHistory::CounterStatHistory() { + init(); +} + +CounterStatHistory::CounterStatHistory(std::string myName) { + init(); + name = myName; +} + +CounterStatHistory::CounterStatHistory(std::string myName, double initialTime, long initialCount) { + init(); + lastCount = currentCount = initialCount; + lastTime = currentTime = totalTime = initialTime; + name = myName; +} + +void CounterStatHistory::init() { + currentCount = 0; + currentDelta = 0; + currentTime = 0.0; + lastCount = 0; + lastTime = 0.0; + totalTime = 0.0; + sampleAt = -1; + sampleCount = 0; +} + void CounterStatHistory::recordSample(long thisCount) { timeval now; gettimeofday(&now,NULL); diff --git a/libraries/shared/src/CounterStats.h b/libraries/shared/src/CounterStats.h index 7d698d0970..81e34853ef 100644 --- a/libraries/shared/src/CounterStats.h +++ b/libraries/shared/src/CounterStats.h @@ -25,23 +25,9 @@ class CounterStatHistory { public: std::string name; - CounterStatHistory(std::string myName): - currentCount(0), currentDelta(0),currentTime(0.0), - lastCount(0),lastTime(0.0), - totalTime(0.0), - sampleAt(-1), sampleCount(0), name(myName) {}; - - CounterStatHistory(): - currentCount(0), currentDelta(0),currentTime(0.0), - lastCount(0),lastTime(0.0), - totalTime(0.0), - sampleAt(-1), sampleCount(0) {}; - - CounterStatHistory(std::string myName, double initialTime, long initialCount) : - currentCount(initialCount), currentDelta(0), currentTime(initialTime), - lastCount(initialCount),lastTime(initialTime), - totalTime(initialTime), - sampleAt(-1), sampleCount(0), name(myName) {}; + CounterStatHistory(); + CounterStatHistory(std::string myName); + CounterStatHistory(std::string myName, double initialTime, long initialCount); void recordSample(long thisCount); void recordSample(double thisTime, long thisCount); @@ -58,6 +44,8 @@ public: return currentCount; }; private: + void init(); + long currentCount; long currentDelta; double currentTime;