Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,8 @@ void CanTrafficSourceAppBase::initialDataFrameCreation() {
}

void CanTrafficSourceAppBase::initialFrameCreation(std::string type,
cStringTokenizer frameIDsTokenizer, cStringTokenizer framesPeriodicityTokenizer,
cStringTokenizer dataLengthFramesTokenizer, cStringTokenizer initialFrameOffsetTokenizer) {
cStringTokenizer& frameIDsTokenizer, cStringTokenizer& framesPeriodicityTokenizer,
cStringTokenizer& dataLengthFramesTokenizer, cStringTokenizer& initialFrameOffsetTokenizer) {

const char *frameType = "";
if (type.compare("data") == 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,10 +183,10 @@ class CanTrafficSourceAppBase: public omnetpp::cSimpleModule {
* @param initialFrameOffsetTokenizer Tokenizer for the first transmission-times of the frames
*/
void initialFrameCreation(std::string type,
omnetpp::cStringTokenizer frameIDsTokenizer,
omnetpp::cStringTokenizer framesPeriodicityTokenizer,
omnetpp::cStringTokenizer dataLengthFramesTokenizer,
omnetpp::cStringTokenizer initialFrameOffsetTokenizer);
omnetpp::cStringTokenizer& frameIDsTokenizer,
omnetpp::cStringTokenizer& framesPeriodicityTokenizer,
omnetpp::cStringTokenizer& dataLengthFramesTokenizer,
omnetpp::cStringTokenizer& initialFrameOffsetTokenizer);

/**
* @brief Registers the outgoing remote frame at the port.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,15 @@ FRTrafficSourceAppBase::FRTrafficSourceAppBase() {

}

FRTrafficSourceAppBase::~FRTrafficSourceAppBase() {
for(FRFrame* element : outgoingStaticFrames){
cancelAndDelete(element);
}
for(FRFrame* element : outgoingDynamicFrames){
cancelAndDelete(element);
}
}

void FRTrafficSourceAppBase::initialize() {
getParentModule()->subscribe("newCycle", this);
// subscribe("newCycle", this);
Expand Down Expand Up @@ -68,7 +77,7 @@ void FRTrafficSourceAppBase::setUpStaticFrames() {
}

while (!staticSlotsChA.empty() || !staticSlotsChB.empty()) {
FRFrame * frMsg = new FRFrame();
FRFrame * frMsg = nullptr;
if ((staticSlotsChA.front() == staticSlotsChB.front())
&& !staticSlotsChA.empty() && !staticSlotsChB.empty()) {
cycleNr = static_cast<int>(ceil(
Expand Down Expand Up @@ -111,7 +120,7 @@ void FRTrafficSourceAppBase::setUpDynamicFrames() {
}

void FRTrafficSourceAppBase::dynamicFrameCreation(
omnetpp::cStringTokenizer tokenizer, int channel) {
omnetpp::cStringTokenizer& tokenizer, int channel) {
int gNumberOfMinislots = getParentModule()->par("gNumberOfMinislots");
while (tokenizer.hasMoreTokens()) {
int slot = atoi(tokenizer.nextToken());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ class FRTrafficSourceAppBase: public omnetpp::cSimpleModule, omnetpp::cListener
*/
FRTrafficSourceAppBase();

virtual ~FRTrafficSourceAppBase();

virtual void receiveSignal(omnetpp::cComponent *source,
omnetpp::simsignal_t signalID, long l, omnetpp::cObject *details) override;

Expand Down Expand Up @@ -84,7 +86,7 @@ class FRTrafficSourceAppBase: public omnetpp::cSimpleModule, omnetpp::cListener
/**
*
*/
void dynamicFrameCreation(omnetpp::cStringTokenizer tokenizer, int channel);
void dynamicFrameCreation(omnetpp::cStringTokenizer& tokenizer, int channel);

/**
*
Expand Down
7 changes: 7 additions & 0 deletions src/fico4omnet/buffer/Buffer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,13 @@ namespace FiCo4OMNeT {
simsignal_t Buffer::queueLengthSignal = registerSignal("length");
simsignal_t Buffer::queueSizeSignal = registerSignal("size");

Buffer::~Buffer(){
for (cMessage* element: frames){
cancelAndDelete(element);
}
frames.clear();
}

void Buffer::initialize() {
initializeStatistics();
registerDestinationGate();
Expand Down
3 changes: 3 additions & 0 deletions src/fico4omnet/buffer/Buffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,9 @@ class Buffer: public cSimpleModule {
virtual void deliverNextFrame();

protected:

~Buffer();

/**
* @brief Caches the queuesize sum of all bytes of frames
* increased with incoming frame, decreased with outgoing frame
Expand Down
6 changes: 6 additions & 0 deletions src/fico4omnet/buffer/can/CanInputBuffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@ namespace FiCo4OMNeT {
class CanInputBuffer: public CanBuffer {

public:

/**
* @brief Destructor
*/
virtual ~CanInputBuffer() = default;

/**
* @brief Puts the frame into the collection and informs the connected gates about the receiption.
*
Expand Down
8 changes: 0 additions & 8 deletions src/fico4omnet/buffer/can/CanOutputBuffer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,6 @@ namespace FiCo4OMNeT {

Define_Module(CanOutputBuffer);

CanOutputBuffer::~CanOutputBuffer(){
for (std::list<cMessage*>::iterator it = frames.begin(); it != frames.end(); ++it)
{
cancelAndDelete((*it));
}
frames.clear();
}

void CanOutputBuffer::putFrame(cMessage* msg) {
CanDataFrame *frame = dynamic_cast<CanDataFrame *>(msg);
if (MOB == true) {
Expand Down
2 changes: 1 addition & 1 deletion src/fico4omnet/buffer/can/CanOutputBuffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class CanOutputBuffer: public CanBuffer {
/**
* @brief Destructor
*/
virtual ~CanOutputBuffer();
virtual ~CanOutputBuffer() = default;

/**
* @brief Is called by the bus logic to permit the frame transmission.
Expand Down
3 changes: 3 additions & 0 deletions src/fico4omnet/bus/can/CanBusLogic.cc
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ CanBusLogic::~CanBusLogic() {
if(scheduledDataFrame){
cancelAndDelete(scheduledDataFrame);
}
for (auto* id : ids){
delete id;
}
}

void CanBusLogic::initialize() {
Expand Down
2 changes: 1 addition & 1 deletion src/fico4omnet/bus/can/canBus.ned
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ module CanBus
busPort: BusPort {
@display("p=163,74");
gates:
phygate[sizeof(gate)];
phygate[sizeof(parent.gate)];
}

canBusLogic: CanBusLogic {
Expand Down
4 changes: 2 additions & 2 deletions src/fico4omnet/bus/flexray/FRBus.ned
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,13 @@ module FRBus
busPortChannelA: BusPort {
@display("p=68,138");
gates:
phygate[numberOfNodesChannelA];
phygate[parent.numberOfNodesChannelA];
}

busPortChannelB: BusPort {
@display("p=163,138");
gates:
phygate[numberOfNodesChannelB];
phygate[parent.numberOfNodesChannelB];
}

frBusLogic: FRBusLogic {
Expand Down
11 changes: 3 additions & 8 deletions src/fico4omnet/linklayer/can/CanPortOutput.cc
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,14 @@ void CanPortOutput::handleReceivedErrorFrame() {
errorReceived = true;
if (scheduledErrorFrame != nullptr && scheduledErrorFrame->isScheduled()) {
EV<< getParentModule()->getParentModule()->getId() << ": error frame wird gedescheduled\n";
cancelEvent(scheduledErrorFrame);
delete scheduledErrorFrame;
cancelAndDelete(scheduledErrorFrame);
scheduledErrorFrame = nullptr;
}
}

void CanPortOutput::initialize() {
bandwidth = getParentModule()->getParentModule()->gate("gate$o")->getPathEndGate()->getOwnerModule()->getParentModule()->par("bandwidth");
errorperc = getParentModule()->getParentModule()->par("errorperc");
scheduledErrorFrame = new ErrorFrame();
initializeStatisticValues();
}

Expand Down Expand Up @@ -98,11 +96,8 @@ void CanPortOutput::handleMessage(cMessage *msg) {
if (position > 0)
position--;
errself->setPos(position);
if (scheduledErrorFrame != nullptr && scheduledErrorFrame->isScheduled()) {
cancelEvent(scheduledErrorFrame);
delete(scheduledErrorFrame);
scheduledErrorFrame = nullptr;
}
cancelAndDelete(scheduledErrorFrame);

scheduledErrorFrame = errself;
scheduleAt((simTime() + calculateScheduleTiming(position)),
scheduledErrorFrame);
Expand Down
2 changes: 1 addition & 1 deletion src/fico4omnet/nodes/can/canNode.ned
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ module CanNode
bufferOut: CanOutputBuffer {
@display("p=98,102");
gates:
in[numSourceApps];
in[parent.numSourceApps];
}

sourceApp[numSourceApps]: <default("CanTrafficSourceAppBase")> like ISourceApplication {
Expand Down
3 changes: 2 additions & 1 deletion src/fico4omnet/scheduler/flexray/SchedulerMessageEvents.msg
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ cplusplus {{
#include "fico4omnet/scheduler/flexray/SchedulerEvent.h"
}}

import SchedulerMessage;

namespace FiCo4OMNeT;

class SchedulerEvent;

//
// Message used for events of TTEScheduler that are triggered at a specified time in cycle (action_time).
Expand Down
2 changes: 1 addition & 1 deletion src/fico4omnet/utilities/HelperFunctions.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ cGate* gateByFullPath(const std::string &path)
{
std::string modulePath = path.substr(0, pos);
std::string gateName = path.substr(pos + 1);
cModule* module = cSimulation::getActiveSimulation()->getModuleByPath(modulePath.c_str());
cModule* module = cSimulation::getActiveSimulation()->findModuleByPath(modulePath.c_str());
if (module)
{
return module->gate(gateName.c_str());
Expand Down
5 changes: 1 addition & 4 deletions src/makefrag
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# WARNINGS_ERROR=1
# for -Werror

CFLAGS += -std=c++11
CFLAGS += -std=c++17

UNAME_S := $(shell uname -s)

Expand Down Expand Up @@ -62,6 +62,3 @@ else
endif

COPTS += $(SYSINCLUDES) -isystem $(OMNETPP_INCL_DIR)

# use legacy message compiler (available since OMNeT++ 5.3)
MSGC += --msg4