nidas
v1.2-1520
|
#include <RawSampleInputStream.h>
Public Types | |
typedef nidas::core::dsm_time_t | dsm_time_t |
Public Member Functions | |
RawSampleInputStream () | |
Default constructor. More... | |
RawSampleInputStream (nidas::core::IOChannel *iochannel) | |
Constructor with a connected IOChannel. More... | |
RawSampleInputStream * | clone (nidas::core::IOChannel *) |
Create a copy with a different, connected IOChannel. More... | |
virtual | ~RawSampleInputStream () |
void | fromDOMElement (const xercesc::DOMElement *node) throw (nidas::util::InvalidParameterException) |
Initialize myself from a xercesc::DOMElement. More... | |
std::string | getName () const |
int | getFd () const |
virtual void | setIOChannel (nidas::core::IOChannel *val) |
Set the IOChannel for this SampleInputStream.h. More... | |
void | readInputHeader () throw (nidas::util::IOException) |
Read archive information at beginning of input stream or file. More... | |
bool | parseInputHeader () throw (nidas::util::IOException) |
const nidas::core::SampleInputHeader & | getInputHeader () const |
void | requestConnection (nidas::core::DSMService *) throw (nidas::util::IOException) |
virtual nidas::core::SampleInput * | getOriginal () const |
nidas::core::SampleInput * | connected (nidas::core::IOChannel *iochan) throw () |
Implementation of IOChannelRequester::connected. More... | |
void | setNonBlocking (bool val) throw (nidas::util::IOException) |
bool | isNonBlocking () const throw (nidas::util::IOException) |
const nidas::core::DSMConfig * | getDSMConfig () const |
What DSM am I connnected to? May be NULL if it cannot be determined. More... | |
void | setKeepStats (bool val) |
void | addSampleTag (const nidas::core::SampleTag *tag) throw () |
Implementation of SampleInput::addSampleTag(). More... | |
void | removeSampleTag (const nidas::core::SampleTag *tag) throw () |
nidas::core::SampleSource * | getRawSampleSource () |
Several objects in NIDAS can be both a SampleSource of raw Samples and processed Samples. More... | |
nidas::core::SampleSource * | getProcessedSampleSource () |
Several objects in NIDAS can be both a SampleSource of raw Samples and processed Samples. More... | |
std::list< const nidas::core::SampleTag * > | getSampleTags () const |
Get the output SampleTags. More... | |
nidas::core::SampleTagIterator | getSampleTagIterator () const |
Implementation of SampleSource::getSampleTagIterator(). More... | |
void | addSampleClient (nidas::core::SampleClient *client) throw () |
Implementation of SampleSource::addSampleClient(). More... | |
void | removeSampleClient (nidas::core::SampleClient *client) throw () |
Remove a SampleClient from this SampleSource. More... | |
void | addSampleClientForTag (nidas::core::SampleClient *client, const nidas::core::SampleTag *tag) throw () |
Add a Client for a given SampleTag. More... | |
void | removeSampleClientForTag (nidas::core::SampleClient *client, const nidas::core::SampleTag *tag) 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 SampleSource::flush(), unpacks and distributes any samples currently in the read buffer. More... | |
const nidas::core::SampleStats & | getSampleStats () const |
bool | readSamples () throw (nidas::util::IOException) |
Read a buffer of data, serialize the data into samples, and distribute() samples to the receive() method of my SampleClients and DSMSensors. More... | |
void | search (const nidas::util::UTime &tt) throw (nidas::util::IOException) |
Search forward until a sample header is read whose time is greater than or equal to tt. More... | |
nidas::core::Sample * | readSample () throw (nidas::util::IOException) |
Read the next sample from the InputStream. More... | |
void | distribute (const nidas::core::Sample *s) throw () |
Distribute a sample to my clients. More... | |
size_t | getBadSamples () const |
void | close () throw (nidas::util::IOException) |
void | setBadSampleFilter (const nidas::core::BadSampleFilter &bsf) |
Replace the bad sample filter rules for this stream with bsf . More... | |
void | setFilterBadSamples (bool val) |
See BadSampleFilter. More... | |
void | setMinDsmId (int val) |
See BadSampleFilter. More... | |
void | setMaxDsmId (int val) |
See BadSampleFilter. More... | |
void | setMinSampleLength (unsigned int val) |
See BadSampleFilter. More... | |
void | setMaxSampleLength (unsigned int val) |
See BadSampleFilter. More... | |
void | setMinSampleTime (const nidas::util::UTime &val) |
See BadSampleFilter. More... | |
void | setMaxSampleTime (const nidas::util::UTime &val) |
See BadSampleFilter. More... | |
void | setExpectHeader (bool val) |
bool | getExpectHeader () const |
virtual xercesc::DOMElement * | toDOMParent (xercesc::DOMElement *parent, bool complete) const throw (xercesc::DOMException) |
Create a DOMElement and append it to the parent. More... | |
virtual xercesc::DOMElement * | toDOMElement (xercesc::DOMElement *node, bool complete) const throw (xercesc::DOMException) |
Add my content into a DOMElement. More... | |
Static Public Member Functions | |
static const XMLCh * | getNamespaceURI () |
Protected Member Functions | |
RawSampleInputStream (RawSampleInputStream &x, nidas::core::IOChannel *) | |
Create a copy, but with a new IOChannel. More... | |
Protected Attributes | |
nidas::core::IOChannel * | _iochan |
nidas::core::SampleSourceSupport | _source |
|
inherited |
RawSampleInputStream::RawSampleInputStream | ( | ) |
Default constructor.
Referenced by clone().
RawSampleInputStream::RawSampleInputStream | ( | nidas::core::IOChannel * | iochannel | ) |
Constructor with a connected IOChannel.
iochannel | The IOChannel that we use for data input. RawSampleInputStream will own the pointer to the IOChannel, and will delete it in ~RawSampleInputStream(). |
|
virtual |
|
protected |
Create a copy, but with a new IOChannel.
|
inlinevirtualinherited |
Implementation of SampleSource::addSampleClient().
Implements nidas::core::SampleSource.
References nidas::dynld::SampleInputStream::_source, and nidas::core::SampleSourceSupport::addSampleClient().
|
inlinevirtualinherited |
Add a Client for a given SampleTag.
Implementation of SampleSource::addSampleClient().
Implements nidas::core::SampleSource.
References nidas::dynld::SampleInputStream::_source, and nidas::core::SampleSourceSupport::addSampleClientForTag().
|
inlinevirtualinherited |
Implementation of SampleInput::addSampleTag().
Implements nidas::core::SampleSource.
References nidas::dynld::SampleInputStream::_source, and nidas::core::SampleSourceSupport::addSampleTag().
Referenced by nidas::dynld::raf::SyncServer::initSensors(), StatsProcess::run(), and DataPrep::run().
|
virtual |
Create a copy with a different, connected IOChannel.
Create a clone, with a new, connected IOChannel.
Reimplemented from nidas::dynld::SampleInputStream.
References RawSampleInputStream().
|
virtualinherited |
Implements nidas::core::SampleInput.
References nidas::dynld::SampleInputStream::_iochan, nidas::dynld::SampleInputStream::_iostream, nidas::core::IOChannel::close(), and nidas::dynld::SampleInputStream::closeBlocks().
Referenced by NidsMerge::run(), StatsProcess::run(), DataPrep::run(), nidas::dynld::raf::SyncServer::stop(), and nidas::dynld::SampleInputStream::~SampleInputStream().
|
virtualinherited |
Implementation of IOChannelRequester::connected.
One can use this method to notify SampleInputStream that the IOChannel is connected, which will cause SampleInputStream to open the IOStream.
Implements nidas::core::IOChannelRequester.
|
inlineinherited |
Distribute a sample to my clients.
One could use this to insert a sample into the stream.
References nidas::dynld::SampleInputStream::_source, and nidas::core::SampleSourceSupport::distribute().
Referenced by nidas::dynld::raf::SyncServer::handleSample().
|
virtualinherited |
Implementation of SampleSource::flush(), unpacks and distributes any samples currently in the read buffer.
Implements nidas::core::SampleSource.
References nidas::dynld::SampleInputStream::_source, CNAME, nidas::core::SampleSourceSupport::distribute(), nidas::core::SampleSourceSupport::getClientCount(), nidas::dynld::SampleInputStream::nextSample(), and VLOG.
|
virtual |
Initialize myself from a xercesc::DOMElement.
Implements nidas::core::DOMable.
References nidas::dynld::SampleInputStream::fromDOMElement(), and nidas::core::RAW_SAMPLE.
|
inlineinherited |
References nidas::dynld::SampleInputStream::_badSamples.
|
inlinevirtualinherited |
How many SampleClients are currently in my list.
Implements nidas::core::SampleSource.
References nidas::dynld::SampleInputStream::_source, and nidas::core::SampleSourceSupport::getClientCount().
|
virtualinherited |
What DSM am I connnected to? May be NULL if it cannot be determined.
Implements nidas::core::SampleInput.
References nidas::dynld::SampleInputStream::_dsm.
|
inlineinherited |
References nidas::dynld::SampleInputStream::_expectHeader.
|
virtualinherited |
Implements nidas::core::SampleInput.
References nidas::dynld::SampleInputStream::_iochan, and nidas::core::IOChannel::getFd().
|
inlineinherited |
|
virtualinherited |
Implements nidas::core::SampleInput.
References nidas::dynld::SampleInputStream::_iochan, and nidas::core::IOChannel::getName().
Referenced by nidas::dynld::SampleInputStream::parseInputHeader(), nidas::dynld::SampleInputStream::readInputHeader(), MergeVerifier::reportBackward(), MergeVerifier::reportDuplicate(), MergeVerifier::reportMissing(), MergeVerifier::run(), and nidas::dynld::SampleInputStream::sampleFromHeader().
|
inlinestaticinherited |
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::ProjectConfig::toDOMParent(), nidas::core::Datasets::toDOMParent(), nidas::core::ProjectConfigs::toDOMParent(), nidas::core::DSMConfig::toDOMParent(), nidas::core::Project::toDOMParent(), nidas::core::Site::toDOMParent(), nidas::core::SampleTag::toDOMParent(), nidas::core::ServerSocket::toDOMParent(), nidas::core::Variable::toDOMParent(), nidas::core::DSMSensor::toDOMParent(), nidas::core::Datasets::writeXML(), and nidas::core::ProjectConfigs::writeXML().
|
inlinevirtualinherited |
Implements nidas::core::SampleInput.
References nidas::dynld::SampleInputStream::_original.
|
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::dynld::SampleInputStream::_source, and nidas::core::SampleSourceSupport::getProcessedSampleSource().
|
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::dynld::SampleInputStream::_source, and nidas::core::SampleSourceSupport::getRawSampleSource().
|
inlinevirtualinherited |
Implements nidas::core::SampleSource.
References nidas::dynld::SampleInputStream::_source, and nidas::core::SampleSourceSupport::getSampleStats().
|
inlinevirtualinherited |
Implementation of SampleSource::getSampleTagIterator().
Implements nidas::core::SampleSource.
References nidas::dynld::SampleInputStream::_source, and nidas::core::SampleSourceSupport::getSampleTagIterator().
|
inlinevirtualinherited |
Get the output SampleTags.
Implements nidas::core::SampleSource.
References nidas::dynld::SampleInputStream::_source, and nidas::core::SampleSourceSupport::getSampleTags().
|
virtualinherited |
Implements nidas::core::SampleInput.
References nidas::dynld::SampleInputStream::_iochan, and nidas::core::IOChannel::isNonBlocking().
|
inherited |
References nidas::dynld::SampleInputStream::_bsf, nidas::dynld::SampleInputStream::_dataToRead, nidas::dynld::SampleInputStream::_expectHeader, nidas::dynld::SampleInputStream::_headerToRead, nidas::dynld::SampleInputStream::_hptr, nidas::dynld::SampleInputStream::_inputHeader, nidas::dynld::SampleInputStream::_inputHeaderParsed, nidas::dynld::SampleInputStream::_iostream, nidas::dynld::SampleInputStream::_samp, nidas::dynld::SampleInputStream::_sheader, nidas::core::IOStream::backup(), CNAME, DLOG, nidas::core::Sample::freeReference(), nidas::dynld::SampleInputStream::getName(), nidas::core::IOStream::getNumInputBytes(), nidas::core::SampleHeader::getSizeOf(), nidas::core::SampleInputHeader::parse(), PLOG, nidas::core::BadSampleFilter::skipNidasHeader(), and nidas::util::Exception::what().
Referenced by nidas::dynld::SampleInputStream::readInputHeader().
|
inherited |
Read archive information at beginning of input stream or file.
References nidas::dynld::SampleInputStream::_inputHeaderParsed, nidas::dynld::SampleInputStream::_iostream, nidas::dynld::SampleInputStream::_last_name, CNAME, DLOG, nidas::dynld::SampleInputStream::getName(), nidas::core::IOStream::getNumInputBytes(), nidas::dynld::SampleInputStream::parseInputHeader(), and nidas::core::IOStream::read().
Referenced by nidas::dynld::raf::SyncRecordReader::init(), nidas::dynld::raf::SyncServer::openStream(), DataStats::readHeader(), MergeVerifier::run(), SensorExtract::run(), StatsProcess::run(), ExtractFast2D::run(), ExtractDMT::run(), and DataPrep::run().
|
virtualinherited |
Read the next sample from the InputStream.
The caller must call freeReference on the sample when they're done with it. This method may perform zero or more reads of the IOChannel.
Implements nidas::core::SampleInput.
References nidas::dynld::SampleInputStream::nextSample().
Referenced by nidas::dynld::raf::SyncRecordReader::init(), nidas::dynld::raf::SyncServer::openStream(), nidas::dynld::raf::SyncServer::read(), NidsMerge::run(), MergeVerifier::run(), SensorExtract::run(), ExtractFast2D::run(), and ExtractDMT::run().
|
virtualinherited |
Read a buffer of data, serialize the data into samples, and distribute() samples to the receive() method of my SampleClients and DSMSensors.
This will perform only one physical read of the underlying IOChannel and so is appropriate to use when a select() or poll() has determined that there is data available on the file descriptor, or when the physical device is configured for non-blocking reads.
Implements nidas::core::SampleInput.
References nidas::dynld::SampleInputStream::_ateof, nidas::dynld::SampleInputStream::_iostream, nidas::dynld::SampleInputStream::_source, nidas::core::IOStream::available(), CNAME, nidas::core::SampleSourceSupport::distribute(), nidas::dynld::SampleInputStream::ReadResult::eof, nidas::dynld::SampleInputStream::handleEOF(), nidas::dynld::SampleInputStream::ReadResult::len, nidas::dynld::SampleInputStream::ReadResult::newinput, nidas::dynld::SampleInputStream::nextSample(), nidas::dynld::SampleInputStream::read(), and VLOG.
Referenced by DataStats::readSamples(), StatsProcess::run(), and DataPrep::run().
|
inlinevirtualinherited |
Remove a SampleClient from this SampleSource.
Implements nidas::core::SampleSource.
References nidas::dynld::SampleInputStream::_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.
References nidas::dynld::SampleInputStream::_source, and nidas::core::SampleSourceSupport::removeSampleClientForTag().
|
inlinevirtualinherited |
Implements nidas::core::SampleSource.
References nidas::dynld::SampleInputStream::_source, and nidas::core::SampleSourceSupport::removeSampleTag().
|
virtualinherited |
Implements nidas::core::SampleInput.
|
inherited |
Search forward until a sample header is read whose time is greater than or equal to tt.
Leaves the InputStream positioned so that the next call to readSample() or readSamples() will read the rest of the sample.
Referenced by StatsProcess::run(), and DataPrep::run().
|
inlineinherited |
Replace the bad sample filter rules for this stream with bsf
.
References nidas::dynld::SampleInputStream::_bsf.
Referenced by StatsProcess::run(), DataPrep::run(), and DataStats::run().
|
inlineinherited |
References nidas::dynld::SampleInputStream::_expectHeader.
Referenced by nidas::dynld::SampleInputStream::setIOChannel().
|
inlineinherited |
See BadSampleFilter.
References nidas::dynld::SampleInputStream::_bsf, and nidas::core::BadSampleFilter::setFilterBadSamples().
|
virtualinherited |
Set the IOChannel for this SampleInputStream.h.
References nidas::dynld::SampleInputStream::_dsm, nidas::dynld::SampleInputStream::_iochan, nidas::core::IOChannel::close(), nidas::core::Project::findDSM(), nidas::core::IOChannel::getConnectionInfo(), nidas::util::Inet4SocketAddress::getInet4Address(), nidas::core::Project::getInstance(), nidas::core::ConnectionInfo::getRemoteSocketAddress(), nidas::dynld::SampleInputStream::setExpectHeader(), and nidas::core::IOChannel::writeNidasHeader().
Referenced by nidas::dynld::SampleInputStream::SampleInputStream().
|
inlinevirtualinherited |
Implements nidas::core::SampleInput.
References nidas::dynld::SampleInputStream::_source, and nidas::core::SampleSourceSupport::setKeepStats().
|
inlineinherited |
See BadSampleFilter.
References nidas::dynld::SampleInputStream::_bsf, and nidas::core::BadSampleFilter::setMaxDsmId().
Referenced by nidas::dynld::raf::SyncServer::openStream().
|
inlineinherited |
See BadSampleFilter.
References nidas::dynld::SampleInputStream::_bsf, and nidas::core::BadSampleFilter::setMaxSampleLength().
Referenced by nidas::dynld::raf::SyncServer::openStream(), MergeVerifier::run(), and SensorExtract::run().
|
inlineinherited |
See BadSampleFilter.
References nidas::dynld::SampleInputStream::_bsf, and nidas::core::BadSampleFilter::setMaxSampleTime().
Referenced by nidas::dynld::raf::SyncServer::openStream(), and MergeVerifier::run().
|
inlineinherited |
See BadSampleFilter.
References nidas::dynld::SampleInputStream::_bsf, and nidas::core::BadSampleFilter::setMinDsmId().
|
inlineinherited |
See BadSampleFilter.
References nidas::dynld::SampleInputStream::_bsf, and nidas::core::BadSampleFilter::setMinSampleLength().
|
inlineinherited |
See BadSampleFilter.
References nidas::dynld::SampleInputStream::_bsf, and nidas::core::BadSampleFilter::setMinSampleTime().
Referenced by nidas::dynld::raf::SyncServer::openStream(), and MergeVerifier::run().
|
virtualinherited |
Implements nidas::core::SampleInput.
|
virtualinherited |
Add my content into a DOMElement.
Reimplemented in nidas::core::DSMSensor, nidas::core::Variable, nidas::core::ServerSocket, nidas::core::SampleTag, nidas::core::Site, nidas::core::Project, and nidas::core::DSMConfig.
Referenced by nidas::core::ServerSocket::toDOMParent().
|
virtualinherited |
Create a DOMElement and append it to the parent.
Reimplemented in nidas::core::DSMSensor, nidas::core::Variable, nidas::core::ServerSocket, nidas::core::SampleTag, nidas::core::Site, nidas::core::Project, and nidas::core::DSMConfig.
|
protectedinherited |
Referenced by nidas::dynld::SampleInputStream::close(), nidas::dynld::SampleInputStream::getFd(), nidas::dynld::SampleInputStream::getName(), nidas::dynld::SampleInputStream::isNonBlocking(), nidas::dynld::SampleInputStream::SampleInputStream(), nidas::dynld::SampleInputStream::setIOChannel(), and nidas::dynld::SampleInputStream::~SampleInputStream().
|
protectedinherited |
Referenced by nidas::dynld::SampleInputStream::addSampleClient(), nidas::dynld::SampleInputStream::addSampleClientForTag(), nidas::dynld::SampleInputStream::addSampleTag(), nidas::dynld::SampleInputStream::distribute(), nidas::dynld::SampleInputStream::flush(), nidas::dynld::SampleInputStream::getClientCount(), nidas::dynld::SampleInputStream::getProcessedSampleSource(), nidas::dynld::SampleInputStream::getRawSampleSource(), nidas::dynld::SampleInputStream::getSampleStats(), nidas::dynld::SampleInputStream::getSampleTagIterator(), nidas::dynld::SampleInputStream::getSampleTags(), nidas::dynld::isff::PacketInputStream::readSamples(), nidas::dynld::SampleInputStream::readSamples(), nidas::dynld::SampleInputStream::removeSampleClient(), nidas::dynld::SampleInputStream::removeSampleClientForTag(), nidas::dynld::SampleInputStream::removeSampleTag(), and nidas::dynld::SampleInputStream::setKeepStats().