class NestJSONServer

Overview

#include <nest_json_server.h>

class NestJSONServer: public EngineJSONServer {
public:
    // construction

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

    // methods

    bool initRunFlag() const;
    virtual SimulationTime runLoopStep(SimulationTime timeStep);

    virtual nlohmann::json initialize(
        const nlohmann::json& data,
        EngineJSONServer::lock_t& datapackLock
    );

    virtual nlohmann::json reset(EngineJSONServer::lock_t& datapackLock);
    virtual nlohmann::json shutdown(const nlohmann::json& data);
};

Inherited Members

public:
    // typedefs

    typedef std::timed_mutex mutex_t;
    typedef std::unique_lock<EngineJSONServer::mutex_t> lock_t;

    // methods

    EngineJSONServer& operator = (const EngineJSONServer&);
    bool isServerRunning() const;
    void startServerAsync();
    void startServer();
    void shutdownServer();
    uint16_t serverPort() const;
    std::string serverAddress() const;

    void registerDataPack(
        const std::string& datapackName,
        JsonDataPackController* interface
    );

    void registerDataPackNoLock(
        const std::string& datapackName,
        JsonDataPackController* interface
    );

    virtual SimulationTime runLoopStep(SimulationTime timeStep) = 0;

    virtual nlohmann::json initialize(
        const nlohmann::json& data,
        EngineJSONServer::lock_t& datapackLock
    ) = 0;

    virtual nlohmann::json reset(EngineJSONServer::lock_t& datapackLock) = 0;
    virtual nlohmann::json shutdown(const nlohmann::json& data) = 0;
    bool shutdownFlag();

Detailed Documentation

Methods

bool initRunFlag() const

Has the initialization been executed?

Returns:

Returns true once the initialize function has been run once

virtual SimulationTime runLoopStep(SimulationTime timeStep)

Run a single loop step.

Parameters:

timeStep

Step to take

Returns:

Returns the time registered by this engine at the end of the loop

virtual nlohmann::json initialize(
    const nlohmann::json& data,
    EngineJSONServer::lock_t& datapackLock
)

Engine Initialization routine.

Parameters:

data

Initialization data

datapackLock

DataPack Lock. Prevents access to _datapacksControllers

Returns:

Returns data about initialization status

virtual nlohmann::json reset(EngineJSONServer::lock_t& datapackLock)

Engine reset routine.

Parameters:

datapackLock

DataPack Lock. Prevents access to _datapacksControllers

Returns:

Returns data about initialization status

virtual nlohmann::json shutdown(const nlohmann::json& data)

Engine Shutdown routine.

Parameters:

data

Shutdown data

Returns:

Returns data about shutdown status