I am trying to set a parameter in PassiveQueueBase which is child class and call it in another child class PriorityScheduler for Base Class IPassiveQueue.
PriorityScheduler is inherited from SchedulerBase which has a pointer (inputQueue) pointing at who ever is of type IpassiveQueue and going to invoke PacketEnqueued() function to PriorityScheduler. This is shown in this code
class INET_API SchedulerBase : public cSimpleModule, public IPassiveQueue, public IPassiveQueueListener
{
public:
virtual void packetEnqueued(IPassiveQueue *inputQueue) override;
};
Note: IpassiveQueue.h has no .cc file it is an interface file for many other classes.
What I tried to do is shown below,
class INET_API IPassiveQueue
{
public:
simtime_t sendWindowStart;
simtime_t sendWindowEnd;
virtual void setWindows() {};
};
class INET_API PassiveQueueBase : public cSimpleModule, public IPassiveQueue
{ protected:
void setWindows(simtime_t SWS,simtime_t SWE);
};
void PassiveQueueBase :: setWindows(simtime_t SWS,simtime_t SWE)
{ SWS = 3; SWE = 4;
sendWindowStart = SWS;
sendWindowEnd = SWE;
};
bool PriorityScheduler::schedulePacket()
{
IPassiveQueue *pqueue;
pqueue->setWindows();
sendWindowStart = inputQueue->sendWindowStart;
sendWindowEnd = inputQueue->sendWindowEnd;
}
I had an error by running the simulation as shown below
Simulation terminated with exit code: 139 Working directory: /home/usrname/omnetpp-5.0/samples/inet/examples/mysimulation Command line: opp_run -r 0 -n ..:../../src:../../tutorials -l ../../src/INET --debug-on-errors=false omnetpp.ini
Also I have exclamation mark on this line
pqueue->setWindows();
with this note
‘Pqueue’ may be used uninitialized in this function [-Wmaybe-uninitialized]
OMNeT++
queue? If yes, you should prepare a new class which inherits fromPassiveQueueBase
andIQueueAccess
, wherePassiveQueueBase
is the class already existed in INET (not your class). – Jerzy D.IPassiveQueue
class which is different thatIPassiveQueue
fromINET
. If you want to use an own queue I strongly suggest preparing a new class which inherits fromPassiveQueueBase
, andIQueueAccess
. In this new class you may add own variables as well as own behaviour. – Jerzy D.