1#ifndef MODELLED_PROCESS_H
2#define MODELLED_PROCESS_H
4#include <asyncbsdsocket/poller.h>
9#include "../../log/logging_framework.h"
10#include "../deterministic_client.h"
23 static const std::string cContextId;
24 static const std::string cContextDescription;
29 std::atomic_bool mCancellationToken;
30 std::future<int> mExitCode;
44 AsyncBsdSocketLib::Poller *
const Poller;
50 std::string appId, AsyncBsdSocketLib::Poller *poller);
58 const std::atomic_bool *cancellationToken,
59 const std::map<std::string, std::string> &arguments) = 0;
75 void Initialize(
const std::map<std::string, std::string> &arguments);
Class that utilizes a client to have deterministic behaviour.
Definition: deterministic_client.h:29
A class that models an instance of an Adaptive (Platform) Application executable.
Definition: modelled_process.h:20
bool WaitForActivation()
Wait for the next main function activation cycle.
Definition: modelled_process.cpp:29
const int cUnsuccessfulExitCode
Unsuccessful application exit code.
Definition: modelled_process.h:41
int Terminate()
Terminate the process model.
Definition: modelled_process.cpp:53
void Log(log::LogLevel logLevel, const log::LogStream &logStream)
Log a steam.
Definition: modelled_process.cpp:23
const int cSuccessfulExitCode
Successful application exit code.
Definition: modelled_process.h:39
ModelledProcess(std::string appId, AsyncBsdSocketLib::Poller *poller)
Constructor.
Definition: modelled_process.cpp:15
virtual int Main(const std::atomic_bool *cancellationToken, const std::map< std::string, std::string > &arguments)=0
Main running block of the process.
AsyncBsdSocketLib::Poller *const Poller
Global poller for TCP/IP network communication.
Definition: modelled_process.h:44
static const log::LogLevel cErrorLevel
Error severity log level.
Definition: modelled_process.h:36
static const log::LogLevel cLogLevel
Information severity log level.
Definition: modelled_process.h:34
void Initialize(const std::map< std::string, std::string > &arguments)
Initialize the process model to run the main block.
Definition: modelled_process.cpp:39
A stream pipeline to combine log entities.
Definition: log_stream.h:17
Logger of a specific context.
Definition: logger.h:12
Logging framework which links loggers to a log sink.
Definition: logging_framework.h:17
LogLevel
Log severity level.
Definition: common.h:13
LogMode
Log sink mode.
Definition: common.h:25