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
6 changes: 3 additions & 3 deletions quisp/modules/Logger/JsonLogger.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ void JsonLogger::setQNodeAddress(int addr) { qnode_address = addr; }

void JsonLogger::logPacket(const std::string& event_type, omnetpp::cMessage const* const msg) {
auto current_time = omnetpp::simTime();
_logger->info("\"simtime\": {}, \"event_type\": \"{}\", \"address\": \"{}\", {}", current_time, event_type, qnode_address, format(msg));
_logger->info("\"simtime\": {}, \"event_type\": \"{}\", \"address\": \"{}\", {}", current_time.str(), event_type, qnode_address, format(msg));
}

void JsonLogger::logQubitState(quisp::modules::QNIC_type qnic_type, int qnic_index, int qubit_index, bool is_busy, bool is_allocated) {
auto current_time = omnetpp::simTime();
_logger->info(
"\"simtime\": {}, \"event_type\": \"QubitStateChange\", \"address\": \"{}\", \"qnic_type\": {}, \"qnic_index\": {}, \"qubit_index\": {}, \"busy\": {}, \"allocated\": {}",
current_time, qnode_address, qnic_type, qnic_index, qubit_index, is_busy, is_allocated);
current_time.str(), qnode_address, qnic_type, qnic_index, qubit_index, is_busy, is_allocated);
}

std::string JsonLogger::format(omnetpp::cMessage const* const msg) {
Expand Down Expand Up @@ -78,7 +78,7 @@ std::string JsonLogger::format(omnetpp::cMessage const* const msg) {
void JsonLogger::logBellPairInfo(const std::string& event_type, int partner_addr, quisp::modules::QNIC_type qnic_type, int qnic_index, int qubit_index) {
auto current_time = omnetpp::simTime();
_logger->info("\"simtime\": {}, \"event_type\": \"BellPair{}\", \"address\": \"{}\", \"partner_addr\": {}, \"qnic_type\": {}, \"qnic_index\": {}, \"qubit_index\": {}",
current_time, event_type, qnode_address, partner_addr, qnic_type, qnic_index, qubit_index);
current_time.str(), event_type, qnode_address, partner_addr, qnic_type, qnic_index, qubit_index);
}

} // namespace quisp::modules::Logger
4 changes: 4 additions & 0 deletions quisp/test_utils/ModuleType.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ class TestModuleType : public cModuleType {
std::string getCxxNamespaceForType(const char *type) const override { return "mock cxx namespace"; };
#endif

#if OMNETPP_VERSION >= 0x602
std::string getDocumentation() const override { return ""; };
#endif

const char *getSourceFileName() const override { return "no source"; };
bool isInnerType() const override { return false; };

Expand Down
12 changes: 12 additions & 0 deletions quisp/test_utils/StaticEnv.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,17 @@ class StaticEnv : public omnetpp::cEnvir {
cRNG *getRNG(int k) override;

// output vectors
#if OMNETPP_VERSION >= 0x601
void *registerOutputVector(const char *modulename, const char *vectorname, opp_string_map *attributes = nullptr) override { return nullptr; }
#else
void *registerOutputVector(const char *modulename, const char *vectorname) override { return nullptr; }
#endif
void deregisterOutputVector(void *vechandle) override {}
#if OMNETPP_VERSION >= 0x601
void setVectorAttribute(void *vechandle, const char *name, const char *value) {}
#else
void setVectorAttribute(void *vechandle, const char *name, const char *value) override {}
#endif
bool recordInOutputVector(void *vechandle, simtime_t t, double value) override { return false; }

// output scalars
Expand Down Expand Up @@ -135,6 +143,10 @@ class StaticEnv : public omnetpp::cEnvir {
double getAnimationSpeed() const override { return 0; }
double getRemainingAnimationHoldTime() const override { return 0; }

#if OMNETPP_VERSION >= 0x601
std::ostream& getOutputStream() override { return std::cout; }
#endif

// lifecycle listeners
void addLifecycleListener(cISimulationLifecycleListener *listener) override {}
void removeLifecycleListener(cISimulationLifecycleListener *listener) override {}
Expand Down