Defines the interface by which operations are performed on data. More...

#include <Operation.h>

Inheritance diagram for dsp::Operation:
OwnStream Reference::Able Reference::HeapTracked dsp::FoldManager dsp::Input dsp::OperationThread dsp::ParallelInput dsp::Simultaneous dsp::Sink< In > dsp::Source dsp::Transformation< In, Out > dsp::Sink< BitSeries > dsp::Sink< dsp::BitSeries > dsp::Sink< TimeSeries > dsp::Transformation< BitSeries, BitSeries > dsp::Transformation< BitSeries, TimeSeries > dsp::Transformation< ParallelBitSeries, TimeSeries > dsp::Transformation< PhaseSeries, PhaseSeries > dsp::Transformation< TimeSeries, BitSeries > dsp::Transformation< TimeSeries, PhaseSeries > dsp::Transformation< TimeSeries, Response > dsp::Transformation< TimeSeries, TimeSeries >

Public Types

enum  Function { Producer, Procedural, Structural }
 The function of the operator. More...
 

Public Member Functions

 Operation (const char *name)
 All sub-classes must specify a unique name. More...
 
 Operation (const Operation &)
 Copy constructor.
 
virtual ~Operation ()
 Virtual destructor.
 
virtual bool operate ()
 Call this method to operate on data Returns false on failure. More...
 
virtual void prepare ()
 Prepare for data operations. More...
 
virtual void reserve ()
 Reserve the maximum amount of memory required. More...
 
virtual void add_extensions (Extensions *)
 Add any extensions.
 
virtual void combine (const Operation *)
 Combine accumulated results with another operation. More...
 
virtual void report () const
 Report operation statistics.
 
virtual void reset ()
 Reset accumulated results to intial values. More...
 
std::string get_name () const
 Return the unique name of this operation.
 
double get_total_time () const
 Return the total time spent on this Operation in seconds.
 
double get_elapsed_time () const
 Get the time spent in the last invocation of operate()
 
virtual uint64_t get_total_weights () const
 Return the total number of timesample weights encountered. More...
 
virtual uint64_t get_discarded_weights () const
 Return the number of invalid timesample weights encountered.
 
int get_id ()
 Inquire the unique instantiation id.
 
virtual Function get_function () const
 Get the function classification of this operation.
 
virtual double get_delay_time () const
 Get the time delay of this operation, if any, in seconds.
 
virtual void set_scratch (Scratch *)
 Set the scratch space.
 
bool scratch_was_set () const
 
virtual uint64_t bytes_storage () const
 The number of bytes of additional storage used by the operation.
 
virtual uint64_t bytes_scratch () const
 The number of bytes of scratch space used by the operation. More...
 
- Public Member Functions inherited from OwnStream
 OwnStream (const OwnStream &)
 
const OwnStreamoperator= (const OwnStream &)
 
virtual void set_cout (std::ostream &) const
 
virtual void set_cerr (std::ostream &) const
 
- Public Member Functions inherited from Reference::Able
 Able (const Able &)
 
Ableoperator= (const Able &)
 
unsigned get_reference_count () const
 
- Public Member Functions inherited from Reference::HeapTracked
 HeapTracked (const HeapTracked &)
 
HeapTrackedoperator= (const HeapTracked &)
 
bool __is_on_heap () const
 

Static Public Attributes

static bool record_time = false
 Global flag enables stopwatch to record the time spent operating. More...
 
static bool report_time = true
 Global flag enables report of time spent in operation on descruction. More...
 
static bool verbose = false
 Global verbosity flag.
 
static int operation_status = 0
 Operations can set this to non-zero in operation() if they fail.
 
static bool check_state = true
 Operations should perform internal consistency checks.
 
static int instantiation_count = 0
 Counts how many Operation instantiations there have been Used for setting the unique instantiation ID. More...
 

Protected Member Functions

virtual bool can_operate ()
 Return false if the operation doesn't have enough data to proceed.
 
virtual void operation ()=0
 Perform operation on data. Defined by derived classes.
 
virtual void set_name (const std::string &_name)
 Set the name!
 
int timers_index (const std::string &op_name)
 Returns the index in the 'timers' array of a particular timer.
 
- Protected Member Functions inherited from Reference::Able
Handle__reference (bool active) const
 
void __dereference (bool auto_delete=true) const
 

Protected Attributes

Scratchscratch
 Shared scratch space, if needed.
 
bool set_scratch_called
 
std::string name
 Operation name.
 
uint64_t discarded_weights
 Number of time sample weights encountered that are flagged invalid.
 
uint64_t total_weights
 Total number of time sample weights encountered.
 
RealTimer optime
 Stop watch records the amount of time spent performing this operation.
 
int id
 Unique instantiation id.
 
bool prepared
 Set true when preparation optimizations are completed.
 

Additional Inherited Members

- Static Public Member Functions inherited from Reference::Able
static size_t get_instance_count ()
 
- Static Public Member Functions inherited from Reference::HeapTracked
static void * operator new (size_t size, void *ptr=0)
 
static void operator delete (void *location, void *ptr)
 
static void operator delete (void *location)
 
static size_t get_heap_queue_size ()
 

Detailed Description

Defines the interface by which operations are performed on data.

This pure virtual base class defines the manner in which various digital signal processing routines are performed on baseband data

Member Enumeration Documentation

◆ Function

The function of the operator.

Enumerator
Procedural 

operations that produce data

Structural 

operations that process data

operations that don't modify data

Constructor & Destructor Documentation

◆ Operation()

dsp::Operation::Operation ( const char *  name)

All sub-classes must specify a unique name.

All sub-classes must specify name and capacity for inplace operation.

Member Function Documentation

◆ bytes_scratch()

virtual uint64_t dsp::Operation::bytes_scratch ( ) const
inlinevirtual

The number of bytes of scratch space used by the operation.

Scratch space is temporary and can be shared.

Reimplemented in dsp::ParallelInput, dsp::ParallelUnpacker, dsp::UnpackerSource< UnpackerType, InputType >, dsp::OperationThread, and dsp::Filterbank.

◆ combine()

void dsp::Operation::combine ( const Operation other)
virtual

◆ get_total_weights()

uint64_t dsp::Operation::get_total_weights ( ) const
virtual

Return the total number of timesample weights encountered.

Return the number of invalid timesample weights encountered.

◆ operate()

bool dsp::Operation::operate ( )
virtual

Call this method to operate on data Returns false on failure.

call the pure virtual method defined by sub-classes

Referenced by dsp::TestInput::runtest(), and dsp::OperationThread::thread().

◆ prepare()

◆ reserve()

◆ reset()

Member Data Documentation

◆ instantiation_count

int dsp::Operation::instantiation_count = 0
static

Counts how many Operation instantiations there have been Used for setting the unique instantiation ID.

Global instantiation count.

◆ record_time

bool dsp::Operation::record_time = false
static

Global flag enables stopwatch to record the time spent operating.

By default, operations do not time themselves

Referenced by dsp::SingleThread::Config::add_options(), dsp::Filterbank::filterbank(), dsp::InverseFilterbank::filterbank(), dsp::SingleThread::finish(), and dsp::Archiver::unload().

◆ report_time

bool dsp::Operation::report_time = true
static

Global flag enables report of time spent in operation on descruction.

By default, if record_time is enabled, operations will report total time spent when their destructor is called

Referenced by dsp::SingleThread::Config::add_options().


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

Generated using doxygen 1.8.17