SimulationChain
 All Classes Functions Variables Pages
CHistorian Class Reference

#include <Historian.h>

Public Member Functions

 CHistorian (int nMaxSamples=10)
 Constructs historian object. More...
 
void SetMaxSamples (unsigned int nMaxSamples)
 Sets maximum samples stored. More...
 
unsigned int GetMaxSamples () const
 Returns number indicating maximum samples stored. More...
 
unsigned int GetNumOfSamplesStored ()
 Returns number indicating how many samples were stored were added to the object from the beginning of its existance.
 
void AddSample (double dSample)
 Insert a sample to the history record. More...
 
std::unique_ptr< std::vector
< double > > 
RetriveNSamples (int nN=0) const
 Return N samples stored. If The number of stored samples is lower than desired the returned vector will have last nN - numOfSamplesStored set to 0. More...
 
void RetriveNSamples (std::vector< double > &v, int nN=0) const
 Return N samples stored. If The number of stored samples is lower than desired the returned vector will have last nN - numOfSamplesStored set to 0. More...
 
void SetHistory (std::vector< double > &v)
 Clears stored samples and copies values from vector. More...
 
void Clear ()
 Clears stored samples.
 
double LastSample ()
 Returns last stored sample.
 

Detailed Description

Handles storing and dispensing given amount of samples.

Using double-ended queue internally to ensure high performance when adding and retrieving samples.

Constructor & Destructor Documentation

CHistorian::CHistorian ( int  nMaxSamples = 10)
inline

Constructs historian object.

Parameters
[in]nMaxSamplesMaximum samples to store.

Member Function Documentation

void CHistorian::AddSample ( double  dSample)

Insert a sample to the history record.

Parameters
[in]dSampleNew sample value.

Here is the caller graph for this function:

unsigned int CHistorian::GetMaxSamples ( ) const
inline

Returns number indicating maximum samples stored.

Returns
Number indication maximum samples stored.

Here is the caller graph for this function:

std::unique_ptr< std::vector< double > > CHistorian::RetriveNSamples ( int  nN = 0) const

Return N samples stored. If The number of stored samples is lower than desired the returned vector will have last nN - numOfSamplesStored set to 0.

Returns
Unique pointer to a copy of stored samples.

Here is the call graph for this function:

Here is the caller graph for this function:

void CHistorian::RetriveNSamples ( std::vector< double > &  v,
int  nN = 0 
) const

Return N samples stored. If The number of stored samples is lower than desired the returned vector will have last nN - numOfSamplesStored set to 0.

Parameters
[out]vVector of stored samples.
[in]nNNumber of samples to retrieve. nN = 0 gives all samples.

Here is the call graph for this function:

void CHistorian::SetHistory ( std::vector< double > &  v)

Clears stored samples and copies values from vector.

Parameters
[in]vSets new history of stored values.

Here is the call graph for this function:

Here is the caller graph for this function:

void CHistorian::SetMaxSamples ( unsigned int  nMaxSamples)

Sets maximum samples stored.

Parameters
[in]nMaxSamplesMaximum samples to store.

Here is the caller graph for this function:


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