Skip to content

Commit

Permalink
make Veins compatible with OMNeT++ 5
Browse files Browse the repository at this point in the history
  • Loading branch information
rhornig authored and sommer committed Mar 22, 2016
1 parent 048abfd commit 89c8a10
Show file tree
Hide file tree
Showing 42 changed files with 177 additions and 155 deletions.
1 change: 0 additions & 1 deletion examples/veins/omnetpp.ini
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ cmdenv-status-frequency = 10000000s

#tkenv-default-config = debug
#tkenv-default-run = 1

ned-path = .

network = RSUExampleScenario
Expand Down
2 changes: 1 addition & 1 deletion src/veins/base/connectionManager/BaseConnectionManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include "veins/base/utils/FindModule.h"

#ifndef ccEV
#define ccEV (getEnvir()->isDisabled()||!coreDebug) ? EV : EV << getName() << ": "
#define ccEV EV << getName() << ": "
#endif

namespace {
Expand Down
2 changes: 1 addition & 1 deletion src/veins/base/connectionManager/ConnectionManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include "veins/base/modules/BaseWorldUtility.h"

#ifndef ccEV
#define ccEV (getEnvir()->isDisabled()||!coreDebug) ? EV : EV << getName() << ": "
#define ccEV EV << getName() << ": "
#endif

Define_Module( ConnectionManager );
Expand Down
4 changes: 2 additions & 2 deletions src/veins/base/connectionManager/NicEntryDebug.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#include "veins/base/utils/FindModule.h"

#ifndef nicEV
#define nicEV (getEnvir()->isDisabled()||!coreDebug) ? EV : EV << "NicEntry: "
#define nicEV EV << "NicEntry: "
#endif

using std::endl;
Expand Down Expand Up @@ -80,7 +80,7 @@ int NicEntryDebug::collectGates(const char* pattern, GateStack& gates)
{
cGate* hostGate = host->gate(gateName);
if(hostGate->isConnectedOutside()) {
throw cException("Gate %s is still connected but not registered with this "
throw cRuntimeError("Gate %s is still connected but not registered with this "
"NicEntry. Either the last NicEntry for this NIC did not "
"clean up correctly or another gate creation module is "
"interfering with this one!", gateName);
Expand Down
2 changes: 1 addition & 1 deletion src/veins/base/connectionManager/NicEntryDirect.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#include "veins/base/connectionManager/ChannelAccess.h"

#ifndef nicEV
#define nicEV (getEnvir()->isDisabled()||!coreDebug) ? EV : EV << "NicEntry: "
#define nicEV EV << "NicEntry: "
#endif

using std::endl;
Expand Down
4 changes: 2 additions & 2 deletions src/veins/base/modules/BaseApplLayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,14 +127,14 @@ class MIXIM_API BaseApplLayer : public BaseLayer
*/
virtual void handleUpperMsg(cMessage *msg) {
assert(false);
throw cException("Application has no upper layers!");
throw cRuntimeError("Application has no upper layers!");
delete msg;
}

/** @brief Handle control messages from upper layer */
virtual void handleUpperControl(cMessage *msg) {
assert(false);
throw cException("Application has no upper layers!");
throw cRuntimeError("Application has no upper layers!");
delete msg;
}

Expand Down
4 changes: 2 additions & 2 deletions src/veins/base/modules/BaseLayer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -96,14 +96,14 @@ void BaseLayer::handleMessage(cMessage* msg)
* it would be wrong to forward the message to one of these gates,
* as they actually don't exist, so raise an error instead.
*/
throw cException("No self message and no gateID?? Check configuration.");
throw cRuntimeError("No self message and no gateID?? Check configuration.");
} else {
/* msg->getArrivalGateId() should be valid, but it isn't recognized
* here. This could signal the case that this class is extended
* with extra gates, but handleMessage() isn't overridden to
* check for the new gate(s).
*/
throw cException("Unknown gateID?? Check configuration or override handleMessage().");
throw cRuntimeError("Unknown gateID?? Check configuration or override handleMessage().");
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/veins/base/modules/BaseMobility.cc
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ void BaseMobility::updatePosition() {
//publish the the new move
emit(mobilityStateChangedSignal, this);

if(getEnvir()->isGUI())
if(hasGUI())
{
std::ostringstream osDisplayTag;
#ifdef __APPLE__
Expand Down
2 changes: 1 addition & 1 deletion src/veins/base/modules/BaseMobility.ned
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ simple BaseMobility like IMobility
double x; // x coordinate of the nodes' position (-1 = random)
double y; // y coordinate of the nodes' position (-1 = random)
double z; // z coordinate of the nodes' position (-1 = random)
@signal[veinsmobilityStateChanged](type="BaseMobility");
@signal[veinsmobilityStateChanged](type="BaseMobility");
@display("i=block/cogwheel");
}

2 changes: 1 addition & 1 deletion src/veins/base/modules/BaseModule.cc
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ void BaseModule::receiveSignal(cComponent *source, simsignal_t signalID, cObject
handleHostState(*pHostState);
}
else {
throw cException("Got catHostStateSignal but obj was not a HostState pointer?");
throw cRuntimeError("Got catHostStateSignal but obj was not a HostState pointer?");
}
}
}
Expand Down
8 changes: 4 additions & 4 deletions src/veins/base/modules/BaseModule.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@
#include "veins/base/utils/HostState.h"

#ifndef debugEV
#define debugEV_clear (getEnvir()->isDisabled()||!debug) ? EV : EV
#define debugEV (getEnvir()->isDisabled()||!debug) ? EV : EV << logName() << "::" << getClassName() << ": "
#define debugEV_clear EV
#define debugEV EV << logName() << "::" << getClassName() << ": "
#endif

#ifndef coreEV
#define coreEV_clear (getEnvir()->isDisabled()||!coreDebug) ? EV : EV
#define coreEV (getEnvir()->isDisabled()||!coreDebug) ? EV : EV << logName() << "::" << getClassName() <<": "
#define coreEV_clear EV
#define coreEV EV << logName() << "::" << getClassName() << ": "
#endif

/**
Expand Down
8 changes: 4 additions & 4 deletions src/veins/base/modules/BaseWorldUtility.cc
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ void BaseWorldUtility::initialize(int stage) {
//check if necessary modules are there
//Connection Manager
if(!FindModule<BaseConnectionManager*>::findGlobalModule()) {
throw cException("Could not find a connection manager module in the network!");
throw cRuntimeError("Could not find a connection manager module in the network!");
}
}
}
Expand All @@ -53,15 +53,15 @@ void BaseWorldUtility::initializeIfNecessary()
use2DFlag ? 0. : par("playgroundSizeZ").doubleValue());

if(playgroundSize.x < 0) {
throw cException("Playground size in X direction is invalid: "\
throw cRuntimeError("Playground size in X direction is invalid: "\
"(%f). Should be greater than or equal to zero.", playgroundSize.x);
}
if(playgroundSize.y < 0) {
throw cException("Playground size in Y direction is invalid: "\
throw cRuntimeError("Playground size in Y direction is invalid: "\
"(%f). Should be greater than or equal to zero.", playgroundSize.y);
}
if(!use2DFlag && playgroundSize.z < 0) {
throw cException("Playground size in Z direction is invalid: "\
throw cRuntimeError("Playground size in Z direction is invalid: "\
"(%f). Should be greater than or equal to zero.", playgroundSize.z);
}

Expand Down
2 changes: 1 addition & 1 deletion src/veins/base/modules/BatteryAccess.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ void BatteryAccess::registerWithBattery(const std::string& name, int numAccounts
battery = FindModule<BaseBattery*>::findSubModule(findHost());

if(!battery) {
throw cException("No battery module defined!");
throw cRuntimeError("No battery module defined!");
} else {
deviceID = battery->registerDevice(name, numAccounts);
}
Expand Down
4 changes: 2 additions & 2 deletions src/veins/base/phyLayer/BaseDecider.cc
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ simtime_t BaseDecider::processSignalEnd(AirFrame* frame) {
}

simtime_t BaseDecider::processUnknownSignal(AirFrame* frame) {
throw cException("Unknown state for the AirFrame with ID %d", frame->getId());
throw cRuntimeError("Unknown state for the AirFrame with ID %d", frame->getId());
return notAgain;
}

Expand All @@ -100,7 +100,7 @@ simtime_t BaseDecider::handleChannelSenseRequest(ChannelSenseRequest* request) {
}

if (currentChannelSenseRequest.first != request) {
throw cException("Got a new ChannelSenseRequest while already handling another one!");
throw cRuntimeError("Got a new ChannelSenseRequest while already handling another one!");
return notAgain;
}

Expand Down
4 changes: 2 additions & 2 deletions src/veins/base/phyLayer/BaseDecider.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class Mapping;

using Veins::AirFrame;

#define deciderEV (getEnvir()->isDisabled()||!debug) ? EV : EV << "[Host " << myIndex << "] - PhyLayer(Decider): "
#define deciderEV EV << "[Host " << myIndex << "] - PhyLayer(Decider): "

/**
* @brief Provides some base functionality for most common deciders.
Expand Down Expand Up @@ -185,7 +185,7 @@ class MIXIM_API BaseDecider: public Decider {
* Default implementation does not handle signal headers.
*/
virtual simtime_t processSignalHeader(AirFrame* frame) {
throw cException("BaseDecider does not handle Signal headers!");
throw cRuntimeError("BaseDecider does not handle Signal headers!");
return notAgain;
}

Expand Down
Loading

2 comments on commit 89c8a10

@brtkwr
Copy link

@brtkwr brtkwr commented on 89c8a10 Sep 2, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

l get two debug windows before it shows me the simulation window, both at line 1602 of envirbase.cc when I run it. Is that expected behaviour?

@sommer
Copy link
Owner

@sommer sommer commented on 89c8a10 Sep 16, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see any windows opening when I run a simulation, so I guess not.

Please sign in to comment.