Woman, Life, Freedom


Adaptive AUTOSAR
ARA public interface header documentation
modelled_process.h
1#ifndef MODELLED_PROCESS_H
2#define MODELLED_PROCESS_H
3
4#include <asyncbsdsocket/poller.h>
5#include <atomic>
6#include <future>
7#include <map>
8#include <string>
9#include "../../log/logging_framework.h"
10#include "../deterministic_client.h"
11
12namespace ara
13{
14 namespace exec
15 {
16 namespace helper
17 {
20 {
21 private:
22 static const log::LogMode cLogMode;
23 static const std::string cContextId;
24 static const std::string cContextDescription;
25
26 log::LoggingFramework *mLoggingFramework;
27 log::Logger mLogger;
28 DeterministicClient mDeterministicClient;
29 std::atomic_bool mCancellationToken;
30 std::future<int> mExitCode;
31
32 protected:
37
39 const int cSuccessfulExitCode{0};
42
44 AsyncBsdSocketLib::Poller *const Poller;
45
50 std::string appId, AsyncBsdSocketLib::Poller *poller);
51
57 virtual int Main(
58 const std::atomic_bool *cancellationToken,
59 const std::map<std::string, std::string> &arguments) = 0;
60
64 void Log(
65 log::LogLevel logLevel, const log::LogStream &logStream);
66
69 bool WaitForActivation();
70
71 public:
75 void Initialize(const std::map<std::string, std::string> &arguments);
76
80 int Terminate();
81
82 virtual ~ModelledProcess();
83 };
84 }
85 }
86}
87
88#endif
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