SimulationChain
 All Classes Functions Variables Pages
CSquareGen Class Reference

#include <SquareGen.h>

Inheritance diagram for CSquareGen:
Collaboration diagram for CSquareGen:

Public Member Functions

 CSquareGen (std::string sName="Square")
 
double GenerateNext () override
 Used to generate next signal sample. More...
 
void Reset () override
 Resets the generator to the enter state. More...
 
void SetAmplitude (double dA)
 Sets amplitude. More...
 
void SetPeriod (int nT)
 Sets period in samples. More...
 
void SetDutyCycle (double nDC)
 Sets duty cycle in range <0,1> More...
 
void LoadState (boost::property_tree::ptree::value_type const &vParams)
 Sets generator parameters. More...
 
void SaveState (boost::property_tree::ptree &pt) const override
 
void SaveHistory () override
 Internally saves a current state in relation with the output signal generation. More...
 
void LoadHistory () override
 Restores an internal state saved with SaveHistory() method. More...
 
- Public Member Functions inherited from CGenerator
 CGenerator (std::string &sName, GenType type)
 Abstract class constructor to initialize common components. More...
 
GenType GetType () const override
 Gets type of the generator. More...
 
const std::string & GetName () const override
 Gets name. More...
 
void SetName (std::string &sName) override
 Sets name. More...
 
void SetDelay (int nD) override
 Sets the delay in samples. More...
 

Additional Inherited Members

- Protected Attributes inherited from CGenerator
const GenType m_Type
 generator type
 
std::string m_sName
 generator name
 
int m_nI
 number of sample in a sequence
 
int m_nIBack
 saved state of the m_nI variable
 
int m_nDelay
 delay of the output in samples
 

Detailed Description

Responsible for generating pulse signal.

Member Function Documentation

double CSquareGen::GenerateNext ( )
inlineoverridevirtual

Used to generate next signal sample.

Returns
Next generated sample of the output.

calculating delay

calculating moment of switch

if the period is a factor of the current sample value (reduced by delay) switch the wave sign

Implements IGenerator.

void CSquareGen::LoadHistory ( )
inlineoverridevirtual

Restores an internal state saved with SaveHistory() method.

Reimplemented from CGenerator.

Here is the call graph for this function:

void CSquareGen::LoadState ( boost::property_tree::ptree::value_type const &  vParams)
inlinevirtual

Sets generator parameters.

Parameters
[in]vParamsProperty tree containing data to deserialize the object.

Implements CGenerator.

void CSquareGen::Reset ( )
inlineoverridevirtual

Resets the generator to the enter state.

Implements IGenerator.

void CSquareGen::SaveHistory ( )
inlineoverridevirtual

Internally saves a current state in relation with the output signal generation.

Reimplemented from CGenerator.

Here is the call graph for this function:

void CSquareGen::SaveState ( boost::property_tree::ptree &  pt) const
inlineoverridevirtual

saving all the properties to the tree

Implements CGenerator.

void CSquareGen::SetAmplitude ( double  dA)
inline

Sets amplitude.

Parameters
[in]dAAmplitude of the output.
void CSquareGen::SetDutyCycle ( double  nDC)
inline

Sets duty cycle in range <0,1>

Parameters
[in]nDCDuty cycle in range <0,1>.
void CSquareGen::SetPeriod ( int  nT)
inline

Sets period in samples.

Parameters
[in]nTPeriod of the output in samples.

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