nidas v1.2.3
|
SampleCounter accumulates samples and values for a particular sample stream. More...
Public Member Functions | |
SampleCounter (dsm_sample_id_t sid=0, const DSMSensor *sensor=0, const SampleTag *stag=0) | |
Create a SampleCounter for the given sample id sid . | |
void | enableJSON (bool enable) |
Set whether information for JSON output will be accumulated, according to whether enable is true or false. | |
void | enableData (bool enable) |
Set whether data values will be extracted from processed samples and accumulated to compute data statistics. | |
std::string | getHeaderLine (bool allnames) |
Format the sensor name or variable names for this SampleCounter into a comma-separated list, abbreviated to a shortened form unless allnames is true. | |
void | reset () |
Reset the accumulated data without changing the sample tag information. | |
bool | receive (const Sample *samp) |
void | accumulateData (const Sample *samp) |
double | computeRate () |
void | printData (std::ostream &outs) |
Format the data from this SampleCounter and write it to the given output stream outs . | |
std::string | generateStreamId (const DSMSensor *sensor=0) |
Generate a streamid for this SampleCounter. | |
void | collectMetadata (const DSMSensor *sensor=0, const SampleTag *stag=0) |
void | accumulateSample (const Sample *samp) |
Json::Value | jsonData () |
Return a Json::Value node containing all the data in this SampleCounter. | |
Json::Value | jsonStats (std::vector< Problem > &problems) |
Return a json object with the statistics calculated for this stream, and append any Problem instances to the vector problems . | |
Json::Value | jsonHeader () |
Return a Json::Value containing just the header for this SampleClient. | |
Public Attributes | |
string | streamid |
string | sname |
dsm_sample_id_t | id |
dsm_time_t | t1s |
dsm_time_t | t2s |
size_t | nsamps |
size_t | minlens |
size_t | maxlens |
size_t | totalBytes |
int | minDeltaTs |
int | maxDeltaTs |
vector< string > | varnames |
vector< string > | fullnames |
bool | enable_json |
bool | enable_data |
vector< float > | sums |
vector< int > | nnans |
vector< std::string > | rawmsg |
vector< vector< float > > | values |
vector< dsm_time_t > | times |
Json::Value | header |
SampleCounter accumulates samples and values for a particular sample stream.
|
inline |
Create a SampleCounter for the given sample id sid
.
If available, pass the Sensor in sensor
, and it will be used to collect metadata about this sample stream and to set a header name. If the SampleTag for this sample is passed in stag
, then it is used to store the variable names for the sample values.
References collectMetadata(), fullnames, generateStreamId(), nidas::core::getSample(), sname, streamid, and varnames.
References nidas::util::addBackslashSequences(), nidas::core::CHAR_ST, nidas::core::DOUBLE_ST, enable_data, nidas::core::FLOAT_ST, nidas::core::getSample(), nnans, rawmsg, sums, times, and values.
Referenced by accumulateSample().
References accumulateData(), nidas::core::Sample::getDataByteLength(), nidas::core::getSample(), maxDeltaTs, maxlens, minDeltaTs, minlens, nsamps, t1s, t2s, totalBytes, and USECS_PER_MSEC.
Referenced by receive().
References assign_if_set(), GET_DSM_ID, GET_SPS_ID, nidas::core::DSMSensor::getCatalogName(), nidas::core::DSMSensor::getClassName(), nidas::core::DSMSensor::getDepthString(), nidas::core::DSMSensor::getDeviceName(), nidas::core::DSMSensor::getDSMConfig(), nidas::core::DSMSensor::getHeightString(), nidas::core::DSMSensor::getLocation(), nidas::core::Variable::getLongName(), nidas::core::Project::getName(), nidas::core::Variable::getName(), nidas::core::Variable::getPrefix(), nidas::core::SampleTag::getRate(), nidas::core::getSample(), nidas::core::DSMSensor::getSite(), nidas::core::Variable::getUnits(), nidas::core::SampleTag::getVariables(), header, rate, and streamid.
Referenced by SampleCounter().
|
inline |
References nidas::core::floatNAN, nidas::core::getSample(), nsamps, rate, t1s, t2s, and USECS_PER_SEC.
Referenced by jsonStats().
Set whether data values will be extracted from processed samples and accumulated to compute data statistics.
Disabling data statistics automatically disables JSON information.
References enable_data, and enableJSON().
Referenced by enableJSON().
Set whether information for JSON output will be accumulated, according to whether enable
is true or false.
Enabling JSON output automatically enables the collection of data statistics.
References enable_json, and enableData().
Referenced by enableData().
Generate a streamid for this SampleCounter.
The streamid is the unique identifer for this stream of samples based on the available metadata.
References GET_DSM_ID, GET_SPS_ID, nidas::core::DSMSensor::getDSMConfig(), nidas::core::getSample(), and id_to_string().
Referenced by SampleCounter().
|
inline |
Format the sensor name or variable names for this SampleCounter into a comma-separated list, abbreviated to a shortened form unless allnames
is true.
If this is a raw counter, meaning no variables, then use the sensor name. The fully-qualified variable names are used in the header line to be compatible with historical behavior, but maybe someday this can change.
References fullnames, nidas::core::getSample(), sname, and varnames.
Referenced by DataStats::printReport().
Json::Value SampleCounter::jsonData | ( | ) |
Return a Json::Value node containing all the data in this SampleCounter.
References enable_data, nidas::core::getSample(), nsamps, streamid, times, values, and varnames.
|
inline |
Return a Json::Value containing just the header for this SampleClient.
References header.
Referenced by DataStats::jsonReport().
Json::Value SampleCounter::jsonStats | ( | std::vector< Problem > & | problems | ) |
Return a json object with the statistics calculated for this stream, and append any Problem instances to the vector problems
.
References computeRate(), nidas::core::getSample(), header, maxDeltaTs, maxlens, minDeltaTs, minlens, Problem::MISSING_VALUES, MSECS_PER_SEC, nnans, Problem::NO_SAMPLES, nsamps, rate, Problem::SAMPLE_RATE_MISMATCH, streamid, sums, t1s, t2s, totalBytes, and varnames.
Referenced by DataStats::printReport().
void SampleCounter::printData | ( | std::ostream & | outs | ) |
Format the data from this SampleCounter and write it to the given output stream outs
.
References nidas::core::getSample(), nnans, nsamps, rawmsg, sums, and varnames.
References accumulateSample(), ELOG, nidas::core::NidasApp::getApplicationInstance(), ILOG, nsamps, and VLOG.
|
inline |
Reset the accumulated data without changing the sample tag information.
References maxDeltaTs, maxlens, minDeltaTs, minlens, nnans, nsamps, rawmsg, sums, t1s, t2s, times, totalBytes, and values.
bool SampleCounter::enable_data |
Referenced by accumulateData(), enableData(), and jsonData().
bool SampleCounter::enable_json |
Referenced by enableJSON().
vector<string> SampleCounter::fullnames |
Referenced by getHeaderLine(), and SampleCounter().
Json::Value SampleCounter::header |
Referenced by collectMetadata(), jsonHeader(), and jsonStats().
dsm_sample_id_t SampleCounter::id |
int SampleCounter::maxDeltaTs |
Referenced by accumulateSample(), jsonStats(), and reset().
size_t SampleCounter::maxlens |
Referenced by accumulateSample(), jsonStats(), and reset().
int SampleCounter::minDeltaTs |
Referenced by accumulateSample(), jsonStats(), and reset().
size_t SampleCounter::minlens |
Referenced by accumulateSample(), jsonStats(), and reset().
vector<int> SampleCounter::nnans |
Referenced by accumulateData(), jsonStats(), printData(), and reset().
size_t SampleCounter::nsamps |
Referenced by accumulateSample(), computeRate(), jsonData(), jsonStats(), printData(), receive(), and reset().
vector<std::string> SampleCounter::rawmsg |
Referenced by accumulateData(), printData(), and reset().
string SampleCounter::sname |
Referenced by getHeaderLine(), and SampleCounter().
string SampleCounter::streamid |
Referenced by collectMetadata(), jsonData(), jsonStats(), and SampleCounter().
vector<float> SampleCounter::sums |
Referenced by accumulateData(), jsonStats(), printData(), and reset().
dsm_time_t SampleCounter::t1s |
Referenced by accumulateSample(), computeRate(), jsonStats(), and reset().
dsm_time_t SampleCounter::t2s |
Referenced by accumulateSample(), computeRate(), jsonStats(), and reset().
vector<dsm_time_t> SampleCounter::times |
Referenced by accumulateData(), jsonData(), and reset().
size_t SampleCounter::totalBytes |
Referenced by accumulateSample(), jsonStats(), and reset().
vector<vector<float> > SampleCounter::values |
Referenced by accumulateData(), jsonData(), and reset().
vector<string> SampleCounter::varnames |
Referenced by getHeaderLine(), jsonData(), jsonStats(), printData(), and SampleCounter().