Sen API
Sen Libraries
Loading...
Searching...
No Matches
kernel.h
Go to the documentation of this file.
1// === kernel.h ========================================================================================================
2// Sen Infrastructure
3// Released under the Apache License v2.0 (SPDX-License-Identifier Apache-2.0).
4// See the LICENSE.txt file for more information.
5// © Airbus SAS, Airbus Helicopters, and Airbus Defence and Space SAU/GmbH/SAS.
6// =====================================================================================================================
7
8#ifndef SEN_KERNEL_KERNEL_H
9#define SEN_KERNEL_KERNEL_H
10
11// sen
14
15// kernel
17
18// generated code
19#include "stl/sen/kernel/basic_types.stl.h"
20
21// std
22#include <filesystem>
23#include <memory>
24
25namespace sen::kernel
26{
27
28// Forward declarations
29class TestKernel;
30
37
39class Kernel final
40{
41 SEN_NOCOPY_NOMOVE(Kernel)
42
43public:
44 explicit Kernel(KernelConfig config);
45 ~Kernel() noexcept;
46
47public:
51 [[nodiscard]] int run(KernelBlockMode blockMode = KernelBlockMode::doBlock);
52
55 void requestStop(int exitCode = 0);
56
59 [[nodiscard]] const KernelConfig& getConfig() const noexcept;
60
63 [[nodiscard]] std::filesystem::path getConfigPath() const noexcept;
64
66 [[nodiscard]] static const BuildInfo& getBuildInfo() noexcept;
67
70
71private:
72 friend class KernelApi;
73 friend class PreloadApi;
74 friend class UnloadApi;
75 friend class impl::Runner;
76 friend class TestKernel;
77
78private:
79 std::unique_ptr<impl::KernelImpl> pimpl_;
80};
81
82} // namespace sen::kernel
83
84#endif // SEN_KERNEL_KERNEL_H
Here we define a set of template meta-programming helpers to let the compiler take some decisions bas...
Holds the kernel configuration information.
Definition kernel_config.h:33
static const BuildInfo & getBuildInfo() noexcept
Gets the kernel build information.
friend class KernelApi
Definition kernel.h:72
const KernelConfig & getConfig() const noexcept
Gets the configuration used to construct the kernel. This method is thread-safe.
Kernel(KernelConfig config)
int run(KernelBlockMode blockMode=KernelBlockMode::doBlock)
Fire up the execution of the kernel. In case the is already running, -1 is returned....
friend class PreloadApi
Definition kernel.h:73
friend class impl::Runner
Definition kernel.h:75
void requestStop(int exitCode=0)
Stops the execution and deallocates runtime resources. This method is thread-safe.
static void registerTerminationHandler()
Registers the kernel termination handler.
std::filesystem::path getConfigPath() const noexcept
Gets the path to the configuration file used to construct the kernel. This method is thread-safe.
friend class TestKernel
Definition kernel.h:76
friend class UnloadApi
Definition kernel.h:74
Kernel class only meant for unit testing your packages or components. It starts in virtual time mode.
Definition test_kernel.h:27
Strong type for the unique identifier for a transport timer.
Definition native_object_impl.h:39
KernelBlockMode
How to deal with the thread that calls the Kernel::run() function.
Definition kernel.h:33
@ doNotBlock
Does not block the caller thread.
Definition kernel.h:34
@ doBlock
Blocks the caller thread.
Definition kernel.h:35
STL namespace.