nidas  v1.2-1520
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
nidas::dynld::RawSampleInputStream Class Reference

#include <RawSampleInputStream.h>

Inheritance diagram for nidas::dynld::RawSampleInputStream:
Inheritance graph
[legend]

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...
 
RawSampleInputStreamclone (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::SampleInputgetOriginal () const
 
nidas::core::SampleInputconnected (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::DSMConfiggetDSMConfig () 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::SampleSourcegetRawSampleSource ()
 Several objects in NIDAS can be both a SampleSource of raw Samples and processed Samples. More...
 
nidas::core::SampleSourcegetProcessedSampleSource ()
 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::SampleStatsgetSampleStats () 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::SamplereadSample () 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
 

Member Typedef Documentation

Constructor & Destructor Documentation

RawSampleInputStream::RawSampleInputStream ( )

Default constructor.

Referenced by clone().

RawSampleInputStream::RawSampleInputStream ( nidas::core::IOChannel iochannel)

Constructor with a connected IOChannel.

Parameters
iochannelThe IOChannel that we use for data input. RawSampleInputStream will own the pointer to the IOChannel, and will delete it in ~RawSampleInputStream().
RawSampleInputStream::~RawSampleInputStream ( )
virtual
RawSampleInputStream::RawSampleInputStream ( RawSampleInputStream x,
nidas::core::IOChannel iochannel 
)
protected

Create a copy, but with a new IOChannel.

Member Function Documentation

void nidas::dynld::SampleInputStream::addSampleClient ( nidas::core::SampleClient client)
throw (
)
inlinevirtualinherited
void nidas::dynld::SampleInputStream::addSampleClientForTag ( nidas::core::SampleClient client,
const nidas::core::SampleTag tag 
)
throw (
)
inlinevirtualinherited
void nidas::dynld::SampleInputStream::addSampleTag ( const nidas::core::SampleTag tag)
throw (
)
inlinevirtualinherited
RawSampleInputStream * RawSampleInputStream::clone ( nidas::core::IOChannel iochannel)
virtual

Create a copy with a different, connected IOChannel.

Create a clone, with a new, connected IOChannel.

Reimplemented from nidas::dynld::SampleInputStream.

References RawSampleInputStream().

void SampleInputStream::close ( )
throw (nidas::util::IOException
)
virtualinherited
SampleInput * SampleInputStream::connected ( nidas::core::IOChannel iochan)
throw (
)
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.

void nidas::dynld::SampleInputStream::distribute ( const nidas::core::Sample s)
throw (
)
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().

void SampleInputStream::flush ( )
throw (
)
virtualinherited
void RawSampleInputStream::fromDOMElement ( const xercesc::DOMElement *  )
throw (nidas::util::InvalidParameterException
)
virtual

Initialize myself from a xercesc::DOMElement.

Implements nidas::core::DOMable.

References nidas::dynld::SampleInputStream::fromDOMElement(), and nidas::core::RAW_SAMPLE.

size_t nidas::dynld::SampleInputStream::getBadSamples ( ) const
inlineinherited
int nidas::dynld::SampleInputStream::getClientCount ( ) const
throw (
)
inlinevirtualinherited

How many SampleClients are currently in my list.

Implements nidas::core::SampleSource.

References nidas::dynld::SampleInputStream::_source, and nidas::core::SampleSourceSupport::getClientCount().

const DSMConfig * SampleInputStream::getDSMConfig ( ) const
virtualinherited

What DSM am I connnected to? May be NULL if it cannot be determined.

Implements nidas::core::SampleInput.

References nidas::dynld::SampleInputStream::_dsm.

bool nidas::dynld::SampleInputStream::getExpectHeader ( ) const
inlineinherited
int SampleInputStream::getFd ( ) const
virtualinherited
const nidas::core::SampleInputHeader& nidas::dynld::SampleInputStream::getInputHeader ( ) const
inlineinherited
string SampleInputStream::getName ( ) const
virtualinherited
static const XMLCh* nidas::core::DOMable::getNamespaceURI ( )
inlinestaticinherited
virtual nidas::core::SampleInput* nidas::dynld::SampleInputStream::getOriginal ( ) const
inlinevirtualinherited
nidas::core::SampleSource* nidas::dynld::SampleInputStream::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 processed samples.

Implements nidas::core::SampleSource.

References nidas::dynld::SampleInputStream::_source, and nidas::core::SampleSourceSupport::getProcessedSampleSource().

nidas::core::SampleSource* nidas::dynld::SampleInputStream::getRawSampleSource ( )
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().

const nidas::core::SampleStats& nidas::dynld::SampleInputStream::getSampleStats ( ) const
inlinevirtualinherited
nidas::core::SampleTagIterator nidas::dynld::SampleInputStream::getSampleTagIterator ( ) const
inlinevirtualinherited
std::list<const nidas::core::SampleTag*> nidas::dynld::SampleInputStream::getSampleTags ( ) const
inlinevirtualinherited
bool SampleInputStream::isNonBlocking ( ) const
throw (nidas::util::IOException
)
virtualinherited
bool SampleInputStream::parseInputHeader ( )
throw (nidas::util::IOException
)
inherited
void SampleInputStream::readInputHeader ( )
throw (nidas::util::IOException
)
inherited
Sample * SampleInputStream::readSample ( )
throw (nidas::util::IOException
)
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.

Returns
pointer to a sample, never NULL.

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().

bool SampleInputStream::readSamples ( )
throw (nidas::util::IOException
)
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.

Returns
false: no data available for physical read, likely the result of an EAGAIN from a non-blocking read on a file descriptor. true: physical read did not necessarily consume all available data.

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().

void nidas::dynld::SampleInputStream::removeSampleClient ( nidas::core::SampleClient c)
throw (
)
inlinevirtualinherited
void nidas::dynld::SampleInputStream::removeSampleClientForTag ( nidas::core::SampleClient c,
const nidas::core::SampleTag  
)
throw (
)
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().

void nidas::dynld::SampleInputStream::removeSampleTag ( const nidas::core::SampleTag tag)
throw (
)
inlinevirtualinherited
void SampleInputStream::requestConnection ( nidas::core::DSMService requester)
throw (nidas::util::IOException
)
virtualinherited
void SampleInputStream::search ( const nidas::util::UTime tt)
throw (nidas::util::IOException
)
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.

References CNAME, and DLOG.

Referenced by StatsProcess::run(), and DataPrep::run().

void nidas::dynld::SampleInputStream::setBadSampleFilter ( const nidas::core::BadSampleFilter bsf)
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().

void nidas::dynld::SampleInputStream::setExpectHeader ( bool  val)
inlineinherited
void nidas::dynld::SampleInputStream::setFilterBadSamples ( bool  val)
inlineinherited
void SampleInputStream::setIOChannel ( nidas::core::IOChannel val)
virtualinherited
void nidas::dynld::SampleInputStream::setKeepStats ( bool  val)
inlinevirtualinherited
void nidas::dynld::SampleInputStream::setMaxDsmId ( int  val)
inlineinherited
void nidas::dynld::SampleInputStream::setMaxSampleLength ( unsigned int  val)
inlineinherited
void nidas::dynld::SampleInputStream::setMaxSampleTime ( const nidas::util::UTime val)
inlineinherited
void nidas::dynld::SampleInputStream::setMinDsmId ( int  val)
inlineinherited
void nidas::dynld::SampleInputStream::setMinSampleLength ( unsigned int  val)
inlineinherited
void nidas::dynld::SampleInputStream::setMinSampleTime ( const nidas::util::UTime val)
inlineinherited
void SampleInputStream::setNonBlocking ( bool  val)
throw (nidas::util::IOException
)
virtualinherited
xercesc::DOMElement * DOMable::toDOMElement ( xercesc::DOMElement *  node,
bool  complete 
) const
throw (xercesc::DOMException
)
virtualinherited
xercesc::DOMElement * DOMable::toDOMParent ( xercesc::DOMElement *  parent,
bool  complete 
) const
throw (xercesc::DOMException
)
virtualinherited

Member Data Documentation

nidas::core::IOChannel* nidas::dynld::SampleInputStream::_iochan
protectedinherited
nidas::core::SampleSourceSupport nidas::dynld::SampleInputStream::_source
protectedinherited

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