Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update OMNeT++ msgc version to 6 #321

Merged
merged 2 commits into from
Dec 14, 2021
Merged
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
17 changes: 2 additions & 15 deletions quisp/PhotonicQubit.msg
Original file line number Diff line number Diff line change
@@ -1,16 +1,3 @@

cplusplus {{
#include <vector>
#include <unsupported/Eigen/MatrixFunctions>

using namespace omnetpp;
typedef cModule *GOD_statQubitPtr;

}} // C++ typedef
class noncobject GOD_statQubitPtr; // For tracking the truely entangled ones (Only God knows!). The system may think the qubit is entangled but it may not (darkcount)!



namespace quisp::messages;

message PhotonicQubit
Expand All @@ -27,7 +14,7 @@ message PhotonicQubit
int NodeEntangledWith = -1;//Which node it is entangled with. -1 if not entangled. Equivalent to SrcAddress.
int QNICEntangledWith = -1;//Which QNIC it is entangled with
int StationaryQubitEntangledWith = -1;//Which buffer it is entangled with
GOD_statQubitPtr entangled_with;
omnetpp::cModule* entangled_with;
int QNICtypeEntangledWith = -1;
//cModulePtr qnic_pointer;
//EntangledWith entangledWith;
Expand All @@ -49,6 +36,6 @@ cplusplus{{
virtual PhotonicQubit *dup() const {return new PhotonicQubit(*this);}

};Register_Class(PhotonicQubit);

}}

1 change: 1 addition & 0 deletions quisp/makefrag
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ CXXFLAGS = -std=c++17

OBJS := $(filter-out test_util/% %_test.o,$(OBJS))
OBJS := $(filter-out %unit_test_main.o,$(OBJS))
MSGC:=$(MSGC) --msg6

# you can pass the file path you want to check as SRCS environment variable. see the example below.
# $ SRCS=./quisp/modules/Application.cc make tidy # checks only Application.cc
Expand Down
5 changes: 1 addition & 4 deletions quisp/messages/HoM_ipc_messages.msg
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
cplusplus {{
#include "base_messages_m.h"
}}
import base_messages;

namespace quisp::messages;

packet Header;

packet HoMNotificationTimer extends Header{}

Expand Down
16 changes: 3 additions & 13 deletions quisp/messages/QNode_ipc_messages.msg
Original file line number Diff line number Diff line change
@@ -1,17 +1,7 @@
cplusplus {{
#include "base_messages_m.h"
#include <rules/RuleSet.h>
}}

cplusplus {{
typedef quisp::rules::RuleSet * RuleSetField;
}}
class noncobject RuleSetField;
import base_messages;

namespace quisp::messages;

packet Header;

packet deleteThisModule{}

packet ConditionNotSatisfied{}
Expand Down Expand Up @@ -48,13 +38,13 @@ packet InternalRuleSetForwarding extends Header{
unsigned long RuleSet_id;
unsigned long Rule_id;

RuleSetField RuleSet;
RuleSet* ruleSet;
}

packet InternalRuleSetForwarding_Application extends Header{
unsigned long RuleSet_id;
unsigned long Rule_id;
int application_type;

RuleSetField RuleSet;
RuleSet* ruleSet;
}
23 changes: 23 additions & 0 deletions quisp/messages/base_messages.msg
Original file line number Diff line number Diff line change
@@ -1,3 +1,26 @@
cplusplus {{
#include "base_messages_m.h"
#include <modules/QNIC.h>
#include <rules/RuleSet.h>
using quisp::rules::RuleSet;
using quisp::modules::QNIC_pair_info;
}}

class QNIC_type {
@existingClass;
@opaque;
};

class QNIC_pair_info {
@existingClass;
@opaque;
};

class RuleSet {
@existingClass;
@opaque;
};

namespace quisp::messages;

packet Header
Expand Down
18 changes: 3 additions & 15 deletions quisp/messages/connection_setup_messages.msg
Original file line number Diff line number Diff line change
@@ -1,19 +1,7 @@
cplusplus {{
#include "base_messages_m.h"
#include <modules/QNIC.h>
#include <rules/RuleSet.h>
}}

