-
Notifications
You must be signed in to change notification settings - Fork 2
/
SwitchQuantumInterface.cc
56 lines (41 loc) · 1.04 KB
/
SwitchQuantumInterface.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/*
* ProcessingQueue.cc
*
* Created on: 3 Apr 2019
* Author: Faisal
*/
#include <string.h>
#include <omnetpp.h>
#include <bitset>
#include <iostream>
#include "SwitchMemory.h"
using namespace omnetpp;
class SwitchQuantumInterface : public cSimpleModule
{
protected:
virtual void initialize(int stage) override;
virtual int numInitStages() const override;
virtual void handleMessage(cMessage *msg) override;
};
Define_Module(SwitchQuantumInterface);
void SwitchQuantumInterface::handleMessage(cMessage *msg)
{
cGate *gate = msg->getArrivalGate();
if(gate->isName("quantumChannelCommunication$i"))
{
std::string exitInterface=this->par("exitInterface").stringValue();
exitInterface.append("$o");
send(msg, exitInterface.c_str());
}
else
{
send(msg,"quantumChannelCommunication$o");
}
}
void SwitchQuantumInterface::initialize(int stage)
{
}
int SwitchQuantumInterface::numInitStages() const
{
return 3;
}