EMANE  1.2.1
eeleventgenerator.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2013,2016 - Adjacent Link LLC, Bridgewater, New
3  * Jersey
4  * Copyright (c) 2010 - DRS CenGen, LLC, Columbia, Maryland
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  *
11  * * Redistributions of source code must retain the above copyright
12  * notice, this list of conditions and the following disclaimer.
13  * * Redistributions in binary form must reproduce the above copyright
14  * notice, this list of conditions and the following disclaimer in
15  * the documentation and/or other materials provided with the
16  * distribution.
17  * * Neither the name of DRS CenGen, LLC nor the names of its
18  * contributors may be used to endorse or promote products derived
19  * from this software without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32  * POSSIBILITY OF SUCH DAMAGE.
33  *
34  */
35 
36 #ifndef EMANEGENERATORSEELGENERATOR_HEADER_
37 #define EMANEGENERATORSEELGENERATOR_HEADER_
38 
39 #include "eelloaderpluginfactory.h"
40 #include "emane/eventgenerator.h"
41 
42 #include <vector>
43 #include <map>
44 #include <string>
45 #include <thread>
46 #include <mutex>
47 #include <condition_variable>
48 
49 namespace EMANE
50 {
51  namespace Generators
52  {
53  namespace EEL
54  {
55  class Generator : public EventGenerator
56  {
57  public:
58  Generator(PlatformServiceProvider *pPlatformService);
59 
60  ~Generator();
61 
62  void initialize(Registrar & registrar) override;
63 
64  void configure(const ConfigurationUpdate & update) override;
65 
66  void start() override;
67 
68  void stop() override;
69 
70  void destroy() throw() override;
71 
72  private:
73  using InputFileNameVector = std::vector<std::string>;
74  using PluginFactoryList = std::list<LoaderPluginFactory *>;
75  using EventPluginMap = std::map<std::string, std::pair<LoaderPlugin *,EventPublishMode>>;
76 
77  std::thread thread_;
78  std::mutex mutex_;
79  std::condition_variable cond_;
80  bool bCancel_;
81  InputFileNameVector inputFileNameVector_;
82  PluginFactoryList pluginFactoryList_;
83  EventPluginMap eventPluginMap_;
84 
85  void generate();
86 
87  bool waitAndSendEvents(const TimePoint & startTime,
88  float fCurrentTime);
89  };
90  }
91  }
92 }
93 
94 #endif // EMANEGENERATORSEELGENERATOR_HEADER_
The Registrar interface provides access to all of the emulator registrars.
Definition: registrar.h:50
The PlatformServiceProvider interface provides access to emulator services.
Base class for all event generators.
Generator(PlatformServiceProvider *pPlatformService)
std::vector< ConfigurationNameAnyValues > ConfigurationUpdate
Clock::time_point TimePoint
Definition: types.h:50
void configure(const ConfigurationUpdate &update) override
Definition: agent.h:43
void initialize(Registrar &registrar) override