INET Framework for OMNeT++/OMNEST
inet::physicallayer::MapCommunicationCache Class Reference

#include <MapCommunicationCache.h>

Inheritance diagram for inet::physicallayer::MapCommunicationCache:
inet::physicallayer::CommunicationCacheBase inet::physicallayer::ICommunicationCache inet::physicallayer::IPrintableObject

Public Member Functions

 MapCommunicationCache ()
 
virtual ~MapCommunicationCache ()
 
virtual std::ostream & printToStream (std::ostream &stream, int level) const override
 Prints this object to the provided output stream. More...
 
Medium state change notifications
virtual void addRadio (const IRadio *radio) override
 
virtual void removeRadio (const IRadio *radio) override
 
virtual void addTransmission (const ITransmission *transmission) override
 
virtual void removeTransmission (const ITransmission *transmission) override
 
Interference cache
virtual void removeNonInterferingTransmissions () override
 
- Public Member Functions inherited from inet::physicallayer::CommunicationCacheBase
 CommunicationCacheBase ()
 
virtual ~CommunicationCacheBase ()
 
virtual std::vector< const ITransmission * > * computeInterferingTransmissions (const IRadio *radio, const simtime_t startTime, const simtime_t endTime) override
 
virtual const simtime_t getCachedInterferenceEndTime (const ITransmission *transmission) override
 
virtual void setCachedInterferenceEndTime (const ITransmission *transmission, const simtime_t interferenceEndTime) override
 
virtual void removeCachedInterferenceEndTime (const ITransmission *transmission) override
 
virtual const IRadioFramegetCachedFrame (const ITransmission *transmission) override
 
virtual void setCachedFrame (const ITransmission *transmission, const IRadioFrame *frame) override
 
virtual void removeCachedFrame (const ITransmission *transmission) override
 
virtual const IArrivalgetCachedArrival (const IRadio *receiver, const ITransmission *transmission) override
 
virtual void setCachedArrival (const IRadio *receiver, const ITransmission *transmission, const IArrival *arrival) override
 
virtual void removeCachedArrival (const IRadio *receiver, const ITransmission *transmission) override
 
virtual const IntervalgetCachedInterval (const IRadio *receiver, const ITransmission *transmission) override
 
virtual void setCachedInterval (const IRadio *receiver, const ITransmission *transmission, const Interval *interval) override
 
virtual void removeCachedInterval (const IRadio *receiver, const ITransmission *transmission) override
 
virtual const IListeninggetCachedListening (const IRadio *receiver, const ITransmission *transmission) override
 
virtual void setCachedListening (const IRadio *receiver, const ITransmission *transmission, const IListening *listening) override
 
virtual void removeCachedListening (const IRadio *receiver, const ITransmission *transmission) override
 
virtual const IReceptiongetCachedReception (const IRadio *receiver, const ITransmission *transmission) override
 
virtual void setCachedReception (const IRadio *receiver, const ITransmission *transmission, const IReception *reception) override
 
virtual void removeCachedReception (const IRadio *receiver, const ITransmission *transmission) override
 
virtual const IInterferencegetCachedInterference (const IRadio *receiver, const ITransmission *transmission) override
 
virtual void setCachedInterference (const IRadio *receiver, const ITransmission *transmission, const IInterference *interference) override
 
virtual void removeCachedInterference (const IRadio *receiver, const ITransmission *transmission) override
 
virtual const INoisegetCachedNoise (const IRadio *receiver, const ITransmission *transmission) override
 
virtual void setCachedNoise (const IRadio *receiver, const ITransmission *transmission, const INoise *noise) override
 
virtual void removeCachedNoise (const IRadio *receiver, const ITransmission *transmission) override
 
virtual const ISNIRgetCachedSNIR (const IRadio *receiver, const ITransmission *transmission) override
 
virtual void setCachedSNIR (const IRadio *receiver, const ITransmission *transmission, const ISNIR *snir) override
 
virtual void removeCachedSNIR (const IRadio *receiver, const ITransmission *transmission) override
 
virtual const IReceptionDecisiongetCachedReceptionDecision (const IRadio *receiver, const ITransmission *transmission, IRadioSignal::SignalPart part) override
 
virtual void setCachedReceptionDecision (const IRadio *receiver, const ITransmission *transmission, IRadioSignal::SignalPart part, const IReceptionDecision *receptionDecision) override
 
virtual void removeCachedReceptionDecision (const IRadio *receiver, const ITransmission *transmission, IRadioSignal::SignalPart part) override
 
