#include <nest_json_server.h>
Public Member Functions | |
NestJSONServer (const std::string &serverAddress, const std::string &engineName, const std::string ®istrationAddress, boost::python::dict globals) | |
virtual | ~NestJSONServer () override |
bool | initRunFlag () const |
Has the initialization been executed? More... | |
virtual SimulationTime | runLoopStep (SimulationTime timeStep) override |
Run a single loop step. More... | |
virtual nlohmann::json | initialize (const nlohmann::json &data, EngineJSONServer::lock_t &datapackLock) override |
Engine Initialization routine. More... | |
virtual nlohmann::json | reset (EngineJSONServer::lock_t &datapackLock) override |
Engine reset routine. More... | |
virtual nlohmann::json | shutdown (const nlohmann::json &data) override |
Engine Shutdown routine. More... | |
![]() | |
EngineJSONServer (const std::string &engineAddress, const std::string &engineName, const std::string &clientAddress) | |
Constructor. Tries to bind to a port and register itself with clientAddress. More... | |
EngineJSONServer ()=delete | |
No dummy servers without name and address. More... | |
virtual | ~EngineJSONServer () |
EngineJSONServer (const EngineJSONServer &)=delete | |
EngineJSONServer & | operator= (const EngineJSONServer &)=delete |
bool | isServerRunning () const |
Is the server running? More... | |
void | startServerAsync () |
Start the server in asynchronous mode. More... | |
void | startServer () |
Start the server synchronously. More... | |
void | shutdownServer () |
Stop running server. More... | |
uint16_t | serverPort () const |
Get running server port. More... | |
std::string | serverAddress () const |
Get server address. More... | |
void | registerDataPack (const std::string &datapackName, JsonDataPackController *interface) |
Registers a datapack. More... | |
void | registerDataPackNoLock (const std::string &datapackName, JsonDataPackController *interface) |
Registers a datapack. Skips locking the mutex. Should only be used if thread-safe access to _datapacksControllers can be guaranteed. More... | |
bool | shutdownFlag () |
Has a shutdown command been received? More... | |
Additional Inherited Members | |
![]() | |
using | mutex_t = std::timed_mutex |
using | lock_t = std::unique_lock< EngineJSONServer::mutex_t > |
![]() | |
void | clearRegisteredDataPacks () |
Remove all registered datapacks. More... | |
const std::string & | getEngineName () |
Get the Engine name. More... | |
![]() | |
mutex_t | _datapackLock |
Lock access to _datapacks to make execution thread-safe. More... | |
![]() | |
static constexpr std::string_view | GetDataPackInformationRoute = EngineJSONConfigConst::EngineServerGetDataPacksRoute |
static constexpr std::string_view | SetDataPackRoute = EngineJSONConfigConst::EngineServerSetDataPacksRoute |
static constexpr std::string_view | RunLoopStepRoute = EngineJSONConfigConst::EngineServerRunLoopStepRoute |
static constexpr std::string_view | InitializeRoute = EngineJSONConfigConst::EngineServerInitializeRoute |
static constexpr std::string_view | ResetRoute = EngineJSONConfigConst::EngineServerResetRoute |
static constexpr std::string_view | ShutdownRoute = EngineJSONConfigConst::EngineServerShutdownRoute |
NestJSONServer::NestJSONServer | ( | const std::string & | serverAddress, |
const std::string & | engineName, | ||
const std::string & | registrationAddress, | ||
boost::python::dict | globals | ||
) |
|
overridevirtual |
|
overridevirtual |
Engine Initialization routine.
data | Initialization data |
datapackLock | DataPack Lock. Prevents access to _datapacksControllers |
Implements EngineJSONServer.
bool NestJSONServer::initRunFlag | ( | ) | const |
Has the initialization been executed?
|
overridevirtual |
Engine reset routine.
datapackLock | DataPack Lock. Prevents access to _datapacksControllers |
Implements EngineJSONServer.
|
overridevirtual |
Run a single loop step.
timeStep | Step to take |
Implements EngineJSONServer.
|
overridevirtual |
Engine Shutdown routine.
data | Shutdown data |
Implements EngineJSONServer.