Skip to content

Commit

Permalink
all: Added missing unit qualifiers to get() calls.
Browse files Browse the repository at this point in the history
  • Loading branch information
levy committed Nov 15, 2024
1 parent 230cf22 commit 2d5193f
Show file tree
Hide file tree
Showing 45 changed files with 85 additions and 85 deletions.
4 changes: 2 additions & 2 deletions src/inet/common/FingerprintCalculator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ bool FingerprintCalculator::addEventIngredient(cEvent *event, cSingleFingerprint
auto packet = dynamic_cast<Packet *>(cpacket);
if (packet == nullptr)
packet = dynamic_cast<Packet *>(cpacket->getEncapsulatedPacket());
if (packet != nullptr && packet->getTotalLength().get() > 0) {
if (packet->getTotalLength().get() % 8 == 0) {
if (packet != nullptr && packet->getTotalLength().get<b>() > 0) {
if (packet->getTotalLength().get<b>() % 8 == 0) {
const auto& content = packet->peekAllAsBytes();
for (auto byte : content->getBytes())
hasher_ << byte;
Expand Down
4 changes: 2 additions & 2 deletions src/inet/common/ResultFilters.cc
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ void DataAgeFilter::receiveSignal(cResultFilter *prev, simtime_t_cref t, cObject
{
if (auto packet = dynamic_cast<Packet *>(object)) {
for (auto& region : packet->peekData()->getAllTags<CreationTimeTag>()) {
WeightedHistogramRecorder::cWeight weight(region.getLength().get());
WeightedHistogramRecorder::cWeight weight(region.getLength().get<b>());
fire(this, t, t - region.getTag()->getCreationTime(), &weight);
}
}
Expand Down Expand Up @@ -245,7 +245,7 @@ Register_ResultFilter("packetLength", PacketLengthFilter);
void PacketLengthFilter::receiveSignal(cResultFilter *prev, simtime_t_cref t, cObject *object, cObject *details)
{
auto packet = check_and_cast<Packet *>(object);
fire(this, t, packet->getDataLength().get(), details);
fire(this, t, packet->getDataLength().get<b>(), details);
}

Register_ResultFilter("flowPacketLength", FlowPacketLengthFilter);
Expand Down
4 changes: 2 additions & 2 deletions src/inet/common/packet/Packet.cc
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,9 @@ void Packet::parsimPack(cCommBuffer *buffer) const
cPacket::parsimPack(buffer);
buffer->packObject(const_cast<Chunk *>(content.get()));
buffer->pack(frontIterator.getIndex());
buffer->pack(frontIterator.getPosition().get());
buffer->pack(frontIterator.getPosition().get<b>());
buffer->pack(backIterator.getIndex());
buffer->pack(backIterator.getPosition().get());
buffer->pack(backIterator.getPosition().get<b>());
tags.parsimPack(buffer);
regionTags.parsimPack(buffer);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Register_Serializer(StreamBufferChunk, StreamBufferChunkSerializer);
void StreamBufferChunkSerializer::serialize(MemoryOutputStream& stream, const Ptr<const Chunk>& chunk, b offset, b length) const
{
const auto& streamBufferChunk = staticPtrCast<const StreamBufferChunk>(chunk);
b currentStreamPosition = b((simTime() - streamBufferChunk->getStartTime()).dbl() * streamBufferChunk->getDatarate().get());
b currentStreamPosition = b((simTime() - streamBufferChunk->getStartTime()).dbl() * streamBufferChunk->getDatarate().get<bps>());
if (length == b(-1))
length = streamBufferChunk->getChunkLength() - offset;
b copyLength = std::max(b(0), std::min(length, currentStreamPosition - offset));
Expand Down
4 changes: 2 additions & 2 deletions src/inet/common/packet/tag/SharingRegionTagSet.cc
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ void SharingRegionTagSet::parsimPack(cCommBuffer *buffer) const
buffer->pack(getNumTags());
if (regionTags != nullptr) {
for (auto regionTag : *regionTags) {
buffer->pack(regionTag.getOffset().get());
buffer->pack(regionTag.getLength().get());
buffer->pack(regionTag.getOffset().get<b>());
buffer->pack(regionTag.getLength().get<b>());
buffer->packObject(const_cast<TagBase *>(regionTag.getTag().get()));
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/inet/linklayer/ieee80211/mac/Ieee80211Mac.cc
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ void Ieee80211Mac::handleUpperCommand(cMessage *msg)
Ieee80211ConfigureRadioCommand *newConfigureCommand = check_and_cast<Ieee80211ConfigureRadioCommand *>(msg->getControlInfo());
if (newConfigureCommand->getChannelNumber() == -1 && oldConfigureCommand->getChannelNumber() != -1)
newConfigureCommand->setChannelNumber(oldConfigureCommand->getChannelNumber());
if (std::isnan(newConfigureCommand->getBitrate().get()) && !std::isnan(oldConfigureCommand->getBitrate().get()))
if (std::isnan(newConfigureCommand->getBitrate().get<bps>()) && !std::isnan(oldConfigureCommand->getBitrate().get<bps>()))
newConfigureCommand->setBitrate(oldConfigureCommand->getBitrate());
delete pendingRadioConfigMsg;
pendingRadioConfigMsg = nullptr;
Expand Down
4 changes: 2 additions & 2 deletions src/inet/linklayer/ieee80211/mac/coordinationfunction/Dcf.cc
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ void Dcf::transmitControlResponseFrame(Packet *responsePacket, const Ptr<const I
else
throw cRuntimeError("Unknown received frame type");
RateSelection::setFrameMode(responsePacket, responseHeader, responseMode);
emit(IRateSelection::datarateSelectedSignal, responseMode->getDataMode()->getNetBitrate().get(), responsePacket);
emit(IRateSelection::datarateSelectedSignal, responseMode->getDataMode()->getNetBitrate().get<bps>(), responsePacket);
EV_DEBUG << "Datarate for " << responsePacket->getName() << " is set to " << responseMode->getDataMode()->getNetBitrate() << ".\n";
tx->transmitFrame(responsePacket, responseHeader, modeSet->getSifsTime(), this);
delete responsePacket;
Expand Down Expand Up @@ -178,7 +178,7 @@ void Dcf::transmitFrame(Packet *packet, simtime_t ifs)
const auto& header = packet->peekAtFront<Ieee80211MacHeader>();
auto mode = rateSelection->computeMode(packet, header);
RateSelection::setFrameMode(packet, header, mode);
emit(IRateSelection::datarateSelectedSignal, mode->getDataMode()->getNetBitrate().get(), packet);
emit(IRateSelection::datarateSelectedSignal, mode->getDataMode()->getNetBitrate().get<bps>(), packet);
EV_DEBUG << "Datarate for " << packet->getName() << " is set to " << mode->getDataMode()->getNetBitrate() << ".\n";
auto pendingPacket = channelAccess->getInProgressFrames()->getPendingFrameFor(packet);
auto duration = originatorProtectionMechanism->computeDurationField(packet, header, pendingPacket, pendingPacket == nullptr ? nullptr : pendingPacket->peekAtFront<Ieee80211DataOrMgmtHeader>());
Expand Down
4 changes: 2 additions & 2 deletions src/inet/linklayer/ieee80211/mac/coordinationfunction/Hcf.cc
Original file line number Diff line number Diff line change
Expand Up @@ -660,7 +660,7 @@ void Hcf::transmitFrame(Packet *packet, simtime_t ifs)
}
auto mode = rateSelection->computeMode(packet, header, txop);
setFrameMode(packet, header, mode);
emit(IRateSelection::datarateSelectedSignal, mode->getDataMode()->getNetBitrate().get(), packet);
emit(IRateSelection::datarateSelectedSignal, mode->getDataMode()->getNetBitrate().get<bps>(), packet);
EV_DEBUG << "Datarate for " << packet->getName() << " is set to " << mode->getDataMode()->getNetBitrate() << ".\n";
if (txop->getProtectionMechanism() == TxopProcedure::ProtectionMechanism::SINGLE_PROTECTION) {
auto pendingPacket = channelOwner->getInProgressFrames()->getPendingFrameFor(packet);
Expand Down Expand Up @@ -695,7 +695,7 @@ void Hcf::transmitControlResponseFrame(Packet *responsePacket, const Ptr<const I
else
throw cRuntimeError("Unknown received frame type");
setFrameMode(responsePacket, responseHeader, responseMode);
emit(IRateSelection::datarateSelectedSignal, responseMode->getDataMode()->getNetBitrate().get(), responsePacket);
emit(IRateSelection::datarateSelectedSignal, responseMode->getDataMode()->getNetBitrate().get<bps>(), responsePacket);
EV_DEBUG << "Datarate for " << responsePacket->getName() << " is set to " << responseMode->getDataMode()->getNetBitrate() << ".\n";
tx->transmitFrame(responsePacket, responseHeader, modeSet->getSifsTime(), this);
delete responsePacket;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ void TxopProcedure::startTxop(AccessCategory ac)
throw cRuntimeError("Txop is already running");
if (limit == -1) {
auto referenceMode = modeSet->getSlowestMandatoryMode();
limit = getTxopLimit(referenceMode, ac).get();
limit = getTxopLimit(referenceMode, ac).get<s>();
}
// The STA selects between single and multiple protection when it transmits the first frame of a TXOP.
// All subsequent frames transmitted by the STA in the same TXOP use the same class of duration settings.
Expand Down
2 changes: 1 addition & 1 deletion src/inet/linklayer/ieee80211/mgmt/Ieee80211MgmtSta.cc
Original file line number Diff line number Diff line change
Expand Up @@ -749,7 +749,7 @@ void Ieee80211MgmtSta::storeAPInfo(Packet *packet, const Ptr<const Ieee80211Mgmt
ap->beaconInterval = body->getBeaconInterval();
auto signalPowerInd = packet->getTag<SignalPowerInd>();
if (signalPowerInd != nullptr) {
ap->rxPower = signalPowerInd->getPower().get();
ap->rxPower = signalPowerInd->getPower().get<W>();
if (ap->address == assocAP.address)
assocAP.rxPower = ap->rxPower;
}
Expand Down
2 changes: 1 addition & 1 deletion src/inet/mobility/single/GaussMarkovMobility.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ void GaussMarkovMobility::initialize(int stage)
if (stage == INITSTAGE_LOCAL) {
speedMean = par("speed");
speedStdDev = par("speedStdDev");
angleMean = deg(fmod(deg(par("angle")).get(), 360.0));
angleMean = deg(fmod(deg(par("angle")).get<deg>(), 360.0));
angleStdDev = deg(par("angleStdDev"));
alpha = par("alpha");
if (alpha < 0.0 || alpha > 1.0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ double L3NetworkConfiguratorBase::computeWirelessLinkWeight(Link *link, const ch
cModule *transmitterInterfaceModule = link->sourceInterfaceInfo->networkInterface;
IRadio *transmitterRadio = check_and_cast<IRadio *>(transmitterInterfaceModule->getSubmodule("radio"));
const FlatTransmitterBase *transmitter = dynamic_cast<const FlatTransmitterBase *>(transmitterRadio->getTransmitter());
double dataRate = transmitter ? transmitter->getBitrate().get() : 0;
double dataRate = transmitter ? transmitter->getBitrate().get<bps>() : 0;
return dataRate != 0 ? 1 / dataRate : minLinkWeight;
}
else if (!strcmp(metric, "errorRate")) {
Expand Down
2 changes: 1 addition & 1 deletion src/inet/networklayer/ipv6/Ipv6Header.cc
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const Ipv6ExtensionHeader *Ipv6Header::findExtensionHeaderByType(IpProtocolId ex

void Ipv6Header::addExtensionHeader(Ipv6ExtensionHeader *eh)
{
ASSERT((eh->getByteLength() >= B(1)) && (eh->getByteLength().get() % 8 == 0));
ASSERT((eh->getByteLength() >= B(1)) && (eh->getByteLength().get<B>() % 8 == 0));
int thisOrder = eh->getOrder();
size_t i;
for (i = 0; i < extensionHeader_arraysize; i++) {
Expand Down
4 changes: 2 additions & 2 deletions src/inet/physicallayer/wireless/common/medium/RadioMedium.cc
Original file line number Diff line number Diff line change
Expand Up @@ -532,9 +532,9 @@ void RadioMedium::sendToAffectedRadios(IRadio *radio, const IWirelessSignal *tra
if (neighborCache && rangeFilter != RANGE_FILTER_ANYWHERE) {
double range;
if (rangeFilter == RANGE_FILTER_COMMUNICATION_RANGE)
range = mediumLimitCache->getMaxCommunicationRange(radio).get();
range = mediumLimitCache->getMaxCommunicationRange(radio).get<m>();
else if (rangeFilter == RANGE_FILTER_INTERFERENCE_RANGE)
range = mediumLimitCache->getMaxInterferenceRange(radio).get();
range = mediumLimitCache->getMaxInterferenceRange(radio).get<m>();
else
throw cRuntimeError("Unknown range filter %d", rangeFilter);
if (std::isnan(range)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ void GridNeighborCache::initialize(int stage)
else if (stage == INITSTAGE_PHYSICAL_LAYER_NEIGHBOR_CACHE) {
constraintAreaMin = radioMedium->getMediumLimitCache()->getMinConstraintArea();
constraintAreaMax = radioMedium->getMediumLimitCache()->getMaxConstraintArea();
maxSpeed = radioMedium->getMediumLimitCache()->getMaxSpeed().get();
maxSpeed = radioMedium->getMediumLimitCache()->getMaxSpeed().get<mps>();
const Coord constraintAreaSize = constraintAreaMax - constraintAreaMin;
if (std::isnan(cellSize.x))
cellSize.x = constraintAreaSize.x / par("cellCountX").intValue();
Expand Down Expand Up @@ -86,7 +86,7 @@ void GridNeighborCache::addRadio(const IRadio *radio)
{
radios.push_back(radio);
Coord radioPos = radio->getAntenna()->getMobility()->getCurrentPosition();
maxSpeed = radioMedium->getMediumLimitCache()->getMaxSpeed().get();
maxSpeed = radioMedium->getMediumLimitCache()->getMaxSpeed().get<mps>();
if (maxSpeed != 0 && !refillCellsTimer->isScheduled() && initialized())
scheduleAfter(refillPeriod, refillCellsTimer);
Coord newConstraintAreaMin = radioMedium->getMediumLimitCache()->getMinConstraintArea();
Expand All @@ -113,7 +113,7 @@ void GridNeighborCache::removeRadio(const IRadio *radio)
constraintAreaMin = newConstraintAreaMin;
constraintAreaMax = newConstraintAreaMax;
}
maxSpeed = radioMedium->getMediumLimitCache()->getMaxSpeed().get();
maxSpeed = radioMedium->getMediumLimitCache()->getMaxSpeed().get<mps>();
fillCubeVector();
if (maxSpeed == 0 && initialized())
cancelEvent(refillCellsTimer);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ void NeighborListNeighborCache::initialize(int stage)
updateNeighborListsTimer = new cMessage("updateNeighborListsTimer");
}
else if (stage == INITSTAGE_PHYSICAL_LAYER_NEIGHBOR_CACHE) {
maxSpeed = radioMedium->getMediumLimitCache()->getMaxSpeed().get();
maxSpeed = radioMedium->getMediumLimitCache()->getMaxSpeed().get<mps>();
updateNeighborLists();
scheduleAfter(refillPeriod, updateNeighborListsTimer);
}
Expand Down Expand Up @@ -97,7 +97,7 @@ void NeighborListNeighborCache::addRadio(const IRadio *radio)
radios.push_back(newEntry);
radioToEntry[radio] = newEntry;
updateNeighborLists();
maxSpeed = radioMedium->getMediumLimitCache()->getMaxSpeed().get();
maxSpeed = radioMedium->getMediumLimitCache()->getMaxSpeed().get<mps>();
if (maxSpeed != 0 && !updateNeighborListsTimer->isScheduled() && initialized())
scheduleAfter(refillPeriod, updateNeighborListsTimer);
}
Expand All @@ -108,7 +108,7 @@ void NeighborListNeighborCache::removeRadio(const IRadio *radio)
if (it != radios.end()) {
removeRadioFromNeighborLists(radio);
radios.erase(it);
maxSpeed = radioMedium->getMediumLimitCache()->getMaxSpeed().get();
maxSpeed = radioMedium->getMediumLimitCache()->getMaxSpeed().get<mps>();
if (maxSpeed == 0 && initialized())
cancelEvent(updateNeighborListsTimer);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ void QuadTreeNeighborCache::initialize(int stage)
constraintAreaMin = radioMedium->getMediumLimitCache()->getMinConstraintArea();
constraintAreaMax = radioMedium->getMediumLimitCache()->getMaxConstraintArea();
quadTree = new QuadTree(constraintAreaMin, constraintAreaMax, maxNumOfPointsPerQuadrant, nullptr);
maxSpeed = radioMedium->getMediumLimitCache()->getMaxSpeed().get();
maxSpeed = radioMedium->getMediumLimitCache()->getMaxSpeed().get<mps>();
rebuildQuadTree();
scheduleAfter(refillPeriod, rebuildQuadTreeTimer);
}
Expand Down Expand Up @@ -66,7 +66,7 @@ void QuadTreeNeighborCache::addRadio(const IRadio *radio)
{
radios.push_back(radio);
Coord radioPos = radio->getAntenna()->getMobility()->getCurrentPosition();
maxSpeed = radioMedium->getMediumLimitCache()->getMaxSpeed().get();
maxSpeed = radioMedium->getMediumLimitCache()->getMaxSpeed().get<mps>();
if (maxSpeed != 0 && !rebuildQuadTreeTimer->isScheduled() && initialized())
scheduleAfter(refillPeriod, rebuildQuadTreeTimer);
Coord newConstraintAreaMin = radioMedium->getMediumLimitCache()->getMinConstraintArea();
Expand Down Expand Up @@ -97,7 +97,7 @@ void QuadTreeNeighborCache::removeRadio(const IRadio *radio)
}
else if (initialized())
quadTree->remove(check_and_cast<const cObject *>(radio));
maxSpeed = radioMedium->getMediumLimitCache()->getMaxSpeed().get();
maxSpeed = radioMedium->getMediumLimitCache()->getMaxSpeed().get<mps>();
if (maxSpeed == 0 && initialized())
cancelEvent(rebuildQuadTreeTimer);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ std::ostream& FreeSpacePathLoss::printToStream(std::ostream& stream, int level,
double FreeSpacePathLoss::computeFreeSpacePathLoss(m waveLength, m distance, double alpha, double systemLoss) const
{
// factor = waveLength ^ 2 / (16 * PI ^ 2 * systemLoss * distance ^ alpha)
return distance.get() == 0.0 ? 1.0 : (waveLength * waveLength).get() / (16 * M_PI * M_PI * systemLoss * pow(distance.get(), alpha));
return distance.get() == 0.0 ? 1.0 : (waveLength * waveLength).get() / (16 * M_PI * M_PI * systemLoss * pow(distance.get<m>(), alpha));
}

double FreeSpacePathLoss::computePathLoss(mps propagationSpeed, Hz frequency, m distance) const
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -401,8 +401,8 @@ class INET_API ObstacleLossFunction : public FunctionBase<double, Domain<m, m, m
ObstacleLossFunction(const IObstacleLoss *obstacleLoss) : obstacleLoss(obstacleLoss) {}

virtual double getValue(const Point<m, m, m, m, m, m, Hz>& p) const override {
Coord transmissionPosition(std::get<0>(p).get(), std::get<1>(p).get(), std::get<2>(p).get());
Coord receptionPosition(std::get<3>(p).get(), std::get<4>(p).get(), std::get<5>(p).get());
Coord transmissionPosition(std::get<0>(p).get<m>(), std::get<1>(p).get<m>(), std::get<2>(p).get<m>());
Coord receptionPosition(std::get<3>(p).get<m>(), std::get<4>(p).get<m>(), std::get<5>(p).get<m>());
Hz frequency = std::get<6>(p);
return obstacleLoss->computeObstacleLoss(frequency, transmissionPosition, receptionPosition);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,8 @@ const IReceptionSymbolModel *Ieee80211OfdmErrorModel::computeSymbolModel(const I

snirFunction->partition(interval, [&] (const math::Interval<simsec, Hz>& i1, const math::IFunction<double, math::Domain<simsec, Hz>> *f1) {

auto intervalStartTime = std::get<0>(i1.getLower()).get();
auto intervalEndTime = std::get<0>(i1.getUpper()).get();
auto intervalStartTime = std::get<0>(i1.getLower()).get<simsec>();
auto intervalEndTime = std::get<0>(i1.getUpper()).get<simsec>();
// sum SNIR

int startTimeSlot = (int)std::floor((intervalStartTime - reception->getHeaderStartTime()) / SimTime(4, SIMTIME_US));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Ieee80211DsssDataMode::Ieee80211DsssDataMode(const DpskModulationBase *modulatio

const simtime_t Ieee80211DsssDataMode::getDuration(b length) const
{
return (simtime_t)(lrint(ceil((double)length.get() / getGrossBitrate().get() * 1E+6))) / 1E+6;
return (simtime_t)(lrint(ceil((double)length.get() / getGrossBitrate().get<bps>() * 1E+6))) / 1E+6;
}

Ieee80211DsssMode::Ieee80211DsssMode(const char *name, const Ieee80211DsssPreambleMode *preambleMode, const Ieee80211DsssHeaderMode *headerMode, const Ieee80211DsssDataMode *dataMode) :
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class INET_API Ieee80211DsssPreambleMode : public Ieee80211DsssChunkMode, public

virtual bps getNetBitrate() const { return Mbps(1); }
virtual bps getGrossBitrate() const { return getNetBitrate(); }
virtual const simtime_t getDuration() const override { return (double)getLength().get() / getNetBitrate().get(); }
virtual const simtime_t getDuration() const override { return (double)getLength().get<b>() / getNetBitrate().get<bps>(); }
virtual const DbpskModulation *getModulation() const { return &DbpskModulation::singleton; }

virtual Ptr<Ieee80211PhyPreamble> createPreamble() const override { return makeShared<Ieee80211DsssPhyPreamble>(); }
Expand All @@ -49,7 +49,7 @@ class INET_API Ieee80211DsssHeaderMode : public Ieee80211DsssChunkMode, public I
virtual b getLength() const override { return getSignalFieldLength() + getServiceFieldLength() + getLengthFieldLength() + getCrcFieldLength(); }
virtual bps getNetBitrate() const override { return Mbps(1); }
virtual bps getGrossBitrate() const override { return getNetBitrate(); }
virtual const simtime_t getDuration() const override { return (double)getLength().get() / getNetBitrate().get(); }
virtual const simtime_t getDuration() const override { return (double)getLength().get<b>() / getNetBitrate().get<bps>(); }
virtual const simtime_t getSymbolInterval() const override { return -1; }
virtual const DbpskModulation *getModulation() const override { return &DbpskModulation::singleton; }

Expand Down
Loading

0 comments on commit 2d5193f

Please sign in to comment.