$darkmode
#include <registrar.hpp>
Public Member Functions | |
| virtual void | register_static_handler (const std::string &endpoint, Handler)=0 |
| virtual void | register_api_handler (const std::string &endpoint, HandlerType, Handler)=0 |
| virtual std::unique_ptr< Registrar > | with_api_prefix (const std::string &prefix) const =0 |
| virtual std::unique_ptr< Registrar > | with_static_prefix (const std::string &prefix) const =0 |
| virtual std::unique_ptr< Registrar > | with_trigger_prefix (const std::string &prefix) const =0 |
| virtual void | register_action (std::unique_ptr< ActionFactory > &&)=0 |
| virtual DataBroker & | data_broker () const =0 |
| template<typename F , typename... Ctx> | |
| void | register_action (Ctx &&... ctx) |
| virtual void | register_event (std::unique_ptr< EventFactory > &&f, std::shared_ptr< Callback > c)=0 |
| virtual sol::table | register_lua_table ()=0 |
| template<typename F , typename... Ctx> | |
| DirectCallbackPtr< typename F::EventType, Ctx... > | register_event (std::unique_ptr< F > &&f) |
| template<typename F , typename... Ctx, typename... Args> | |
| DirectCallbackPtr< typename F::EventType, Ctx... > | register_event (Args... args) |
Registrar is passed to controllers and simulators to allow them to register action factories as well as web handlers.
Note that a Registrar may modify the key or endpoint that you provide.
|
inline |
Construct and register an ActionFactory.
This replaces what otherwise would be a very common pattern:
r.register_action(std::make_unique<F>(args...));
with:
r.register_action<F>(args...);
|
pure virtual |
Register an ActionFactory.
|
pure virtual |
Register a web handler that can be accessed at the given endpoint.
Currently, the endpoint should be a valid static path, starting with a slash "/". The root represents whatever receives the Registrar, e.g., the controller or simulator. Any endpoint registered will be prefixed to ensure identifiability.
Implemented in engine::Registrar.
|
inline |
Construct and register an EventFactory and return a DirectCallback for storage of events.
This replaces what otherwise would be a common pattern:
r.register_event<F, Ctx...>(std::make_unique<F, Args...>(args...));
with:
r.register_event<F, Ctx...>(args...);
|
pure virtual |
Register an EventFactory.
The Callback is shared by the Registrar and the "Originator" that registers the event. The Registrar owner places triggers with the corresponding event into the callback, which the Originator can trigger when the event occurs.
|
inline |
Register an EventFactory and return a DirectCallback for storage of events.
|
pure virtual |
Provide a Lua table for registration of functions and variables.
Implemented in engine::Registrar.
|
pure virtual |
Register a static web handler that can be given at the endpoint.
Currently, the endpoint should be a valid static path, starting with a slash "/". The root represents whatever receives the Registrar, e.g., the controller or simulator. Any endpoint registered will be prefixed to ensure identifiability.
Implemented in engine::Registrar.
|
pure virtual |
Return a new Registrar with the given static handler prefix.
The returned object should remain valid even if the object creating it is destroyed.
Implemented in engine::Registrar.
|
pure virtual |
Return a new Registrar with the given dynamic handler prefix.
The returned object should remain valid even if the object creating it is destroyed.
Implemented in engine::Registrar.
|
pure virtual |
Return a new Registrar with the given trigger prefix.
The returned object should remain valid even if the object creating it is destroyed.
Implemented in engine::Registrar.