EchoMap 2026-07-25 6d3977c
An experimental cross-platform digital signal processing application for sound-source localisation.
Loading...
Searching...
No Matches
echomap::ActionControllerBase< Derived > Class Template Reference

Provides a platform-independent static mechanism for performing "system actions", such as raising a file-selector dialog, and invoking callbacks upon completion. More...

#include <ActionControllerBase.hpp>

Static Public Member Functions

static void bind (CallbackT &&bound_callback)
 Bind the callback slot.
static void unbind ()
 Disconnect the callback.
static void select_project_file ()
 Invokes the Project File Action.
static void register_vfs_mapping (const std::size_t project_id, const std::filesystem::path &external)
 Invokes the Register VFS Mapping.

Static Protected Member Functions

template<class NotificationT, class... Args>
requires variant_helpers::VariantAlternative< NotificationT, Notification>
static void notify (Args &&... args)
 Invokes the notification callback.

Private Types

using CallbackT = sigc::slot<void(const Notification&)>

Static Private Attributes

static CallbackT callback

Detailed Description

template<typename Derived>
class echomap::ActionControllerBase< Derived >

Provides a platform-independent static mechanism for performing "system actions", such as raising a file-selector dialog, and invoking callbacks upon completion.

The intended workflow is:

  1. Application controller invokes ActionControllerBase::bind to provide a slot capable of accepting Notification objects.
  2. Components on the main thread invoke actions, such as ActionControllerBase::select_project_file.
  3. The specialisation of ActionControllerBase (either JSActionController or NativeActionController) carries out the action. This may or may not involve invoking the bound callback slot with a constructed Notification.
  4. Following completion of the action, the specialisation reports its status through the bound callback slot with a notification.

Due to the reliance upon static storage, this class (and any of its inheritors) is not thread-safe. This data model is necessary to accommodate elaborate callback routines, such as Emscripten's ccall API, in which calling code cannot reasonably retrieve a pointer to any C++ objects.

Definition at line 60 of file ActionControllerBase.hpp.

Member Typedef Documentation

◆ CallbackT

template<typename Derived>
using echomap::ActionControllerBase< Derived >::CallbackT = sigc::slot<void(const Notification&)>
private

Definition at line 62 of file ActionControllerBase.hpp.

Member Function Documentation

◆ notify()

template<typename Derived>
template<class NotificationT, class... Args>
requires variant_helpers::VariantAlternative< NotificationT, Notification>
void echomap::ActionControllerBase< Derived >::notify ( Args &&... args)
inlinestaticprotected

Invokes the notification callback.

If no callback is bound, a warning is issued and the Notification is dropped.

Template Parameters
NotificationTThe type of Notification to send.
ArgsThe parameter types of the Notification constructor.
Parameters
argsThe arguments for the Notification constructor.

Definition at line 130 of file ActionControllerBase.hpp.

133 {
134 if (callback.empty())
136 "Dropping {} due to unbound application instance.", NotificationNames::get<NotificationT>()
137 );
138 else
140 }
#define LOG_F_WARN(msg,...)
Logs a formatted warning-level message using echomap::Logger::log_f.
Definition Logger.hpp:115
Provides a platform-independent static mechanism for performing "system actions", such as raising a f...

Member Data Documentation

◆ callback

template<typename Derived>
CallbackT echomap::ActionControllerBase< Derived >::callback
staticprivate

Definition at line 63 of file ActionControllerBase.hpp.


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