From 787bebb5fc66d7a8c575977afd4cf4a97e5a8193 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Fri, 12 Apr 2013 16:51:59 -0700 Subject: [PATCH] don't call constructor and assignment operator --- libraries/shared/src/CounterStats.cpp | 40 ++++++++++++++++++++------- 1 file changed, 30 insertions(+), 10 deletions(-) diff --git a/libraries/shared/src/CounterStats.cpp b/libraries/shared/src/CounterStats.cpp index 20281c113e..b86cfd37f2 100644 --- a/libraries/shared/src/CounterStats.cpp +++ b/libraries/shared/src/CounterStats.cpp @@ -33,20 +33,40 @@ // int sampleAt; -CounterStatHistory::CounterStatHistory() { - init(); +CounterStatHistory::CounterStatHistory() : + currentCount(0), + currentDelta(0), + currentTime(0.0), + lastCount(0), + lastTime(0.0), + totalTime(0.0), + sampleAt(-1), + sampleCount(0) { } -CounterStatHistory::CounterStatHistory(std::string myName) { - init(); - name = myName; +CounterStatHistory::CounterStatHistory(std::string myName) : + name(myName), + currentCount(0), + currentDelta(0), + currentTime(0.0), + lastCount(0), + lastTime(0.0), + totalTime(0.0), + sampleAt(-1), + sampleCount(0) { } -CounterStatHistory::CounterStatHistory(std::string myName, double initialTime, long initialCount) { - init(); - lastCount = currentCount = initialCount; - lastTime = currentTime = totalTime = initialTime; - name = myName; + +CounterStatHistory::CounterStatHistory(std::string myName, double initialTime, long initialCount) : + name(myName), + currentCount(initialCount), + currentDelta(0), + currentTime(initialTime), + lastCount(initialCount), + lastTime(initialTime), + totalTime(initialTime), + sampleAt(-1), + sampleCount(0) { } void CounterStatHistory::init() {