diff --git a/quisp/channels/FreeSpaceChannel.cc b/quisp/channels/FreeSpaceChannel.cc index b299acf16..3861a2874 100644 --- a/quisp/channels/FreeSpaceChannel.cc +++ b/quisp/channels/FreeSpaceChannel.cc @@ -50,7 +50,7 @@ double FreeSpaceChannel::getDistanceAtTime(const simtime_t time) { } SimTime FreeSpaceChannel::getNextCheckTime() { - Enter_Method("next_check_time()"); + Enter_Method("getNextCheckTime()"); const SimTime current_time = fmod(simTime(), op.orbit_period); if (current_time >= op.vis_start_time and current_time <= op.vis_end_time) { return 0; diff --git a/quisp/channels/FreeSpaceChannel.h b/quisp/channels/FreeSpaceChannel.h index af40ed445..ae3c14d51 100644 --- a/quisp/channels/FreeSpaceChannel.h +++ b/quisp/channels/FreeSpaceChannel.h @@ -35,7 +35,7 @@ class FreeSpaceChannel : public cDatarateChannel { FreeSpaceChannel(); bool isRecipientVisible(); double getDistanceAtTime(const simtime_t time); - SimTime getNextCheckTime(); + virtual SimTime getNextCheckTime(); private: OrbitalParameters op; diff --git a/quisp/messages/visibility_messages.msg b/quisp/messages/visibility_messages.msg index a133f177a..e258698eb 100644 --- a/quisp/messages/visibility_messages.msg +++ b/quisp/messages/visibility_messages.msg @@ -3,12 +3,12 @@ namespace quisp::messages; packet VisibilityMessage {} packet VisCheckOutcome extends VisibilityMessage { - double next_check_time; + double next_check_time @getter(getNextCheckTime) @setter(setNextCheckTime); } packet VisCheckRequest extends VisibilityMessage { - string out_gate; - int index; + string out_gate; + int index; } -packet VisCheckRetry extends VisibilityMessage {} \ No newline at end of file +packet VisCheckRetry extends VisibilityMessage {} diff --git a/quisp/modules/Common/GatedQueue.cc b/quisp/modules/Common/GatedQueue.cc index 41f19f2e7..3ab02bbd7 100644 --- a/quisp/modules/Common/GatedQueue.cc +++ b/quisp/modules/Common/GatedQueue.cc @@ -21,7 +21,7 @@ void GatedQueue::handleMessage(cMessage *msg) { } if (auto vco = dynamic_cast(msg)) { - if (vco->getNext_check_time() == 0) { + if (vco->getNextCheckTime() == 0) { last_polling_time = simTime(); pending_vcr = false; msg = (cMessage *)queue.pop(); @@ -30,7 +30,7 @@ void GatedQueue::handleMessage(cMessage *msg) { startTransmitting(msg); } else { VisCheckRetry *retry = new VisCheckRetry(); - next_check_time = vco->getNext_check_time(); + next_check_time = vco->getNextCheckTime(); scheduleAfter(next_check_time, retry); } delete vco; diff --git a/quisp/modules/Common/GatedQueue_test.cc b/quisp/modules/Common/GatedQueue_test.cc index 135c129d3..72014df85 100644 --- a/quisp/modules/Common/GatedQueue_test.cc +++ b/quisp/modules/Common/GatedQueue_test.cc @@ -11,7 +11,7 @@ using namespace quisp_test; using namespace quisp_test::utils; using namespace quisp::messages; using namespace quisp::modules::SharedResource; -using quisp_test::FSChannel::MockFreeSpaceChannel; +using quisp_test::FreeSpaceChannel::MockFreeSpaceChannel; using OriginalGatedQueue = quisp::modules::GatedQueue; namespace { @@ -156,7 +156,7 @@ TEST_F(GatedQueueTest, handleOutgoingMessage_Visible) { ASSERT_EQ(gated_queue->gate("to_ps")->messages.size(), 1); // Must request Vis info ASSERT_EQ(gated_queue->gate("line$o")->messages.size(), 0); // Must not send message yet VisCheckOutcome* vco = new VisCheckOutcome(); - vco->setNext_check_time(0); + vco->setNextCheckTime(0); vco->setArrival(gated_queue->getId(), gated_queue->findGate("from_ps"), simTime()); gated_queue->handleMessage(vco); ASSERT_EQ(*gated_queue->gate("line$o")->messages.front()->getName(), *pkt->getName()); // If receiver is visible, we can send the message. @@ -170,7 +170,7 @@ TEST_F(GatedQueueTest, handleOutgoingMessage_NonVisible) { ASSERT_EQ(gated_queue->gate("to_ps")->messages.size(), 1); // Must request Vis info ASSERT_EQ(gated_queue->gate("line$o")->messages.size(), 0); // Must not send message yet VisCheckOutcome* vco = new VisCheckOutcome(); - vco->setNext_check_time(1); + vco->setNextCheckTime(1); vco->setArrival(gated_queue->getId(), gated_queue->findGate("from_ps"), simTime()); gated_queue->handleMessage(vco); ASSERT_EQ(gated_queue->gate("line$o")->messages.size(), 0); // Must not send message yet @@ -180,7 +180,7 @@ TEST_F(GatedQueueTest, handleOutgoingMessage_NonVisible) { ASSERT_EQ(gated_queue->gate("to_ps")->messages.size(), 2); // Must request Vis info ASSERT_EQ(gated_queue->gate("line$o")->messages.size(), 0); // Must not send message yet VisCheckOutcome* second_vco = new VisCheckOutcome(); - second_vco->setNext_check_time(0); + second_vco->setNextCheckTime(0); second_vco->setArrival(gated_queue->getId(), gated_queue->findGate("from_ps"), simTime()); gated_queue->handleMessage(second_vco); ASSERT_EQ(gated_queue->gate("line$o")->messages.size(), 1); // Finally send the message diff --git a/quisp/modules/Satellite/PointingSystem.cc b/quisp/modules/Satellite/PointingSystem.cc index 03a2ba180..9ff2b8954 100644 --- a/quisp/modules/Satellite/PointingSystem.cc +++ b/quisp/modules/Satellite/PointingSystem.cc @@ -3,7 +3,7 @@ * \brief PointingSystem */ #include "PointingSystem.h" -#include "channels/FSChannel.h" +#include "channels/FreeSpaceChannel.h" #include "messages/visibility_messages_m.h" using namespace channels; @@ -25,12 +25,12 @@ void PointingSystem::handleMessage(cMessage* msg) { const char* gate_to_check = vcr->getOut_gate(); int gtc_index = vcr->getIndex(); cChannel* chl = getParentModule()->gate(gate_to_check, gtc_index)->getChannel(); - if (auto* fs_chl = dynamic_cast(chl)) { - SimTime next_check_time = fs_chl->getNext_check_time(); - vco->setNext_check_time(next_check_time.dbl()); + if (auto* fs_chl = dynamic_cast(chl)) { + SimTime next_check_time = fs_chl->getNextCheckTime(); + vco->setNextCheckTime(next_check_time.dbl()); } else { EV << "WARNING: checking visibility along a fiber channel. Seems weird."; - vco->setNext_check_time(0); + vco->setNextCheckTime(0); } send(vco, "ans"); delete vcr; diff --git a/quisp/modules/Satellite/PointingSystem.h b/quisp/modules/Satellite/PointingSystem.h index 12e96aaef..3b1dbd6b6 100644 --- a/quisp/modules/Satellite/PointingSystem.h +++ b/quisp/modules/Satellite/PointingSystem.h @@ -5,7 +5,7 @@ #pragma once #include -#include "channels/FSChannel.h" +#include "channels/FreeSpaceChannel.h" #include "messages/visibility_messages_m.h" #include "omnetpp/simtime.h" diff --git a/quisp/modules/Satellite/PointingSystem_test.cc b/quisp/modules/Satellite/PointingSystem_test.cc index d047a8a24..19b121124 100644 --- a/quisp/modules/Satellite/PointingSystem_test.cc +++ b/quisp/modules/Satellite/PointingSystem_test.cc @@ -12,7 +12,7 @@ using namespace quisp_test::utils; using namespace quisp::messages; using namespace quisp::modules::SharedResource; using OriginalPointingSystem = quisp::modules::Satellite::PointingSystem; -using quisp_test::FSChannel::MockFreeSpaceChannel; +using quisp_test::FreeSpaceChannel::MockFreeSpaceChannel; namespace { @@ -120,7 +120,7 @@ TEST_F(PointingSystemTest, handleNonControlMessage) { } TEST_F(PointingSystemTest, handleVisRequest_VisibleChannel) { - chl->setNext_check_time(simTime()); + chl->setNextCheckTime(simTime()); auto vcr = new VisCheckRequest; vcr->setOut_gate("test_out"); @@ -132,12 +132,12 @@ TEST_F(PointingSystemTest, handleVisRequest_VisibleChannel) { { auto* msg = pointing_system->gate("ans")->messages.at(0); auto vco = dynamic_cast(msg); - ASSERT_EQ(vco->getNext_check_time(), 0); + ASSERT_EQ(vco->getNextCheckTime(), 0); } } TEST_F(PointingSystemTest, handleVisRequest_NonVisibleChannel) { - chl->setNext_check_time(simTime() + 1); + chl->setNextCheckTime(simTime() + 1); auto vcr = new VisCheckRequest; vcr->setOut_gate("test_out"); @@ -149,11 +149,11 @@ TEST_F(PointingSystemTest, handleVisRequest_NonVisibleChannel) { { auto* msg = pointing_system->gate("ans")->messages.at(0); auto vco = dynamic_cast(msg); - ASSERT_EQ(vco->getNext_check_time(), simTime().dbl() + 1); + ASSERT_EQ(vco->getNextCheckTime(), simTime().dbl() + 1); } } -TEST_F(PointingSystemTest, handleVisRequest_NonFSChannel) { +TEST_F(PointingSystemTest, handleVisRequest_NonFreeSpaceChannel) { outgate->disconnect(); outgate->connectTo(stub_gate); @@ -167,7 +167,7 @@ TEST_F(PointingSystemTest, handleVisRequest_NonFSChannel) { { auto* msg = pointing_system->gate("ans")->messages.at(0); auto vco = dynamic_cast(msg); - ASSERT_EQ(vco->getNext_check_time(), 0); + ASSERT_EQ(vco->getNextCheckTime(), 0); } } diff --git a/quisp/test_utils/MockFreeSpaceChannel.cc b/quisp/test_utils/MockFreeSpaceChannel.cc index 75cb7f750..029f9e937 100644 --- a/quisp/test_utils/MockFreeSpaceChannel.cc +++ b/quisp/test_utils/MockFreeSpaceChannel.cc @@ -5,12 +5,12 @@ #include "omnetpp/cchannel.h" #include "omnetpp/ccomponent.h" -namespace quisp_test::FSChannel { +namespace quisp_test::FreeSpaceChannel { using quisp_test::channel_type::TestChannelType; using namespace quisp_test::utils; -MockFreeSpaceChannel::MockFreeSpaceChannel(const char* channel_name) : channels::FSChannel() { +MockFreeSpaceChannel::MockFreeSpaceChannel(const char* channel_name) : channels::FreeSpaceChannel() { setComponentType(new TestChannelType("test channel")); setName(channel_name); @@ -23,7 +23,7 @@ MockFreeSpaceChannel::MockFreeSpaceChannel(const char* channel_name) : channels: MockFreeSpaceChannel::~MockFreeSpaceChannel() { this->getSourceGate()->disconnect(); }; -void MockFreeSpaceChannel::setNext_check_time(SimTime next_check) { next_check_time = next_check; } +void MockFreeSpaceChannel::setNextCheckTime(SimTime next_check) { next_check_time = next_check; } -SimTime MockFreeSpaceChannel::getNext_check_time() { return next_check_time; } -} // namespace quisp_test::FSChannel +SimTime MockFreeSpaceChannel::getNextCheckTime() { return next_check_time; } +} // namespace quisp_test::FreeSpaceChannel diff --git a/quisp/test_utils/MockFreeSpaceChannel.h b/quisp/test_utils/MockFreeSpaceChannel.h index 87156c357..c8df917bc 100644 --- a/quisp/test_utils/MockFreeSpaceChannel.h +++ b/quisp/test_utils/MockFreeSpaceChannel.h @@ -1,18 +1,18 @@ #pragma once #include -#include "channels/FSChannel.h" +#include "channels/FreeSpaceChannel.h" -namespace quisp_test::FSChannel { +namespace quisp_test::FreeSpaceChannel { -class MockFreeSpaceChannel : public channels::FSChannel { +class MockFreeSpaceChannel : public channels::FreeSpaceChannel { public: explicit MockFreeSpaceChannel(const char* channel_name); ~MockFreeSpaceChannel(); void initialize() override{}; - void setNext_check_time(SimTime next_check); + void setNextCheckTime(SimTime next_check); virtual cProperties* getProperties() const override { return props; }; - SimTime getNext_check_time() override; + SimTime getNextCheckTime() override; void addResultRecorders() override{}; virtual simtime_t getTransmissionFinishTime() const override { return simTime(); }; @@ -21,4 +21,4 @@ class MockFreeSpaceChannel : public channels::FSChannel { cProperties* props; cConfiguration* cfg; }; -} // namespace quisp_test::FSChannel +} // namespace quisp_test::FreeSpaceChannel