|
| | RunApi (Kernel &kernel, impl::KernelImpl &kernelImpl, impl::Runner *runner, std::atomic_bool &stopRequested, const VarMap &config, Guarded< TimeStamp > &timePoint) noexcept |
| | ~RunApi () noexcept=default |
| const std::atomic_bool & | stopRequested () const noexcept |
| | True if stop has been requested by the runtime.
|
| void | drainInputs () |
| | Perform any request coming from the outside and drainInputs all the local data structures with their most up-to-date value. This method is thread-safe.
|
| void | update () |
| | This calls update() on all the objects registered by the component.
|
| void | commit () |
| | Send changes, so that they become visible to other participants. This includes object additions and removals, property changes and emitted events that others might have interest in. This method is thread-safe.
|
| void | commit (TimeStamp time) |
| | The same, tagging what is sent with time instead of the time Sen would stamp, for a component that runs its own cycle and bridges a system keeping its own clock. The time applies to every object this component owns. getTime() still reports Sen's time, because the rest of the kernel keeps running on its own clock. This method is thread-safe.
|
| FuncResult | execLoop (Duration cycleTime, std::function< void()> &&func=nullptr, bool logOverruns=true) |
| | A basic execution loop. Func is an optional callback that will be invoked on each cycle. logOverruns keeps the log lines for a missed deadline: an execution time overrun and the two ways a cycle is lost. The Tracy messages are emitted either way.
|
| TimeStamp | getStartTime () const noexcept |
| | The initial simulation time for the objects in the component.
|
| TimeStamp | getTime () const noexcept |
| | The (potentially virtualized) time.
|
| std::optional< Duration > | getTargetCycleTime () const noexcept |
| | If present, it returns the configured cycle time for iterations.
|
| ComponentMonitoringInfo | fetchComponentMonitoringInfo () const |
| | Monitoring information of the calling component.
|
| KernelMonitoringInfo | fetchMonitoringInfo () const |
| | Monitoring information of all components loaded by the kernel.
|
| Span< const ComponentInfo > | getImportedPackages () const noexcept |
| | Build information for all imported packages (from pipeline components). The returned span references kernel-owned storage that is stable for the lifetime of the kernel.
|
| Span< const ComponentInfo > | getLoadedComponents () const noexcept |
| | Build information for every component loaded into the kernel, excluding pipeline components (which are built from imports and have no individual build identity) and the internal kernel component. The returned span references kernel-owned storage that is stable for the lifetime of the kernel.
|
| std::optional< uint32_t > | getTransportProtocolVersion () const noexcept |
| | Version of the currently installed transport protocol. Empty when no transport is installed. Static for the lifetime of the kernel.
|
| Tracer & | getTracer () const noexcept |
| | Create a scoped zone used for tracing runtime performance.
|
| const VarMap & | getConfig () const noexcept |
| | Gets the configuration associated with this component.
|
| CustomTypeRegistry & | getTypes () noexcept |
| | The types registered into the kernel.
|
| void | requestKernelStop (int exitCode=0) |
| | Issues an asynchronous request to stop the kernel. The request is ignored if a previous stop request was issued.
|
| std::shared_ptr< ObjectSource > | getSource (const BusAddress &address) |
| | Gets an object source, where objects can be found and published.
|
| std::shared_ptr< ObjectSource > | getSource (const std::string &address) |
| | Gets an object source, where objects can be found and published. The address parameter must be given as <session-name>.<bus-name>.
|
| SessionsDiscoverer & | getSessionsDiscoverer () noexcept |
| | Object that allows discovering sessions and buses.
|
| const ProcessInfo * | fetchOwnerInfo (const Object *object) const noexcept |
| | Gets information about the process where an object is. Returns nullptr if the object resides in the current process.
|
| const std::string & | getAppName () const noexcept |
| | Gets the (optional) application name passed to the kernel as a configuration parameter.
|
| std::vector< BusAddress > | getConfiguredBusAddresses () const |
| | Gets configured non-local bus addresses.
|
| ::sen::impl::WorkQueue * | getWorkQueue () const noexcept |
| | The work queue of this runner.
|
| template<typename T, typename Bus> |
| std::shared_ptr< Subscription< T > > | selectAllFrom (const Bus &bus) |
| | Subscribe to every object of type T on bus. The returned Subscription owns the kernel-side wiring; destruct it to stop.
|
| template<typename T, typename Bus> |
| std::shared_ptr< Subscription< T > > | selectAllFrom (const Bus &bus, typename sen::ObjectList< T >::Callback onAdded, typename sen::ObjectList< T >::Callback onRemoved=nullptr) |
| | As above, plus addition/removal callbacks installed before subscribing so they fire for objects already present. Pass nullptr to skip either.
|
| template<typename T, typename Bus> |
| std::shared_ptr< Subscription< T > > | selectFrom (const Bus &bus, const std::string &query, typename sen::ObjectList< T >::Callback onAdded=nullptr, typename sen::ObjectList< T >::Callback onRemoved=nullptr) |
| | Subscription against an arbitrary Sen query (with WHERE conditions). Example: selectFrom<Shape>(bus, R"(SELECT Shape FROM local.bus WHERE color IN ("red"))"). Installs the callbacks before subscribing. Pass nullptr to skip either.
|
| std::filesystem::path | getConfigFilePath () const noexcept |
| | Gets the path to the configuration file used to construct the kernel. It might be empty if the kernel is programmatically configured.
|
|
| static std::shared_ptr< spdlog::logger > | getOrCreateLogger (const std::string &loggerName) |
| | Registers a new logger in the kernel if it does not exist, or returns the existing one by name. Used to propagate the logger configuration to other packages/components that use it.
|
| static void | applyToAllLoggers (std::function< void(std::shared_ptr< spdlog::logger >)> &&func) |
| | Applies the input function to all loggers kept in the logger registry. Used by the logmaster component.
|
| static FuncResult | setAllLoggersLevel (spdlog::level::level_enum level) |
| | The level below is the registry's, not a kernel's, and spdlog is one shared library with one registry per process. So it reaches every logger in that registry, including one a component made through spdlog's own factory. A logger constructed directly and never registered is not in it.
|
| static void | setCrashBannerDescriptor (int descriptor) noexcept |
| | Where the kernel writes the crash banner, the few lines naming what died and where the report went, for a component that has taken stderr over.
|
| static void | prepareCurrentThreadForCrashReports () noexcept |
| | Give the calling thread the alternate signal stack the crash handler needs.
|
| static spdlog::level::level_enum | getAllLoggersLevel () |
| | The level setAllLoggersLevel last set, which is also the level a new logger starts from.
|
What can be done while a component is running.
| FuncResult sen::kernel::KernelApi::setAllLoggersLevel |
( |
spdlog::level::level_enum | level | ) |
|
|
staticnodiscardinherited |
The level below is the registry's, not a kernel's, and spdlog is one shared library with one registry per process. So it reaches every logger in that registry, including one a component made through spdlog's own factory. A logger constructed directly and never registered is not in it.
spdlog appears in these signatures by name: this header declares the types instead of including them, so compiling against the kernel does not compile spdlog or fmt. A caller that uses a logger includes spdlog itself and links the copy Sen ships, which holds the registry.
Sets the level on every logger the kernel knows and on every logger made afterwards.
Walking the registry with applyToAllLoggers reaches only the loggers that exist when it runs, so a level set that way stops applying as soon as another component makes a logger. This sets the registry's own level, which is what a new logger is initialised from.
It replaces the per-logger levels a configuration file asked for, and there is no way back to them: read one before you change it if you mean to restore it.
Errors on a level outside the enum. Nothing else can fail.