NRP Core  1.4.1
NestJSONServer Class Reference

#include <nest_json_server.h>

Inheritance diagram for NestJSONServer:
EngineJSONServer

Public Member Functions

 NestJSONServer (const std::string &serverAddress, const std::string &engineName, const std::string &registrationAddress, 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...
 
- Public Member Functions inherited from EngineJSONServer
 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
 
EngineJSONServeroperator= (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

- Public Types inherited from EngineJSONServer
using mutex_t = std::timed_mutex
 
using lock_t = std::unique_lock< EngineJSONServer::mutex_t >
 
- Protected Member Functions inherited from EngineJSONServer
void clearRegisteredDataPacks ()
 Remove all registered datapacks. More...
 
const std::string & getEngineName ()
 Get the Engine name. More...
 
- Protected Attributes inherited from EngineJSONServer
mutex_t _datapackLock
 Lock access to _datapacks to make execution thread-safe. More...
 
- Static Protected Attributes inherited from EngineJSONServer
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
 

Constructor & Destructor Documentation

◆ NestJSONServer()

NestJSONServer::NestJSONServer ( const std::string &  serverAddress,
const std::string &  engineName,
const std::string &  registrationAddress,
boost::python::dict  globals 
)

◆ ~NestJSONServer()

NestJSONServer::~NestJSONServer ( )
overridevirtual

Member Function Documentation

◆ initialize()

nlohmann::json NestJSONServer::initialize ( const nlohmann::json data,
EngineJSONServer::lock_t datapackLock 
)
overridevirtual

Engine Initialization routine.

Parameters
dataInitialization data
datapackLockDataPack Lock. Prevents access to _datapacksControllers
Returns
Returns data about initialization status

Implements EngineJSONServer.

◆ initRunFlag()

bool NestJSONServer::initRunFlag ( ) const

Has the initialization been executed?

Returns
Returns true once the initialize function has been run once

◆ reset()

nlohmann::json NestJSONServer::reset ( EngineJSONServer::lock_t datapackLock)
overridevirtual

Engine reset routine.

Parameters
datapackLockDataPack Lock. Prevents access to _datapacksControllers
Returns
Returns data about initialization status

Implements EngineJSONServer.

◆ runLoopStep()

SimulationTime NestJSONServer::runLoopStep ( SimulationTime  timeStep)
overridevirtual

Run a single loop step.

Parameters
timeStepStep to take
Returns
Returns the time registered by this engine at the end of the loop

Implements EngineJSONServer.

◆ shutdown()

nlohmann::json NestJSONServer::shutdown ( const nlohmann::json data)
overridevirtual

Engine Shutdown routine.

Parameters
dataShutdown data
Returns
Returns data about shutdown status

Implements EngineJSONServer.


The documentation for this class was generated from the following files: