55 if(moduleType ==
"nem")
59 throw FormatException(
"LoaderFadingSelection expects at least 1 argument");
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;
86 if(params.size() != 2)
92 NEMId targetNEM{moduleId};
97 for(
size_t i = 0; i < params.size(); ++i)
106 size_t pos = params[i].find(
':');
108 if(pos != std::string::npos)
110 if(params[i].substr(0,pos) ==
"nem")
116 std::stringstream sstream;
117 throw FormatException(
"LoaderFadingSelection only supports 'nem' module type");
125 std::string sModel{params[i]};
131 else if(sModel ==
"nakagami")
137 throw makeException<FormatException>(
"LoaderFadingSelection loader unknown fading model: %s",
144 throw FormatException(
"LoaderFadingSelection loader too many parameters");
150 std::stringstream sstream;
151 sstream<<
"LoaderFadingSelection loader: Parameter conversion error. "<<exp.
what()<<std::ends;
157 loadFadingSelectionCache(targetNEM,txNEM,model,fadingSelectionEntryCache_);
160 loadFadingSelectionCache(targetNEM,txNEM,model,fadingSelectionDeltaEntryCache_);
171 FadingSelectionEntryCache * pCache = 0;
177 pCache = &fadingSelectionDeltaEntryCache_;
184 pCache = &fadingSelectionEntryCache_;
189 FadingSelectionEntryCache::iterator iter = pCache->begin();
191 for(;iter != pCache->end(); ++iter)
193 FadingSelectionEntryMap::iterator iterEntry = iter->second.begin();
195 for(; iterEntry != iter->second.end(); ++iterEntry)
197 fadingSelections.push_back(iterEntry->second);
200 if(!fadingSelections.empty())
202 eventInfoList.push_back({iter->first,
207 fadingSelections.clear();
210 fadingSelectionDeltaEntryCache_.clear();
212 return eventInfoList;
215 void EMANE::Generators::EEL::LoaderFadingSelection::loadFadingSelectionCache(
NEMId targetNEM,
218 FadingSelectionEntryCache & cache)
222 FadingSelectionEntryCache::iterator iter = cache.end();
224 if((iter = cache.find(targetNEM)) != cache.end())
226 std::pair<FadingSelectionEntryMap::iterator,bool> ret =
227 iter->second.insert(std::make_pair(txNEM,fadingSelection));
231 ret.first->second = fadingSelection;
236 FadingSelectionEntryMap entryMap;
237 entryMap.insert(std::make_pair(txNEM,fadingSelection));
238 cache.insert(std::make_pair(targetNEM,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
const char * what() const
EventInfoList getEvents(EventPublishMode mode) override
std::list< FadingSelection > FadingSelections
std::list< EventInfo > EventInfoList
Parameter conversion class with range checks.
void load(const ModuleType &modelType, const ModuleId &moduleId, const EventType &eventType, const InputArguments &args) override