cplusplus {{
typedef quisp::rules::RuleSet * RuleSetField;
}}
class noncobject RuleSetField;

struct QNIC_pair_info;

import base_messages;
namespace quisp::messages;

packet Header;


packet ConnectionSetupRequest extends Header
{
Expand All @@ -38,7 +26,7 @@ packet ConnectionSetupResponse extends Header
int actual_srcAddr;
int actual_destAddr;
unsigned long RuleSet_id;
RuleSetField RuleSet;
RuleSet* ruleSet;
int application_type;
int stack_of_QNodeIndexes[];
}
11 changes: 1 addition & 10 deletions quisp/messages/entanglement_swapping_messages.msg
Original file line number Diff line number Diff line change
@@ -1,16 +1,7 @@
cplusplus {{
#include "base_messages_m.h"
#include <modules/QNIC.h>

using namespace quisp::modules;
}}

struct QNIC_type;
import base_messages;

namespace quisp::messages;

packet Header;

packet SwappingResult extends Header{
unsigned long RuleSet_id;
unsigned long Rule_id;
Expand Down
7 changes: 1 addition & 6 deletions quisp/messages/link_generation_messages.msg
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
cplusplus {{
#include "base_messages_m.h"
}}

import base_messages;
namespace quisp::messages;

packet Header;

packet BSMtimingNotifier extends Header
{
simtime_t timing_at;
Expand Down
23 changes: 9 additions & 14 deletions quisp/messages/purification_messages.msg
Original file line number Diff line number Diff line change
@@ -1,22 +1,14 @@
cplusplus {{
#include "base_messages_m.h"

using namespace omnetpp;
typedef cModule *GOD_statQubitPtr;
}} // C++ typedef
class noncobject GOD_statQubitPtr; // For tracking the truely entangled ones (Only God knows!). The system may think the qubit is entangled but it may not (darkcount)!

import base_messages;
namespace quisp::messages;

packet Header;

packet PurificationResult extends Header
{
bool Output_is_plus;
unsigned long ruleset_id;
unsigned long rule_id;
int action_index;
GOD_statQubitPtr entangled_with;//For Debugging purposes.
//For Debugging
omnetpp::cModule* entangled_with;
}

packet DoublePurificationResult extends Header
Expand All @@ -26,7 +18,8 @@ packet DoublePurificationResult extends Header
unsigned long ruleset_id;
unsigned long rule_id;
int action_index;
GOD_statQubitPtr entangled_with;//For Debugging purposes.
//For Debugging
omnetpp::cModule* entangled_with;
}

packet DS_DoublePurificationResult extends Header
Expand All @@ -38,7 +31,8 @@ packet DS_DoublePurificationResult extends Header
unsigned long ruleset_id;
unsigned long rule_id;
int action_index;
GOD_statQubitPtr entangled_with;//For Debugging purposes.
//For Debugging
omnetpp::cModule* entangled_with;
}

packet DS_DoublePurificationSecondResult extends Header
Expand All @@ -49,5 +43,6 @@ packet DS_DoublePurificationSecondResult extends Header
unsigned long ruleset_id;
unsigned long rule_id;
int action_index;
GOD_statQubitPtr entangled_with;//For Debugging purposes.
//For Debugging
omnetpp::cModule* entangled_with;
}
17 changes: 2 additions & 15 deletions quisp/messages/tomography_messages.msg
Original file line number Diff line number Diff line change
@@ -1,25 +1,12 @@
cplusplus {{
#include "base_messages_m.h"
#include <rules/RuleSet.h>
#include <modules/QNIC.h>
}}

cplusplus {{
typedef quisp::rules::RuleSet * RuleSetField;
}}

struct QNIC_type;
class noncobject RuleSetField;
import base_messages;

namespace quisp::messages;

packet Header;

packet LinkTomographyRuleSet extends Header
{
int process_id;
int number_of_measuring_resources;
RuleSetField RuleSet;
RuleSet* ruleSet;
}

