OMNeT++ Simulation Library  5.6.1
ccomponent.h
1 //==========================================================================
2 // CCOMPONENT.H - header for
3 // OMNeT++/OMNEST
4 // Discrete System Simulation in C++
5 //
6 //==========================================================================
7 
8 /*--------------------------------------------------------------*
9  Copyright (C) 1992-2017 Andras Varga
10  Copyright (C) 2006-2017 OpenSim Ltd.
11 
12  This file is distributed WITHOUT ANY WARRANTY. See the file
13  `license' for details on this and other legal matters.
14 *--------------------------------------------------------------*/
15 
16 #ifndef __OMNETPP_CCOMPONENT_H
17 #define __OMNETPP_CCOMPONENT_H
18 
19 #include <vector>
20 #include "simkerneldefs.h"
21 #include "cownedobject.h"
22 #include "cpar.h"
23 #include "cdefaultlist.h"
24 #include "simtime.h"
25 #include "cenvir.h"
26 #include "clistener.h"
27 #include "clog.h"
28 #include "distrib.h"
29 
30 namespace omnetpp {
31 
32 class cComponentType;
33 class cProperties;
34 class cDisplayString;
35 class cRNG;
36 class cStatistic;
37 class cResultRecorder;
38 
48 class SIM_API cComponent : public cDefaultList //implies noncopyable
49 {
50  friend class cComponentDescriptor; // listener lists, etc
51  friend class cComponent__SignalListenerListDescriptor; // sim_std.msg
52  friend class cPar; // needs to call handleParameterChange()
53  friend class cChannel; // allow access to FL_INITIALIZED, FL_DELETING and releaseLocalListeners()
54  friend class cModule; // allow access to FL_INITIALIZED, FL_DELETING, releaseLocalListeners() and repairSignalFlags()
55  friend class cSimpleModule; // allow access to FL_INITIALIZED, FL_DELETING, releaseLocalListeners() and repairSignalFlags()
56  friend class cGate; // because of repairSignalFlags()
57  friend class cSimulation; // sets componentId
58  friend class cResultListener; // invalidateCachedResultRecorderLists()
59  public:
60  enum ComponentKind { KIND_MODULE, KIND_CHANNEL, KIND_OTHER };
61 
62  private:
63  enum {
64  FL_PARAMSFINALIZED = 1 << 2, // whether finalizeParameters() has been called
65  FL_INITIALIZED = 1 << 3, // whether initialize() has been called
66  FL_DELETING = 1 << 4, // module or channel is being deleted (via deleteModule(), disconnect(), etc.)
67  FL_DISPSTR_CHECKED = 1 << 5, // for hasDisplayString(): whether the FL_DISPSTR_NOTEMPTY flag is valid
68  FL_DISPSTR_NOTEMPTY = 1 << 6, // for hasDisplayString(): whether the display string is not empty
69  FL_LOGLEVEL_SHIFT = 7, // 3 bits wide
70  };
71 
72  private:
73  cComponentType *componentType; // component type object
74  int componentId; // id in cSimulation
75 
76  short rngMapSize; // size of the rngMap array (RNGs with index >= rngMapSize are mapped one-to-one to global RNGs)
77  int *rngMap; // maps local RNG numbers (may be nullptr if rngMapSize==0)
78 
79  short numPars;
80  short parArraySize;
81  cPar *parArray; // array of cPar objects
82 
83  mutable cDisplayString *displayString; // created on demand
84 
85  struct SignalListenerList {
86  simsignal_t signalID;
87  cIListener **listeners; // nullptr-terminated array
88 
89  SignalListenerList() {signalID=SIMSIGNAL_NULL; listeners=nullptr;}
90  const char *getSignalName() const;
91  std::string str() const;
92  void dispose() {delete [] listeners;}
93  bool addListener(cIListener *l);
94  bool removeListener(cIListener *l);
95  int findListener(cIListener *l) const;
96  bool hasListener() const {return listeners && listeners[0];}
97  int countListeners() const;
98  cIListener *getListener(int k) const {return listeners[k];} // unsafe
99  static bool gt(const SignalListenerList& e1, const SignalListenerList& e2) {return e1.signalID > e2.signalID;}
100  };
101 
102  typedef std::vector<SignalListenerList> SignalTable;
103  SignalTable *signalTable; // ordered by signalID so we can do binary search
104 
105  // string-to-simsignal_t mapping
106  static struct SignalNameMapping {
107  std::map<std::string,simsignal_t> signalNameToID;
108  std::map<simsignal_t,std::string> signalIDToName;
109  } *signalNameMapping; // must be dynamically allocated on first access so that registerSignal() can be invoked from static initialization code
110  static int lastSignalID;
111 
112  // for hasListeners()/mayHaveListeners()
113  static std::vector<int> signalListenerCounts; // index: signalID, value: number of listeners anywhere
114 
115  // stack of listener lists being notified, to detect concurrent modification
116  static cIListener **notificationStack[];
117  static int notificationSP;
118 
119  // whether only signals declared in NED via @signal are allowed to be emitted
120  static bool checkSignals;
121 
122  // for caching the result of getResultRecorders()
123  struct ResultRecorderList {
124  const cComponent *component;
125  std::vector<cResultRecorder*> recorders;
126  };
127 
128  // for getResultRecorders(); static because we don't want to increase cComponent's size
129  static std::vector<ResultRecorderList*> cachedResultRecorderLists;
130 
131  private:
132  SignalListenerList *findListenerList(simsignal_t signalID) const;
133  SignalListenerList *findOrCreateListenerList(simsignal_t signalID);
134  void throwInvalidSignalID(simsignal_t signalID) const;
135  void removeListenerList(simsignal_t signalID);
136  void checkNotFiring(simsignal_t, cIListener **listenerList);
137  template<typename T> void fire(cComponent *src, simsignal_t signalID, T x, cObject *details);
138  void fireFinish();
139  void releaseLocalListeners();
140  const SignalListenerList& getListenerList(int k) const {return (*signalTable)[k];} // for inspectors
141  int getSignalTableSize() const {return signalTable ? signalTable->size() : 0;} // for inspectors
142  void collectResultRecorders(std::vector<cResultRecorder*>& result) const;
143 
144  public:
145  // internal: used by log mechanism
146  LogLevel getLogLevel() const { return (LogLevel)((flags >> FL_LOGLEVEL_SHIFT) & 0x7); }
147  virtual void setLogLevel(LogLevel logLevel);
148 
149  // internal: invoked from within cEnvir::preconfigure(component)
150  virtual void setRNGMap(short size, int *map) {rngMapSize=size; rngMap=map;}
151 
152  // internal: sets associated cComponentType for the component;
153  // called as part of the creation process.
154  virtual void setComponentType(cComponentType *componenttype);
155 
156  // internal: adds a new parameter to the component; called as part of the creation process
157  virtual void addPar(cParImpl *value);
158 
159  // internal: reallocates paramv (size must be >= numparams)
160  void reallocParamv(int size);
161 
162  // internal: save parameters marked with "save-as-scalars=true"
163  virtual void recordParametersAsScalars();
164 
165  // internal: has finalizeParameters() been called?
166  bool parametersFinalized() const {return flags&FL_PARAMSFINALIZED;}
167 
168  // internal: sets up @statistic-based result recording
169  virtual void addResultRecorders();
170 
171  // internal: has initialize() been called?
172  bool initialized() const {return flags&FL_INITIALIZED;}
173 
174  // internal: calls refreshDisplay() recursively
175  virtual void callRefreshDisplay() = 0;
176 
177  // internal: used from Tkenv: find out if this module has a display string.
178  // getDisplayString() would create the object immediately which we want to avoid.
179  bool hasDisplayString();
180 
181  // internal: clears per-run signals-related data structures; to be invoked before each simulation run
182  static void clearSignalState();
183 
184  // internal: clears signal registrations; to be invoked on exit
185  static void clearSignalRegistrations();
186 
187  // internal: allocates a signalHasLocalListeners/signalHasAncestorListeners bit index to the
188  // given signal and returns the corresponding mask (1<<index); returns 0 if there are no more
189  // free bit indices. Result is remembered and returned in subsequent calls (until clearSignalState())
190  static uint64_t getSignalMask(simsignal_t signalID);
191 
192  // internal: controls whether signals should be validated against @signal declarations in NED files
193  static void setCheckSignals(bool b) {checkSignals = b;}
194  static bool getCheckSignals() {return checkSignals;}
195 
196  // internal: for inspectors
197  const std::vector<cResultRecorder*>& getResultRecorders() const;
198  static void invalidateCachedResultRecorderLists();
199 
200  protected:
220 
225  virtual void initialize(int stage) {if (stage==0) initialize();}
226 
232  virtual int numInitStages() const {return 1;}
233 
238  virtual void initialize();
239 
244  virtual void finish();
245 
264  virtual void handleParameterChange(const char *parname);
265 
292  virtual void refreshDisplay() const;
294 
295  public:
305  cComponent(const char *name = nullptr);
306 
310  virtual ~cComponent();
312 
318  virtual void forEachChild(cVisitor *v) override;
319 
324  const cComponent *getThisPtr() const {return this;} //Note: nonvirtual
326 
334  virtual void finalizeParameters();
335 
342  virtual cProperties *getProperties() const = 0;
343 
347  virtual cComponentType *getComponentType() const;
348 
354  cSimulation *getSimulation() const;
355 
363  int getId() const {return componentId;}
364 
372  virtual const char *getNedTypeName() const;
373 
379  virtual ComponentKind getComponentKind() const = 0;
380 
384  bool isModule() const {return getComponentKind() == KIND_MODULE;}
385 
389  bool isChannel() const {return getComponentKind() == KIND_CHANNEL;}
390 
396  virtual cModule *getParentModule() const = 0;
397 
402  virtual cModule *getSystemModule() const;
404 
410 
414  virtual void callInitialize() = 0;
415 
420  virtual bool callInitialize(int stage) = 0;
421 
426  virtual void callFinish() = 0;
428 
431 
435  virtual int getNumParams() const {return numPars;}
436 
441  virtual cPar& par(int k);
442 
447  const cPar& par(int k) const {return const_cast<cComponent *>(this)->par(k);}
448 
453  virtual cPar& par(const char *parname);
454 
459  const cPar& par(const char *parname) const {return const_cast<cComponent *>(this)->par(parname);}
460 
465  virtual int findPar(const char *parname) const;
466 
470  bool hasPar(const char *s) const {return findPar(s)>=0;}
472 
475 
480  virtual cRNG *getRNG(int k) const;
481 
485  virtual unsigned long intrand(long r, int rng=0) const {return getRNG(rng)->intRand(r);}
486 
490  virtual double dblrand(int rng=0) const {return getRNG(rng)->doubleRand();}
492 
495 
502  virtual double uniform(double a, double b, int rng=0) const {return omnetpp::uniform(getRNG(rng), a, b);}
503 
507  virtual SimTime uniform(SimTime a, SimTime b, int rng=0) const {return uniform(a.dbl(), b.dbl(), rng);}
508 
516  virtual double exponential(double mean, int rng=0) const {return omnetpp::exponential(getRNG(rng), mean);};
517 
521  virtual SimTime exponential(SimTime mean, int rng=0) const {return exponential(mean.dbl(), rng);}
522 
531  virtual double normal(double mean, double stddev, int rng=0) const {return omnetpp::normal(getRNG(rng), mean, stddev);};
532 
536  virtual SimTime normal(SimTime mean, SimTime stddev, int rng=0) const {return normal(mean.dbl(), stddev.dbl(), rng);}
537 
553  virtual double truncnormal(double mean, double stddev, int rng=0) const {return omnetpp::truncnormal(getRNG(rng), mean, stddev);};
554 
558  virtual SimTime truncnormal(SimTime mean, SimTime stddev, int rng=0) const {return truncnormal(mean.dbl(), stddev.dbl(), rng);}
559 
595  virtual double gamma_d(double alpha, double theta, int rng=0) const {return omnetpp::gamma_d(getRNG(rng), alpha, theta);};
596 
609  virtual double beta(double alpha1, double alpha2, int rng=0) const {return omnetpp::beta(getRNG(rng), alpha1, alpha2);};
610 
629  virtual double erlang_k(unsigned int k, double mean, int rng=0) const {return omnetpp::erlang_k(getRNG(rng), k, mean);};
630 
646  virtual double chi_square(unsigned int k, int rng=0) const {return omnetpp::chi_square(getRNG(rng), k);};
647 
659  virtual double student_t(unsigned int i, int rng=0) const {return omnetpp::student_t(getRNG(rng), i);};
660 
675  virtual double cauchy(double a, double b, int rng=0) const {return omnetpp::cauchy(getRNG(rng), a, b);};
676 
686  virtual double triang(double a, double b, double c, int rng=0) const {return omnetpp::triang(getRNG(rng), a, b, c);};
687 
699  virtual double lognormal(double m, double w, int rng=0) const {return omnetpp::lognormal(getRNG(rng), m, w);}
700 
720  virtual double weibull(double a, double b, int rng=0) const {return omnetpp::weibull(getRNG(rng), a, b);};
721 
731  virtual double pareto_shifted(double a, double b, double c, int rng=0) const {return omnetpp::pareto_shifted(getRNG(rng), a, b, c);};
733 
736 
744  virtual int intuniform(int a, int b, int rng=0) const {return omnetpp::intuniform(getRNG(rng), a, b);};
745 
753  virtual int intuniformexcl(int a, int b, int rng=0) const {return omnetpp::intuniformexcl(getRNG(rng), a, b);};
754 
764  virtual int bernoulli(double p, int rng=0) const {return omnetpp::bernoulli(getRNG(rng), p);};
765 
778  virtual int binomial(int n, double p, int rng=0) const {return omnetpp::binomial(getRNG(rng), n, p);};
779 
792  virtual int geometric(double p, int rng=0) const {return omnetpp::geometric(getRNG(rng), p);};
793 
806  virtual int negbinomial(int n, double p, int rng=0) const {return omnetpp::negbinomial(getRNG(rng), n, p);};
807 
823  virtual int poisson(double lambda, int rng=0) const {return omnetpp::poisson(getRNG(rng), lambda);};
825 
842  static simsignal_t registerSignal(const char *name);
843 
848  static const char *getSignalName(simsignal_t signalID);
849 
855  virtual void emit(simsignal_t signalID, bool b, cObject *details = nullptr);
856 
862  virtual void emit(simsignal_t signalID, long l, cObject *details = nullptr);
863 
869  virtual void emit(simsignal_t signalID, unsigned long l, cObject *details = nullptr);
870 
876  virtual void emit(simsignal_t signalID, double d, cObject *details = nullptr);
877 
883  virtual void emit(simsignal_t signalID, const SimTime& t, cObject *details = nullptr);
884 
890  virtual void emit(simsignal_t signalID, const char *s, cObject *details = nullptr);
891 
897  virtual void emit(simsignal_t signalID, cObject *obj, cObject *details = nullptr);
898 
900  virtual void emit(simsignal_t signalID, const cObject *obj, cObject *details = nullptr) { emit(signalID, const_cast<cObject *>(obj), details); }
901 
903  virtual void emit(simsignal_t signalID, char c, cObject *details = nullptr) {emit(signalID,(long)c, details);}
904 
906  virtual void emit(simsignal_t signalID, unsigned char c, cObject *details = nullptr) {emit(signalID,(unsigned long)c, details);}
907 
909  virtual void emit(simsignal_t signalID, short i, cObject *details = nullptr) {emit(signalID,(long)i, details);}
910 
912  virtual void emit(simsignal_t signalID, unsigned short i, cObject *details = nullptr) {emit(signalID,(unsigned long)i, details);}
913 
915  virtual void emit(simsignal_t signalID, int i, cObject *details = nullptr) {emit(signalID,(long)i, details);}
916 
918  virtual void emit(simsignal_t signalID, unsigned int i, cObject *details = nullptr) {emit(signalID,(unsigned long)i, details);}
919 
921  virtual void emit(simsignal_t signalID, float f, cObject *details = nullptr) {emit(signalID,(double)f, details);}
922 
924  virtual void emit(simsignal_t signalID, long double d, cObject *details = nullptr) {emit(signalID,(double)d, details);}
925 
932  bool mayHaveListeners(simsignal_t signalID) const {
933  if (signalID < 0 || signalID > lastSignalID)
934  throwInvalidSignalID(signalID);
935  return signalListenerCounts[signalID] > 0;
936  }
937 
947  bool hasListeners(simsignal_t signalID) const;
949 
959  virtual void subscribe(simsignal_t signalID, cIListener *listener);
960 
965  virtual void subscribe(const char *signalName, cIListener *listener);
966 
971  virtual void unsubscribe(simsignal_t signalID, cIListener *listener);
972 
977  virtual void unsubscribe(const char *signalName, cIListener *listener);
978 
984  virtual bool isSubscribed(simsignal_t signalID, cIListener *listener) const;
985 
990  virtual bool isSubscribed(const char *signalName, cIListener *listener) const;
991 
995  virtual std::vector<simsignal_t> getLocalListenedSignals() const;
996 
1000  virtual std::vector<cIListener*> getLocalSignalListeners(simsignal_t signalID) const;
1002 
1014  virtual bool hasGUI() const;
1015 
1020  virtual cDisplayString& getDisplayString() const;
1021 
1025  virtual void setDisplayString(const char *dispstr);
1026 
1031  virtual void bubble(const char *text) const;
1032 
1045  virtual std::string resolveResourcePath(const char *fileName) const;
1047 
1050 
1054  virtual void recordScalar(const char *name, double value, const char *unit=nullptr);
1055 
1059  virtual void recordScalar(const char *name, SimTime value, const char *unit=nullptr) {recordScalar(name, value.dbl(), unit);}
1060 
1066  virtual void recordStatistic(cStatistic *stats, const char *unit=nullptr);
1067 
1073  virtual void recordStatistic(const char *name, cStatistic *stats, const char *unit=nullptr);
1075 };
1076 
1077 } // namespace omnetpp
1078 
1079 
1080 #endif
1081 
SIM_API double triang(cRNG *rng, double a, double b, double c)
Returns a random variate from the triangular distribution with parameters a <= b <= c...
Internal class, used as a base class for modules and channels. It is not intended for subclassing out...
Definition: cdefaultlist.h:33
virtual unsigned long intRand()=0
Common base for module and channel classes.
Definition: ccomponent.h:48
Represents a module gate.
Definition: cgate.h:63
SIM_API double cauchy(cRNG *rng, double a, double b)
Returns a random variate from the Cauchy distribution (also called Lorentzian distribution) with para...
Root of the OMNeT++ class hierarchy. cObject is a lightweight class without any data members...
Definition: cobject.h:58
virtual void emit(simsignal_t signalID, short i, cObject *details=nullptr)
Definition: ccomponent.h:909
virtual double uniform(double a, double b, int rng=0) const
Definition: ccomponent.h:502
SIM_API int intuniformexcl(cRNG *rng, int a, int b)
Returns a random integer with uniform distribution over [a,b), that is, from [a,b-1].
int64_t-based, base-10 fixed-point simulation time.
Definition: simtime.h:66
Base class for all simple module classes.
Definition: csimplemodule.h:62
virtual double exponential(double mean, int rng=0) const
Definition: ccomponent.h:516
virtual int intuniform(int a, int b, int rng=0) const
Definition: ccomponent.h:744
virtual int poisson(double lambda, int rng=0) const
Definition: ccomponent.h:823
SIM_API double truncnormal(cRNG *rng, double mean, double stddev)
Normal distribution truncated to nonnegative values.
SIM_API double pareto_shifted(cRNG *rng, double a, double b, double c)
Returns a random variate from the shifted generalized Pareto distribution.
virtual void emit(simsignal_t signalID, char c, cObject *details=nullptr)
Definition: ccomponent.h:903
virtual void emit(simsignal_t signalID, unsigned short i, cObject *details=nullptr)
Definition: ccomponent.h:912
SIM_API int binomial(cRNG *rng, int n, double p)
Returns a random integer from the binomial distribution with parameters n and p, that is...
const cPar & par(int k) const
Definition: ccomponent.h:447
SIM_API double student_t(cRNG *rng, unsigned int i)
Returns a random variate from the student-t distribution with i degrees of freedom. If Y1 has a normal distribution and Y2 has a chi-square distribution with k degrees of freedom then X = Y1 / sqrt(Y2/k) has a student-t distribution with k degrees of freedom.
SIM_API double chi_square(cRNG *rng, unsigned int k)
Returns a random variate from the chi-square distribution with k degrees of freedom.
LogLevel
Classifies log messages based on detail and importance.
Definition: clog.h:33
virtual void emit(simsignal_t signalID, unsigned char c, cObject *details=nullptr)
Definition: ccomponent.h:906
virtual SimTime uniform(SimTime a, SimTime b, int rng=0) const
Definition: ccomponent.h:507
virtual int binomial(int n, double p, int rng=0) const
Definition: ccomponent.h:778
Abstract interface for random number generator classes.
Definition: crng.h:49
Simulation manager class.
Definition: csimulation.h:62
virtual void initialize(int stage)
Definition: ccomponent.h:225
SIM_API int intuniform(cRNG *rng, int a, int b)
Returns a random integer with uniform distribution in the range [a,b], inclusive. (Note that the func...
SIM_API int geometric(cRNG *rng, double p)
Returns a random integer from the geometric distribution with parameter p, that is, the number of independent trials with probability p until the first success.
Represents a module or channel parameter.
Definition: cpar.h:68
virtual double cauchy(double a, double b, int rng=0) const
Definition: ccomponent.h:675
bool hasPar(const char *s) const
Definition: ccomponent.h:470
SIM_API int negbinomial(cRNG *rng, int n, double p)
Returns a random integer from the negative binomial distribution with parameters n and p...
int getId() const
Definition: ccomponent.h:363
virtual double beta(double alpha1, double alpha2, int rng=0) const
Definition: ccomponent.h:609
virtual double normal(double mean, double stddev, int rng=0) const
Definition: ccomponent.h:531
virtual int getNumParams() const
Definition: ccomponent.h:435
virtual void emit(simsignal_t signalID, float f, cObject *details=nullptr)
Definition: ccomponent.h:921
virtual double gamma_d(double alpha, double theta, int rng=0) const
Definition: ccomponent.h:595
virtual double pareto_shifted(double a, double b, double c, int rng=0) const
Definition: ccomponent.h:731
virtual void emit(simsignal_t signalID, int i, cObject *details=nullptr)
Definition: ccomponent.h:915
SIM_API int poisson(cRNG *rng, double lambda)
Returns a random integer from the Poisson distribution with parameter lambda, that is...
SIM_API double normal(cRNG *rng, double mean, double stddev)
Returns a random variate from the normal distribution with the given mean and standard deviation...
virtual double weibull(double a, double b, int rng=0) const
Definition: ccomponent.h:720
bool isModule() const
Definition: ccomponent.h:384
const cPar & par(const char *parname) const
Definition: ccomponent.h:459
SIM_API double beta(cRNG *rng, double alpha1, double alpha2)
Returns a random variate from the beta distribution with parameters alpha1, alpha2.
double dbl() const
Definition: simtime.h:301
virtual double student_t(unsigned int i, int rng=0) const
Definition: ccomponent.h:659
int bernoulli(cRNG *rng, double p)
Returns the result of a Bernoulli trial with probability p, that is, 1 with probability p and 0 with ...
Definition: distrib.h:317
This class represents modules in the simulation.
Definition: cmodule.h:47
virtual double lognormal(double m, double w, int rng=0) const
Definition: ccomponent.h:699
bool mayHaveListeners(simsignal_t signalID) const
Definition: ccomponent.h:932
const cComponent * getThisPtr() const
Definition: ccomponent.h:324
virtual unsigned long intrand(long r, int rng=0) const
Definition: ccomponent.h:485
SIM_API double weibull(cRNG *rng, double a, double b)
Returns a random variate from the Weibull distribution with parameters a, b > 0, where a is the "scal...
virtual double triang(double a, double b, double c, int rng=0) const
Definition: ccomponent.h:686
SIM_API double gamma_d(cRNG *rng, double alpha, double theta)
Returns a random variate from the gamma distribution with parameters alpha>0, theta>0. Alpha is known as the "shape" parameter, and theta as the "scale" parameter.
virtual double doubleRand()=0
virtual int intuniformexcl(int a, int b, int rng=0) const
Definition: ccomponent.h:753
virtual void recordScalar(const char *name, SimTime value, const char *unit=nullptr)
Definition: ccomponent.h:1059
virtual int negbinomial(int n, double p, int rng=0) const
Definition: ccomponent.h:806
Enables traversing the tree of (cObject-rooted) simulation objects.
Definition: cvisitor.h:56
virtual SimTime exponential(SimTime mean, int rng=0) const
Definition: ccomponent.h:521
double lognormal(cRNG *rng, double m, double w)
Returns a random variate from the lognormal distribution with "scale" parameter m and "shape" paramet...
Definition: distrib.h:244
Common base class for cModuleType and cChannelType.
Definition: ccomponenttype.h:49
Definition: cabstracthistogram.h:21
SIM_API double erlang_k(cRNG *rng, unsigned int k, double mean)
Returns a random variate from the Erlang distribution with k phases and mean mean.
A collection of properties (cProperty).
Definition: cproperties.h:34
Common abstract base class for result filters and result recorders.
Definition: cresultlistener.h:34
virtual SimTime truncnormal(SimTime mean, SimTime stddev, int rng=0) const
Definition: ccomponent.h:558
virtual double truncnormal(double mean, double stddev, int rng=0) const
Definition: ccomponent.h:553
SIM_API double exponential(cRNG *rng, double mean)
Returns a random variate from the exponential distribution with the given mean (that is...
virtual double dblrand(int rng=0) const
Definition: ccomponent.h:490
virtual int geometric(double p, int rng=0) const
Definition: ccomponent.h:792
Represents a display string.
Definition: cdisplaystring.h:58
Interface for listeners in a simulation model.
Definition: clistener.h:66
virtual SimTime normal(SimTime mean, SimTime stddev, int rng=0) const
Definition: ccomponent.h:536
virtual double erlang_k(unsigned int k, double mean, int rng=0) const
Definition: ccomponent.h:629
virtual double chi_square(unsigned int k, int rng=0) const
Definition: ccomponent.h:646
virtual void emit(simsignal_t signalID, unsigned int i, cObject *details=nullptr)
Definition: ccomponent.h:918
int simsignal_t
Signal handle.
Definition: clistener.h:24
SIM_API double uniform(cRNG *rng, double a, double b)
Returns a random variate with uniform distribution in the range [a,b).
bool isChannel() const
Definition: ccomponent.h:389
virtual int bernoulli(double p, int rng=0) const
Definition: ccomponent.h:764
Base class for channels.
Definition: cchannel.h:34
cStatistic is an abstract class for computing statistical properties of a random variable.
Definition: cstatistic.h:34
cSimulation * getSimulation()
Returns the currently active simulation, or nullptr if there is none.
Definition: csimulation.h:575
Internal class that stores values for cPar objects.
Definition: cparimpl.h:44
virtual int numInitStages() const
Definition: ccomponent.h:232
virtual void emit(simsignal_t signalID, long double d, cObject *details=nullptr)
Definition: ccomponent.h:924
virtual void emit(simsignal_t signalID, const cObject *obj, cObject *details=nullptr)
Definition: ccomponent.h:900