OMNeT++ Simulation Library  6.0.3
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) = 0;
106 
112  virtual void deregisterVector(void *vechandle) = 0;
113 
118  virtual void setVectorAttribute(void *vechandle, const char *name, const char *value) = 0;
119 
127  virtual bool record(void *vechandle, simtime_t t, double value) = 0;
128 
133  virtual const char *getFileName() const = 0;
134 
138  virtual void flush() = 0;
140 };
141 
142 
165 {
166  protected:
170  virtual void lifecycleEvent(SimulationLifecycleEventType eventType, cObject *details) override;
171 
172  public:
175 
179  explicit cIOutputScalarManager() {}
180 
186 
189 
193  virtual void startRun() = 0;
194 
198  virtual void endRun() = 0;
200 
203 
208  virtual bool recordScalar(cComponent *component, const char *name, double value, opp_string_map *attributes=nullptr) = 0;
209 
215  virtual bool recordStatistic(cComponent *component, const char *name, cStatistic *statistic, opp_string_map *attributes=nullptr) = 0;
216 
221  virtual bool recordParameter(cPar *par) = 0;
222 
227  virtual bool recordComponentType(cComponent *component) = 0;
228 
233  virtual const char *getFileName() const = 0;
234 
238  virtual void flush() = 0;
240 };
241 
242 
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, noncopyable
344 {
345  public:
348 
352  explicit cIEventlogManager() {}
353 
357  virtual ~cIEventlogManager() {}
359 
362 
371  virtual void resume() = 0;
372 
376  virtual void suspend() = 0;
377 
381  virtual void flush() = 0;
382 
387  virtual const char *getFileName() const = 0;
388 
389  //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
390  virtual void endRun(bool isError, int resultCode, const char *message) = 0;
392 
395  virtual void simulationEvent(cEvent *event) = 0;
396  virtual void bubble(cComponent *component, const char *text) = 0;
397  virtual void messageScheduled(cMessage *msg) = 0;
398  virtual void messageCancelled(cMessage *msg) = 0;
399  virtual void beginSend(cMessage *msg, const SendOptions& options) = 0;
400  virtual void messageSendDirect(cMessage *msg, cGate *toGate, const ChannelResult& result) = 0;
401  virtual void messageSendHop(cMessage *msg, cGate *srcGate) = 0;
402  virtual void messageSendHop(cMessage *msg, cGate *srcGate, const ChannelResult& result) = 0;
403  virtual void endSend(cMessage *msg) = 0;
404  virtual void messageCreated(cMessage *msg) = 0;
405  virtual void messageCloned(cMessage *msg, cMessage *clone) = 0;
406  virtual void messageDeleted(cMessage *msg) = 0;
407  virtual void moduleReparented(cModule *module, cModule *oldparent, int oldId) = 0;
408  virtual void componentMethodBegin(cComponent *from, cComponent *to, const char *methodFmt, va_list va) = 0;
409  virtual void componentMethodEnd() = 0;
410  virtual void moduleCreated(cModule *newmodule) = 0;
411  virtual void moduleDeleted(cModule *module) = 0;
412  virtual void gateCreated(cGate *newgate) = 0;
413  virtual void gateDeleted(cGate *gate) = 0;
414  virtual void connectionCreated(cGate *srcgate) = 0;
415  virtual void connectionDeleted(cGate *srcgate) = 0;
416  virtual void displayStringChanged(cComponent *component) = 0;
417  virtual void logLine(const char *prefix, const char *line, int lineLength) = 0;
418  virtual void stoppedWithException(bool isError, int resultCode, const char *message) = 0;
420 };
421 
422 } // namespace omnetpp
423 
424 
425 #endif
426 
427 
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:164
omnetpp::cIOutputScalarManager::cIOutputScalarManager
cIOutputScalarManager()
Definition: envirext.h:179
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:352
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:279
omnetpp::cIEventlogManager
Abstract base class for eventlog managers for cEnvir.
Definition: envirext.h:343
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:284
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:264
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:357
omnetpp::cIOutputScalarManager::~cIOutputScalarManager
virtual ~cIOutputScalarManager()
Definition: envirext.h:184