packet LinkTomographyRequest extends Header {}
Expand Down
4 changes: 2 additions & 2 deletions quisp/modules/PhysicalConnection/BSA/BellStateAnalyzer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ void BellStateAnalyzer::handleMessage(cMessage *msg) {
left_photon_origin_qnic_address = photon->getQNICEntangledWith();
left_photon_origin_qubit_address = photon->getStationaryQubitEntangledWith();
left_photon_origin_qnic_type = photon->getQNICtypeEntangledWith();
left_statQubit_ptr = check_and_cast<StationaryQubit *>(photon->getEntangled_with());
left_statQubit_ptr = const_cast<StationaryQubit *>(check_and_cast<const StationaryQubit *>(photon->getEntangled_with()));
left_photon_Xerr = photon->getPauliXerr();
left_photon_Zerr = photon->getPauliZerr();
left_photon_lost = photon->getPhotonLost();
Expand All @@ -181,7 +181,7 @@ void BellStateAnalyzer::handleMessage(cMessage *msg) {
right_photon_origin_qubit_address = photon->getStationaryQubitEntangledWith();
right_photon_origin_qnic_type = photon->getQNICtypeEntangledWith();
// right_statQubit_ptr = photon->getEntangled_with();
right_statQubit_ptr = check_and_cast<StationaryQubit *>(photon->getEntangled_with());
right_statQubit_ptr = const_cast<StationaryQubit *>(check_and_cast<const StationaryQubit *>(photon->getEntangled_with()));
right_photon_Xerr = photon->getPauliXerr();
right_photon_Zerr = photon->getPauliZerr();
right_photon_lost = photon->getPhotonLost();
Expand Down
8 changes: 4 additions & 4 deletions quisp/modules/QNIC/StationaryQubit/IStationaryQubit.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#pragma once

#include <PhotonicQubit_m.h>

#include <Eigen/Eigen>
namespace quisp {

namespace types {
Expand Down Expand Up @@ -122,7 +122,7 @@ struct measurement_outcome {
char GOD_clean;
};

class IStationaryQubit : public cSimpleModule {
class IStationaryQubit : public omnetpp::cSimpleModule {
public:
IStationaryQubit(){};
virtual ~IStationaryQubit(){};
Expand Down Expand Up @@ -176,9 +176,9 @@ class IStationaryQubit : public cSimpleModule {
/** Pointer to the entangled qubit*/
IStationaryQubit *entangled_partner = nullptr;
/** Photon emitted at*/
simtime_t emitted_time = -1;
omnetpp::simtime_t emitted_time = -1;
/** Stationary qubit last updated at*/
simtime_t updated_time = -1;
omnetpp::simtime_t updated_time = -1;

/** Stationary Qubit is free or reserved. */
bool isBusy;
Expand Down
2 changes: 1 addition & 1 deletion quisp/modules/QNIC/StationaryQubit/StationaryQubit.h
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ class StationaryQubit : public IStationaryQubit {
protected:
void initialize() override;
void finish() override;
void handleMessage(cMessage *msg) override;
void handleMessage(omnetpp::cMessage *msg) override;
messages::PhotonicQubit *generateEntangledPhoton();
void setBusy();
// returns the matrix that represents the errors on the Bell pair. (e.g. XY, XZ and ZI...)
Expand Down
4 changes: 2 additions & 2 deletions quisp/modules/QRSA/ConnectionManager/ConnectionManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ void ConnectionManager::storeRuleSet(ConnectionSetupResponse *pk) {
pk_internal->setSrcAddr(pk->getDestAddr());
pk_internal->setKind(4);
pk_internal->setRuleSet_id(pk->getRuleSet_id());
pk_internal->setRuleSet(pk->getRuleSet());
pk_internal->setRuleSet(const_cast<RuleSet *>(pk->getRuleSet()));
send(pk_internal, "RouterPort$o");
}

Expand All @@ -178,7 +178,7 @@ void ConnectionManager::storeRuleSetForApplication(ConnectionSetupResponse *pk)
pk_internal->setSrcAddr(pk->getDestAddr()); // Should be original Src here?
pk_internal->setKind(4);
pk_internal->setRuleSet_id(pk->getRuleSet_id());
pk_internal->setRuleSet(pk->getRuleSet());
pk_internal->setRuleSet(const_cast<RuleSet *>(pk->getRuleSet()));
pk_internal->setApplication_type(pk->getApplication_type());
send(pk_internal, "RouterPort$o");
}
Expand Down
6 changes: 3 additions & 3 deletions quisp/modules/QRSA/RuleEngine/RuleEngine.cc
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ void RuleEngine::handleMessage(cMessage *msg) {
// Received a tomography rule set.
LinkTomographyRuleSet *pk = check_and_cast<LinkTomographyRuleSet *>(msg);
// std::cout<<"node["<<parentAddress<<"] !!!!!!!!!!Ruleset reveid!!!!!!!!! ruleset id = "<<pk->getRuleSet()->ruleset_id<<"\n";
auto ruleset = pk->getRuleSet();
auto *ruleset = const_cast<RuleSet *>(pk->getRuleSet());
int process_id = rp.size(); // This is temporary because it will not be unique when processes have been deleted.
std::cout << "Process size is ...." << ruleset->size() << " node[" << parentAddress << "\n";
// todo:We also need to allocate resources. e.g. if all qubits were entangled already, and got a new ruleset.
Expand Down Expand Up @@ -290,7 +290,7 @@ void RuleEngine::handleMessage(cMessage *msg) {
else if (dynamic_cast<InternalRuleSetForwarding *>(msg) != nullptr) {
InternalRuleSetForwarding *pkt = check_and_cast<InternalRuleSetForwarding *>(msg);
// add actual process
auto &ruleset = pkt->getRuleSet();
auto *ruleset = const_cast<RuleSet *>(pkt->getRuleSet());
// here swappers got swapping ruleset with internal packet
// todo:We also need to allocate resources. e.g. if all qubits were entangled already, and got a new ruleset.
// ResourceAllocation();
Expand All @@ -306,7 +306,7 @@ void RuleEngine::handleMessage(cMessage *msg) {
if (pkt->getApplication_type() == 0) {
// Received a tomography rule set.

auto ruleset = pkt->getRuleSet();
auto ruleset = const_cast<RuleSet *>(pkt->getRuleSet());
std::cout << "Process size is ...." << ruleset->size() << " node[" << parentAddress << "\n";
if (ruleset->size() > 0) {
rp.insert(ruleset);
Expand Down
2 changes: 1 addition & 1 deletion quisp/rules/Rule.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class Rule {
action_partners = _action_partners;
};

int num_partners() { return action_partners.size(); };
int num_partners() const { return action_partners.size(); };
void addResource(int address_entangled_with, IStationaryQubit *qubit);
void setCondition(Condition *c);
void setAction(Action *a);
Expand Down
4 changes: 2 additions & 2 deletions quisp/rules/RuleSet.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ RuleSet::RuleSet(long _ruleset_id, int _owner_addr, int partner_addr) {

void RuleSet::addRule(std::unique_ptr<Rule> r) { rules.emplace_back(std::move(r)); };
std::unique_ptr<Rule>& RuleSet::getRule(int i) { return rules[i]; };
int RuleSet::size() { return rules.size(); };
bool RuleSet::empty() { return rules.empty(); }
int RuleSet::size() const { return rules.size(); };
bool RuleSet::empty() const { return rules.empty(); }
std::vector<std::unique_ptr<Rule>>::const_iterator RuleSet::cbegin() { return rules.cbegin(); }
std::vector<std::unique_ptr<Rule>>::const_iterator RuleSet::cend() { return rules.cend(); }

Expand Down
4 changes: 2 additions & 2 deletions quisp/rules/RuleSet.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ class RuleSet {
RuleSet(long _ruleset_id, int _owner_addr, std::vector<int> partner_addrs);
void addRule(std::unique_ptr<Rule> r);
std::unique_ptr<Rule>& getRule(int i);
int size();
bool empty();
int size() const;
bool empty() const;
void finalize() {}
std::vector<std::unique_ptr<Rule>>::const_iterator cbegin();
std::vector<std::unique_ptr<Rule>>::const_iterator cend();
Expand Down