DiSMEC++
tracked.cpp
Go to the documentation of this file.
1 // Copyright (c) 2021, Aalto University, developed by Erik Schultheis
2 // All rights reserved.
3 //
4 // SPDX-License-Identifier: MIT
5 
6 #include "tracked.h"
7 #include "collection.h"
8 
9 using namespace dismec::stats;
10 
11 Tracked::~Tracked() = default;
12 
13 Tracked::Tracked() : m_Collection(std::make_shared<StatisticsCollection>()) {
14 }
15 
17  m_Collection->declare_stat(index, std::move(name));
18 }
19 
20 void Tracked::register_stat(const std::string& name, std::unique_ptr<Statistics> stat) {
21  m_Collection->register_stat(name, std::move(stat));
22 }
23 
24 void Tracked::declare_tag(tag_id_t index, std::string name) {
25  m_Collection->declare_tag(index, std::move(name));
26 }
This class manages a collection of named Statistics objects.
Definition: collection.h:47
void register_stat(const std::string &name, std::unique_ptr< Statistics > stat)
Registers a tracker for the statistics name.
Definition: tracked.cpp:20
Tracked()
Default constructor, creates the internal stats::StatisticsCollection.
Definition: tracked.cpp:13
~Tracked()
Non-virtual destructor. Declared protected, so we don't accidentally try to do a polymorphic delete.
std::shared_ptr< StatisticsCollection > m_Collection
The internal collection. Filled with a new StatisticsCollection in the constructor.
Definition: tracked.h:138
void declare_tag(tag_id_t index, std::string name)
Declares a new tag. This function just forwards all its arguments to the internal StatisticsCollectio...
Definition: tracked.cpp:24
void declare_stat(stat_id_t index, StatisticMetaData meta)
Declares a new statistics. This function just forwards all its arguments to the internal StatisticsCo...
Definition: tracked.cpp:16
Data that is associated with each declared statistics.
Definition: stat_id.h:33