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

Represents an ITask for downsampling a Signal time-series data by a fixed factor. More...

#include <DownsampleTask.hpp>

Inheritance diagram for echomap::DownsampleTask:
[legend]

Public Member Functions

 DownsampleTask (std::shared_ptr< Signal > signal, float factor=downsampling_factor)
 Creates a new downsampling job for the given Signal.
 DownsampleTask (const DownsampleTask &)=delete
DownsampleTaskoperator= (const DownsampleTask &)=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 float factor

Static Private Attributes

static constexpr float downsampling_factor = 50.0f

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 downsampling a Signal time-series data by a fixed factor.

See also
SignalFactory::downsample

Definition at line 27 of file DownsampleTask.hpp.

Constructor & Destructor Documentation

◆ DownsampleTask()

echomap::DownsampleTask::DownsampleTask ( std::shared_ptr< Signal > signal,
float factor = downsampling_factor )
explicit

Creates a new downsampling 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 downsample.
factorThe multiplicative factor by which the Signal should be downsampled.
Precondition
The given Signal must detain a non-nullptr Signal.

Definition at line 20 of file DownsampleTask.cpp.

23 :
24 ITask(std::format("DownsampleTask: {}", signal->get_name())),
25 signal(std::move(signal)),
26 factor(factor)
27{
28 assert(this->signal != nullptr);
29}
T format(T... args)

Member Function Documentation

◆ execute_work()

WorkerResult echomap::DownsampleTask::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 33 of file DownsampleTask.cpp.

34{
35 return DownsampleResult(signal->get_id(), SignalFactory::downsample(*signal, factor));
36}
static std::unique_ptr< Signal > downsample(const Signal &source, float downsample_factor, std::string_view name={})
Downsamples an existing Signal instance across all channels to the given number of samples.

Member Data Documentation

◆ downsampling_factor

float echomap::DownsampleTask::downsampling_factor = 50.0f
staticconstexprprivate

Definition at line 29 of file DownsampleTask.hpp.

◆ factor

const float echomap::DownsampleTask::factor
private

Definition at line 60 of file DownsampleTask.hpp.

◆ signal

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

Definition at line 59 of file DownsampleTask.hpp.


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