1 // ANNA - Anna is Not Nothingness Anymore //
3 // (c) Copyright 2005-2015 Eduardo Ramos Testillano & Francisco Ruiz Rayo //
5 // See project site at http://redmine.teslayout.com/projects/anna-suite //
6 // See accompanying file LICENSE or copy at http://www.teslayout.com/projects/public/anna.LICENSE //
9 #include <anna/core/tracing/Logger.hpp>
10 #include <anna/core/oam/Counter.hpp>
11 #include <anna/core/oam/CounterScope.hpp>
12 #include <anna/core/util/defines.hpp>
18 #define TEST_COUNTER_TAG "__CNT__"
21 oam::Counter::Counter(oam::CounterScope& scope, const int id, const char* name) :
26 a_name = scope.getName();
31 int oam::Counter::getReference() const
33 return (a_scope.getId() * CounterScope::MaxCounter) + a_id;
36 void oam::Counter::debug() const
38 Logger::write(Logger::Information, functions::asString("%s| Counter%08d | %u | %s", TEST_COUNTER_TAG, getReference(), a_value, a_name.c_str()), ANNA_FILE_LOCATION);
41 string oam::Counter::asString() const
43 string result("oam::Counter { Id: ");
44 result += functions::asString("%08d", getReference());
45 result += " | Name: ";
47 result += " | Value: ";
48 result += functions::asString(a_value);
49 result += " | Acc-Value: ";
50 result += functions::asString(a_accValue);
51 return result += " }";