OMNeT++ Simulation Library  6.0.3
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 <unordered_set>
21 #include "simkerneldefs.h"
22 #include "cownedobject.h"
23 #include "cpar.h"
24 #include "csoftowner.h"
25 #include "simtime.h"
26 #include "cenvir.h"
27 #include "clistener.h"
28 #include "clog.h"
29 #include "distrib.h"
30 
31 namespace omnetpp {
32 
33 class cComponentType;
34 class cProperties;
35 class cDisplayString;
36 class cRNG;
37 class cStatistic;
38 class cResultRecorder;
39 
49 class SIM_API cComponent : public cSoftOwner //implies noncopyable
50 {
51  friend class cComponentDescriptor; // listener lists, etc
52  friend class cComponent__SignalListenerListDescriptor; // sim_std.msg
53  friend class cPar; // needs to call handleParameterChange()
54  friend class cChannel; // allow access to FL_INITIALIZED, FL_DELETING and releaseLocalListeners()
55  friend class cModule; // allow access to FL_INITIALIZED, FL_DELETING, releaseLocalListeners() and repairSignalFlags()
56  friend class cSimpleModule; // allow access to FL_INITIALIZED, FL_DELETING, releaseLocalListeners() and repairSignalFlags()
57  friend class cGate; // because of repairSignalFlags()
58  friend class cSimulation; // sets componentId
59  friend class cResultListener; // invalidateCachedResultRecorderLists()
60  public:
61  enum ComponentKind { KIND_MODULE, KIND_CHANNEL, KIND_OTHER };
62 
63  private:
64  enum {
65  FL_PARAMSFINALIZED = 1 << 2, // whether finalizeParameters() has been called
66  FL_INITIALIZED = 1 << 3, // whether initialize() has completed for this module
67  FL_DELETING = 1 << 4, // module or channel is being deleted (via deleteModule(), disconnect(), etc.)
68  FL_DISPSTR_CHECKED = 1 << 5, // for hasDisplayString(): whether the FL_DISPSTR_NOTEMPTY flag is valid
69  FL_DISPSTR_NOTEMPTY = 1 << 6, // for hasDisplayString(): whether the display string is not empty
70  FL_LOGLEVEL_SHIFT = 7, // 3 bits wide
71  };
72 
73  private:
75 
76  cComponentType *componentType; // component type object
77  cSimulation *simulation; // the simulation it belongs to
78  int componentId; // id in cSimulation
79 
80  short lastCompletedInitStage;
81 
82  short rngMapSize; // size of the rngMap array (RNGs with index >= rngMapSize are mapped one-to-one to global RNGs)
83  int *rngMap; // maps local RNG numbers (may be nullptr if rngMapSize==0)
84 
85  short numPars;
86  short parArraySize;
87  cPar *parArray; // array of cPar objects
88 
89  mutable cDisplayString *displayString; // created on demand
90  opp_pooledstring displayName = nullptr; // optional display name
91 
92  public:
93  struct SignalListenerList { // public for inspectors
94  simsignal_t signalID;
95  cIListener **listeners; // nullptr-terminated array
96 
97  SignalListenerList() {signalID=SIMSIGNAL_NULL; listeners=nullptr;}
98  const char *getSignalName() const;
99  std::string str() const;
100  void dispose() {delete [] listeners;}
101  bool addListener(cIListener *l);
102  bool removeListener(cIListener *l);
103  int findListener(cIListener *l) const;
104  bool hasListener() const {return listeners && listeners[0];}
105  int countListeners() const;
106  cIListener *getListener(int k) const {return listeners[k];} // unsafe
107  static bool gt(const SignalListenerList& e1, const SignalListenerList& e2) {return e1.signalID > e2.signalID;}
108  };
109 
110  private:
111  typedef std::vector<SignalListenerList> SignalTable;
112  SignalTable *signalTable; // ordered by signalID so we can do binary search
113 
114  std::unordered_set<void**> *selfPointers = nullptr;
115 
116  // string-to-simsignal_t mapping
117  static struct SignalNameMapping {
118  std::map<std::string,simsignal_t> signalNameToID;
119  std::map<simsignal_t,std::string> signalIDToName;
120  } *signalNameMapping; // must be dynamically allocated on first access so that registerSignal() can be invoked from static initialization code
121  static int lastSignalID;
122 
123  // for hasListeners()/mayHaveListeners()
124  static std::vector<int> signalListenerCounts; // index: signalID, value: number of listeners anywhere
125 
126  // stack of listener lists being notified, to detect concurrent modification
127  static cIListener **notificationStack[];
128  static int notificationSP;
129 
130  // whether only signals declared in NED via @signal are allowed to be emitted
131  static bool checkSignals;
132 
133  // for caching the result of getResultRecorders()
134  struct ResultRecorderList {
135  const cComponent *component;
136  std::vector<cResultRecorder*> recorders;
137  };
138 
139  // for getResultRecorders(); static because we don't want to increase cComponent's size
140  static std::vector<ResultRecorderList*> cachedResultRecorderLists;
141 
142  private:
143  SignalListenerList *findListenerList(simsignal_t signalID) const;
144  SignalListenerList *findOrCreateListenerList(simsignal_t signalID);
145  void throwInvalidSignalID(simsignal_t signalID) const;
146  void removeListenerList(simsignal_t signalID);
147  void checkNotFiring(simsignal_t, cIListener **listenerList);
148  template<typename T> void fire(cComponent *src, simsignal_t signalID, T x, cObject *details);
149  void fireFinish();
150  void releaseLocalListeners();
151  const SignalListenerList& getListenerList(int k) const {return (*signalTable)[k];} // for inspectors
152  int getSignalTableSize() const {return signalTable ? signalTable->size() : 0;} // for inspectors
153  void collectResultRecorders(std::vector<cResultRecorder*>& result) const;
154  virtual void doEmit(simsignal_t signalID, intval_t i, cObject *details);
155  virtual void doEmit(simsignal_t signalID, uintval_t i, cObject *details);
156 
157  protected:
158  virtual cModule *doFindModuleByPath(const char *s) const = 0;
159 
160  public:
161  // internal: used by log mechanism
162  LogLevel getLogLevel() const { return (LogLevel)((flags >> FL_LOGLEVEL_SHIFT) & 0x7); }
163  virtual void setLogLevel(LogLevel logLevel);
164 
165  // internal: invoked from within cEnvir::preconfigure(component)
166  virtual void setRNGMap(short size, int *map) {rngMapSize=size; rngMap=map;}
167 
168  // internal: sets associated cComponentType for the component;
169  // called as part of the creation process.
170  virtual void setComponentType(cComponentType *componenttype);
171 
172  // internal: adds a new parameter to the component; called as part of the creation process
173  virtual void addPar(cParImpl *value);
174 
175  // internal: reallocates paramv (size must be >= numparams)
176  void reallocParamv(int size);
177 
178  // internal: save parameters
179  virtual void recordParameters();
180  virtual void recordParameterAsScalar(cPar *par);
181 
182  // internal: has finalizeParameters() been called?
183  bool parametersFinalized() const {return flags&FL_PARAMSFINALIZED;}
184 
185  // internal: sets up @statistic-based result recording
186  virtual void addResultRecorders();
187  virtual void emitStatisticInitialValues();
188 
189  // internal: has initialize() been called?
190  bool initialized() const {return flags&FL_INITIALIZED;}
191 
192  // internal: calls refreshDisplay() recursively
193  virtual void callRefreshDisplay() = 0;
194 
195  // internal: calls preDelete() recursively
196  virtual void callPreDelete(cComponent *root) = 0;
197 
198  // internal: used from Qtenv: find out if this module has a display string.
199  // getDisplayString() would create the object immediately which we want to avoid.
200  bool hasDisplayString();
201 
202  // internal: clears per-run signals-related data structures; to be invoked before each simulation run
203  static void clearSignalState();
204 
205  // internal: clears signal registrations; to be invoked on exit
206  static void clearSignalRegistrations();
207 
208  // internal: allocates a signalHasLocalListeners/signalHasAncestorListeners bit index to the
209  // given signal and returns the corresponding mask (1<<index); returns 0 if there are no more
210  // free bit indices. Result is remembered and returned in subsequent calls (until clearSignalState())
211  static uint64_t getSignalMask(simsignal_t signalID);
212 
213  // internal: controls whether signals should be validated against @signal declarations in NED files
214  static void setCheckSignals(bool b) {checkSignals = b;}
215  static bool getCheckSignals() {return checkSignals;}
216 
217  // internal: for inspectors
218  const std::vector<cResultRecorder*>& getResultRecorders() const;
219  static void invalidateCachedResultRecorderLists();
220 
221  // experimental
222  template<class T>
223  void registerSelfPointer(T *&ptr) {
224  ASSERT(dynamic_cast<cComponent*>(ptr) == this);
225  if (!selfPointers)
226  selfPointers = new std::unordered_set<void**>;
227  selfPointers->insert((void**)&ptr);
228  }
229 
230  template<class T>
231  void deregisterSelfPointer(T *&ptr) {
232  ASSERT(dynamic_cast<cComponent*>(ptr) == this);
233  ASSERT(selfPointers != nullptr && selfPointers->find((void**)&ptr) != selfPointers->end());
234  selfPointers->erase((void**)&ptr);
235  }
236 
237  protected:
257 
262  virtual void initialize(int stage) {if (stage==0) initialize();}
263 
269  virtual int numInitStages() const {return 1;}
270 
275  virtual void initialize();
276 
281  virtual void finish();
282 
306  virtual void handleParameterChange(const char *parname);
307 
334  virtual void refreshDisplay() const;
335 
350  virtual void preDelete(cComponent *root);
352 
353  public:
363  cComponent(const char *name = nullptr);
364 
368  virtual ~cComponent();
370 
376  virtual void forEachChild(cVisitor *v) override;
377 
382  const cComponent *getThisPtr() const {return this;} //Note: nonvirtual
384 
392  virtual void finalizeParameters();
393 
400  virtual cProperties *getProperties() const = 0;
401 
407  virtual void setDisplayName(const char *name);
408 
414  virtual const char *getDisplayName() const {return displayName.c_str();}
415 
419  virtual cComponentType *getComponentType() const;
420 
424  cSimulation *getSimulation() const {return simulation;}
425 
433  int getId() const {return componentId;}
434 
442  virtual const char *getNedTypeName() const;
443 
450  virtual std::string getNedTypeAndFullName() const;
451 
458  virtual std::string getNedTypeAndFullPath() const;
459 
465  virtual ComponentKind getComponentKind() const = 0;
466 
470  bool isModule() const {return getComponentKind() == KIND_MODULE;}
471 
475  bool isChannel() const {return getComponentKind() == KIND_CHANNEL;}
476 
482  virtual cModule *getParentModule() const = 0;
483 
488  virtual cModule *getSystemModule() const;
489 
514  virtual cModule *getModuleByPath(const char *path) const;
515 
524  virtual cModule *findModuleByPath(const char *path) const;
526 
532 
536  virtual void callInitialize() = 0;
537 
542  virtual bool callInitialize(int stage) = 0;
543 
548  virtual void callFinish() = 0;
550 
553 
557  virtual int getNumParams() const {return numPars;}
558 
563  virtual cPar& par(int k);
564 
569  const cPar& par(int k) const {return const_cast<cComponent *>(this)->par(k);}
570 
575  virtual cPar& par(const char *parname);
576 
581  const cPar& par(const char *parname) const {return const_cast<cComponent *>(this)->par(parname);}
582 
587  virtual int findPar(const char *parname) const;
588 
592  bool hasPar(const char *s) const {return findPar(s)>=0;}
594 
597 
602  virtual cRNG *getRNG(int k) const;
603 
607  virtual uint32_t intrand(uint32_t r, int rng=0) const {return getRNG(rng)->intRand(r);}
608 
612  virtual double dblrand(int rng=0) const {return getRNG(rng)->doubleRand();}
614 
617 
624  virtual double uniform(double a, double b, int rng=0) const {return omnetpp::uniform(getRNG(rng), a, b);}
625 
629  virtual SimTime uniform(SimTime a, SimTime b, int rng=0) const {return uniform(a.dbl(), b.dbl(), rng);}
630 
638  virtual double exponential(double mean, int rng=0) const {return omnetpp::exponential(getRNG(rng), mean);};
639 
643  virtual SimTime exponential(SimTime mean, int rng=0) const {return exponential(mean.dbl(), rng);}
644 
653  virtual double normal(double mean, double stddev, int rng=0) const {return omnetpp::normal(getRNG(rng), mean, stddev);};
654 
658  virtual SimTime normal(SimTime mean, SimTime stddev, int rng=0) const {return normal(mean.dbl(), stddev.dbl(), rng);}
659 
675  virtual double truncnormal(double mean, double stddev, int rng=0) const {return omnetpp::truncnormal(getRNG(rng), mean, stddev);};
676 
680  virtual SimTime truncnormal(SimTime mean, SimTime stddev, int rng=0) const {return truncnormal(mean.dbl(), stddev.dbl(), rng);}
681 
717  virtual double gamma_d(double alpha, double theta, int rng=0) const {return omnetpp::gamma_d(getRNG(rng), alpha, theta);};
718 
731  virtual double beta(double alpha1, double alpha2, int rng=0) const {return omnetpp::beta(getRNG(rng), alpha1, alpha2);};
732 
751  virtual double erlang_k(unsigned int k, double mean, int rng=0) const {return omnetpp::erlang_k(getRNG(rng), k, mean);};
752 
768  virtual double chi_square(unsigned int k, int rng=0) const {return omnetpp::chi_square(getRNG(rng), k);};
769 
781  virtual double student_t(unsigned int i, int rng=0) const {return omnetpp::student_t(getRNG(rng), i);};
782 
797  virtual double cauchy(double a, double b, int rng=0) const {return omnetpp::cauchy(getRNG(rng), a, b);};
798 
808  virtual double triang(double a, double b, double c, int rng=0) const {return omnetpp::triang(getRNG(rng), a, b, c);};
809 
821  virtual double lognormal(double m, double w, int rng=0) const {return omnetpp::lognormal(getRNG(rng), m, w);}
822 
842  virtual double weibull(double a, double b, int rng=0) const {return omnetpp::weibull(getRNG(rng), a, b);};
843 
853  virtual double pareto_shifted(double a, double b, double c, int rng=0) const {return omnetpp::pareto_shifted(getRNG(rng), a, b, c);};
855 
858 
866  virtual int intuniform(int a, int b, int rng=0) const {return omnetpp::intuniform(getRNG(rng), a, b);};
867 
875  virtual int intuniformexcl(int a, int b, int rng=0) const {return omnetpp::intuniformexcl(getRNG(rng), a, b);};
876 
886  virtual int bernoulli(double p, int rng=0) const {return omnetpp::bernoulli(getRNG(rng), p);};
887 
900  virtual int binomial(int n, double p, int rng=0) const {return omnetpp::binomial(getRNG(rng), n, p);};
901 
914  virtual int geometric(double p, int rng=0) const {return omnetpp::geometric(getRNG(rng), p);};
915 
928  virtual int negbinomial(int n, double p, int rng=0) const {return omnetpp::negbinomial(getRNG(rng), n, p);};
929 
945  virtual int poisson(double lambda, int rng=0) const {return omnetpp::poisson(getRNG(rng), lambda);};
947 
964  static simsignal_t registerSignal(const char *name);
965 
970  static const char *getSignalName(simsignal_t signalID);
971 
977  virtual void emit(simsignal_t signalID, bool b, cObject *details = nullptr);
978 
984  virtual void emit(simsignal_t signalID, double d, cObject *details = nullptr);
985 
991  virtual void emit(simsignal_t signalID, const SimTime& t, cObject *details = nullptr);
992 
999  virtual void emit(simsignal_t signalID, const char *s, cObject *details = nullptr);
1000 
1006  virtual void emit(simsignal_t signalID, cObject *obj, cObject *details = nullptr);
1007 
1009  virtual void emit(simsignal_t signalID, const cObject *obj, cObject *details = nullptr) { emit(signalID, const_cast<cObject *>(obj), details); }
1010 
1012  virtual void emit(simsignal_t signalID, char c, cObject *details = nullptr) {doEmit(signalID,(intval_t)c, details);}
1013 
1015  virtual void emit(simsignal_t signalID, unsigned char c, cObject *details = nullptr) {doEmit(signalID,(uintval_t)c, details);}
1016 
1018  virtual void emit(simsignal_t signalID, short i, cObject *details = nullptr) {doEmit(signalID,(intval_t)i, details);}
1019 
1021  virtual void emit(simsignal_t signalID, unsigned short i, cObject *details = nullptr) {doEmit(signalID,(uintval_t)i, details);}
1022 
1024  virtual void emit(simsignal_t signalID, int i, cObject *details = nullptr) {doEmit(signalID,(intval_t)i, details);}
1025 
1027  virtual void emit(simsignal_t signalID, unsigned int i, cObject *details = nullptr) {doEmit(signalID,(uintval_t)i, details);}
1028 
1030  virtual void emit(simsignal_t signalID, long i, cObject *details = nullptr) {doEmit(signalID,(intval_t)i, details);}
1031 
1033  virtual void emit(simsignal_t signalID, unsigned long i, cObject *details = nullptr) {doEmit(signalID,(uintval_t)i, details);}
1034 
1036  virtual void emit(simsignal_t signalID, long long i, cObject *details = nullptr) {doEmit(signalID,(intval_t)i, details);}
1037 
1039  virtual void emit(simsignal_t signalID, unsigned long long i, cObject *details = nullptr) {doEmit(signalID,(uintval_t)i, details);}
1040 
1042  virtual void emit(simsignal_t signalID, float f, cObject *details = nullptr) {emit(signalID,(double)f, details);}
1043 
1045  virtual void emit(simsignal_t signalID, long double d, cObject *details = nullptr) {emit(signalID,(double)d, details);}
1046 
1053  bool mayHaveListeners(simsignal_t signalID) const {
1054  if (signalID < 0 || signalID > lastSignalID)
1055  throwInvalidSignalID(signalID);
1056  return signalListenerCounts[signalID] > 0;
1057  }
1058 
1068  bool hasListeners(simsignal_t signalID) const;
1070 
1080  virtual void subscribe(simsignal_t signalID, cIListener *listener);
1081 
1086  virtual void subscribe(const char *signalName, cIListener *listener);
1087 
1092  virtual void unsubscribe(simsignal_t signalID, cIListener *listener);
1093 
1098  virtual void unsubscribe(const char *signalName, cIListener *listener);
1099 
1105  virtual bool isSubscribed(simsignal_t signalID, cIListener *listener) const;
1106 
1111  virtual bool isSubscribed(const char *signalName, cIListener *listener) const;
1112 
1116  virtual std::vector<simsignal_t> getLocalListenedSignals() const;
1117 
1121  virtual std::vector<cIListener*> getLocalSignalListeners(simsignal_t signalID) const;
1123 
1135  virtual bool hasGUI() const;
1136 
1141  virtual cDisplayString& getDisplayString() const;
1142 
1146  virtual void setDisplayString(const char *dispstr);
1147 
1152  virtual void bubble(const char *text) const;
1153 
1166  virtual std::string resolveResourcePath(const char *fileName) const;
1168 
1171 
1175  virtual void recordScalar(const char *name, double value, const char *unit=nullptr);
1176 
1180  virtual void recordScalar(const char *name, SimTime value, const char *unit=nullptr) {recordScalar(name, value.dbl(), unit);}
1181 
1187  virtual void recordStatistic(cStatistic *stats, const char *unit=nullptr);
1188 
1194  virtual void recordStatistic(const char *name, cStatistic *stats, const char *unit=nullptr);
1196 };
1197 
1198 } // namespace omnetpp
1199 
1200 
1201 #endif
1202 
omnetpp::cComponent::geometric
virtual int geometric(double p, int rng=0) const
Definition: ccomponent.h:914
omnetpp::normal
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.
omnetpp::chi_square
SIM_API double chi_square(cRNG *rng, unsigned int k)
Returns a random variate from the chi-square distribution with k degrees of freedom.
omnetpp::cModule
This class represents modules in the simulation.
Definition: cmodule.h:48
omnetpp::gamma_d
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....
omnetpp::simsignal_t
int simsignal_t
Signal handle.
Definition: clistener.h:27
omnetpp::cComponent::chi_square
virtual double chi_square(unsigned int k, int rng=0) const
Definition: ccomponent.h:768
omnetpp::cObject
cObject is a lightweight class which serves as the root of the OMNeT++ class hierarchy....
Definition: cobject.h:92
omnetpp::cComponent::uniform
virtual SimTime uniform(SimTime a, SimTime b, int rng=0) const
Definition: ccomponent.h:629
omnetpp::cComponent::beta
virtual double beta(double alpha1, double alpha2, int rng=0) const
Definition: ccomponent.h:731
omnetpp::cComponent::gamma_d
virtual double gamma_d(double alpha, double theta, int rng=0) const
Definition: ccomponent.h:717
omnetpp::cauchy
SIM_API double cauchy(cRNG *rng, double a, double b)
Returns a random variate from the Cauchy distribution (also called Lorentzian distribution) with para...
omnetpp::cComponent::initialize
virtual void initialize(int stage)
Definition: ccomponent.h:262
omnetpp::cComponent::triang
virtual double triang(double a, double b, double c, int rng=0) const
Definition: ccomponent.h:808
omnetpp::cComponent::emit
virtual void emit(simsignal_t signalID, unsigned char c, cObject *details=nullptr)
Definition: ccomponent.h:1015
omnetpp::cComponent::exponential
virtual double exponential(double mean, int rng=0) const
Definition: ccomponent.h:638
omnetpp::cSimulation
Simulation manager class.
Definition: csimulation.h:63
omnetpp::cComponent::pareto_shifted
virtual double pareto_shifted(double a, double b, double c, int rng=0) const
Definition: ccomponent.h:853
omnetpp::cComponent::emit
virtual void emit(simsignal_t signalID, const cObject *obj, cObject *details=nullptr)
Definition: ccomponent.h:1009
omnetpp::cComponent::par
const cPar & par(const char *parname) const
Definition: ccomponent.h:581
omnetpp::cComponent::recordScalar
virtual void recordScalar(const char *name, SimTime value, const char *unit=nullptr)
Definition: ccomponent.h:1180
omnetpp::cComponent::cauchy
virtual double cauchy(double a, double b, int rng=0) const
Definition: ccomponent.h:797
omnetpp::geometric
SIM_API int geometric(cRNG *rng, double p)
Returns a random integer from the geometric distribution with parameter p, that is,...
omnetpp::cComponent::isChannel
bool isChannel() const
Definition: ccomponent.h:475
omnetpp::cComponent::student_t
virtual double student_t(unsigned int i, int rng=0) const
Definition: ccomponent.h:781
omnetpp::cComponent::dblrand
virtual double dblrand(int rng=0) const
Definition: ccomponent.h:612
omnetpp::cComponent::emit
virtual void emit(simsignal_t signalID, unsigned int i, cObject *details=nullptr)
Definition: ccomponent.h:1027
omnetpp::lognormal
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:251
omnetpp::cIListener
Interface for listeners in a simulation model.
Definition: clistener.h:71
omnetpp::cComponent::negbinomial
virtual int negbinomial(int n, double p, int rng=0) const
Definition: ccomponent.h:928
omnetpp::cVisitor
Enables traversing the tree of (cObject-rooted) simulation objects.
Definition: cvisitor.h:56
omnetpp::cChannel
Base class for channels.
Definition: cchannel.h:46
omnetpp::cComponent::normal
virtual double normal(double mean, double stddev, int rng=0) const
Definition: ccomponent.h:653
omnetpp::bernoulli
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:324
omnetpp::cComponent::isModule
bool isModule() const
Definition: ccomponent.h:470
omnetpp::SimTime
int64_t-based, base-10 fixed-point simulation time.
Definition: simtime.h:66
omnetpp::cComponent::emit
virtual void emit(simsignal_t signalID, unsigned short i, cObject *details=nullptr)
Definition: ccomponent.h:1021
omnetpp::negbinomial
SIM_API int negbinomial(cRNG *rng, int n, double p)
Returns a random integer from the negative binomial distribution with parameters n and p,...
omnetpp::uintval_t
uint64_t uintval_t
Unsigned integer type which is guaranteed to be at least 64 bits wide. It is used throughout the libr...
Definition: simkerneldefs.h:109
omnetpp::triang
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.
omnetpp::cComponent::truncnormal
virtual double truncnormal(double mean, double stddev, int rng=0) const
Definition: ccomponent.h:675
omnetpp::poisson
SIM_API int poisson(cRNG *rng, double lambda)
Returns a random integer from the Poisson distribution with parameter lambda, that is,...
omnetpp::intuniform
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...
omnetpp::cSoftOwner
Internal class, used as a base class for modules and channels. It is not intended for subclassing out...
Definition: csoftowner.h:33
omnetpp::cComponent::poisson
virtual int poisson(double lambda, int rng=0) const
Definition: ccomponent.h:945
omnetpp::cGate
Represents a module gate.
Definition: cgate.h:62
omnetpp::cComponent::hasPar
bool hasPar(const char *s) const
Definition: ccomponent.h:592
omnetpp::cProperties
A collection of properties (cProperty).
Definition: cproperties.h:34
omnetpp::uniform
SIM_API double uniform(cRNG *rng, double a, double b)
Returns a random variate with uniform distribution in the range [a,b).
omnetpp::cComponent::emit
virtual void emit(simsignal_t signalID, long double d, cObject *details=nullptr)
Definition: ccomponent.h:1045
omnetpp::cRNG
Abstract interface for random number generator classes.
Definition: crng.h:48
omnetpp::cComponent::weibull
virtual double weibull(double a, double b, int rng=0) const
Definition: ccomponent.h:842
omnetpp::cComponent::intuniformexcl
virtual int intuniformexcl(int a, int b, int rng=0) const
Definition: ccomponent.h:875
omnetpp::erlang_k
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.
omnetpp::cComponent::emit
virtual void emit(simsignal_t signalID, int i, cObject *details=nullptr)
Definition: ccomponent.h:1024
omnetpp::cComponent::intrand
virtual uint32_t intrand(uint32_t r, int rng=0) const
Definition: ccomponent.h:607
omnetpp::cPar
Represents a module or channel parameter.
Definition: cpar.h:70
omnetpp::cComponent::intuniform
virtual int intuniform(int a, int b, int rng=0) const
Definition: ccomponent.h:866
omnetpp::cComponentType
Common base class for cModuleType and cChannelType.
Definition: ccomponenttype.h:49
omnetpp::cComponent::getDisplayName
virtual const char * getDisplayName() const
Definition: ccomponent.h:414
omnetpp::cComponent::getId
int getId() const
Definition: ccomponent.h:433
omnetpp::cComponent::getSimulation
cSimulation * getSimulation() const
Definition: ccomponent.h:424
omnetpp::cComponent::mayHaveListeners
bool mayHaveListeners(simsignal_t signalID) const
Definition: ccomponent.h:1053
omnetpp::intuniformexcl
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].
omnetpp::cComponent::emit
virtual void emit(simsignal_t signalID, unsigned long long i, cObject *details=nullptr)
Definition: ccomponent.h:1039
omnetpp::intval_t
int64_t intval_t
Signed integer type which is guaranteed to be at least 64 bits wide. It is used throughout the librar...
Definition: simkerneldefs.h:101
omnetpp::cComponent::lognormal
virtual double lognormal(double m, double w, int rng=0) const
Definition: ccomponent.h:821
omnetpp::internal::cParImpl
Internal class that stores values for cPar objects.
Definition: cparimpl.h:46
omnetpp::cComponent::emit
virtual void emit(simsignal_t signalID, unsigned long i, cObject *details=nullptr)
Definition: ccomponent.h:1033
omnetpp::cComponent::getThisPtr
const cComponent * getThisPtr() const
Definition: ccomponent.h:382
omnetpp::pareto_shifted
SIM_API double pareto_shifted(cRNG *rng, double a, double b, double c)
Returns a random variate from the shifted generalized Pareto distribution.
omnetpp::SimTime::dbl
double dbl() const
Definition: simtime.h:307
omnetpp::cComponent
Common base for module and channel classes.
Definition: ccomponent.h:49
omnetpp::cComponent::emit
virtual void emit(simsignal_t signalID, char c, cObject *details=nullptr)
Definition: ccomponent.h:1012
omnetpp::cComponent::numInitStages
virtual int numInitStages() const
Definition: ccomponent.h:269
omnetpp::cComponent::uniform
virtual double uniform(double a, double b, int rng=0) const
Definition: ccomponent.h:624
omnetpp::cComponent::emit
virtual void emit(simsignal_t signalID, short i, cObject *details=nullptr)
Definition: ccomponent.h:1018
omnetpp::cComponent::par
const cPar & par(int k) const
Definition: ccomponent.h:569
omnetpp::opp_pooledstring
Definition: opp_pooledstring.h:63
omnetpp::cStatistic
cStatistic is an abstract class for computing statistical properties of a random variable.
Definition: cstatistic.h:34
omnetpp::cComponent::bernoulli
virtual int bernoulli(double p, int rng=0) const
Definition: ccomponent.h:886
omnetpp::student_t
SIM_API double student_t(cRNG *rng, unsigned int i)
Returns a random variate from the student-t distribution with i degrees of freedom....
omnetpp::cComponent::normal
virtual SimTime normal(SimTime mean, SimTime stddev, int rng=0) const
Definition: ccomponent.h:658
omnetpp::cSimpleModule
Base class for all simple module classes.
Definition: csimplemodule.h:202
omnetpp::cResultListener
Common abstract base class for result filters and result recorders.
Definition: cresultlistener.h:34
omnetpp::truncnormal
SIM_API double truncnormal(cRNG *rng, double mean, double stddev)
Normal distribution truncated to nonnegative values.
omnetpp::beta
SIM_API double beta(cRNG *rng, double alpha1, double alpha2)
Returns a random variate from the beta distribution with parameters alpha1, alpha2.
omnetpp::cComponent::binomial
virtual int binomial(int n, double p, int rng=0) const
Definition: ccomponent.h:900
omnetpp::cDisplayString
Represents a display string.
Definition: cdisplaystring.h:58
omnetpp::cComponent::emit
virtual void emit(simsignal_t signalID, long i, cObject *details=nullptr)
Definition: ccomponent.h:1030
omnetpp::weibull
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...
omnetpp::cComponent::truncnormal
virtual SimTime truncnormal(SimTime mean, SimTime stddev, int rng=0) const
Definition: ccomponent.h:680
omnetpp::cComponent::erlang_k
virtual double erlang_k(unsigned int k, double mean, int rng=0) const
Definition: ccomponent.h:751
omnetpp::cComponent::exponential
virtual SimTime exponential(SimTime mean, int rng=0) const
Definition: ccomponent.h:643
omnetpp::LogLevel
LogLevel
Classifies log messages based on detail and importance.
Definition: clog.h:33
omnetpp::binomial
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,...
omnetpp::cComponent::emit
virtual void emit(simsignal_t signalID, long long i, cObject *details=nullptr)
Definition: ccomponent.h:1036
omnetpp::exponential
SIM_API double exponential(cRNG *rng, double mean)
Returns a random variate from the exponential distribution with the given mean (that is,...
omnetpp::cComponent::emit
virtual void emit(simsignal_t signalID, float f, cObject *details=nullptr)
Definition: ccomponent.h:1042
omnetpp::cComponent::getNumParams
virtual int getNumParams() const
Definition: ccomponent.h:557