nidas
v1.2-1520
|
#include <SampleAverager.h>
Public Member Functions | |
SampleAverager () | |
SampleAverager (const std::vector< const Variable * > &vars) | |
SampleAverager (const std::vector< Variable * > &vars) | |
virtual | ~SampleAverager () |
void | setAveragePeriodSecs (float val) |
Set average period. More... | |
float | getAveragePeriodSecs () const |
Get average period. More... | |
void | addVariable (const Variable *var) |
void | addVariables (const std::vector< const Variable * > &) |
SampleSource * | getRawSampleSource () |
Several objects in NIDAS can be both a SampleSource of raw Samples and processed Samples. More... | |
SampleSource * | getProcessedSampleSource () |
Several objects in NIDAS can be both a SampleSource of raw Samples and processed Samples. More... | |
std::list< const SampleTag * > | getSampleTags () const |
Get the output SampleTags. More... | |
SampleTagIterator | getSampleTagIterator () const |
Implementation of SampleSource::getSampleTagIterator(). More... | |
void | addSampleClient (SampleClient *client) throw () |
Implementation of SampleSource::addSampleClient(). More... | |
void | removeSampleClient (SampleClient *client) throw () |
Remove a SampleClient from this SampleSource. More... | |
void | addSampleClientForTag (SampleClient *client, const SampleTag *) throw () |
Add a Client for a given SampleTag. More... | |
void | removeSampleClientForTag (SampleClient *client, const SampleTag *) throw () |
Remove a SampleClient for a given SampleTag from this SampleSource. More... | |
int | getClientCount () const throw () |
How many SampleClients are currently in my list. More... | |
void | flush () throw () |
Implementation of Resampler::flush(). More... | |
const SampleStats & | getSampleStats () const |
void | connect (SampleSource *source) throw (nidas::util::InvalidParameterException) |
Connect the resampler to a SampleSource. More... | |
void | disconnect (SampleSource *source) throw () |
bool | receive (const Sample *s) throw () |
Method called to pass a sample to this client. More... | |
Protected Member Functions | |
void | init () throw () |
Private Member Functions | |
void | addSampleTag (const SampleTag *tag) throw () |
Add a SampleTag to this SampleSource. More... | |
void | removeSampleTag (const SampleTag *tag) throw () |
SampleAverager (const SampleAverager &) | |
No copy. More... | |
SampleAverager & | operator= (const SampleAverager &) |
No assignment. More... | |
Private Attributes | |
SampleSourceSupport | _source |
SampleTag | _outSample |
int | _averagePeriodUsecs |
Length of average, in microseconds. More... | |
dsm_time_t | _endTime |
end time of current statistics window. More... | |
std::map< Variable *, unsigned int > | _outVarIndices |
Index of each requested output variable in the output sample. More... | |
std::map< dsm_sample_id_t, std::vector< unsigned int > > | _inmap |
std::map< dsm_sample_id_t, std::vector< unsigned int > > | _lenmap |
std::map< dsm_sample_id_t, std::vector< unsigned int > > | _outmap |
unsigned int | _ndataValues |
double * | _sums |
int * | _cnts |
SampleAverager::SampleAverager | ( | ) |
SampleAverager::SampleAverager | ( | const std::vector< const Variable * > & | vars | ) |
SampleAverager::SampleAverager | ( | const std::vector< Variable * > & | vars | ) |
|
private |
No copy.
|
inlinevirtual |
Implementation of SampleSource::addSampleClient().
Implements nidas::core::SampleSource.
References _source, and nidas::core::SampleSourceSupport::addSampleClient().
|
inlinevirtual |
Add a Client for a given SampleTag.
Implementation of SampleSource::addSampleClient().
Implements nidas::core::SampleSource.
References _source, and nidas::core::SampleSourceSupport::addSampleClient().
|
inlineprivatevirtual |
Add a SampleTag to this SampleSource.
Implements nidas::core::SampleSource.
References _source, and nidas::core::SampleSourceSupport::addSampleTag().
Referenced by SampleAverager().
void SampleAverager::addVariable | ( | const Variable * | var | ) |
References _ndataValues, _outSample, _outVarIndices, nidas::core::SampleTag::addVariable(), and nidas::core::Variable::getLength().
Referenced by addVariables().
void SampleAverager::addVariables | ( | const std::vector< const Variable * > & | ) |
References addVariable().
Referenced by SampleAverager().
|
virtual |
Connect the resampler to a SampleSource.
Implements nidas::core::Resampler.
References nidas::core::SampleTag::getDataIndex(), nidas::core::SampleTag::getId(), nidas::core::Variable::getLength(), nidas::core::Site::getName(), nidas::core::Variable::getName(), nidas::core::Variable::getSite(), nidas::core::Variable::getStation(), nidas::core::SampleTag::getVariableIterator(), nidas::core::VariableIterator::hasNext(), nidas::core::VariableIterator::next(), and WLOG.
|
virtual |
Implements nidas::core::Resampler.
|
virtual |
Implementation of Resampler::flush().
Implements nidas::core::Resampler.
References _averagePeriodUsecs, _cnts, _endTime, _ndataValues, _outSample, _source, _sums, nidas::core::SampleSourceSupport::distribute(), nidas::core::floatNAN, fp, nidas::core::SampleT< DataT >::freeReference(), nidas::core::SampleT< DataT >::getDataPtr(), nidas::core::SampleTag::getId(), nidas::core::Sample::setId(), and nidas::core::Sample::setTimeTag().
|
inline |
Get average period.
References _averagePeriodUsecs, and USECS_PER_SEC.
|
inlinevirtual |
How many SampleClients are currently in my list.
Implements nidas::core::SampleSource.
References _source, and nidas::core::SampleSourceSupport::getClientCount().
|
inlinevirtual |
Several objects in NIDAS can be both a SampleSource of raw Samples and processed Samples.
SampleClients use this method to get a pointer to whatever sample source they are interested in. Derived classes can return NULL if they are not a SampleSource of processed samples.
Implements nidas::core::SampleSource.
References _source.
|
inlinevirtual |
Several objects in NIDAS can be both a SampleSource of raw Samples and processed Samples.
SampleClients use this method to get a pointer to whatever sample source they are interested in. Derived classes can return NULL if they are not a SampleSource of raw samples.
Implements nidas::core::SampleSource.
|
inlinevirtual |
Implements nidas::core::SampleSource.
References _source, and nidas::core::SampleSourceSupport::getSampleStats().
|
inlinevirtual |
Implementation of SampleSource::getSampleTagIterator().
Implements nidas::core::SampleSource.
References _source, and nidas::core::SampleSourceSupport::getSampleTagIterator().
|
inlinevirtual |
Get the output SampleTags.
Implements nidas::core::SampleSource.
References _source, and nidas::core::SampleSourceSupport::getSampleTags().
Referenced by nidas::dynld::psql::PSQLProcessor::getSampleTags().
|
protected |
References _cnts, _endTime, _ndataValues, and _sums.
|
private |
No assignment.
|
virtual |
Method called to pass a sample to this client.
This method is typically called by a SampleSource for each of its SampleClients when it has a sample ready. Returns true: success false: sample rejected. This is meant to signal a warning-type situation - like a socket not being available temporarily. True errors will be thrown as an IOException.
Implements nidas::core::SampleClient.
References nidas::core::DOUBLE_ST, nidas::core::FLOAT_ST, nidas::core::floatNAN, fp, nidas::core::SampleT< DataT >::getDataPtr(), nidas::core::Sample::getTimeTag(), nidas::core::Sample::setId(), nidas::core::Sample::setTimeTag(), and nidas::util::timeCeiling().
|
inlinevirtual |
Remove a SampleClient from this SampleSource.
Implements nidas::core::SampleSource.
References _source, and nidas::core::SampleSourceSupport::removeSampleClient().
|
inlinevirtual |
Remove a SampleClient for a given SampleTag from this SampleSource.
The pointer to the SampleClient must remain valid, until after it is removed.
Implements nidas::core::SampleSource.
References _source, and nidas::core::SampleSourceSupport::removeSampleClient().
|
inlineprivatevirtual |
Implements nidas::core::SampleSource.
References _source, and nidas::core::SampleSourceSupport::removeSampleTag().
|
inline |
Set average period.
val | average period, in seconds. |
References _averagePeriodUsecs, _outSample, nidas::core::SampleTag::setRate(), and USECS_PER_SEC.
Referenced by SampleAverager().
|
private |
Length of average, in microseconds.
Referenced by flush(), getAveragePeriodSecs(), and setAveragePeriodSecs().
|
private |
Referenced by flush(), init(), and ~SampleAverager().
|
private |
|
private |
|
private |
|
private |
Referenced by addVariable(), flush(), and init().
|
private |
|
private |
Referenced by addVariable(), flush(), SampleAverager(), and setAveragePeriodSecs().
|
private |
Index of each requested output variable in the output sample.
Referenced by addVariable().
|
private |
|
private |
Referenced by flush(), init(), and ~SampleAverager().