SST  7.0.0
StructuralSimulationToolkit
statnull.h
1 // Copyright 2009-2017 Sandia Corporation. Under the terms
2 // of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S.
3 // Government retains certain rights in this software.
4 //
5 // Copyright (c) 2009-2017, Sandia Corporation
6 // All rights reserved.
7 //
8 // This file is part of the SST software package. For license
9 // information, see the LICENSE file in the top level directory of the
10 // distribution.
11 
12 
13 #ifndef _H_SST_CORE_NULL_STATISTIC_
14 #define _H_SST_CORE_NULL_STATISTIC_
15 
16 #include <sst/core/sst_types.h>
17 #include <sst/core/warnmacros.h>
18 
19 #include <sst/core/statapi/statbase.h>
20 
21 namespace SST {
22 namespace Statistics {
23 
24 // NOTE: When calling base class members of classes derived from
25 // a templated base class. The user must use "this->" in
26 // order to call base class members (to avoid a compilier
27 // error) because they are "nondependant named" and the
28 // templated base class is a "dependant named". The
29 // compilier will not look in dependant named base classes
30 // when looking up independant names.
31 // See: http://www.parashift.com/c++-faq-lite/nondependent-name-lookup-members.html
32 
33 /**
34  \class NullStatistic
35 
36  An empty statistic place holder.
37 
38  @tparam T A template for holding the main data type of this statistic
39 */
40 
41 template <typename T>
42 class NullStatistic : public Statistic<T>
43 {
44 public:
45  NullStatistic(BaseComponent* comp, const std::string& statName, const std::string& statSubId, Params& statParams)
46  : Statistic<T>(comp, statName, statSubId, statParams)
47  {
48  // Set the Name of this Statistic
49  this->setStatisticTypeName("NULL");
50  }
51 
52  ~NullStatistic(){};
53 
54  void clearStatisticData() override
55  {
56  // Do Nothing
57  }
58 
59  void registerOutputFields(StatisticOutput* UNUSED(statOutput)) override
60  {
61  // Do Nothing
62  }
63 
64  void outputStatisticData(StatisticOutput* UNUSED(statOutput), bool UNUSED(EndOfSimFlag)) override
65  {
66  // Do Nothing
67  }
68 
69  bool isReady() const override
70  {
71  return true;
72  }
73 
74  bool isNullStatistic() const override
75  {
76  return true;
77  }
78 
79 protected:
80  void addData_impl(T UNUSED(data)) override
81  {
82  // Do Nothing
83  }
84 
85 
86 private:
87 };
88 
89 } //namespace Statistics
90 } //namespace SST
91 
92 #endif
bool isNullStatistic() const override
Indicate if the Statistic is a NullStatistic.
Definition: statnull.h:74
Forms the base class for statistics output generation within the SST core.
Definition: statoutput.h:47
void setStatisticTypeName(const char *typeName)
Set an optional Statistic Type Name.
Definition: statbase.h:202
Definition: action.cc:17
void clearStatisticData() override
Inform the Statistic to clear its data.
Definition: statnull.h:54
Forms the template defined base class for statistics gathering within SST.
Definition: statbase.h:294
bool isReady() const override
Indicate that the Statistic is Ready to be used.
Definition: statnull.h:69
Main component object for the simulation.
Definition: baseComponent.h:104
Parameter store.
Definition: params.h:45
An empty statistic place holder.
Definition: statnull.h:42