7#include <boost/serialization/vector.hpp>
13class ArchiveDataSeries;
96 std::vector<std::shared_ptr<ArchiveNode>> & getChildren() {
100 const std::vector<std::shared_ptr<ArchiveNode>> & getChildren()
const {
104 void setParent(std::shared_ptr<ArchiveNode> & parent) {
105 setParent(parent.get());
109 sparta_assert(parent_ ==
nullptr,
"Cannot reassign parent archive nodes");
162 size_t num_leaves = (
children_.empty() ? 1 : 0);
164 recursGetTotalNumLeaves_(*child, num_leaves);
182 void recursGetTotalNumLeaves_(
183 const ArchiveNode & node,
size_t & num_leaves)
const
188 for (
const auto & child : node.
children_) {
189 recursGetTotalNumLeaves_(*child, num_leaves);
205 template <
class Archive>
206 void serialize(Archive & ar,
const unsigned int) {
228 std::unique_ptr<ArchiveDataSeries> ar_data_series_;
242 leaf_index_(leaf_index),
252 return data_values_.at(idx);
264 return data_values_.size();
277 void readAllDataFromArchive_();
279 std::vector<double> data_values_;
280 const size_t leaf_index_;
288namespace serialization {
291template <
class Archive>
292void serialize(Archive & ar,
293 std::shared_ptr<sparta::statistics::ArchiveNode> & node,
296 if (node ==
nullptr) {
303template <
class Archive>
304void serialize(Archive & ar,
Describes reports to instantiate and tracks their instantiations.
#define sparta_assert(...)
Simple variadic assertion that will throw a sparta_exception if the condition fails.
Instance of either a StatisticDef or CounterBase or an Expression. Has a sample window (simulator tic...
Wrapper around a leaf ArchiveNode's data. Owns a back pointer to the top RootArchiveNode in its tree,...
bool empty()
See if there are any SI data values at all.
size_t size()
Get the size of the SI data array.
const std::vector< double > & getDataReference()
Get the entire SI data array.
double getValueAt(const size_t idx)
When a simulation is configured to archive its statistics values, it will build a subset of its devic...
ArchiveNode(const std::string &name, const Report *)
bool canAccessDataSeries() const
std::vector< std::shared_ptr< ArchiveNode > > children_
ArchiveNode(const std::string &name)
Construct a named node.
void setLeafIndex(const size_t index)
ArchiveDataSeries * createDataSeries()
ArchiveNode(const std::string &name, const StatisticInstance *)
const std::string & getName() const
Return the name that this node was originally created with.
size_t getTotalNumLeaves() const
friend class boost::serialization::access
RootArchiveNode * getRoot()
There is one of these root node objects at the top of each report's archive. The hierarchy looks like...
Provides a wrapper around a value to ensure that the value is assigned.
const value_type & getValue() const
Get the value - const version.
bool isValid() const
Is this value valid.
Macros for handling exponential backoff.