FERS 0.1.0
The Flexible Extensible Radar Simulator
Loading...
Searching...
No Matches
fers_signal::FmcwIfResamplingSink Class Reference

#include "if_resampler.h"

Classes

class  Stage
 

Public Member Functions

 FmcwIfResamplingSink (FmcwIfResamplerPlan plan)
 
 ~FmcwIfResamplingSink ()
 
 FmcwIfResamplingSink (const FmcwIfResamplingSink &)=delete
 
FmcwIfResamplingSinkoperator= (const FmcwIfResamplingSink &)=delete
 
 FmcwIfResamplingSink (FmcwIfResamplingSink &&) noexcept
 
FmcwIfResamplingSinkoperator= (FmcwIfResamplingSink &&) noexcept
 
void consume (std::span< const ComplexType > block)
 
FmcwIfZeroInputResult consumeZeroInput (std::size_t input_count)
 
std::vector< ComplexTypetakeOutput ()
 
std::vector< ComplexTypefinish ()
 
void reset ()
 
const FmcwIfResamplerPlanplan () const noexcept
 

Detailed Description

Definition at line 117 of file if_resampler.h.

Constructor & Destructor Documentation

◆ FmcwIfResamplingSink() [1/3]

fers_signal::FmcwIfResamplingSink::FmcwIfResamplingSink ( FmcwIfResamplerPlan  plan)
explicit

Definition at line 755 of file if_resampler.cpp.

755 : _plan(std::move(plan))
756 {
757 for (const auto& stage : _plan.stages)
758 {
759 _stages.push_back(std::make_unique<Stage>(stage));
760 }
761 }
const FmcwIfResamplerPlan & plan() const noexcept
math::Vec3 max

References max, and fers_signal::FmcwIfResamplerPlan::stages.

◆ ~FmcwIfResamplingSink()

fers_signal::FmcwIfResamplingSink::~FmcwIfResamplingSink ( )
default

◆ FmcwIfResamplingSink() [2/3]

fers_signal::FmcwIfResamplingSink::FmcwIfResamplingSink ( const FmcwIfResamplingSink )
delete

◆ FmcwIfResamplingSink() [3/3]

fers_signal::FmcwIfResamplingSink::FmcwIfResamplingSink ( FmcwIfResamplingSink &&  )
defaultnoexcept

Member Function Documentation

◆ consume()

void fers_signal::FmcwIfResamplingSink::consume ( std::span< const ComplexType block)

Definition at line 767 of file if_resampler.cpp.

768 {
769 if (_finished)
770 {
771 throw std::logic_error("Cannot consume IF resampler input after finish");
772 }
773
774 if (_stages.empty())
775 {
776 _output.insert(_output.end(), block.begin(), block.end());
777 return;
778 }
779
780 std::vector<ComplexType> current(block.begin(), block.end());
781 for (auto& stage : _stages)
782 {
783 stage->consume(current);
784 current = stage->take();
785 }
786 _output.insert(_output.end(), current.begin(), current.end());
787 }

References max.

◆ consumeZeroInput()

FmcwIfZeroInputResult fers_signal::FmcwIfResamplingSink::consumeZeroInput ( std::size_t  input_count)

Definition at line 789 of file if_resampler.cpp.

790 {
791 if (_finished)
792 {
793 throw std::logic_error("Cannot consume IF resampler input after finish");
794 }
795
796 FmcwIfZeroInputResult result;
797 if (input_count == 0)
798 {
799 return result;
800 }
801
802 if (_stages.empty())
803 {
804 result.emitted = takeOutput();
805 result.skipped_output_samples = input_count;
806 return result;
807 }
808
809 std::vector<ComplexType> current;
810 std::size_t zero_count = input_count;
811 for (auto& stage : _stages)
812 {
813 if (!current.empty())
814 {
815 stage->consume(current);
816 current = stage->take();
817 }
818 if (zero_count == 0)
819 {
820 continue;
821 }
822
823 auto zero_result = stage->consumeZeroInput(zero_count);
824 current.insert(current.end(), zero_result.emitted.begin(), zero_result.emitted.end());
825 zero_count = zero_result.skipped_output_samples;
826 }
827
828 _output.insert(_output.end(), current.begin(), current.end());
829 result.emitted = takeOutput();
830 result.skipped_output_samples = zero_count;
831 return result;
832 }
std::vector< ComplexType > takeOutput()

References max, and takeOutput().

+ Here is the call graph for this function:

◆ finish()

std::vector< ComplexType > fers_signal::FmcwIfResamplingSink::finish ( )

Definition at line 841 of file if_resampler.cpp.

842 {
843 if (_finished)
844 {
845 return takeOutput();
846 }
847 _finished = true;
848
849 if (_stages.empty())
850 {
851 return takeOutput();
852 }
853
854 std::vector<ComplexType> current;
855 for (std::size_t i = 0; i < _stages.size(); ++i)
856 {
857 if (i > 0)
858 {
859 _stages[i]->consume(current);
860 }
861 current = _stages[i]->finish();
862 }
863 _output.insert(_output.end(), current.begin(), current.end());
864 return takeOutput();
865 }

References max, and takeOutput().

+ Here is the call graph for this function:

◆ operator=() [1/2]

FmcwIfResamplingSink & fers_signal::FmcwIfResamplingSink::operator= ( const FmcwIfResamplingSink )
delete

◆ operator=() [2/2]

FmcwIfResamplingSink & fers_signal::FmcwIfResamplingSink::operator= ( FmcwIfResamplingSink &&  )
defaultnoexcept

◆ plan()

const FmcwIfResamplerPlan & fers_signal::FmcwIfResamplingSink::plan ( ) const
noexcept

Definition at line 134 of file if_resampler.h.

134{ return _plan; }

◆ reset()

void fers_signal::FmcwIfResamplingSink::reset ( )

Definition at line 867 of file if_resampler.cpp.

868 {
869 for (auto& stage : _stages)
870 {
871 stage->reset();
872 }
873 _output.clear();
874 _finished = false;
875 }

References max.

◆ takeOutput()

std::vector< ComplexType > fers_signal::FmcwIfResamplingSink::takeOutput ( )

Definition at line 834 of file if_resampler.cpp.

835 {
836 std::vector<ComplexType> out;
837 out.swap(_output);
838 return out;
839 }

References max.

Referenced by consumeZeroInput(), and finish().

+ Here is the caller graph for this function:

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