OMNeT++ Simulation Library  5.4.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  private:
61  // copy constructor and assignment unsupported, make them inaccessible and also leave unimplemented
64 
65  protected:
69  virtual void lifecycleEvent(SimulationLifecycleEventType eventType, cObject *details) override;
70 
71  public:
74 
78  explicit cIOutputVectorManager() {}
79 
85 
88 
92  virtual void startRun() = 0;
93 
97  virtual void endRun() = 0;
99 
102 
109  virtual void *registerVector(const char *modulename, const char *vectorname) = 0;
110 
116  virtual void deregisterVector(void *vechandle) = 0;
117 
122  virtual void setVectorAttribute(void *vechandle, const char *name, const char *value) = 0;
123 
131  virtual bool record(void *vechandle, simtime_t t, double value) = 0;
132 
137  virtual const char *getFileName() const = 0;
138 
142  virtual void flush() = 0;
144 };
145 
146 
169 {
170  private:
171  // copy constructor and assignment unsupported, make them inaccessible and also leave unimplemented
173  cIOutputScalarManager& operator=(const cIOutputScalarManager&);
174 
175  protected:
179  virtual void lifecycleEvent(SimulationLifecycleEventType eventType, cObject *details) override;
180 
181  public:
184 
188  explicit cIOutputScalarManager() {}
189 
195 
198 
202  virtual void startRun() = 0;
203 
207  virtual void endRun() = 0;
209 
212 
216  virtual void recordScalar(cComponent *component, const char *name, double value, opp_string_map *attributes=nullptr) = 0;
217 
222  virtual void recordStatistic(cComponent *component, const char *name, cStatistic *statistic, opp_string_map *attributes=nullptr) = 0;
223 
228  virtual const char *getFileName() const = 0;
229 
233  virtual void flush() = 0;
235 };
236 
237 
260 {
261  private:
262  // copy constructor and assignment unsupported, make them inaccessible and also leave unimplemented
264  cISnapshotManager& operator=(const cISnapshotManager&);
265 
266  protected:
270  virtual void lifecycleEvent(SimulationLifecycleEventType eventType, cObject *details) override;
271 
272  public:
275 
279  explicit cISnapshotManager() {}
280 
284  virtual ~cISnapshotManager() {}
286 
289 
293  virtual void startRun() = 0;
294 
298  virtual void endRun() = 0;
300 
306  virtual std::ostream *getStreamForSnapshot() = 0;
307 
311  virtual void releaseStreamForSnapshot(std::ostream *os) = 0;
312 
317  virtual const char *getFileName() const = 0;
319 };
320 
321 
343 class SIM_API cIEventlogManager : public cObject
344 {
345  private:
346  // copy constructor and assignment unsupported, make them inaccessible and also leave unimplemented
348  cIEventlogManager& operator=(const cIEventlogManager&);
349 
350  public:
353 
357  explicit cIEventlogManager() {}
358 
362  virtual ~cIEventlogManager() {}
364 
367 
376  virtual void startRecording() = 0;
377 
381  virtual void stopRecording() = 0;
382 
386  virtual void flush() = 0;
387 
392  virtual const char *getFileName() const = 0;
394 
397  virtual void simulationEvent(cEvent *event) = 0;
398  virtual void bubble(cComponent *component, const char *text) = 0;
399  virtual void messageScheduled(cMessage *msg) = 0;
400  virtual void messageCancelled(cMessage *msg) = 0;
401  virtual void beginSend(cMessage *msg) = 0;
402  virtual void messageSendDirect(cMessage *msg, cGate *toGate, simtime_t propagationDelay, simtime_t transmissionDelay) = 0;
403  virtual void messageSendHop(cMessage *msg, cGate *srcGate) = 0;
404  virtual void messageSendHop(cMessage *msg, cGate *srcGate, simtime_t propagationDelay, simtime_t transmissionDelay, bool discard) = 0;
405  virtual void endSend(cMessage *msg) = 0;
406  virtual void messageCreated(cMessage *msg) = 0;
407  virtual void messageCloned(cMessage *msg, cMessage *clone) = 0;
408  virtual void messageDeleted(cMessage *msg) = 0;
409  virtual void moduleReparented(cModule *module, cModule *oldparent, int oldId) = 0;
410  virtual void componentMethodBegin(cComponent *from, cComponent *to, const char *methodFmt, va_list va) = 0;
411  virtual void componentMethodEnd() = 0;
412  virtual void moduleCreated(cModule *newmodule) = 0;
413  virtual void moduleDeleted(cModule *module) = 0;
414  virtual void gateCreated(cGate *newgate) = 0;
415  virtual void gateDeleted(cGate *gate) = 0;
416  virtual void connectionCreated(cGate *srcgate) = 0;
417  virtual void connectionDeleted(cGate *srcgate) = 0;
418  virtual void displayStringChanged(cComponent *component) = 0;
419  virtual void logLine(const char *prefix, const char *line, int lineLength) = 0;
420  virtual void stoppedWithException(bool isError, int resultCode, const char *message) = 0;
422 };
423 
424 
425 
426 } // namespace omnetpp
427 
428 
429 #endif
430 
431 
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:284
This class represents modules in the simulation.
Definition: cmodule.h:47
Abstract base class for snapshot managers.
Definition: envirext.h:259
virtual ~cIEventlogManager()
Definition: envirext.h:362
Abstract base class for handling recording of output scalar data.
Definition: envirext.h:168
Lightweight string-to-string map, used internally in some parts of OMNeT++.
Definition: opp_string.h:200
cISnapshotManager()
Definition: envirext.h:279
cIOutputScalarManager()
Definition: envirext.h:188
cIOutputVectorManager()
Definition: envirext.h:78
Definition: cabstracthistogram.h:21
virtual ~cIOutputScalarManager()
Definition: envirext.h:193
SimulationLifecycleEventType
Event type for cISimulationLifecycleListener&#39;s lifecycleEvent() method.
Definition: clifecyclelistener.h:28
cIEventlogManager()
Definition: envirext.h:357
Abstract base class for eventlog managers for cEnvir.
Definition: envirext.h:343
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:83