OMNeT++ Simulation Library  5.6.1
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 
31 class cModule;
32 class cStatistic;
33 class cEvent;
34 class cMessage;
35 class cGate;
36 
59 {
60  protected:
64  virtual void lifecycleEvent(SimulationLifecycleEventType eventType, cObject *details) override;
65 
66  public:
69 
73  explicit cIOutputVectorManager() {}
74 
80 
83 
87  virtual void startRun() = 0;
88 
92  virtual void endRun() = 0;
94 
97 
104  virtual void *registerVector(const char *modulename, const char *vectorname) = 0;
105 
111  virtual void deregisterVector(void *vechandle) = 0;
112 
117  virtual void setVectorAttribute(void *vechandle, const char *name, const char *value) = 0;
118 
126  virtual bool record(void *vechandle, simtime_t t, double value) = 0;
127 
132  virtual const char *getFileName() const = 0;
133 
137  virtual void flush() = 0;
139 };
140 
141 
164 {
165  protected:
169  virtual void lifecycleEvent(SimulationLifecycleEventType eventType, cObject *details) override;
170 
171  public:
174 
178  explicit cIOutputScalarManager() {}
179 
185 
188 
192  virtual void startRun() = 0;
193 
197  virtual void endRun() = 0;
199 
202 
206  virtual void recordScalar(cComponent *component, const char *name, double value, opp_string_map *attributes=nullptr) = 0;
207 
212  virtual void recordStatistic(cComponent *component, const char *name, cStatistic *statistic, opp_string_map *attributes=nullptr) = 0;
213 
218  virtual const char *getFileName() const = 0;
219 
223  virtual void flush() = 0;
225 };
226 
227 
250 {
251  protected:
255  virtual void lifecycleEvent(SimulationLifecycleEventType eventType, cObject *details) override;
256 
257  public:
260 
264  explicit cISnapshotManager() {}
265 
269  virtual ~cISnapshotManager() {}
271 
274 
278  virtual void startRun() = 0;
279 
283  virtual void endRun() = 0;
285 
291  virtual std::ostream *getStreamForSnapshot() = 0;
292 
296  virtual void releaseStreamForSnapshot(std::ostream *os) = 0;
297 
302  virtual const char *getFileName() const = 0;
304 };
305 
306 
328 class SIM_API cIEventlogManager : public cObject, noncopyable
329 {
330  public:
333 
337  explicit cIEventlogManager() {}
338 
342  virtual ~cIEventlogManager() {}
344 
347 
356  virtual void startRecording() = 0;
357 
361  virtual void stopRecording() = 0;
362 
366  virtual void flush() = 0;
367 
372  virtual const char *getFileName() const = 0;
374 
377  virtual void simulationEvent(cEvent *event) = 0;
378  virtual void bubble(cComponent *component, const char *text) = 0;
379  virtual void messageScheduled(cMessage *msg) = 0;
380  virtual void messageCancelled(cMessage *msg) = 0;
381  virtual void beginSend(cMessage *msg) = 0;
382  virtual void messageSendDirect(cMessage *msg, cGate *toGate, simtime_t propagationDelay, simtime_t transmissionDelay) = 0;
383  virtual void messageSendHop(cMessage *msg, cGate *srcGate) = 0;
384  virtual void messageSendHop(cMessage *msg, cGate *srcGate, simtime_t propagationDelay, simtime_t transmissionDelay, bool discard) = 0;
385  virtual void endSend(cMessage *msg) = 0;
386  virtual void messageCreated(cMessage *msg) = 0;
387  virtual void messageCloned(cMessage *msg, cMessage *clone) = 0;
388  virtual void messageDeleted(cMessage *msg) = 0;
389  virtual void moduleReparented(cModule *module, cModule *oldparent, int oldId) = 0;
390  virtual void componentMethodBegin(cComponent *from, cComponent *to, const char *methodFmt, va_list va) = 0;
391  virtual void componentMethodEnd() = 0;
392  virtual void moduleCreated(cModule *newmodule) = 0;
393  virtual void moduleDeleted(cModule *module) = 0;
394  virtual void gateCreated(cGate *newgate) = 0;
395  virtual void gateDeleted(cGate *gate) = 0;
396  virtual void connectionCreated(cGate *srcgate) = 0;
397  virtual void connectionDeleted(cGate *srcgate) = 0;
398  virtual void displayStringChanged(cComponent *component) = 0;
399  virtual void logLine(const char *prefix, const char *line, int lineLength) = 0;
400  virtual void stoppedWithException(bool isError, int resultCode, const char *message) = 0;
402 };
403 
404 } // namespace omnetpp
405 
406 
407 #endif
408 
409 
The message class in OMNeT++. cMessage objects may represent events, messages, jobs or other entities...
Definition: cmessage.h:95
Common base for module and channel classes.
Definition: ccomponent.h:48
Represents a module gate.
Definition: cgate.h:63
Root of the OMNeT++ class hierarchy. cObject is a lightweight class without any data members...
Definition: cobject.h:58
int64_t-based, base-10 fixed-point simulation time.
Definition: simtime.h:66
Represents an event in the discrete event simulator.
Definition: cevent.h:43
A callback interface for receiving notifications at various stages simulations, including setting up...
Definition: clifecyclelistener.h:186
virtual ~cISnapshotManager()
Definition: envirext.h:269
This class represents modules in the simulation.
Definition: cmodule.h:47
Abstract base class for snapshot managers.
Definition: envirext.h:249
virtual ~cIEventlogManager()
Definition: envirext.h:342
Abstract base class for handling recording of output scalar data.
Definition: envirext.h:163
Lightweight string-to-string map, used internally in some parts of OMNeT++.
Definition: opp_string.h:200
cISnapshotManager()
Definition: envirext.h:264
cIOutputScalarManager()
Definition: envirext.h:178
Utility class, to make it impossible to call the operator= and copy constructor of any class derived ...
Definition: cobject.h:311
cIOutputVectorManager()
Definition: envirext.h:73
Definition: cabstracthistogram.h:21
virtual ~cIOutputScalarManager()
Definition: envirext.h:183
SimulationLifecycleEventType
Event type for cISimulationLifecycleListener&#39;s lifecycleEvent() method.
Definition: clifecyclelistener.h:28
cIEventlogManager()
Definition: envirext.h:337
Abstract base class for eventlog managers for cEnvir.
Definition: envirext.h:328
Abstract base class for output vector managers for cEnvir.
Definition: envirext.h:58
cStatistic is an abstract class for computing statistical properties of a random variable.
Definition: cstatistic.h:34
virtual ~cIOutputVectorManager()
Definition: envirext.h:78