OMNeT++ Simulation Library
6.0.3
|
16 #ifndef __OMNETPP_CSIMULATION_H
17 #define __OMNETPP_CSIMULATION_H
19 #include "simkerneldefs.h"
20 #include "simtime_t.h"
21 #include "ccomponent.h"
22 #include "ccontextswitcher.h"
23 #include "cexception.h"
36 class cFutureEventSet;
38 class cParsimPartition;
40 class cFingerprintCalculator;
45 SIM_API
extern cSoftOwner globalOwningContext;
69 static cEnvir *activeEnvir;
70 static cEnvir *staticEnvir;
76 int lastComponentId = 0;
80 cModule *systemModule =
nullptr;
83 ContextType contextType;
89 ContextType simulationStage;
94 bool trapOnNextEvent =
false;
96 bool parameterMutabilityCheck =
true;
102 void checkActive() {
if (getActiveSimulation()!=
this)
throw cRuntimeError(
this, E_WRONGSIM);}
106 void setParameterMutabilityCheck(
bool b) {parameterMutabilityCheck = b;}
107 bool getParameterMutabilityCheck()
const {
return parameterMutabilityCheck;}
130 virtual void forEachChild(
cVisitor *v)
override;
135 virtual std::string getFullPath()
const override;
162 static void setStaticEnvir(
cEnvir *env);
190 void deregisterComponent(
cComponent *component);
209 cModule *getModuleByPath(
const char *modulePath)
const;
223 cModule *findModuleByPath(
const char *modulePath)
const;
246 void setSystemModule(
cModule *module);
276 static int loadNedSourceFolder(
const char *folderName,
const char *excludedPackages=
"");
285 static void loadNedFile(
const char *nedFilename,
const char *expectedPackage=
nullptr,
bool isXML=
false);
297 static void loadNedText(
const char *name,
const char *nedText,
const char *expectedPackage=
nullptr,
bool isXML=
false);
305 static void doneLoadingNedFiles();
311 static std::string getNedPackageForFolder(
const char *folder);
345 void setSimulationTimeLimit(
simtime_t simTimeLimit);
357 void callInitialize();
369 void deleteNetwork();
462 void putBackEvent(
cEvent *event);
468 void executeEvent(
cEvent *event);
473 void callRefreshDisplay();
484 void transferToMain();
491 void insertEvent(
cEvent *event);
506 void setGlobalContext() {contextComponent=
nullptr; cOwnedObject::setOwningContext(&globalOwningContext);}
533 cModule *getContextModule()
const;
569 unsigned long getUniqueNumber();
576 void snapshot(
cObject *obj,
const char *label);
const typedef simtime_t & simtime_t_cref
Constant reference to a simtime_t.
Definition: simtime_t.h:48
Exception class.
Definition: cexception.h:49
This class represents modules in the simulation.
Definition: cmodule.h:48
simtime_t_cref getSimTime() const
Definition: csimulation.h:400
cComponent * getContext() const
Definition: csimulation.h:518
cObject is a lightweight class which serves as the root of the OMNeT++ class hierarchy....
Definition: cobject.h:92
cFingerprintCalculator * getFingerprintCalculator()
Definition: csimulation.h:582
int getSimulationStage() const
Definition: csimulation.h:380
void requestTrapOnNextEvent()
Definition: csimulation.h:547
This class defines the interface for fingerprint calculators.
Definition: cfingerprint.h:34
cEnvir * getEnvir()
Returns the environment object for the currently active simulation. This function never returns nullp...
Definition: csimulation.h:611
Utility class, to make it impossible to call the operator= and copy constructor of any class derived ...
Definition: cobject.h:415
Represents an event in the discrete event simulator.
Definition: cevent.h:46
Simulation manager class.
Definition: csimulation.h:63
void clearTrapOnNextEvent()
Definition: csimulation.h:552
bool isChannel() const
Definition: ccomponent.h:475
Abstract base class for the future event set (FES), a central data structure for discrete event simul...
Definition: cfutureeventset.h:32
Abstract class to encapsulate event scheduling.
Definition: cscheduler.h:47
Enables traversing the tree of (cObject-rooted) simulation objects.
Definition: cvisitor.h:56
Base class for channels.
Definition: cchannel.h:46
Abstract class for creating a module of a specific type.
Definition: ccomponenttype.h:206
simtime_t simTime()
Returns the current simulation time.
Definition: csimulation.h:596
bool isModule() const
Definition: ccomponent.h:470
int64_t-based, base-10 fixed-point simulation time.
Definition: simtime.h:66
cModule * getSystemModule() const
Definition: csimulation.h:251
cComponent * getComponent(int id) const
Definition: csimulation.h:229
bool isTrapOnNextEventRequested() const
Definition: csimulation.h:558
cScheduler * getScheduler() const
Definition: csimulation.h:327
int64_t eventnumber_t
Sequence number of events during the simulation. Events are numbered from one. (Event number zero is ...
Definition: simkerneldefs.h:78
cModule * getModule(int id) const
Definition: csimulation.h:235
cSimulation * getSimulation()
Returns the currently active simulation, or nullptr if there is none.
Definition: csimulation.h:603
int getLastComponentId() const
Definition: csimulation.h:195
simtime_t_cref getWarmupPeriod() const
Definition: csimulation.h:417
ContextType getContextType() const
Definition: csimulation.h:527
void setWarmupPeriod(simtime_t t)
Definition: csimulation.h:422
Extends cObject with a name string. Also includes a "flags" member, with bits open for use by subclas...
Definition: cnamedobject.h:34
Common base for module and channel classes.
Definition: ccomponent.h:49
cFutureEventSet * getFES() const
Definition: csimulation.h:339
cChannel * getChannel(int id) const
Definition: csimulation.h:241
cSimpleModule * getActivityModule() const
Definition: csimulation.h:513
Thrown when the simulation kernel or other components detect a runtime error.
Definition: cexception.h:286
Base class for all simple module classes.
Definition: csimplemodule.h:202
cModuleType * getNetworkType() const
Definition: csimulation.h:386
static cEnvir * getActiveEnvir()
Definition: csimulation.h:149
cEnvir represents the "environment" or user interface of the simulation.
Definition: cenvir.h:75
static cEnvir * getStaticEnvir()
Definition: csimulation.h:167
static cSimulation * getActiveSimulation()
Definition: csimulation.h:143
void setSimTime(simtime_t time)
Definition: csimulation.h:393
eventnumber_t getEventNumber() const
Definition: csimulation.h:406
void setContextType(ContextType type)
Definition: csimulation.h:501
void setGlobalContext()
Definition: csimulation.h:506
cEnvir * getEnvir() const
Definition: csimulation.h:172