nidas v1.2.3
|
Interface of a processor of samples. More...
#include <StatisticsProcessor.h>
Classes | |
struct | OutputInfo |
Static Public Member Functions | |
static const XMLCh * | getNamespaceURI () |
Protected Member Functions | |
void | removeRequestedSampleTag (SampleTag *tag) |
Allow subclasses to remove requested SampleTags. | |
Protected Attributes | |
SampleSourceSupport | _source |
nidas::util::Mutex | _tagsMutex |
std::list< SampleTag * > | _requestedTags |
Private Member Functions | |
StatisticsProcessor (const StatisticsProcessor &) | |
Copy not supported. | |
StatisticsProcessor & | operator= (const StatisticsProcessor &) |
Assignment not supported. | |
Private Attributes | |
nidas::util::Mutex | _cruncherListMutex |
Implementation of SampleIOProcessor::addSampleTag(SampleTag*). | |
std::set< SampleSource * > | _connectedSources |
std::set< SampleOutput * > | _connectedOutputs |
std::list< StatisticsCruncher * > | _crunchers |
std::map< dsm_sample_id_t, struct OutputInfo > | _infoBySampleId |
nidas::util::UTime | _startTime |
nidas::util::UTime | _endTime |
float | _statsPeriod |
bool | _fillGaps |
std::set< std::string > | _cntsNames |
Set of counts variables for output samples. | |
std::string | _name |
dsm_sample_id_t | _id |
std::list< const SampleTag * > | _constRequestedTags |
std::list< SampleOutput * > | _origOutputs |
bool | _optional |
const DSMService * | _service |
What service am I a part of? | |
const DSMConfig * | _dsm |
Or, what DSM am I a part of? | |
std::list< Parameter * > | _parameters |
std::list< const Parameter * > | _constParameters |
Static Private Attributes | |
static XMLCh * | namespaceURI = 0 |
Interface of a processor of samples.
A StatisticsProcessor reads input Samples from a single SampleInput, and sends its processed output Samples to one or more SampleOutputs.
StatisticsProcessor::StatisticsProcessor | ( | ) |
References nidas::core::SampleIOProcessor::setName().
StatisticsProcessor::~StatisticsProcessor | ( | ) |
References _connectedOutputs, _cruncherListMutex, _crunchers, nidas::core::SampleOutput::close(), nidas::core::SampleClient::flush(), nidas::core::SampleIOProcessor::getName(), nidas::core::SampleOutput::getName(), nidas::core::SampleOutput::getOriginal(), nidas::core::getSample(), nidas::util::Mutex::lock(), LOG_ERR, and nidas::util::Mutex::unlock().
|
private |
Copy not supported.
|
inlinevirtualinherited |
Add an SampleOutput to this SampleIOProcessor.
This is used to add a desired SampleOutput to this SampleIOProcessor. SampleIOProcessor will own the SampleOutput. Once a SampleSource has connected, then SampleIOProcessor is responsible for do SampleOutput::requestConnection, or SampleOutputRequestThread::addConnectRequest() on all these as-yet disconnected outputs.
References nidas::core::SampleIOProcessor::_origOutputs.
Referenced by nidas::core::SampleIOProcessor::fromDOMElement().
Add a parameter to this SampleIOProcessor, which will then own the pointer and will delete it in its destructor.
If a Parameter exists with the same name, it will be replaced with the new Parameter.
nidas::util::InvalidParameterException |
References nidas::core::SampleIOProcessor::_constParameters, and nidas::core::SampleIOProcessor::_parameters.
Referenced by nidas::core::SampleIOProcessor::fromDOMElement().
Request a sample from this StatisticsProcessor, containing Parameters indicating what variables to process and what kind of statistics to compute.
nidas::util::InvalidParameterException |
Reimplemented from nidas::core::SampleIOProcessor.
References _infoBySampleId, _statsPeriod, nidas::core::SampleIOProcessor::addRequestedSampleTag(), nidas::core::SampleTag::addVariable(), nidas::core::Parameter::BOOL_PARAM, nidas::dynld::StatisticsProcessor::OutputInfo::countsName, GET_DSM_ID, GET_SPS_ID, nidas::core::SampleTag::getDSMId(), nidas::core::SampleTag::getId(), nidas::core::Project::getInstance(), nidas::core::Parameter::getLength(), nidas::core::Parameter::getName(), nidas::core::SampleIOProcessor::getName(), nidas::core::Parameter::getNumericValue(), nidas::core::SampleTag::getParameters(), nidas::core::SampleTag::getPeriod(), nidas::core::SampleTag::getRate(), nidas::core::SampleIOProcessor::getRequestedSampleTags(), nidas::core::getSample(), nidas::core::SampleTag::getSpSId(), nidas::dynld::StatisticsCruncher::getStatisticsString(), nidas::dynld::StatisticsCruncher::getStatisticsType(), nidas::core::Parameter::getStringValue(), nidas::core::Parameter::getType(), ILOG, nidas::core::Parameter::INT_PARAM, nidas::core::SampleTag::isEnabled(), LOG_VERBOSE, nidas::core::SampleTag::setSampleId(), stats_log_variable(), nidas::dynld::StatisticsCruncher::STATS_UNKNOWN, nidas::dynld::StatisticsCruncher::STATS_WINDDIR, nidas::core::Parameter::STRING_PARAM, and VLOG.
|
inlinevirtualinherited |
Implementation of SampleSource::addSampleClient().
Implements nidas::core::SampleSource.
Reimplemented in nidas::dynld::raf::SyncRecordGenerator.
References nidas::core::SampleIOProcessor::_source, and nidas::core::SampleSourceSupport::addSampleClient().
|
inlinevirtualinherited |
Add a Client for a given SampleTag.
Implementation of SampleSource::addSampleClient().
Implements nidas::core::SampleSource.
Reimplemented in nidas::dynld::raf::SyncRecordGenerator.
References nidas::core::SampleIOProcessor::_source, and nidas::core::SampleSourceSupport::addSampleClientForTag().
Implementation of SampleSource::addSampleTag().
Implements nidas::core::SampleSource.
Referenced by nidas::dynld::raf::CVIProcessor::addRequestedSampleTag(), and connectSource().
|
virtual |
Implementation of SampleConnectionRequester::connect.
Do common operations necessary when a output has connected:
Implements nidas::core::SampleConnectionRequester.
References nidas::core::getSample().
|
overridevirtual |
Do common operations necessary when a input has connected:
connect() methods in subclasses should do whatever initialization necessary before invoking this StatisticsProcessor::connect().
Implements nidas::core::SampleIOProcessor.
References _connectedSources, _cruncherListMutex, _crunchers, _infoBySampleId, nidas::core::SampleIOProcessor::addSampleTag(), nidas::core::SampleOutput::addSourceSampleTags(), nidas::dynld::StatisticsProcessor::OutputInfo::countsName, nidas::core::SampleTag::getDSMId(), getEndTime(), getFillGaps(), nidas::core::SampleOutputRequestThread::getInstance(), nidas::core::SampleIOProcessor::getName(), nidas::core::SampleIOProcessor::getOutputs(), nidas::core::SampleSource::getProcessedSampleSource(), nidas::core::SampleIOProcessor::getRequestedSampleTags(), nidas::core::getSample(), nidas::core::SampleIOProcessor::getSampleTags(), nidas::core::SampleSource::getSampleTags(), nidas::core::SampleTag::getSpSId(), getStartTime(), nidas::core::SampleTag::getVariables(), nidas::dynld::StatisticsProcessor::OutputInfo::higherMoments, nidas::util::Mutex::lock(), LOG_VERBOSE, PLOG, stats_log_variable(), nidas::dynld::StatisticsProcessor::OutputInfo::type, nidas::util::Mutex::unlock(), VLOG, and VLOGT.
|
virtual |
Implementation of SampleConnectionRequester::disconnect.
Do common operations necessary when a output has disconnected:
Implements nidas::core::SampleConnectionRequester.
References nidas::core::SampleOutputRequestThread::getInstance(), nidas::core::SampleOutput::getOriginal(), nidas::core::getSample(), and LOG_ERR.
|
virtual |
Disconnect a SampleInput from this StatisticsProcessor.
Right now just does a flush() of all connected outputs.
Implements nidas::core::SampleIOProcessor.
References nidas::core::getSample().
|
virtual |
Implementation of SampleSource::flush().
Finish the current statistics and send them on.
Implements nidas::core::SampleSource.
References _connectedOutputs, _cruncherListMutex, _crunchers, nidas::core::SampleClient::flush(), nidas::core::getSample(), nidas::util::Mutex::lock(), and nidas::util::Mutex::unlock().
nidas::util::InvalidParameterException |
Implements nidas::core::DOMable.
References nidas::core::SampleIOProcessor::_origOutputs, nidas::core::SampleIOProcessor::addOutput(), nidas::core::SampleIOProcessor::addParameter(), nidas::core::SampleIOProcessor::addRequestedSampleTag(), nidas::core::DOMObjectFactory::createObject(), nidas::core::Parameter::createParameter(), nidas::core::SampleTag::fromDOMElement(), nidas::core::DOMable::fromDOMElement(), nidas::core::SampleIOProcessor::getId(), nidas::core::Project::getInstance(), nidas::core::SampleIOProcessor::getRequestedSampleTags(), nidas::core::getSample(), nidas::core::SampleTag::getSampleId(), nidas::core::SampleIOProcessor::setOptional(), nidas::core::SampleIOProcessor::setSampleId(), nidas::core::SampleTag::setSampleId(), nidas::core::SampleTag::setSensorId(), and WLOG.
Referenced by nidas::dynld::raf::CVIProcessor::fromDOMElement().
|
inlinevirtualinherited |
How many SampleClients are currently in my list.
)
Implements nidas::core::SampleSource.
Reimplemented in nidas::dynld::raf::SyncRecordGenerator.
References nidas::core::SampleIOProcessor::_source, and nidas::core::SampleSourceSupport::getClientCount().
|
inlinevirtualinherited |
What DSM am I associated with?
References nidas::core::SampleIOProcessor::_dsm.
Referenced by nidas::dynld::raf::CVIProcessor::addRequestedSampleTag().
|
inline |
References _endTime.
Referenced by connectSource().
|
inline |
Whether to generate output samples over time gaps.
In some circumstances one might be generating statistics for separate time periods, and one does not want to output samples of missing data for the gaps between the periods.
References _fillGaps.
Referenced by connectSource().
|
inlineinherited |
References nidas::core::SampleIOProcessor::_id, and GET_FULL_ID.
Referenced by nidas::core::SampleIOProcessor::fromDOMElement().
|
virtualinherited |
References nidas::core::DOMable::namespaceURI.
Referenced by nidas::dynld::UDPSampleOutput::getProjectDOM(), nidas::core::Dataset::toDOMElement(), nidas::core::ProjectConfig::toDOMElement(), nidas::core::Dataset::toDOMParent(), nidas::core::Datasets::toDOMParent(), nidas::core::ProjectConfig::toDOMParent(), nidas::core::ProjectConfigs::toDOMParent(), nidas::core::DSMConfig::toDOMParent(), nidas::core::DSMSensor::toDOMParent(), nidas::core::Project::toDOMParent(), nidas::core::SampleTag::toDOMParent(), nidas::core::Site::toDOMParent(), nidas::core::ServerSocket::toDOMParent(), nidas::core::Variable::toDOMParent(), nidas::core::Datasets::writeXML(), and nidas::core::ProjectConfigs::writeXML().
|
inlinevirtualinherited |
References nidas::core::SampleIOProcessor::_origOutputs.
Referenced by nidas::core::SampleArchiver::connectSource(), nidas::dynld::raf::CVIProcessor::connectSource(), nidas::dynld::SampleProcessor::connectSource(), connectSource(), nidas::dynld::raf::SyncRecordGenerator::connectSource(), and nidas::core::Project::findServerSampleOutputStreamFileSets().
|
inlineinherited |
Get list of parameters.
References nidas::core::SampleIOProcessor::_constParameters.
Referenced by nidas::dynld::raf::CVIProcessor::fromDOMElement().
|
inline |
References _statsPeriod.
|
inlinevirtualinherited |
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 nidas::core::SampleIOProcessor::_source.
|
inlinevirtualinherited |
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.
References nidas::core::SampleIOProcessor::_id, and GET_SPS_ID.
Referenced by selectRequestedSampleTags().
|
inlinevirtualinherited |
Implements nidas::core::SampleSource.
Reimplemented in nidas::dynld::raf::SyncRecordGenerator.
References nidas::core::SampleIOProcessor::_source, and nidas::core::SampleSourceSupport::getSampleStats().
|
inlinevirtualinherited |
Implementation of SampleSource::getSampleTagIterator().
Implements nidas::core::SampleSource.
Reimplemented in nidas::dynld::raf::SyncRecordGenerator.
References nidas::core::SampleIOProcessor::_source, and nidas::core::SampleSourceSupport::getSampleTagIterator().
|
inlinevirtualinherited |
Implementation of SampleSource::getSampleTags().
Implements nidas::core::SampleSource.
Reimplemented in nidas::dynld::raf::SyncRecordGenerator.
References nidas::core::SampleIOProcessor::_source, and nidas::core::SampleSourceSupport::getSampleTags().
Referenced by nidas::dynld::raf::CVIProcessor::addRequestedSampleTag(), nidas::dynld::raf::CVIProcessor::connectSource(), and connectSource().
|
inlinevirtualinherited |
What DSMService am I associated with?
References nidas::core::SampleIOProcessor::_service.
|
inline |
References _startTime.
Referenced by connectSource().
string StatisticsProcessor::getUniqueCountsName | ( | const std::string & | val | ) |
All output samples (and StatisticsCrunchers) should have a unique name for their counts output variable.
This will check if val exists in _cntsNames. If not, it is added to _cntsNames and returned as a unique name. If it is in _cntsName, a suffix of "_N" where N is 1:Inf is appended until it is unique.
References _cntsNames, and nidas::core::getSample().
Referenced by nidas::dynld::StatisticsCruncher::initStats().
|
inlinevirtualinherited |
Reimplemented in nidas::dynld::raf::SyncRecordGenerator.
References nidas::core::SampleIOProcessor::_optional.
|
private |
Assignment not supported.
|
inlinevirtualinherited |
Reimplemented in nidas::core::SampleArchiver, and nidas::dynld::raf::SyncRecordGenerator.
Referenced by nidas::dynld::RawSampleService::printStatus().
Allow subclasses to remove requested SampleTags.
The tag will be deleted.
References nidas::core::SampleIOProcessor::_constRequestedTags, nidas::core::SampleIOProcessor::_requestedTags, nidas::core::SampleIOProcessor::_tagsMutex, and nidas::core::getSample().
Referenced by selectRequestedSampleTags().
|
inlinevirtualinherited |
Remove a SampleClient from this SampleSource.
)
Implements nidas::core::SampleSource.
Reimplemented in nidas::dynld::raf::SyncRecordGenerator.
References nidas::core::SampleIOProcessor::_source, and nidas::core::SampleSourceSupport::removeSampleClient().
|
inlinevirtualinherited |
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.
Reimplemented in nidas::dynld::raf::SyncRecordGenerator.
References nidas::core::SampleIOProcessor::_source, and nidas::core::SampleSourceSupport::removeSampleClientForTag().
void StatisticsProcessor::selectRequestedSampleTags | ( | const std::vector< unsigned int > & | sampleIds | ) |
References nidas::core::SampleIOProcessor::_requestedTags, nidas::core::SampleIOProcessor::_tagsMutex, nidas::core::getSample(), nidas::core::SampleIOProcessor::getSampleId(), nidas::core::SampleTag::getSpSId(), nidas::util::Mutex::lock(), nidas::core::SampleIOProcessor::removeRequestedSampleTag(), and nidas::util::Mutex::unlock().
|
inlinevirtualinherited |
References nidas::core::SampleIOProcessor::_dsm, and nidas::core::getSample().
|
inline |
References _endTime, and nidas::core::getSample().
References _fillGaps, and nidas::core::getSample().
References nidas::core::SampleIOProcessor::_optional, and nidas::core::getSample().
Referenced by nidas::core::SampleIOProcessor::fromDOMElement().
References nidas::core::SampleIOProcessor::_id, and SET_SPS_ID.
Referenced by nidas::core::SampleIOProcessor::fromDOMElement().
|
inlinevirtualinherited |
References nidas::core::SampleIOProcessor::_service, and nidas::core::getSample().
|
inline |
References _startTime, and nidas::core::getSample().
|
virtualinherited |
Add my content into a DOMElement.
xercesc::DOMException |
Reimplemented in nidas::core::DSMConfig, nidas::core::DSMSensor, nidas::core::Project, nidas::core::SampleTag, nidas::core::Site, nidas::core::ServerSocket, and nidas::core::Variable.
Referenced by nidas::core::ServerSocket::toDOMParent().
|
virtualinherited |
Create a DOMElement and append it to the parent.
xercesc::DOMException |
Reimplemented in nidas::core::DSMConfig, nidas::core::DSMSensor, nidas::core::Project, nidas::core::SampleTag, nidas::core::Site, nidas::core::ServerSocket, and nidas::core::Variable.
|
private |
Set of counts variables for output samples.
Referenced by getUniqueCountsName().
|
private |
Referenced by flush(), and ~StatisticsProcessor().
|
private |
Referenced by connectSource().
|
private |
Implementation of SampleIOProcessor::addSampleTag(SampleTag*).
Referenced by connectSource(), flush(), and ~StatisticsProcessor().
|
private |
Referenced by connectSource(), flush(), and ~StatisticsProcessor().
Or, what DSM am I a part of?
Referenced by nidas::core::SampleIOProcessor::getDSMConfig(), and nidas::core::SampleIOProcessor::setDSMConfig().
|
private |
Referenced by getEndTime(), and setEndTime().
|
private |
Referenced by getFillGaps(), and setFillGaps().
|
privateinherited |
|
private |
Referenced by addRequestedSampleTag(), and connectSource().
|
privateinherited |
Referenced by nidas::core::SampleIOProcessor::getName(), and nidas::core::SampleIOProcessor::setName().
|
privateinherited |
|
privateinherited |
|
privateinherited |
|
protectedinherited |
|
privateinherited |
What service am I a part of?
Referenced by nidas::core::SampleIOProcessor::getService(), and nidas::core::SampleIOProcessor::setService().
|
protectedinherited |
Referenced by nidas::core::SampleIOProcessor::addSampleClient(), nidas::core::SampleIOProcessor::addSampleClientForTag(), nidas::core::SampleIOProcessor::getClientCount(), nidas::core::SampleIOProcessor::getProcessedSampleSource(), nidas::core::SampleIOProcessor::getSampleStats(), nidas::core::SampleIOProcessor::getSampleTagIterator(), nidas::core::SampleIOProcessor::getSampleTags(), nidas::core::SampleIOProcessor::removeSampleClient(), and nidas::core::SampleIOProcessor::removeSampleClientForTag().
|
private |
Referenced by getStartTime(), and setStartTime().
|
private |
Referenced by addRequestedSampleTag(), and getPeriod().
|
mutableprotectedinherited |
|
staticprivateinherited |
Referenced by nidas::core::DOMable::getNamespaceURI().