OMNeT++ Simulation Library  5.6.1
cstatisticbuilder.h
1 //==========================================================================
2 // CSTATISTICBUILDER.H - part of
3 // OMNeT++/OMNEST
4 // Discrete System Simulation in C++
5 //
6 // Author: Andras Varga
7 //
8 //==========================================================================
9 
10 /*--------------------------------------------------------------*
11  Copyright (C) 1992-2017 Andras Varga
12  Copyright (C) 2006-2017 OpenSim Ltd.
13 
14  This file is distributed WITHOUT ANY WARRANTY. See the file
15  `license' for details on this and other legal matters.
16 *--------------------------------------------------------------*/
17 
18 #ifndef __OMNETPP_CSTATISTICBUILDER_H
19 #define __OMNETPP_CSTATISTICBUILDER_H
20 
21 #include "omnetpp/clistener.h"
22 #include "omnetpp/cproperty.h"
23 
24 namespace omnetpp {
25 
26 extern const char *PROPKEY_STATISTIC_SOURCE;
27 extern const char *PROPKEY_STATISTIC_RECORD;
28 extern const char *PROPKEY_STATISTIC_CHECKSIGNALS;
29 
30 class cConfiguration;
31 class SignalSource;
32 
36 class SIM_API cStatisticBuilder
37 {
38  public:
39  enum TristateBool {TRISTATE_TRUE=1, TRISTATE_FALSE=0, TRISTATE_DEFAULT=-1}; // for internal use only
40 
41  private:
42  cConfiguration *config;
43 
44  public:
45  cStatisticBuilder(cConfiguration *config) : config(config) {}
46 
51  void addResultRecorders(cComponent *component);
52 
57  void addResultRecorders(cComponent *component, simsignal_t signal, const char *statisticName, cProperty *statisticTemplateProperty);
58 
59  protected:
60  // Utility function: adds result recording listeners for the given signal (if it's non-null) or for the given @statistic property.
61  // If signal is specified, it will override the source= key in statisticProperty.
62  // The index of statisticProperty is ignored; statisticName will be used as name of the statistic instead.
63  void doAddResultRecorders(cComponent *component, std::string& componentFullPath, const char *statisticName, cProperty *statisticProperty, simsignal_t signal=SIMSIGNAL_NULL);
64 
65  // Utility functions for addResultRecorders()
66  std::vector<std::string> extractRecorderList(const char *modesOption, cProperty *statisticProperty);
67  SignalSource doStatisticSource(cComponent *component, cProperty *statisticProperty, const char *statisticName, const char *sourceSpec, TristateBool checkSignalDecl, bool needWarmupFilter);
68  void doResultRecorder(const SignalSource& source, const char *mode, cComponent *component, const char *statisticName, cProperty *attrsProperty);
69  TristateBool parseTristateBool(const char *s, const char *what);
70 };
71 
72 } // namespace omnetpp
73 
74 #endif
75 
76 
Common base for module and channel classes.
Definition: ccomponent.h:48
Stores a (NED) property with its (possibly compound) value.
Definition: cproperty.h:38
Definition: cstatisticbuilder.h:36
Definition: cabstracthistogram.h:21
int simsignal_t
Signal handle.
Definition: clistener.h:24
Represents the configuration, as accessed by the simulation kernel.
Definition: cconfiguration.h:70