55 class EMANE::Application::NEMBuilder::NEMBuilderImpl
58 SpectrumMonitor * getSpectrumMonitor(
NEMId id)
60 auto iter = spectrumMonitorCache_.find(
id);
62 if(iter != spectrumMonitorCache_.end())
68 SpectrumMonitor * pSpectrumMonitor{
new SpectrumMonitor};
70 spectrumMonitorCache_.insert(std::make_pair(
id,pSpectrumMonitor));
72 return pSpectrumMonitor;
77 using SpectrumMonitorCache = std::map<NEMId,SpectrumMonitor *>;
78 SpectrumMonitorCache spectrumMonitorCache_;
82 pImpl_{
new NEMBuilderImpl}{}
86 std::unique_ptr<EMANE::NEMLayer>
88 const std::string & sLibraryFile,
92 std::string sNativeLibraryFile =
"lib" +
101 std::string sRegistrationName{};
105 if(sLibraryFile.empty())
107 pImpl =
new FrameworkPHY{id, pPlatformService, pImpl_->getSpectrumMonitor(
id)};
109 sRegistrationName =
"emanephy";
117 pImpl = phyLayerFactory.
createLayer(
id, pPlatformService);
119 sRegistrationName = sLibraryFile;
123 std::unique_ptr<NEMQueuedLayer> pNEMLayer{
new PHYLayer{id,
136 pPlatformService->setNEMLayer(buildId,
147 pNEMLayer->initialize(registrarProxy);
155 return std::unique_ptr<NEMLayer>(pNEMLayer.release());
158 std::unique_ptr<EMANE::NEMLayer>
160 const std::string & sLibraryFile,
164 std::string sNativeLibraryFile =
"lib" +
179 macLayerFactory.
createLayer(
id, pPlatformService,pRadioService);
181 std::unique_ptr<NEMQueuedLayer> pNEMLayer{
new MACLayer{id,
196 pPlatformService->setNEMLayer(buildId,
207 pNEMLayer->initialize(registrarProxy);
215 return std::unique_ptr<EMANE::NEMLayer>(pNEMLayer.release());
219 std::unique_ptr<EMANE::NEMLayer>
221 const std::string & sLibraryFile,
225 std::string sNativeLibraryFile =
"lib" +
240 shimLayerFactory.
createLayer(
id, pPlatformService,pRadioService);
242 std::unique_ptr<NEMQueuedLayer> pNEMLayer{
new ShimLayer{id,
257 pPlatformService->setNEMLayer(buildId,
268 pNEMLayer->initialize(registrarProxy);
276 return std::unique_ptr<EMANE::NEMLayer>(pNEMLayer.release());
280 std::unique_ptr<EMANE::Application::NEM>
284 bool bExternalTransport)
286 std::unique_ptr<NEMLayerStack> pLayerStack{
new NEMLayerStack};
293 std::vector<BuildId> nemBuildIds;
294 for(
auto & pLayer : layers)
296 if(pLayer->getNEMId() != id)
299 throw makeException<BuildException>(
"NEMId mismatch: NEMLayer (%hu) NEM (%hu)",
304 pLayerStack->addLayer(pLayer);
307 std::unique_ptr<NEM> pNEM{
new NEMImpl{id,pLayerStack,bExternalTransport}};
314 pNEM->initialize(registrarProxy);
323 std::unique_ptr<EMANE::Application::NEMManager>
330 throw BuildException(
"Trying to build an NEM Manager without any NEMs.");
333 std::unique_ptr<Application::NEMManager> pPlatform{
new NEMManagerImpl{uuid}};
339 pPlatform->initialize(registrarProxy);
344 std::for_each(nems.begin(),
346 [&pPlatform](std::unique_ptr<NEM> & pNEM)
348 pPlatform->add(pNEM);
354 std::unique_ptr<EMANE::NEMLayer>
356 const std::string & sLibraryFile,
360 std::string sNativeLibraryFile =
"lib" +
389 pPlatformService->setNEMLayer(buildId,
400 pNEMLayer->initialize(registrarProxy);
408 return std::unique_ptr<EMANE::NEMLayer>(pNEMLayer.release());
Bridge for the PHY NEM layer. Decouples a PHYLayerImplementor implementation from the NEM to allow fo...
std::list< std::unique_ptr< NEMLayer > > NEMLayers
std::unique_ptr< NEMManager > buildNEMManager(const uuid_t &uuid, NEMs &nems, const ConfigurationUpdateRequest &request)
Implementation of the Network emulation module consisting of NEM components, OTA Adapater and network...
std::unique_ptr< NEMLayer > buildMACLayer(NEMId id, const std::string &sLibraryFile, const ConfigurationUpdateRequest &request, bool bSkipConfigure=false)
Base class for all transports.
const MACLayerFactory & getMACLayerFactory(const std::string &sLibraryFile)
Interface used to create a PHY layer plugin implementation.
const TransportFactory & getTransportFactory(const std::string &sLibraryFile)
Implementation of Platform interface. Contains and manages NEMs.
PHYLayerImplementor * createLayer(NEMId nemId, PlatformServiceProvider *pPlatformServiceProvider) const
Bridge for a shim NEM layer. Decouples a ShimLayerImplementor implementation from the NEM to allow fo...
Exception thrown by builders when constructing and assembling application objects and containers...
std::unique_ptr< NEMLayer > buildPHYLayer(NEMId id, const std::string &sLibraryFile, const ConfigurationUpdateRequest &request, bool bSkipConfigure=false)
Interface used to create a Shim layer plugin implementation.
Bridge for the MAC NEM layer. Decouples a MACLayerImplementor implementation from the NEM to allow fo...
void registerRunningStateMutable(BuildId buildId, RunningStateMutable *pRunningStateMutable)
Transport * createTransport(NEMId nemId, PlatformServiceProvider *pPlatformService) const
BuildId registerBuildable(Application::NEMManager *pNEMManager)
const ShimLayerFactory & getShimLayerFactory(const std::string &sLibraryFile)
Bridge for the Transport NEM layer. Decouples a TransportLayerImplementor implementation from the NEM...
Factory for creating Transports. The factory manages the DLL allowing for the creation of multiple tr...
std::unique_ptr< NEM > buildNEM(NEMId id, NEMLayers &layers, const ConfigurationUpdateRequest &request, bool bHasExternalTransport)
std::list< std::unique_ptr< NEM > > NEMs
std::vector< ConfigurationNameStringValues > ConfigurationUpdateRequest
A stack of NEM layers. Allows ownership and connection of NEM layers in a non layer specific manner...
T * createLayer(NEMId nemId, PlatformServiceProvider *pPlatformService, RadioServiceProvider *pRadioServiceProvider) const
const PHYLayerFactory & getPHYLayerFactory(const std::string &sLibraryFile)
std::unique_ptr< NEMLayer > buildTransportLayer(NEMId id, const std::string &sLibraryFile, const ConfigurationUpdateRequest &request, bool bSkipConfigure=false)
Factory for creating T layers . The factory manages the DLL allowing for the creation of layers of th...
void registerEventServiceUser(BuildId buildId, EventServiceUser *pEventServiceUser, NEMId=0)
A layer stack that enforces component state transition rules. The stateful layer is not a fully funct...
static LayerFactoryManager * instance()
std::unique_ptr< NEMLayer > buildShimLayer(NEMId id, const std::string &sLibraryFile, const ConfigurationUpdateRequest &request, bool bSkipConfigure=false)
Interface used to create a MAC layer plugin implementation.