Woman, Life, Freedom


Adaptive AUTOSAR
ARA public interface header documentation
ara::exec::helper::ModelledProcess Class Referenceabstract

A class that models an instance of an Adaptive (Platform) Application executable. More...

#include <modelled_process.h>

Inheritance diagram for ara::exec::helper::ModelledProcess:
application::ExtendedVehicle application::platform::DiagnosticManager application::platform::ExecutionManagement application::platform::PlatformHealthManagement application::platform::StateManagement

Public Member Functions

void Initialize (const std::map< std::string, std::string > &arguments)
 Initialize the process model to run the main block. More...
 
int Terminate ()
 Terminate the process model. More...
 

Protected Member Functions

 ModelledProcess (std::string appId, AsyncBsdSocketLib::Poller *poller)
 Constructor. More...
 
virtual int Main (const std::atomic_bool *cancellationToken, const std::map< std::string, std::string > &arguments)=0
 Main running block of the process. More...
 
void Log (log::LogLevel logLevel, const log::LogStream &logStream)
 Log a steam. More...
 
bool WaitForActivation ()
 Wait for the next main function activation cycle. More...
 

Protected Attributes

const int cSuccessfulExitCode {0}
 Successful application exit code.
 
const int cUnsuccessfulExitCode {1}
 Unsuccessful application exit code.
 
AsyncBsdSocketLib::Poller *const Poller
 Global poller for TCP/IP network communication.
 

Static Protected Attributes

static const log::LogLevel cLogLevel {log::LogLevel::kInfo}
 Information severity log level.
 
static const log::LogLevel cErrorLevel {log::LogLevel::kError}
 Error severity log level.
 

Detailed Description

A class that models an instance of an Adaptive (Platform) Application executable.

Constructor & Destructor Documentation

◆ ModelledProcess()

ara::exec::helper::ModelledProcess::ModelledProcess ( std::string  appId,
AsyncBsdSocketLib::Poller *  poller 
)
protected

Constructor.

Parameters
appIdModelled process application ID for logging
pollerGlobal poller for network communication

Member Function Documentation

◆ Initialize()

void ara::exec::helper::ModelledProcess::Initialize ( const std::map< std::string, std::string > &  arguments)

Initialize the process model to run the main block.

Parameters
argumentsInitialization arguments keys and their corresponding values
See also
Main(const std::map<std::string, std::string> &)

◆ Log()

void ara::exec::helper::ModelledProcess::Log ( log::LogLevel  logLevel,
const log::LogStream logStream 
)
protected

Log a steam.

Parameters
logLevelStream log severity level
logStreamStream to be logged

◆ Main()

virtual int ara::exec::helper::ModelledProcess::Main ( const std::atomic_bool *  cancellationToken,
const std::map< std::string, std::string > &  arguments 
)
protectedpure virtual

Main running block of the process.

Parameters
argumentsInitialization arguments keys and their corresponding values
cancellationTokenToken to be for cancelling the main cycle
Returns
Exit code
Note
Exit code zero means the graceful shutdown of the process.

Implemented in application::ExtendedVehicle, application::platform::DiagnosticManager, application::platform::ExecutionManagement, application::platform::PlatformHealthManagement, and application::platform::StateManagement.

◆ Terminate()

int ara::exec::helper::ModelledProcess::Terminate ( )

Terminate the process model.

Returns
Returned exit code from the main running block
Note
The caller will blocked until the termination be finished.

◆ WaitForActivation()

bool ara::exec::helper::ModelledProcess::WaitForActivation ( )
protected

Wait for the next main function activation cycle.

Returns
True if the cycle is not terminiated yet, otherwise false