#include <NeighborListNeighborCache.h>
inet::physicallayer::NeighborListNeighborCache::NeighborListNeighborCache |
( |
| ) |
|
double range
Definition: NeighborListNeighborCache.h:52
RadioMedium * radioMedium
Definition: NeighborListNeighborCache.h:47
double maxSpeed
Definition: NeighborListNeighborCache.h:53
cMessage * updateNeighborListsTimer
Definition: NeighborListNeighborCache.h:49
#define NaN
Definition: INETMath.h:103
double refillPeriod
Definition: NeighborListNeighborCache.h:51
inet::physicallayer::NeighborListNeighborCache::~NeighborListNeighborCache |
( |
| ) |
|
149 for (
auto & elem :
radios)
cMessage * updateNeighborListsTimer
Definition: NeighborListNeighborCache.h:49
RadioEntries radios
Definition: NeighborListNeighborCache.h:48
void inet::physicallayer::NeighborListNeighborCache::addRadio |
( |
const IRadio * |
radio | ) |
|
|
overridevirtual |
Implements inet::physicallayer::INeighborCache.
106 RadioEntry *newEntry =
new RadioEntry(radio);
107 radios.push_back(newEntry);
const value_type & get() const
Definition: Units.h:89
RadioMedium * radioMedium
Definition: NeighborListNeighborCache.h:47
double maxSpeed
Definition: NeighborListNeighborCache.h:53
cMessage * updateNeighborListsTimer
Definition: NeighborListNeighborCache.h:49
RadioEntries radios
Definition: NeighborListNeighborCache.h:48
virtual const IMediumLimitCache * getMediumLimitCache() const override
Definition: RadioMedium.h:328
double refillPeriod
Definition: NeighborListNeighborCache.h:51
void updateNeighborLists()
Definition: NeighborListNeighborCache.cc:130
RadioEntryCache radioToEntry
Definition: NeighborListNeighborCache.h:50
virtual mps getMaxSpeed() const =0
Returns the maximum possible speed among the radios, the value is in the range [0, +infinity) or NaN if unspecified.
void inet::physicallayer::NeighborListNeighborCache::handleMessage |
( |
cMessage * |
msg | ) |
|
|
overrideprotectedvirtual |
79 if (!msg->isSelfMessage())
80 throw cRuntimeError(
"This module only handles self messages");
double refillPeriod
Definition: NeighborListNeighborCache.h:51
void updateNeighborLists()
Definition: NeighborListNeighborCache.cc:130
void inet::physicallayer::NeighborListNeighborCache::initialize |
( |
int |
stage | ) |
|
|
overrideprotectedvirtual |
39 radioMedium = getModuleFromPar<RadioMedium>(par(
"radioMediumModule"),
this);
double range
Definition: NeighborListNeighborCache.h:52
const value_type & get() const
Definition: Units.h:89
RadioMedium * radioMedium
Definition: NeighborListNeighborCache.h:47
double maxSpeed
Definition: NeighborListNeighborCache.h:53
cMessage * updateNeighborListsTimer
Definition: NeighborListNeighborCache.h:49
Local initializations.
Definition: InitStages.h:35
virtual const IMediumLimitCache * getMediumLimitCache() const override
Definition: RadioMedium.h:328
double refillPeriod
Definition: NeighborListNeighborCache.h:51
Additional link-layer initializations that depend on the previous stage.
Definition: InitStages.h:64
void updateNeighborLists()
Definition: NeighborListNeighborCache.cc:130
virtual mps getMaxSpeed() const =0
Returns the maximum possible speed among the radios, the value is in the range [0, +infinity) or NaN if unspecified.
virtual int inet::physicallayer::NeighborListNeighborCache::numInitStages |
( |
| ) |
const |
|
inlineoverrideprotectedvirtual |
The number of initialization stages.
Definition: InitStages.h:116
std::ostream & inet::physicallayer::NeighborListNeighborCache::printToStream |
( |
std::ostream & |
stream, |
|
|
int |
level |
|
) |
| const |
|
overridevirtual |
Prints this object to the provided output stream.
Function calls to operator<< with pointers or references either const or not are all forwarded to this function.
Reimplemented from inet::physicallayer::IPrintableObject.
53 stream <<
"NeighborListNeighborCache";
56 <<
", range = " <<
range double range
Definition: NeighborListNeighborCache.h:52
double maxSpeed
Definition: NeighborListNeighborCache.h:53
Definition: IPrintableObject.h:34
double refillPeriod
Definition: NeighborListNeighborCache.h:51
void inet::physicallayer::NeighborListNeighborCache::removeRadio |
( |
const IRadio * |
radio | ) |
|
|
overridevirtual |
Implements inet::physicallayer::INeighborCache.
126 throw cRuntimeError(
"You can't remove radio: %d because it is not in our radio vector", radio->getId());
void removeRadioFromNeighborLists(const IRadio *radio)
Definition: NeighborListNeighborCache.cc:137
const value_type & get() const
Definition: Units.h:89
RadioMedium * radioMedium
Definition: NeighborListNeighborCache.h:47
double maxSpeed
Definition: NeighborListNeighborCache.h:53
cMessage * updateNeighborListsTimer
Definition: NeighborListNeighborCache.h:49
RadioEntries radios
Definition: NeighborListNeighborCache.h:48
virtual const IMediumLimitCache * getMediumLimitCache() const override
Definition: RadioMedium.h:328
RadioEntryCache radioToEntry
Definition: NeighborListNeighborCache.h:50
virtual mps getMaxSpeed() const =0
Returns the maximum possible speed among the radios, the value is in the range [0, +infinity) or NaN if unspecified.
std::vector< T >::iterator find(std::vector< T > &v, const T &a)
Definition: stlutils.h:48
void inet::physicallayer::NeighborListNeighborCache::removeRadioFromNeighborLists |
( |
const IRadio * |
radio | ) |
|
|
protected |
Referenced by removeRadio().
139 for (
auto & elem :
radios) {
140 Radios neighborVector = elem->neighborVector;
141 auto it =
find(neighborVector.begin(), neighborVector.end(), radio);
142 if (it != neighborVector.end())
143 neighborVector.erase(it);
std::vector< const IRadio * > Radios
Definition: NeighborListNeighborCache.h:43
RadioEntries radios
Definition: NeighborListNeighborCache.h:48
std::vector< T >::iterator find(std::vector< T > &v, const T &a)
Definition: stlutils.h:48
void inet::physicallayer::NeighborListNeighborCache::sendToNeighbors |
( |
IRadio * |
transmitter, |
|
|
const IRadioFrame * |
frame, |
|
|
double |
range |
|
) |
| const |
|
overridevirtual |
Sends the provided frame (using the radio medium) to all neighbors within the given range.
Implements inet::physicallayer::INeighborCache.
64 throw cRuntimeError(
"The transmitter's (id: %d) range is bigger then the cache range", transmitter->getId());
66 RadioEntryCache::const_iterator it =
radioToEntry.find(transmitter);
68 throw cRuntimeError(
"Transmitter is not found");
70 RadioEntry *radioEntry = it->second;
71 Radios& neighborVector = radioEntry->neighborVector;
73 for (
auto & elem : neighborVector)
double range
Definition: NeighborListNeighborCache.h:52
std::vector< const IRadio * > Radios
Definition: NeighborListNeighborCache.h:43
virtual void sendToRadio(IRadio *trasmitter, const IRadio *receiver, const IRadioFrame *frame)
Definition: RadioMedium.cc:553
RadioMedium * radioMedium
Definition: NeighborListNeighborCache.h:47
RadioEntryCache radioToEntry
Definition: NeighborListNeighborCache.h:50
void inet::physicallayer::NeighborListNeighborCache::updateNeighborList |
( |
RadioEntry * |
radioEntry | ) |
|
|
protected |
Referenced by updateNeighborLists().
89 IMobility *radioMobility = radioEntry->radio->getAntenna()->getMobility();
90 Coord radioPosition = radioMobility->getCurrentPosition();
92 radioEntry->neighborVector.clear();
94 for (
auto & elem :
radios) {
95 const IRadio *otherRadio = elem->radio;
96 Coord otherEntryPosition = otherRadio->getAntenna()->getMobility()->getCurrentPosition();
98 if (otherRadio->getId() != radioEntry->radio->getId() &&
99 otherEntryPosition.sqrdist(radioPosition) <= radius * radius)
100 radioEntry->neighborVector.push_back(otherRadio);
double range
Definition: NeighborListNeighborCache.h:52
double maxSpeed
Definition: NeighborListNeighborCache.h:53
RadioEntries radios
Definition: NeighborListNeighborCache.h:48
double refillPeriod
Definition: NeighborListNeighborCache.h:51
void inet::physicallayer::NeighborListNeighborCache::updateNeighborLists |
( |
| ) |
|
|
protected |
Referenced by addRadio(), handleMessage(), and initialize().
132 EV_DETAIL <<
"Updating the neighbor lists" << endl;
133 for (
auto & elem :
radios)
void updateNeighborList(RadioEntry *radioEntry)
Definition: NeighborListNeighborCache.cc:87
RadioEntries radios
Definition: NeighborListNeighborCache.h:48
double inet::physicallayer::NeighborListNeighborCache::maxSpeed |
|
protected |
RadioMedium* inet::physicallayer::NeighborListNeighborCache::radioMedium |
|
protected |
RadioEntries inet::physicallayer::NeighborListNeighborCache::radios |
|
protected |
RadioEntryCache inet::physicallayer::NeighborListNeighborCache::radioToEntry |
|
protected |
double inet::physicallayer::NeighborListNeighborCache::range |
|
protected |
double inet::physicallayer::NeighborListNeighborCache::refillPeriod |
|
protected |
cMessage* inet::physicallayer::NeighborListNeighborCache::updateNeighborListsTimer |
|
protected |
The documentation for this class was generated from the following files: