OMNeT++ API 6.1
Discrete Event Simulation Library
envirext.h
1 //==========================================================================
2 // ENVIREXT.H - part of
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_ENVIREXT_H
17 #define __OMNETPP_ENVIREXT_H
18 
19 #include <iostream>
20 #include "simkerneldefs.h"
21 #include "opp_string.h"
22 #include "simtime_t.h"
23 #include "cobject.h"
24 #include "simtime_t.h"
25 #include "opp_string.h"
26 #include "clifecyclelistener.h"
27 
28 namespace omnetpp {
29 
30 class cModule;
31 class cStatistic;
32 class cEvent;
33 class cMessage;
34 class cGate;
35 struct SendOptions;
36 struct ChannelResult;
37 
60 {
61  protected:
65  virtual void lifecycleEvent(SimulationLifecycleEventType eventType, cObject *details) override;
66 
67  public:
70 
74  explicit cIOutputVectorManager() {}
75 
81 
84 
88  virtual void startRun() = 0;
89 
93  virtual void endRun() = 0;
95 
98 
105  virtual void *registerVector(const char *modulename, const char *vectorname, opp_string_map *attributes=nullptr) = 0;
106 
112  virtual void deregisterVector(void *vechandle) = 0;
113 
121  virtual bool record(void *vechandle, simtime_t t, double value) = 0;
122 
127  virtual const char *getFileName() const = 0;
128 
132  virtual void flush() = 0;
134 };
135 
136 
159 {
160  protected:
164  virtual void lifecycleEvent(SimulationLifecycleEventType eventType, cObject *details) override;
165 
166  public:
169 
173  explicit cIOutputScalarManager() {}
174 
180 
183 
187  virtual void startRun() = 0;
188 
192  virtual void endRun() = 0;
194 
197 
202  virtual bool recordScalar(cComponent *component, const char *name, double value, opp_string_map *attributes=nullptr) = 0;
203 
209  virtual bool recordStatistic(cComponent *component, const char *name, cStatistic *statistic, opp_string_map *attributes=nullptr) = 0;
210 
215  virtual bool recordParameter(cPar *par) = 0;
216 
221  virtual bool recordComponentType(cComponent *component) = 0;
222 
227  virtual const char *getFileName() const = 0;
228 
232  virtual void flush() = 0;
234 };
235 
236 
259 {
260  protected:
264  virtual void lifecycleEvent(SimulationLifecycleEventType eventType, cObject *details) override;
265 
266  public:
269 
273  explicit cISnapshotManager() {}
274 
278  virtual ~cISnapshotManager() {}
280 
283 
287  virtual void startRun() = 0;
288 
292  virtual void endRun() = 0;
294 
300  virtual std::ostream *getStreamForSnapshot() = 0;
301 
305  virtual void releaseStreamForSnapshot(std::ostream *os) = 0;
306 
311  virtual const char *getFileName() const = 0;
313 };
314 
315 
337 class SIM_API cIEventlogManager : public cObject, noncopyable
338 {
339  public:
342 
346  explicit cIEventlogManager() {}
347 
351  virtual ~cIEventlogManager() {}
353 
356 
365  virtual void resume() = 0;
366 
370  virtual void suspend() = 0;
371 
375  virtual void flush() = 0;
376 
381  virtual const char *getFileName() const = 0;
382 
383  //TODO this one could be removed from the interface by invoking it via the LF_ON_RUN_END lifecycle event, but it needs to send more details
384  virtual void endRun(bool isError, int resultCode, const char *message) = 0;
386 
389  virtual void simulationEvent(cEvent *event) = 0;
390  virtual void bubble(cComponent *component, const char *text) = 0;
391  virtual void messageScheduled(cMessage *msg) = 0;
392  virtual void messageCancelled(cMessage *msg) = 0;
393  virtual void beginSend(cMessage *msg, const SendOptions& options) = 0;
394  virtual void messageSendDirect(cMessage *msg, cGate *toGate, const ChannelResult& result) = 0;
395  virtual void messageSendHop(cMessage *msg, cGate *srcGate) = 0;
396  virtual void messageSendHop(cMessage *msg, cGate *srcGate, const ChannelResult& result) = 0;
397  virtual void endSend(cMessage *msg) = 0;
398  virtual void messageCreated(cMessage *msg) = 0;
399  virtual void messageCloned(cMessage *msg, cMessage *clone) = 0;
400  virtual void messageDeleted(cMessage *msg) = 0;
401  virtual void moduleReparented(cModule *module, cModule *oldparent, int oldId) = 0;
402  virtual void componentMethodBegin(cComponent *from, cComponent *to, const char *methodFmt, va_list va) = 0;
403  virtual void componentMethodEnd() = 0;
404  virtual void moduleCreated(cModule *newmodule) = 0;
405  virtual void moduleDeleted(cModule *module) = 0;
406  virtual void gateCreated(cGate *newgate) = 0;
407  virtual void gateDeleted(cGate *gate) = 0;
408  virtual void connectionCreated(cGate *srcgate) = 0;
409  virtual void connectionDeleted(cGate *srcgate) = 0;
410  virtual void displayStringChanged(cComponent *component) = 0;
411  virtual void logLine(const char *prefix, const char *line, int lineLength) = 0;
412  virtual void stoppedWithException(bool isError, int resultCode, const char *message) = 0;
414 };
415 
416 } // namespace omnetpp
417 
418 
419 #endif
420 
421 
omnetpp::cModule
This class represents modules in the simulation.
Definition: cmodule.h:48
omnetpp::ChannelResult
Allows returning multiple values from the processMessage() method.
Definition: cchannel.h:33
omnetpp::cIOutputScalarManager
Abstract base class for handling recording of output scalar data.
Definition: envirext.h:158
omnetpp::cIOutputScalarManager::cIOutputScalarManager
cIOutputScalarManager()
Definition: envirext.h:173
omnetpp::cIOutputVectorManager::~cIOutputVectorManager
virtual ~cIOutputVectorManager()
Definition: envirext.h:79
omnetpp::cObject
cObject is a lightweight class which serves as the root of the OMNeT++ class hierarchy....
Definition: cobject.h:92
omnetpp::noncopyable
Utility class, to make it impossible to call the operator= and copy constructor of any class derived ...
Definition: cobject.h:415
omnetpp::cEvent
Represents an event in the discrete event simulator.
Definition: cevent.h:46
omnetpp::cIEventlogManager::cIEventlogManager
cIEventlogManager()
Definition: envirext.h:346
omnetpp::opp_string_map
Lightweight string-to-string map, used internally in some parts of OMNeT++.
Definition: opp_string.h:219
omnetpp::SimulationLifecycleEventType
SimulationLifecycleEventType
Event type for cISimulationLifecycleListener's lifecycleEvent() method.
Definition: clifecyclelistener.h:28
omnetpp::SimTime
int64_t-based, base-10 fixed-point simulation time.
Definition: simtime.h:66
omnetpp::cIOutputVectorManager
Abstract base class for output vector managers for cEnvir.
Definition: envirext.h:59
omnetpp::SendOptions
Options for the cSimpleModule::send() and cSimpleModule::sendDirect() calls.
Definition: csimplemodule.h:82
omnetpp::cISnapshotManager::cISnapshotManager
cISnapshotManager()
Definition: envirext.h:273
omnetpp::cIEventlogManager
Abstract base class for eventlog managers for cEnvir.
Definition: envirext.h:337
omnetpp::cIOutputVectorManager::cIOutputVectorManager
cIOutputVectorManager()
Definition: envirext.h:74
omnetpp::cGate
Represents a module gate.
Definition: cgate.h:62
omnetpp::cPar
Represents a module or channel parameter.
Definition: cpar.h:70
omnetpp::cISnapshotManager::~cISnapshotManager
virtual ~cISnapshotManager()
Definition: envirext.h:278
omnetpp::cMessage
The message class in OMNeT++. cMessage objects may represent events, messages, jobs or other entities...
Definition: cmessage.h:95
omnetpp::cComponent
Common base for module and channel classes.
Definition: ccomponent.h:49
omnetpp::cStatistic
cStatistic is an abstract class for computing statistical properties of a random variable.
Definition: cstatistic.h:34
omnetpp::cISnapshotManager
Abstract base class for snapshot managers.
Definition: envirext.h:258
omnetpp::cISimulationLifecycleListener
A callback interface for receiving notifications at various stages simulations, including setting up,...
Definition: clifecyclelistener.h:186
omnetpp::cIEventlogManager::~cIEventlogManager
virtual ~cIEventlogManager()
Definition: envirext.h:351
omnetpp::cIOutputScalarManager::~cIOutputScalarManager
virtual ~cIOutputScalarManager()
Definition: envirext.h:178