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

Represents an ITask for computing the Discrete Fourier Transform of a Signal. More...

#include <DFTTask.hpp>

Inheritance diagram for echomap::DFTTask:
[legend]

Public Member Functions

 DFTTask (std::shared_ptr< Signal > signal, WindowFunctions::AllFunctions window_function, std::size_t transform_size)
 Creates a new DFT job for the given Signal.
 DFTTask (const DFTTask &)=delete
DFTTaskoperator= (const DFTTask &)=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

std::shared_ptr< Signalsignal
const WindowFunctions::AllFunctions window_function
const std::size_t transform_size

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

Represents an ITask for computing the Discrete Fourier Transform of a Signal.

See also
FrequencySpectrumFactory::create_frequency_spectrum

Definition at line 28 of file DFTTask.hpp.

Constructor & Destructor Documentation

◆ DFTTask()

echomap::DFTTask::DFTTask ( std::shared_ptr< Signal > signal,
WindowFunctions::AllFunctions window_function,
std::size_t transform_size )
explicit

Creates a new DFT job for the given Signal.

Given the immutable nature of Signal Sample data, it is assumed that the time-series data will not be modified during the scheduling and execution of the job. Shared ownership is required to preserve lifetimes across the master and computation threads.

Parameters
signalThe shared-ownership Signal to analyse.
window_functionThe window function to preprocess the input data.
transform_sizeThe number of samples to include in the transform.
Precondition
The given Signal must detain a non-nullptr Signal.

Definition at line 19 of file DFTTask.cpp.

23 :
24 ITask(std::format(
25 "DFTTask: {}",
26 signal->get_name()
27 )),
28 signal(std::move(signal)),
29 window_function(window_function),
30 transform_size(transform_size)
31{
32 assert(this->signal != nullptr);
33}
T format(T... args)

Member Function Documentation

◆ execute_work()

WorkerResult echomap::DFTTask::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 37 of file DFTTask.cpp.

38{
39 return DFTResult(
40 signal->get_id(),
41 FrequencySpectrumFactory::create_frequency_spectrum(*signal, window_function, transform_size),
42 transform_size
43 );
44}
static std::unique_ptr< FrequencySpectrum > create_frequency_spectrum(const Signal &signal, WindowFunctions::AllFunctions window_function, std::size_t transform_size)
Construct a FrequencySpectrum of the given uniformly sampled Signal.

Member Data Documentation

◆ signal

std::shared_ptr<Signal> echomap::DFTTask::signal
private

Definition at line 58 of file DFTTask.hpp.

◆ transform_size

const std::size_t echomap::DFTTask::transform_size
private

Definition at line 60 of file DFTTask.hpp.

◆ window_function

const WindowFunctions::AllFunctions echomap::DFTTask::window_function
private

Definition at line 59 of file DFTTask.hpp.


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