virtual const IReceptionResultgetCachedReceptionResult (const IRadio *receiver, const ITransmission *transmission) override
 
virtual void setCachedReceptionResult (const IRadio *receiver, const ITransmission *transmission, const IReceptionResult *receptionResult) override
 
virtual void removeCachedReceptionResult (const IRadio *receiver, const ITransmission *transmission) override
 
virtual const IRadioFramegetCachedFrame (const IRadio *receiver, const ITransmission *transmission) override
 
virtual void setCachedFrame (const IRadio *receiver, const ITransmission *transmission, const IRadioFrame *frame) override
 
virtual void removeCachedFrame (const IRadio *receiver, const ITransmission *transmission) override
 
Medium state change notifications
Interference cache
Transmission cache
Reception Cache
- Public Member Functions inherited from inet::physicallayer::IPrintableObject
virtual ~IPrintableObject ()
 
virtual std::string getInfoStringRepresentation () const
 
virtual std::string getDetailStringRepresentation () const
 
virtual std::string getDebugStringRepresentation () const
 
virtual std::string getTraceStringRepresentation () const
 
virtual std::string getCompleteStringRepresentation () const
 

Protected Member Functions

Cache data structures
virtual RadioCacheEntrygetRadioCacheEntry (const IRadio *radio) override
 
virtual TransmissionCacheEntrygetTransmissionCacheEntry (const ITransmission *transmission) override
 
virtual ReceptionCacheEntrygetReceptionCacheEntry (const IRadio *radio, const ITransmission *transmission) override
 
Cache data structures

Protected Attributes

Cache
std::map< const IRadio *, RadioCacheEntryradioCache
 Caches intermediate computation results for radios. More...
 
std::map< const ITransmission *, TransmissionCacheEntrytransmissionCache
 Caches intermediate computation results for transmissions. More...
 

Additional Inherited Members

- Public Types inherited from inet::physicallayer::IPrintableObject
enum  PrintLevel {
  PRINT_LEVEL_TRACE, PRINT_LEVEL_DEBUG, PRINT_LEVEL_DETAIL, PRINT_LEVEL_INFO,
  PRINT_LEVEL_COMPLETE = INT_MIN
}
 

Constructor & Destructor Documentation

inet::physicallayer::MapCommunicationCache::MapCommunicationCache ( )
28 {
29 }
inet::physicallayer::MapCommunicationCache::~MapCommunicationCache ( )
virtual
32 {
33  for (auto &transmissionIt : transmissionCache)
34  delete static_cast<std::map<const IRadio *, ReceptionCacheEntry> *>(transmissionIt.second.receptionCacheEntries);
35 }
std::map< const ITransmission *, TransmissionCacheEntry > transmissionCache
Caches intermediate computation results for transmissions.
Definition: MapCommunicationCache.h:39

Member Function Documentation

void inet::physicallayer::MapCommunicationCache::addRadio ( const IRadio radio)
overridevirtual
void inet::physicallayer::MapCommunicationCache::addTransmission ( const ITransmission transmission)
overridevirtual
MapCommunicationCache::RadioCacheEntry * inet::physicallayer::MapCommunicationCache::getRadioCacheEntry ( const IRadio radio)
overrideprotectedvirtual

Implements inet::physicallayer::CommunicationCacheBase.

38 {
39  return &radioCache[radio];
40 }
std::map< const IRadio *, RadioCacheEntry > radioCache
Caches intermediate computation results for radios.
Definition: MapCommunicationCache.h:35
MapCommunicationCache::ReceptionCacheEntry * inet::physicallayer::MapCommunicationCache::getReceptionCacheEntry ( const IRadio radio,
const ITransmission transmission 
)
overrideprotectedvirtual

Implements inet::physicallayer::CommunicationCacheBase.

51 {
52  TransmissionCacheEntry *transmissionCacheEntry = getTransmissionCacheEntry(transmission);
53  if (transmissionCacheEntry == nullptr)
54  return nullptr;
55  else
56  return &(*static_cast<std::map<const IRadio *, ReceptionCacheEntry> *>(transmissionCacheEntry->receptionCacheEntries))[radio];
57 }
virtual TransmissionCacheEntry * getTransmissionCacheEntry(const ITransmission *transmission) override
Definition: MapCommunicationCache.cc:42
MapCommunicationCache::TransmissionCacheEntry * inet::physicallayer::MapCommunicationCache::getTransmissionCacheEntry ( const ITransmission transmission)
overrideprotectedvirtual

