55 if(moduleType ==
"nem")
63 InputArguments::const_iterator iterArg = args.begin();
66 for(; iterArg != args.end(); ++iterArg)
76 while(posEnd != std::string::npos)
78 posEnd = iterArg->find_first_of(
",",posStart);
80 params.push_back( iterArg->substr(posStart, posEnd - posStart));
82 posStart = posEnd + 1;
92 NEMId srcNEM{moduleId};
94 float fReversePathlossdb{};
95 float fForwardPathlossdb{};
98 for(
size_t i = 0; i < params.size(); ++i)
107 size_t pos = params[i].find(
':');
109 if(pos != std::string::npos)
111 if(params[i].substr(0,pos) ==
"nem")
117 std::stringstream sstream;
118 throw FormatException(
"LoaderPathloss only supports 'nem' module type");
129 fReversePathlossdb = fForwardPathlossdb;
143 std::stringstream sstream;
144 sstream<<
"LoaderPathloss loader: Parameter conversion error. "<<exp.
what()<<std::ends;
150 loadPathlossCache(dstNEM,srcNEM,fForwardPathlossdb,fReversePathlossdb,pathlossEntryCache_);
153 loadPathlossCache(dstNEM,srcNEM,fForwardPathlossdb,fReversePathlossdb,pathlossDeltaEntryCache_);
164 PathlossEntryCache * pCache = 0;
170 pCache = &pathlossDeltaEntryCache_;
177 pCache = &pathlossEntryCache_;
182 PathlossEntryCache::iterator iter = pCache->begin();
184 for(;iter != pCache->end(); ++iter)
186 PathlossEntryMap::iterator iterEntry = iter->second.begin();
188 for(; iterEntry != iter->second.end(); ++iterEntry)
190 pathlosses.push_back(iterEntry->second);
193 if(!pathlosses.empty())
195 eventInfoList.push_back({iter->first,
203 pathlossDeltaEntryCache_.clear();
205 return eventInfoList;
208 void EMANE::Generators::EEL::LoaderPathloss::loadPathlossCache(
NEMId dstNEM,
210 float fForwardPathloss,
211 float fReversePathloss,
212 PathlossEntryCache & cache)
218 PathlossEntryCache::iterator iter = cache.end();
220 if((iter = cache.find(dstNEM)) != cache.end())
222 std::pair<PathlossEntryMap::iterator,bool> ret =
223 iter->second.insert(std::make_pair(pathlossForward.getNEMId(),pathlossForward));
227 ret.first->second = pathlossForward;
232 PathlossEntryMap entryMap;
233 entryMap.insert(std::make_pair(pathlossForward.getNEMId(),pathlossForward));
234 cache.insert(std::make_pair(dstNEM,entryMap));
238 if((iter = cache.find(srcNEM)) != cache.end())
240 std::pair<PathlossEntryMap::iterator,bool> ret =
241 iter->second.insert(std::make_pair(pathlossReverse.getNEMId(),pathlossReverse));
245 ret.first->second = pathlossReverse;
250 PathlossEntryMap entryMap;
251 entryMap.insert(std::make_pair(pathlossReverse.getNEMId(),pathlossReverse));
252 cache.insert(std::make_pair(srcNEM,entryMap));
std::vector< std::string > InputArguments
#define DECLARE_EEL_LOADER_PLUGIN(X)
Parameter conversion exception class.
std::uint16_t toUINT16(std::uint16_t u16Min=std::numeric_limits< std::uint16_t >::min(), std::uint16_t u16Max=std::numeric_limits< std::uint16_t >::max()) const
float toFloat(float fMin=std::numeric_limits< float >::lowest(), float fMax=std::numeric_limits< float >::max()) const
void load(const ModuleType &modelType, const ModuleId &moduleId, const EventType &eventType, const InputArguments &args) override
A pathloss entry holds the source NEM Id and the forward and reverse pathloss to apply to received tr...
std::list< Pathloss > Pathlosses
const char * what() const
EventInfoList getEvents(EventPublishMode mode) override
std::list< EventInfo > EventInfoList
Parameter conversion class with range checks.