Skip to content

Commit

Permalink
Fixed names to make capitalization consistent
Browse files Browse the repository at this point in the history
  • Loading branch information
Paolo Fittipaldi committed Jul 4, 2024
1 parent b427ae9 commit 4cfbfff
Show file tree
Hide file tree
Showing 10 changed files with 36 additions and 36 deletions.
2 changes: 1 addition & 1 deletion quisp/channels/FreeSpaceChannel.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion quisp/channels/FreeSpaceChannel.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
8 changes: 4 additions & 4 deletions quisp/messages/visibility_messages.msg
Original file line number Diff line number Diff line change
Expand Up @@ -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 {}
packet VisCheckRetry extends VisibilityMessage {}
4 changes: 2 additions & 2 deletions quisp/modules/Common/GatedQueue.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ void GatedQueue::handleMessage(cMessage *msg) {
}

if (auto vco = dynamic_cast<VisCheckOutcome *>(msg)) {
if (vco->getNext_check_time() == 0) {
if (vco->getNextCheckTime() == 0) {
last_polling_time = simTime();
pending_vcr = false;
msg = (cMessage *)queue.pop();
Expand All @@ -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;
Expand Down
8 changes: 4 additions & 4 deletions quisp/modules/Common/GatedQueue_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down Expand Up @@ -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.
Expand All @@ -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
Expand All @@ -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
Expand Down
10 changes: 5 additions & 5 deletions quisp/modules/Satellite/PointingSystem.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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<FSChannel*>(chl)) {
SimTime next_check_time = fs_chl->getNext_check_time();
vco->setNext_check_time(next_check_time.dbl());
if (auto* fs_chl = dynamic_cast<FreeSpaceChannel*>(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;
Expand Down
2 changes: 1 addition & 1 deletion quisp/modules/Satellite/PointingSystem.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#pragma once

#include <omnetpp.h>
#include "channels/FSChannel.h"
#include "channels/FreeSpaceChannel.h"
#include "messages/visibility_messages_m.h"
#include "omnetpp/simtime.h"

Expand Down
14 changes: 7 additions & 7 deletions quisp/modules/Satellite/PointingSystem_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down Expand Up @@ -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");
Expand All @@ -132,12 +132,12 @@ TEST_F(PointingSystemTest, handleVisRequest_VisibleChannel) {
{
auto* msg = pointing_system->gate("ans")->messages.at(0);
auto vco = dynamic_cast<VisCheckOutcome*>(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");
Expand All @@ -149,11 +149,11 @@ TEST_F(PointingSystemTest, handleVisRequest_NonVisibleChannel) {
{
auto* msg = pointing_system->gate("ans")->messages.at(0);
auto vco = dynamic_cast<VisCheckOutcome*>(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);

Expand All @@ -167,7 +167,7 @@ TEST_F(PointingSystemTest, handleVisRequest_NonFSChannel) {
{
auto* msg = pointing_system->gate("ans")->messages.at(0);
auto vco = dynamic_cast<VisCheckOutcome*>(msg);
ASSERT_EQ(vco->getNext_check_time(), 0);
ASSERT_EQ(vco->getNextCheckTime(), 0);
}
}

Expand Down
10 changes: 5 additions & 5 deletions quisp/test_utils/MockFreeSpaceChannel.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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
12 changes: 6 additions & 6 deletions quisp/test_utils/MockFreeSpaceChannel.h
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
#pragma once

#include <omnetpp.h>
#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(); };

Expand All @@ -21,4 +21,4 @@ class MockFreeSpaceChannel : public channels::FSChannel {
cProperties* props;
cConfiguration* cfg;
};
} // namespace quisp_test::FSChannel
} // namespace quisp_test::FreeSpaceChannel

0 comments on commit 4cfbfff

Please sign in to comment.