nidas
v1.2-1520
|
#include <PacketInputStream.h>
Public Types | |
typedef nidas::core::dsm_time_t | dsm_time_t |
Public Member Functions | |
throw (nidas::util::InvalidParameterException) | |
Constructor. More... | |
PacketInputStream (const PacketInputStream &x, nidas::core::IOChannel *iochannel) | |
Copy constructor, with a new, connected IOChannel. More... | |
virtual PacketInputStream * | clone (nidas::core::IOChannel *iochannel) |
Create a clone, with a new, connected IOChannel. More... | |
virtual | ~PacketInputStream () |
std::string | getName () const |
std::list< const nidas::core::SampleTag * > | getSampleTags () const |
What SampleTags am I a SampleSource for? More... | |
void | init () throw () |
nidas::core::Sample * | readSample () throw (nidas::util::IOException) |
Read the next sample from the InputStream. More... | |
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 | close () throw (nidas::util::IOException) |
void | flush () throw () |
Implementation of SampleSource::flush(). More... | |
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... | |
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... | |
const nidas::core::SampleStats & | getSampleStats () const |
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... | |
void | distribute (const nidas::core::Sample *s) throw () |
Distribute a sample to my clients. More... | |
size_t | getBadSamples () const |
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 | fromDOMElement (const xercesc::DOMElement *node) throw (nidas::util::InvalidParameterException) |
Initialize myself from a xercesc::DOMElement. 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 Attributes | |
nidas::core::SampleSourceSupport | _source |
Private Member Functions | |
const nidas::core::SampleTag * | findSampleTag (int configId, int goesId, int sampleId) throw (nidas::util::InvalidParameterException) |
const GOESProject * | getGOESProject (int configid) const throw (nidas::util::InvalidParameterException) |
PacketInputStream (const PacketInputStream &) | |
No copy. More... | |
PacketInputStream & | operator= (const PacketInputStream &) |
No assignment. More... | |
Private Attributes | |
nidas::core::IOChannel * | _iochan |
nidas::core::IOStream * | _iostream |
PacketParser * | _packetParser |
std::map< int, GOESProject * > | _projectsByConfigId |
|
inherited |
PacketInputStream::PacketInputStream | ( | const PacketInputStream & | x, |
nidas::core::IOChannel * | iochannel | ||
) |
Copy constructor, with a new, connected IOChannel.
References _iochan, and nidas::core::IOChannel::getBufferSize().
Referenced by clone().
|
virtual |
References _iochan, _iostream, and _packetParser.
|
private |
No copy.
|
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 clone, with a new, connected IOChannel.
Reimplemented from nidas::dynld::SampleInputStream.
References PacketInputStream().
|
virtual |
Implements nidas::core::SampleInput.
References _iochan, _iostream, _packetParser, and nidas::core::IOChannel::close().
Referenced by PacketDecode::run().
|
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().
|
private |
References DLOG, nidas::dynld::isff::GOESProject::getSampleTag(), and nidas::dynld::isff::GOESProject::getStationNumber().
Referenced by readSamples().
|
inlinevirtual |
Implementation of SampleSource::flush().
Implements nidas::core::SampleSource.
|
virtualinherited |
Initialize myself from a xercesc::DOMElement.
Implements nidas::core::DOMable.
References nidas::core::IOChannel::createIOChannel(), nidas::core::DOMable::fromDOMElement(), nidas::core::XDOMAttr::getName(), and WLOG.
Referenced by nidas::dynld::RawSampleInputStream::fromDOMElement().
|
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().
|
private |
References nidas::core::Project::getInstance(), nidas::core::ParameterT< T >::getLength(), nidas::core::Project::getName(), nidas::core::Project::getParameter(), nidas::core::Parameter::getType(), nidas::core::ParameterT< T >::getValue(), and nidas::core::Parameter::INT_PARAM.
Referenced by getSampleTags(), and readSamples().
|
inlineinherited |
|
virtual |
Implements nidas::core::SampleInput.
References _iochan, and nidas::core::IOChannel::getName().
Referenced by readSample(), and readSamples().
|
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().
|
virtual |
What SampleTags am I a SampleSource for?
Implements nidas::core::SampleSource.
References getGOESProject(), and nidas::dynld::isff::GOESProject::getSampleTags().
Referenced by PacketDecode::run().
void PacketInputStream::init | ( | ) | ||
throw | ( | |||
) |
References _iochan, nidas::core::IOChannel::getBufferSize(), nidas::util::Logger::getInstance(), nidas::util::Logger::log(), LOG_WARNING, and nidas::util::Exception::what().
Referenced by PacketDecode::run().
|
virtualinherited |
Implements nidas::core::SampleInput.
References nidas::dynld::SampleInputStream::_iochan, and nidas::core::IOChannel::isNonBlocking().
|
private |
No assignment.
|
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().
|
inlinevirtual |
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 getName().
|
virtual |
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() has determined that there is data available on our file descriptor.
Implements nidas::core::SampleInput.
References nidas::dynld::SampleInputStream::_source, nidas::core::SampleSourceSupport::distribute(), DLOG, findSampleTag(), nidas::dynld::isff::PacketInfo::getChannel(), nidas::core::SampleT< DataT >::getDataLength(), nidas::core::SampleT< DataT >::getDataPtr(), nidas::dynld::isff::PacketInfo::getFreqOffset(), getGOESProject(), nidas::dynld::isff::GOESProject::getGOESSampleTag(), nidas::core::SampleTag::getId(), nidas::util::Logger::getInstance(), getName(), nidas::dynld::isff::PacketInfo::getSignalStrength(), nidas::dynld::isff::GOESProject::getStationNumber(), nidas::dynld::isff::PacketInfo::getStatusInt(), nidas::core::SampleTag::getVariables(), nidas::dynld::isff::GOESProject::getXmitInterval(), nidas::dynld::isff::GOESProject::getXmitOffset(), len, nidas::util::Logger::log(), LOG_WARNING, nidas::dynld::isff::PacketParser::NESDIS_PT, nidas::core::Sample::setId(), nidas::core::Sample::setTimeTag(), USECS_PER_SEC, and nidas::util::Exception::what().
Referenced by PacketDecode::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.
nidas::dynld::isff::PacketInputStream::throw | ( | nidas::util::InvalidParameterException | ) |
Constructor.
iochannel | The IOChannel that we use for data input. SampleInputStream will own the pointer to the IOChannel, and will delete it in ~SampleInputStream(). If it is a null pointer, then it must be set within the fromDOMElement method. |
|
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.
|
private |
Referenced by close(), getName(), init(), PacketInputStream(), and ~PacketInputStream().
|
private |
Referenced by close(), and ~PacketInputStream().
|
private |
Referenced by close(), and ~PacketInputStream().
|
mutableprivate |
|
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(), readSamples(), nidas::dynld::SampleInputStream::readSamples(), nidas::dynld::SampleInputStream::removeSampleClient(), nidas::dynld::SampleInputStream::removeSampleClientForTag(), nidas::dynld::SampleInputStream::removeSampleTag(), and nidas::dynld::SampleInputStream::setKeepStats().