24 #include "cheetah/emulator/Emulator.h" 25 #include "cheetah/emulator/Config.h" 26 #include "panda/Log.h" 35 template<
typename StreamType,
typename T>
36 template<
typename... StreamConstructorArgs>
38 , generators::TimeFrequencyGenerator<T>* model
39 , StreamConstructorArgs&&... args)
41 , _stream(*_model,
std::forward<StreamConstructorArgs>(args)...)
42 , _connection(new ConnectionType(config.engine()))
43 , _emulator_app(_stream, config.engine())
44 , _server(config.server_config(), _emulator_app)
46 assert(_model !=
nullptr);
47 _connection->set_remote_end_point(config.fixed_end_point());
48 _emulator_app.add_fixed_client(_connection);
51 template<
typename StreamType,
typename T>
52 Emulator<StreamType, T>::~Emulator()
54 PANDA_LOG <<
"mean send rate: " << _connection->monitor().mean();
58 template<
typename StreamType,
typename T>
59 int Emulator<StreamType, T>::run()
61 _connection->socket().set_option(boost::asio::ip::udp::socket::reuse_address(
true));
65 template<
typename StreamType,
typename T>
66 void Emulator<StreamType, T>::stop()
71 template<
typename StreamType,
typename T>
72 bool Emulator<StreamType, T>::is_running()
const 74 return _server.is_running();
77 template<
typename StreamType,
typename T>
80 return _connection->remote_end_point();
83 template<
typename StreamType,
typename T>
89 template<
typename StreamType,
typename T>
boost::asio::ip::udp::endpoint const end_point() const
the port to where the udp data stream is being directed
Emulator(Config const &, ModelType *model, StreamConstructorArgs &&...)
Construct an Emulator utilisiing the provided model.
Some limits and constants for FLDO.
Emulate UDP stream using a data madel generator.