EchoMap
2026-07-25 6d3977c
An experimental cross-platform digital signal processing application for sound-source localisation.
Toggle main menu visibility
Loading...
Searching...
No Matches
ActionControllerBase.hpp
Go to the documentation of this file.
1
9
10
#ifndef ECHOMAP_ACTIONCONTROLLERBASE_HPP
11
#define ECHOMAP_ACTIONCONTROLLERBASE_HPP
12
13
#include <sigc++/slot.h>
14
15
#include <
filesystem
>
16
17
#include "
../notifications/AllNotifications.hpp
"
18
#include "
../utility/Logger.hpp
"
19
#include "
../utility/VariantHelpers.hpp
"
20
21
namespace
echomap
22
{
23
28
34
40
60
template
<
typename
Derived>
class
ActionControllerBase
61
{
62
using
CallbackT = sigc::slot<void(
const
Notification
&)>;
63
static
CallbackT callback;
64
65
public
:
71
static
void
bind
(
72
CallbackT&& bound_callback
73
)
74
{
75
callback = std::move(bound_callback);
76
}
77
83
static
void
unbind
()
84
{
85
callback.disconnect();
86
}
87
93
static
void
select_project_file
()
94
{
95
Derived::select_project_file_impl();
96
}
97
106
static
void
register_vfs_mapping
(
107
const
std::size_t
project_id,
108
const
std::filesystem::path
& external
109
)
110
{
111
Derived::register_vfs_mapping_impl(project_id, external);
112
}
113
114
protected
:
124
template
<
125
class
NotificationT,
126
class
... Args>
127
requires
variant_helpers::VariantAlternative
<
128
NotificationT,
129
Notification
>
130
static
void
notify
(
131
Args&&... args
132
)
133
{
134
if
(callback.empty())
135
LOG_F_WARN
(
136
"Dropping {} due to unbound application instance."
,
NotificationNames::get<NotificationT>
()
137
);
138
else
139
callback(NotificationT(
std::forward<Args>
(args)...));
140
}
141
};
142
143
template
<
typename
Derived> ActionControllerBase<Derived>::CallbackT ActionControllerBase<Derived>::callback{};
144
145
}
// namespace echomap
146
147
#endif
// ECHOMAP_ACTIONCONTROLLERBASE_HPP
AllNotifications.hpp
AllNotifications specification.
Logger.hpp
EchoMap portable logger specification.
LOG_F_WARN
#define LOG_F_WARN(msg,...)
Logs a formatted warning-level message using echomap::Logger::log_f.
Definition
Logger.hpp:115
VariantHelpers.hpp
VariantHelpers specification.
echomap::ActionControllerBase
Provides a platform-independent static mechanism for performing "system actions", such as raising a f...
Definition
ActionControllerBase.hpp:61
echomap::ActionControllerBase::notify
static void notify(Args &&... args)
Invokes the notification callback.
Definition
ActionControllerBase.hpp:130
echomap::variant_helpers::VariantAlternative
Constrains a type to be one of the alternatives of a std::variant.
Definition
VariantHelpers.hpp:67
filesystem
std::forward
T forward(T... args)
echomap::ActionControllerBase::unbind
static void unbind()
Disconnect the callback.
Definition
ActionControllerBase.hpp:83
echomap::ActionControllerBase::bind
static void bind(CallbackT &&bound_callback)
Bind the callback slot.
Definition
ActionControllerBase.hpp:71
echomap::Notification
std::variant< AddChannelMappingNotification, ModifySensorColourNotification, ModifySensorPositionNotification, ProjectSelectionCompleteNotification, ClearErrorNotification, RaiseFileChooserNotification, RegisterVFSMappingNotification, CompleteProjectLoadNotification, CancelProjectLoadNotification > Notification
A Notification is a trivial message sent exclusively to the EchoMap controller.
Definition
AllNotificationsFwd.hpp:70
echomap::ActionControllerBase::select_project_file
static void select_project_file()
Invokes the Project File Action.
Definition
ActionControllerBase.hpp:93
echomap::ActionControllerBase::register_vfs_mapping
static void register_vfs_mapping(const std::size_t project_id, const std::filesystem::path &external)
Invokes the Register VFS Mapping.
Definition
ActionControllerBase.hpp:106
echomap
The main EchoMap outermost namespace for all non-exported symbols.
Definition
ActionController.hpp:20
std::filesystem::path
std::size_t
echomap::NotificationNames::get
static constexpr std::string_view get()
Retrieve a human-readable name for the templated Notification.
Definition
AllNotificationsFwd.hpp:106
src
actions
ActionControllerBase.hpp
Generated by
1.17.0