EchoMap 2026-07-25 6d3977c
An experimental cross-platform digital signal processing application for sound-source localisation.
Loading...
Searching...
No Matches
echomap::LoadSignalFileTask Class Reference
Inheritance diagram for echomap::LoadSignalFileTask:
[legend]

Public Member Functions

 LoadSignalFileTask (id_type project_id, const std::filesystem::path &path, std::vector< std::unique_ptr< SignalFactory > > &&factories)
 LoadSignalFileTask (const LoadSignalFileTask &)=delete
LoadSignalFileTask & operator= (const LoadSignalFileTask &)=delete
Public Member Functions inherited from echomap::ITask
 ITask (const std::string_view task_name)
virtual ~ITask () noexcept=default
 Destruct the ITask base.
WorkerResult execute (const std::stop_token &stop_token)
 Execute the work, subject to the given token, and produce a WorkerResult.
WorkerResult operator() ()
 Alias for execute with a vacuous stop token.
Public Member Functions inherited from echomap::Object< ITask >
 ~Object ()=default
 Non-virtual base destructor.
id_type get_id () const noexcept
bool is_valid () const noexcept
void set_name (const std::string_view new_name)
std::string_view get_name () const noexcept
const char * get_imgui_name () const noexcept
 Object (const Object &)=delete
Object & operator= (const Object &)=delete
bool operator== (const Object &other) const noexcept
 Determine shallow equality between two Object instances.

Private Member Functions

WorkerResult execute_work () override
 Execute the work and produce a WorkerResult.

Private Attributes

id_type project_id
std::filesystem::path path
std::vector< std::unique_ptr< SignalFactory > > factories

Additional Inherited Members

Static Public Member Functions inherited from echomap::Object< ITask >
static std::string_view get_class_name () noexcept
Protected Member Functions inherited from echomap::Object< ITask >
void move_identity_from (Object &&other) noexcept
 Helper for derived classes to provide move-assignment operations.

Detailed Description

Definition at line 25 of file LoadSignalFileTask.hpp.

Constructor & Destructor Documentation

◆ LoadSignalFileTask()

echomap::LoadSignalFileTask::LoadSignalFileTask ( id_type project_id,
const std::filesystem::path & path,
std::vector< std::unique_ptr< SignalFactory > > && factories )
explicit

Definition at line 17 of file LoadSignalFileTask.cpp.

21 :
22 ITask(std::format(
23 "LoadSignalFileTask: {} ",
24 path.c_str()
25 )),
26 project_id(project_id),
27 path(path),
28 factories(std::move(factories))
29{
30}
T format(T... args)

Member Function Documentation

◆ execute_work()

WorkerResult echomap::LoadSignalFileTask::execute_work ( )
overrideprivatevirtual

Execute the work and produce a WorkerResult.

Returns
An owning container detaining the result of the work.

Implements echomap::ITask.

Definition at line 34 of file LoadSignalFileTask.cpp.

35{
36 // Prepare the factories as slots for the loader.
37 std::vector<SignalFactory*> factory_refs;
38 factory_refs.reserve(factories.size());
39 for (const auto& factory_owner : factories)
40 factory_refs.emplace_back(factory_owner.get());
41
42 // Load each channel into the correct factories.
43 SignalFactory::load_wave_file(path.c_str(), factory_refs);
44
45 // Retrieve the loaded signals.
46 std::vector<std::unique_ptr<Signal>> loaded_signals;
47 for (auto&& factory_owner : factories)
48 if (factory_owner != nullptr)
49 loaded_signals.emplace_back(std::move(factory_owner)->take_signal());
50
51 // Now we own the loaded signals, pass them onto the result.
52 return LoadSignalFileResult(project_id, std::move(loaded_signals));
53}
static std::vector< std::unique_ptr< Signal > > load_wave_file(const char *file_path)
Loads a WAV file from the file system.
T emplace_back(T... args)
T reserve(T... args)

Member Data Documentation

◆ factories

std::vector<std::unique_ptr<SignalFactory> > echomap::LoadSignalFileTask::factories
private

Definition at line 46 of file LoadSignalFileTask.hpp.

◆ path

std::filesystem::path echomap::LoadSignalFileTask::path
private

Definition at line 45 of file LoadSignalFileTask.hpp.

◆ project_id

id_type echomap::LoadSignalFileTask::project_id
private

Definition at line 44 of file LoadSignalFileTask.hpp.


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