Sen API
Sen Libraries
Loading...
Searching...
No Matches
kernel_config.h
Go to the documentation of this file.
1// === kernel_config.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_CONFIG_H
9#define SEN_KERNEL_KERNEL_CONFIG_H
10
11// sen
13
14// generated code
15#include "stl/sen/kernel/basic_types.stl.h"
16
17// std
18#include <filesystem>
19
20namespace sen::kernel
21{
22
25{
26 Component* instance = nullptr;
27 ComponentConfig config {};
28 ComponentInfo info {};
29};
30
32class KernelConfig final
33{
34public:
37 {
38 const std::string path;
39 ComponentConfig config;
41 };
42
50
53 {
54 std::string name;
55 std::string className;
56 BusAddress bus;
58 };
59
62 {
63 std::string name;
64 ComponentConfig config;
65 StringList imports;
66 std::vector<ObjectConfig> objects;
69 };
70
71public: // special members
72 KernelConfig() = default;
73 ~KernelConfig() noexcept = default;
74 SEN_COPY_ASSIGN(KernelConfig) = default;
75 SEN_MOVE_ASSIGN(KernelConfig) = default;
76 SEN_COPY_CONSTRUCT(KernelConfig) = default;
77 SEN_MOVE_CONSTRUCT(KernelConfig) = default;
78
79public: // execution management
81 void setParams(KernelParams params) noexcept;
82
85 [[nodiscard]] const KernelParams& getParams() const noexcept;
86
87public: // main configuration settings
91
94 void addToLoad(ComponentToLoad component);
95
98 void addToLoad(PipelineToLoad pipeline);
99
100public:
102 [[nodiscard]] const std::vector<ComponentPluginToLoad>& getPluginsToLoad() const noexcept;
103
105 [[nodiscard]] const std::vector<ComponentToLoad>& getComponentsToLoad() const noexcept;
106
108 [[nodiscard]] const std::vector<PipelineToLoad>& getPipelinesToLoad() const noexcept;
109
110public:
112 void setConfigFilePath(const std::filesystem::path& path) noexcept { path_ = path; }
113
115 [[nodiscard]] std::filesystem::path getConfigFilePath() const noexcept { return path_; }
116
117private:
118 std::vector<ComponentPluginToLoad> pluginsToLoad_;
119 std::vector<ComponentToLoad> componentsToLoad_;
120 std::vector<PipelineToLoad> pipelinesToLoad_;
121 KernelParams params_ {};
122 std::filesystem::path path_ {};
123};
124
125} // namespace sen::kernel
126
127#endif // SEN_KERNEL_KERNEL_CONFIG_H
A time duration.
Definition duration.h:25
Base class for implementing sen kernel components.
Definition component.h:34
ComponentConfig config
Component configuration parameters.
Definition kernel_config.h:47
const KernelParams & getParams() const noexcept
Gets the behavior of the kernel when calling run. By default it is blockUntilDone.
const std::vector< ComponentToLoad > & getComponentsToLoad() const noexcept
The in-memory components to be loaded on startup.
VarMap params
Dynamic user-defined parameters.
Definition kernel_config.h:48
std::string className
The name of its class.
Definition kernel_config.h:55
std::string name
The unique name of the object (process-wide).
Definition kernel_config.h:54
BusAddress bus
The bus where to publish it, if any.
Definition kernel_config.h:56
const std::string path
Path to the shared object.
Definition kernel_config.h:38
std::string name
Definition kernel_config.h:63
void addToLoad(ComponentPluginToLoad plugin)
Adds a plugin to be loaded by the kernel upon startup. Overrides previous parameters in case of repea...
void setParams(KernelParams params) noexcept
Sets general parameters.
void setConfigFilePath(const std::filesystem::path &path) noexcept
Sets the path to the configuration file's path used to construct the kernel.
Definition kernel_config.h:112
VarMap params
Time between updates (0 for event-triggered execution).
Definition kernel_config.h:68
Duration period
Objects to create.
Definition kernel_config.h:67
StringList imports
Config data (of the owning component).
Definition kernel_config.h:65
VarMap params
Dynamic user-defined parameters.
Definition kernel_config.h:40
ComponentConfig config
Component configuration parameters.
Definition kernel_config.h:39
~KernelConfig() noexcept=default
std::filesystem::path getConfigFilePath() const noexcept
Gets the path to the configuration file used to construct the kernel.
Definition kernel_config.h:115
std::vector< ObjectConfig > objects
Libraries to import.
Definition kernel_config.h:66
ComponentConfig config
The name of the pipeline.
Definition kernel_config.h:64
const std::vector< ComponentPluginToLoad > & getPluginsToLoad() const noexcept
The components to be loaded from plugins on startup.
VarMap params
Dynamic user-defined parameters.
Definition kernel_config.h:57
const std::vector< PipelineToLoad > & getPipelinesToLoad() const noexcept
The pipelines to be loaded on startup.
ComponentContext component
Component instance.
Definition kernel_config.h:46
Information about a component to load from a plugin.
Definition kernel_config.h:37
Information about a component to load.
Definition kernel_config.h:45
Information about how to create an object.
Definition kernel_config.h:53
Information about how to create a pipeline.
Definition kernel_config.h:62
ComponentConfig config
Definition kernel_config.h:27
Component * instance
Definition kernel_config.h:26
ComponentInfo info
Definition kernel_config.h:28
Holds a component instance and basic info.
Definition kernel_config.h:25
std::map< std::string, Var, std::less<> > VarMap
A map of vars to represent structures.
Definition var.h:107
Strong type for the unique identifier for a transport timer.
Definition native_object_impl.h:39
STL namespace.