Implements inet::physicallayer::CommunicationCacheBase.

Referenced by getReceptionCacheEntry().

43 {
44  TransmissionCacheEntry *transmissionCacheEntry = &transmissionCache[transmission];
45  if (transmissionCacheEntry->receptionCacheEntries == nullptr)
46  transmissionCacheEntry->receptionCacheEntries = new std::map<const IRadio *, ReceptionCacheEntry>();
47  return transmissionCacheEntry;
48 }
std::map< const ITransmission *, TransmissionCacheEntry > transmissionCache
Caches intermediate computation results for transmissions.
Definition: MapCommunicationCache.h:39
virtual std::ostream& inet::physicallayer::MapCommunicationCache::printToStream ( std::ostream &  stream,
int  level 
) const
inlineoverridevirtual

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.

54 { return stream << "MapCommunicationCache"; }
void inet::physicallayer::MapCommunicationCache::removeNonInterferingTransmissions ( )
overridevirtual

Implements inet::physicallayer::ICommunicationCache.

104 {
105 }
void inet::physicallayer::MapCommunicationCache::removeRadio ( const IRadio radio)
overridevirtual

Implements inet::physicallayer::ICommunicationCache.

64 {
65  auto radioIt = radioCache.find(radio);
66  if (radioIt != radioCache.end())
67  radioCache.erase(radioIt);
68  for (auto &transmissionIt : transmissionCache) {
69  std::map<const IRadio *, ReceptionCacheEntry> *receptionCacheEntries = static_cast<std::map<const IRadio *, ReceptionCacheEntry> *>(transmissionIt.second.receptionCacheEntries);
70  if (receptionCacheEntries != nullptr) {
71  auto receptionIt = receptionCacheEntries->find(radio);
72  if (receptionIt != receptionCacheEntries->end())
73  receptionCacheEntries->erase(receptionIt);
74  }
75  }
76 }
std::map< const IRadio *, RadioCacheEntry > radioCache
Caches intermediate computation results for radios.
Definition: MapCommunicationCache.h:35
std::map< const ITransmission *, TransmissionCacheEntry > transmissionCache
Caches intermediate computation results for transmissions.
Definition: MapCommunicationCache.h:39
void inet::physicallayer::MapCommunicationCache::removeTransmission ( const ITransmission transmission)
overridevirtual

Implements inet::physicallayer::ICommunicationCache.

83 {
84  auto transmissionIt = transmissionCache.find(transmission);
85  if (transmissionIt != transmissionCache.end()) {
86  const TransmissionCacheEntry &transmissionCacheEntry = (*transmissionIt).second;
87  std::map<const IRadio *, ReceptionCacheEntry> *receptionCacheEntries = static_cast<std::map<const IRadio *, ReceptionCacheEntry> *>(transmissionCacheEntry.receptionCacheEntries);
88  if (receptionCacheEntries != nullptr) {
89  for (auto &receptionIt : *receptionCacheEntries) {
90  const IRadio *radio = receptionIt.first;
91  const RadioCacheEntry &radioCacheEntry = radioCache[radio];
92  const ReceptionCacheEntry &recpeionCacheEntry = receptionIt.second;
93  const Interval *interval = recpeionCacheEntry.interval;
94  if (interval != nullptr)
95  radioCacheEntry.receptionIntervals->deleteNode(interval);
96  }
97  }
98  delete static_cast<std::map<const IRadio *, ReceptionCacheEntry> *>(transmissionCacheEntry.receptionCacheEntries);
99  transmissionCache.erase(transmissionIt);
100  }
101 }
std::map< const IRadio *, RadioCacheEntry > radioCache
Caches intermediate computation results for radios.
Definition: MapCommunicationCache.h:35
std::map< const ITransmission *, TransmissionCacheEntry > transmissionCache
Caches intermediate computation results for transmissions.
Definition: MapCommunicationCache.h:39

Member Data Documentation

std::map<const IRadio *, RadioCacheEntry> inet::physicallayer::MapCommunicationCache::radioCache
protected

Caches intermediate computation results for radios.

Referenced by getRadioCacheEntry(), removeRadio(), and removeTransmission().

std::map<const ITransmission *, TransmissionCacheEntry> inet::physicallayer::MapCommunicationCache::transmissionCache
protected

Caches intermediate computation results for transmissions.

Referenced by getTransmissionCacheEntry(), removeRadio(), removeTransmission(), and ~MapCommunicationCache().


The documentation for this class was generated from the following files: