Corium 1.1.0
High-Performance Zero-Heap C++20 MPSC Application Runtime
Loading...
Searching...
No Matches
corium::Application< Derived, EventVariantOrBus, MaxServices > Class Template Reference

Static CRTP base class for applications managed by Corium Runtime. Subclass Application<Derived> or Application<Derived, EventVariant, MaxServices> for zero-vtable compile-time static dispatch. All framework operations and handlers are protected for clean encapsulation within the derived application. More...

#include <Application.hpp>

+ Collaboration diagram for corium::Application< Derived, EventVariantOrBus, MaxServices >:

Public Types

using ContextType = ApplicationContext< EventVariant >
 
using EventVariant = internal::extract_event_variant_t< EventVariantOrBus >
 
using ServiceRegistryType = BasicServiceRegistry< MaxServices, EventVariant >
 

Public Member Functions

 Application ()=default
 
 Application (Application &&)=delete
 
 Application (const Application &)=delete
 
Applicationoperator= (Application &&)=delete
 
Applicationoperator= (const Application &)=delete
 
 ~Application ()
 

Protected Member Functions

bool cancelTimer (TimerId id) noexcept
 Cancel an active timer.
 
EventSinkT< EventVarianteventSink ()
 Access event sink handle.
 
template<typename ServiceType >
ServiceType * getService () const noexcept
 Retrieve registered background service by concrete type.
 
template<typename Filter , typename Handler >
requires (std::is_invocable_r_v<bool, Filter&, const callable_event_type_t<Handler>&>)
bool on (Filter &&filter, Handler &&handler)
 Register a filtered event handler executed only when predicate evaluates to true.
 
template<typename Handler >
bool on (Handler &&handler)
 Register event handler with automatic event type deduction from callable signature.
 
template<typename Rep , typename Period >
TimerId postDelayed (EventVariant event, const std::chrono::duration< Rep, Period > &delay, EventPriority priority=EventPriority::Normal)
 Schedule a single-shot delayed event.
 
template<typename Rep , typename Period >
TimerId postPeriodic (EventVariant event, const std::chrono::duration< Rep, Period > &interval, EventPriority priority=EventPriority::Normal)
 Schedule a recurring periodic event.
 
void requestQuit ()
 Request graceful runtime shutdown.
 
const ServiceRegistryTypeservices () const noexcept
 Access const background service registry.
 
ServiceRegistryTypeservices () noexcept
 Access background service registry.
 

Friends

template<typename EV , typename QP , typename SP , typename STP , typename OP , typename TP , typename PP >
class BasicRuntime
 

Detailed Description

template<typename Derived, typename EventVariantOrBus = DefaultEvents, std::size_t MaxServices = 8>
class corium::Application< Derived, EventVariantOrBus, MaxServices >

Static CRTP base class for applications managed by Corium Runtime. Subclass Application<Derived> or Application<Derived, EventVariant, MaxServices> for zero-vtable compile-time static dispatch. All framework operations and handlers are protected for clean encapsulation within the derived application.

Template Parameters
DerivedSubclass type implementing lifecycle hooks (onRegisterHandlers, onInitialize, onShutdown, onConfigureServices).
EventVariantOrBusEvent variant type list or EventBus type (defaults to DefaultEvents).
MaxServicesMaximum number of background services that can be registered (defaults to 8).

Member Typedef Documentation

◆ ContextType

template<typename Derived , typename EventVariantOrBus = DefaultEvents, std::size_t MaxServices = 8>
using corium::Application< Derived, EventVariantOrBus, MaxServices >::ContextType = ApplicationContext<EventVariant>

◆ EventVariant

template<typename Derived , typename EventVariantOrBus = DefaultEvents, std::size_t MaxServices = 8>
using corium::Application< Derived, EventVariantOrBus, MaxServices >::EventVariant = internal::extract_event_variant_t<EventVariantOrBus>

◆ ServiceRegistryType

template<typename Derived , typename EventVariantOrBus = DefaultEvents, std::size_t MaxServices = 8>
using corium::Application< Derived, EventVariantOrBus, MaxServices >::ServiceRegistryType = BasicServiceRegistry<MaxServices, EventVariant>

Constructor & Destructor Documentation

◆ Application() [1/3]

template<typename Derived , typename EventVariantOrBus = DefaultEvents, std::size_t MaxServices = 8>
corium::Application< Derived, EventVariantOrBus, MaxServices >::Application ( )
default

◆ ~Application()

template<typename Derived , typename EventVariantOrBus = DefaultEvents, std::size_t MaxServices = 8>
corium::Application< Derived, EventVariantOrBus, MaxServices >::~Application ( )
inline
+ Here is the call graph for this function:

◆ Application() [2/3]

template<typename Derived , typename EventVariantOrBus = DefaultEvents, std::size_t MaxServices = 8>
corium::Application< Derived, EventVariantOrBus, MaxServices >::Application ( const Application< Derived, EventVariantOrBus, MaxServices > &  )
delete

◆ Application() [3/3]

template<typename Derived , typename EventVariantOrBus = DefaultEvents, std::size_t MaxServices = 8>
corium::Application< Derived, EventVariantOrBus, MaxServices >::Application ( Application< Derived, EventVariantOrBus, MaxServices > &&  )
delete

Member Function Documentation

◆ cancelTimer()

template<typename Derived , typename EventVariantOrBus = DefaultEvents, std::size_t MaxServices = 8>
bool corium::Application< Derived, EventVariantOrBus, MaxServices >::cancelTimer ( TimerId  id)
inlineprotectednoexcept

Cancel an active timer.

+ Here is the call graph for this function:

◆ eventSink()

template<typename Derived , typename EventVariantOrBus = DefaultEvents, std::size_t MaxServices = 8>
EventSinkT< EventVariant > corium::Application< Derived, EventVariantOrBus, MaxServices >::eventSink ( )
inlineprotected

Access event sink handle.

+ Here is the call graph for this function:

◆ getService()

template<typename Derived , typename EventVariantOrBus = DefaultEvents, std::size_t MaxServices = 8>
template<typename ServiceType >
ServiceType * corium::Application< Derived, EventVariantOrBus, MaxServices >::getService ( ) const
inlineprotectednoexcept

Retrieve registered background service by concrete type.

◆ on() [1/2]

template<typename Derived , typename EventVariantOrBus = DefaultEvents, std::size_t MaxServices = 8>
template<typename Filter , typename Handler >
requires (std::is_invocable_r_v<bool, Filter&, const callable_event_type_t<Handler>&>)
bool corium::Application< Derived, EventVariantOrBus, MaxServices >::on ( Filter &&  filter,
Handler &&  handler 
)
inlineprotected

Register a filtered event handler executed only when predicate evaluates to true.

Template Parameters
FilterCallable returning bool when passed the event.
HandlerCallable taking const EventType&.
+ Here is the call graph for this function:

◆ on() [2/2]

template<typename Derived , typename EventVariantOrBus = DefaultEvents, std::size_t MaxServices = 8>
template<typename Handler >
bool corium::Application< Derived, EventVariantOrBus, MaxServices >::on ( Handler &&  handler)
inlineprotected

Register event handler with automatic event type deduction from callable signature.

+ Here is the call graph for this function:

◆ operator=() [1/2]

template<typename Derived , typename EventVariantOrBus = DefaultEvents, std::size_t MaxServices = 8>
Application & corium::Application< Derived, EventVariantOrBus, MaxServices >::operator= ( Application< Derived, EventVariantOrBus, MaxServices > &&  )
delete

◆ operator=() [2/2]

template<typename Derived , typename EventVariantOrBus = DefaultEvents, std::size_t MaxServices = 8>
Application & corium::Application< Derived, EventVariantOrBus, MaxServices >::operator= ( const Application< Derived, EventVariantOrBus, MaxServices > &  )
delete

◆ postDelayed()

template<typename Derived , typename EventVariantOrBus = DefaultEvents, std::size_t MaxServices = 8>
template<typename Rep , typename Period >
TimerId corium::Application< Derived, EventVariantOrBus, MaxServices >::postDelayed ( EventVariant  event,
const std::chrono::duration< Rep, Period > &  delay,
EventPriority  priority = EventPriority::Normal 
)
inlineprotected

Schedule a single-shot delayed event.

+ Here is the call graph for this function:

◆ postPeriodic()

template<typename Derived , typename EventVariantOrBus = DefaultEvents, std::size_t MaxServices = 8>
template<typename Rep , typename Period >
TimerId corium::Application< Derived, EventVariantOrBus, MaxServices >::postPeriodic ( EventVariant  event,
const std::chrono::duration< Rep, Period > &  interval,
EventPriority  priority = EventPriority::Normal 
)
inlineprotected

Schedule a recurring periodic event.

+ Here is the call graph for this function:

◆ requestQuit()

template<typename Derived , typename EventVariantOrBus = DefaultEvents, std::size_t MaxServices = 8>
void corium::Application< Derived, EventVariantOrBus, MaxServices >::requestQuit ( )
inlineprotected

Request graceful runtime shutdown.

+ Here is the call graph for this function:

◆ services() [1/2]

template<typename Derived , typename EventVariantOrBus = DefaultEvents, std::size_t MaxServices = 8>
const ServiceRegistryType & corium::Application< Derived, EventVariantOrBus, MaxServices >::services ( ) const
inlineprotectednoexcept

Access const background service registry.

◆ services() [2/2]

template<typename Derived , typename EventVariantOrBus = DefaultEvents, std::size_t MaxServices = 8>
ServiceRegistryType & corium::Application< Derived, EventVariantOrBus, MaxServices >::services ( )
inlineprotectednoexcept

Access background service registry.

Friends And Related Symbol Documentation

◆ BasicRuntime

template<typename Derived , typename EventVariantOrBus = DefaultEvents, std::size_t MaxServices = 8>
template<typename EV , typename QP , typename SP , typename STP , typename OP , typename TP , typename PP >
friend class BasicRuntime
friend

The documentation for this class was generated from the following file: