nidas
v1.2-1520
|
Implementation of portions of SampleOutput. More...
#include <SampleOutput.h>
Public Member Functions | |
SampleOutputBase () | |
SampleOutputBase (IOChannel *iochan, SampleConnectionRequester *rqstr=0) | |
Create a SampleOutput with a connected IOChannel. More... | |
~SampleOutputBase () | |
virtual void | setIOChannel (IOChannel *val) |
Set the IOChannel for this SampleOutput. More... | |
SampleOutput * | getOriginal () const |
Get pointer to SampleOutput that was cloned. More... | |
void | setName (const std::string &val) |
const std::string & | getName () const |
bool | isRaw () const |
void | addRequestedSampleTag (SampleTag *tag) throw (nidas::util::InvalidParameterException) |
Some SampleOutputs don't send out all the Samples that they receive. More... | |
std::list< const SampleTag * > | getRequestedSampleTags () const |
void | addSourceSampleTag (const SampleTag *tag) throw (nidas::util::InvalidParameterException) |
Some SampleOutputs like to be informed of what SampleTags they will be receiving from their SampleSources before they make a connection. More... | |
void | addSourceSampleTags (const std::list< const SampleTag * > &tags) throw (nidas::util::InvalidParameterException) |
std::list< const SampleTag * > | getSourceSampleTags () const |
void | requestConnection (SampleConnectionRequester *) throw (nidas::util::IOException) |
Request a connection, but don't wait for it. More... | |
SampleOutput * | connected (IOChannel *ochan) throw () |
Implementation of IOChannelRequester::connected(). More... | |
int | getReconnectDelaySecs () const |
Base class implementation. More... | |
void | setReconnectDelaySecs (int val) |
int | getFd () const |
void | close () throw (nidas::util::IOException) |
dsm_time_t | getNextFileTime () const |
void | createNextFile (dsm_time_t) throw (nidas::util::IOException) |
size_t | write (const void *buf, size_t len) override throw (nidas::util::IOException) |
Raw write method, typically used to write the initial header. More... | |
void | fromDOMElement (const xercesc::DOMElement *node) throw (nidas::util::InvalidParameterException) |
Initialize myself from a xercesc::DOMElement. More... | |
IOChannel * | getIOChannel () const |
void | setHeaderSource (HeaderSource *val) |
void | setDSMConfig (const DSMConfig *val) |
const DSMConfig * | getDSMConfig () const |
size_t | getNumDiscardedSamples () const |
void | addParameter (Parameter *val) |
Add a parameter to this DSMSensor. More... | |
const std::list< const Parameter * > & | getParameters () const |
Get list of parameters. More... | |
const Parameter * | getParameter (const std::string &name) const |
Fetch a parameter by name. More... | |
void | setLatency (float val) throw (nidas::util::InvalidParameterException) |
Set desired latency, providing some control over the response time vs buffer efficiency tradeoff. More... | |
float | getLatency () const |
virtual bool | receive (const Sample *s)=0 throw () |
Method called to pass a sample to this client. More... | |
virtual void | flush ()=0 throw () |
Ask that this SampleClient send out any buffered Samples that it may be holding. More... | |
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 | |
SampleOutputBase (SampleOutputBase &, IOChannel *) | |
Protected copy constructor, with a new, connected IOChannel. More... | |
size_t | incrementDiscardedSamples () |
SampleConnectionRequester * | getSampleConnectionRequester () |
void | disconnect () throw (nidas::util::IOException) |
Close the IOChannel and notify whoever did the requestConnection that it is time to disconnect, perhaps because of an IOException. More... | |
virtual SampleOutput * | clone (IOChannel *iochannel)=0 |
Protected Attributes | |
std::string | _name |
Private Member Functions | |
SampleOutputBase (const SampleOutputBase &) | |
No copy. More... | |
SampleOutputBase & | operator= (const SampleOutputBase &) |
No assignment. More... | |
Private Attributes | |
nidas::util::Mutex | _tagsMutex |
std::list< SampleTag * > | _requestedTags |
std::list< const SampleTag * > | _constRequestedTags |
IOChannel * | _iochan |
SampleConnectionRequester * | _connectionRequester |
dsm_time_t | _nextFileTime |
HeaderSource * | _headerSource |
const DSMConfig * | _dsm |
size_t | _nsamplesDiscarded |
std::map< std::string, Parameter * > | _parameters |
Map of parameters by name. More... | |
std::list< const Parameter * > | _constParameters |
List of const pointers to Parameters for providing via getParameters(). More... | |
std::list< const SampleTag * > | _sourceTags |
SampleOutput * | _original |
Pointer to the SampleOutput that I was cloned from. More... | |
float | _latency |
int | _reconnectDelaySecs |
Implementation of portions of SampleOutput.
SampleOutputBase::SampleOutputBase | ( | ) |
SampleOutputBase::SampleOutputBase | ( | IOChannel * | iochan, |
SampleConnectionRequester * | rqstr = 0 |
||
) |
Create a SampleOutput with a connected IOChannel.
rqstr,: | If non-NULL, who to call to notify that the connection has dropped. |
SampleOutputBase::~SampleOutputBase | ( | ) |
References _iochan, _parameters, and _requestedTags.
|
protected |
Protected copy constructor, with a new, connected IOChannel.
References _iochan, addRequestedSampleTag(), addSourceSampleTag(), getDSMConfig(), getRequestedSampleTags(), getSourceSampleTags(), and nidas::core::IOChannel::setDSMConfig().
|
private |
No copy.
void SampleOutputBase::addParameter | ( | Parameter * | val | ) |
Add a parameter to this DSMSensor.
DSMSensor 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.
References _constParameters, _parameters, and nidas::core::Parameter::getName().
|
virtual |
Some SampleOutputs don't send out all the Samples that they receive.
At configuration time, one can use this method to request the SampleTags that should be output from a SampleOutput. SampleOutput will own the pointer.
Implements nidas::core::SampleOutput.
Reimplemented in nidas::dynld::isff::GOESOutput, and nidas::dynld::raf::CVIOutput.
Referenced by nidas::dynld::raf::CVIOutput::addRequestedSampleTag(), nidas::dynld::isff::GOESOutput::addRequestedSampleTag(), and SampleOutputBase().
|
virtual |
Some SampleOutputs like to be informed of what SampleTags they will be receiving from their SampleSources before they make a connection.
Users of SampleOutputs should call this method before calling requestConnection().
Implements nidas::core::SampleOutput.
Reimplemented in nidas::dynld::isff::GOESOutput.
Referenced by nidas::dynld::isff::GOESOutput::addSourceSampleTag(), and SampleOutputBase().
|
virtual |
Implements nidas::core::SampleOutput.
|
protectedpure virtualinherited |
|
virtual |
Implements nidas::core::SampleOutput.
Reimplemented in nidas::dynld::isff::GOESOutput, nidas::dynld::psql::PSQLSampleOutput, nidas::dynld::UDPSampleOutput, and nidas::dynld::SampleOutputStream.
References _iochan, _nextFileTime, nidas::core::IOChannel::close(), DLOG, and getName().
Referenced by nidas::dynld::SampleOutputStream::close(), nidas::dynld::UDPSampleOutput::close(), nidas::dynld::isff::GOESOutput::close(), and disconnect().
|
virtual |
Implementation of IOChannelRequester::connected().
How an IOChannel calls back to a SampleConnectionRequester that it is connected. The ConnectionRequester can then return a clone of itself if the IOChannel is a new instance.
Implements nidas::core::IOChannelRequester.
Reimplemented in nidas::dynld::isff::GOESOutput, nidas::dynld::psql::PSQLSampleOutput, nidas::dynld::UDPSampleOutput, and nidas::dynld::SampleOutputStream.
References nidas::core::SampleOutput::close().
Referenced by nidas::dynld::SampleOutputStream::connected(), nidas::dynld::UDPSampleOutput::connected(), and nidas::dynld::isff::GOESOutput::connected().
void SampleOutputBase::createNextFile | ( | dsm_time_t | tt | ) | |
throw | ( | nidas::util::IOException | |||
) |
References nidas::core::HeaderSource::sendDefaultHeader().
|
protected |
Close the IOChannel and notify whoever did the requestConnection that it is time to disconnect, perhaps because of an IOException.
This is typically called in the receive() method of a SampleOutput if it gets an IOException when writing data. A common implementation of a connection requester is to delete this SampleOutput after the removing it from the sample stream. So the caller method should immediately return after calling disconnect().
References _connectionRequester, close(), nidas::core::SampleConnectionRequester::disconnect(), getName(), and ILOG.
|
pure virtualinherited |
Ask that this SampleClient send out any buffered Samples that it may be holding.
Implemented in SampleDispatcher, DataStats, nidas::core::DSMSensor, nidas::dynld::raf::SyncRecordSource, nidas::core::NearestResamplerAtRate, nidas::core::SampleSorter, nidas::dynld::raf::SyncRecordReader, nidas::core::SampleBuffer, nidas::core::NearestResampler, nidas::dynld::StatisticsCruncher, nidas::core::SampleAverager, DumpClient, nidas::dynld::psql::PSQLSampleOutput, DumpClient, nidas::dynld::SampleOutputStream, nidas::dynld::isff::GOESOutput, nidas::core::SampleThread, nidas::dynld::UDPSampleOutput, nidas::dynld::AsciiOutput, nidas::dynld::raf::CVIOutput, nidas::dynld::raf::CVIProcessor, nidas::core::RemoteSerialConnection, and nidas::core::Resampler.
Referenced by nidas::core::DSMEngine::closeOutputs(), nidas::dynld::SampleProcessor::flush(), nidas::core::SampleArchiver::flush(), nidas::dynld::raf::CVIProcessor::flush(), nidas::dynld::StatisticsProcessor::flush(), nidas::dynld::raf::CVIProcessor::~CVIProcessor(), nidas::core::SampleArchiver::~SampleArchiver(), nidas::core::SampleIOProcessor::~SampleIOProcessor(), nidas::dynld::SampleProcessor::~SampleProcessor(), nidas::dynld::StatisticsProcessor::~StatisticsProcessor(), and nidas::dynld::raf::SyncRecordGenerator::~SyncRecordGenerator().
|
virtual |
Initialize myself from a xercesc::DOMElement.
Implements nidas::core::DOMable.
Reimplemented in nidas::dynld::isff::GOESOutput, nidas::dynld::psql::PSQLSampleOutput, nidas::dynld::UDPSampleOutput, and nidas::dynld::RawSampleOutputStream.
References nidas::core::IOChannel::createIOChannel(), nidas::core::Parameter::createParameter(), nidas::core::DOMable::fromDOMElement(), nidas::core::Project::getInstance(), nidas::core::XDOMAttr::getName(), nidas::core::XDOMElement::getNodeName(), nidas::core::IOChannel::setDSMConfig(), and WLOG.
Referenced by nidas::dynld::RawSampleOutputStream::fromDOMElement(), and nidas::dynld::UDPSampleOutput::fromDOMElement().
|
inlinevirtual |
Implements nidas::core::SampleOutput.
Referenced by SampleOutputBase(), and setIOChannel().
|
virtual |
Implements nidas::core::SampleOutput.
Reimplemented in nidas::dynld::psql::PSQLSampleOutput.
References _iochan, and nidas::core::IOChannel::getFd().
|
inlinevirtual |
Implements nidas::core::SampleOutput.
Referenced by nidas::dynld::AsciiOutput::AsciiOutput(), nidas::dynld::raf::CVIOutput::CVIOutput(), nidas::dynld::isff::GOESOutput::GOESOutput(), nidas::dynld::AsciiOutput::printHeader(), nidas::dynld::RawSampleOutputStream::RawSampleOutputStream(), nidas::dynld::SampleOutputStream::SampleOutputStream(), nidas::dynld::isff::GOESOutput::setIOChannel(), and nidas::dynld::raf::CVIOutput::setIOChannel().
|
inlinevirtual |
Implements nidas::core::SampleOutput.
Referenced by nidas::dynld::SampleOutputStream::SampleOutputStream().
|
inlinevirtual |
Implements nidas::core::SampleOutput.
Reimplemented in nidas::dynld::psql::PSQLSampleOutput.
Referenced by nidas::dynld::UDPSampleOutput::ConnectionMonitor::addConnection(), nidas::dynld::AsciiOutput::AsciiOutput(), nidas::dynld::isff::GOESOutput::cancelThread(), nidas::dynld::UDPSampleOutput::XMLSocketListener::checkWorkers(), close(), nidas::dynld::raf::CVIOutput::CVIOutput(), disconnect(), nidas::dynld::UDPSampleOutput::XMLSocketListener::fireWorkers(), nidas::dynld::SampleOutputStream::flush(), nidas::dynld::isff::GOESOutput::GOESOutput(), nidas::dynld::isff::GOESOutput::joinThread(), nidas::dynld::isff::GOESOutput::killThread(), nidas::dynld::RawSampleOutputStream::RawSampleOutputStream(), nidas::dynld::UDPSampleOutput::ConnectionMonitor::removeConnection(), nidas::dynld::isff::GOESOutput::run(), nidas::dynld::SampleOutputStream::SampleOutputStream(), nidas::dynld::isff::GOESOutput::setIOChannel(), nidas::dynld::raf::CVIOutput::setIOChannel(), and nidas::dynld::isff::GOESOutput::write().
|
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().
|
inline |
|
inline |
|
inlinevirtual |
Get pointer to SampleOutput that was cloned.
Will be NULL if this SampleOutput is an un-cloned original.
Implements nidas::core::SampleOutput.
const Parameter * SampleOutputBase::getParameter | ( | const std::string & | name | ) | const |
Fetch a parameter by name.
Returns a NULL pointer if no such parameter exists.
References _parameters.
|
inline |
Get list of parameters.
|
virtual |
Base class implementation.
If setReconnectDelaySecs() has been called on this SampleOutput, then that value will be returned. Otherwise this will return the value of the IOChannel.
Implements nidas::core::SampleOutput.
References _iochan, _reconnectDelaySecs, and nidas::core::IOChannel::getReconnectDelaySecs().
|
virtual |
Implements nidas::core::SampleOutput.
References _constRequestedTags, and _tagsMutex.
Referenced by nidas::dynld::isff::GOESProject::GOESProject(), nidas::dynld::isff::GOESOutput::run(), and SampleOutputBase().
|
inlineprotected |
|
virtual |
Implements nidas::core::SampleOutput.
References _sourceTags, and _tagsMutex.
Referenced by SampleOutputBase().
|
inlineprotected |
|
inlinevirtual |
Implements nidas::core::SampleOutput.
Reimplemented in nidas::dynld::psql::PSQLSampleOutput, and nidas::dynld::RawSampleOutputStream.
|
private |
No assignment.
|
pure virtualinherited |
Method called to pass a sample to this client.
This method is typically called by a SampleSource for each of its SampleClients when it has a sample ready. Returns true: success false: sample rejected. This is meant to signal a warning-type situation - like a socket not being available temporarily. True errors will be thrown as an IOException.
Implemented in SampleDispatcher, DataStats, nidas::core::DSMSensor, nidas::dynld::raf::SyncRecordSource, nidas::core::NearestResamplerAtRate, nidas::core::SampleSorter, nidas::core::SampleBuffer, nidas::dynld::raf::SyncRecordReader, TestClient, nidas::core::SampleAverager, nidas::core::NearestResampler, nidas::dynld::StatisticsCruncher, nidas::dynld::isff::GOESOutput, nidas::dynld::raf::CVIProcessor, DumpClient, DumpClient, nidas::dynld::psql::PSQLSampleOutput, nidas::core::RemoteSerialConnection, nidas::dynld::AsciiOutput, nidas::dynld::SampleOutputStream, nidas::dynld::UDPSampleOutput, and nidas::dynld::raf::CVIOutput.
|
virtual |
Request a connection, but don't wait for it.
Requester will be notified via SampleConnectionRequester interface when the connection has been made. It is not necessary to call this method if a SampleOutput is constructed with a connected IOChannel.
Implements nidas::core::SampleOutput.
Reimplemented in nidas::dynld::psql::PSQLSampleOutput, nidas::dynld::raf::CVIOutput, and nidas::dynld::AsciiOutput.
Referenced by nidas::dynld::AsciiOutput::requestConnection(), and nidas::dynld::raf::CVIOutput::requestConnection().
|
inlinevirtual |
Implements nidas::core::SampleOutput.
|
inlinevirtual |
Implements nidas::core::SampleOutput.
Referenced by NidsMerge::run(), SensorExtract::run(), and ARLIngest::run().
|
virtual |
Set the IOChannel for this SampleOutput.
This IOChannel is not yet connected. The IOChannel must be connected before the SampleOutput is used for I/O, using the requestConnection() method, or by IOChannel::connect() followed by SampleOutput::connected(IOChannel*).
Reimplemented in nidas::dynld::raf::CVIOutput, and nidas::dynld::isff::GOESOutput.
References _iochan, getDSMConfig(), and nidas::core::IOChannel::setDSMConfig().
Referenced by nidas::dynld::isff::GOESOutput::setIOChannel(), and nidas::dynld::raf::CVIOutput::setIOChannel().
|
inlinevirtual |
Set desired latency, providing some control over the response time vs buffer efficiency tradeoff.
Setting a latency of 1/10 sec means buffer data in the IOStream for a 1/10 sec, then send the data to the physical device.
val | Latency, in seconds. |
Implements nidas::core::SampleOutput.
Reimplemented in nidas::dynld::SampleOutputStream.
Referenced by nidas::dynld::SampleOutputStream::setLatency().
|
inlinevirtual |
Implements nidas::core::SampleOutput.
Reimplemented in nidas::dynld::psql::PSQLSampleOutput.
Referenced by nidas::dynld::AsciiOutput::AsciiOutput(), nidas::dynld::raf::CVIOutput::CVIOutput(), nidas::dynld::isff::GOESOutput::GOESOutput(), nidas::dynld::RawSampleOutputStream::RawSampleOutputStream(), nidas::dynld::SampleOutputStream::SampleOutputStream(), nidas::dynld::isff::GOESOutput::setIOChannel(), and nidas::dynld::raf::CVIOutput::setIOChannel().
|
virtual |
Implements nidas::core::SampleOutput.
References _reconnectDelaySecs.
Referenced by nidas::dynld::raf::SyncServer::init().
|
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.
|
overridevirtual |
Raw write method, typically used to write the initial header.
Implements nidas::core::SampleOutput.
Reimplemented in nidas::dynld::isff::GOESOutput.
References len.
|
private |
Referenced by disconnect().
|
private |
List of const pointers to Parameters for providing via getParameters().
Referenced by addParameter().
|
private |
Referenced by getRequestedSampleTags().
|
private |
|
private |
|
private |
Referenced by close(), getFd(), getReconnectDelaySecs(), SampleOutputBase(), setIOChannel(), and ~SampleOutputBase().
|
private |
|
protected |
|
private |
Referenced by close().
|
private |
|
private |
Pointer to the SampleOutput that I was cloned from.
|
private |
Map of parameters by name.
Referenced by addParameter(), getParameter(), and ~SampleOutputBase().
|
private |
Referenced by getReconnectDelaySecs(), and setReconnectDelaySecs().
|
private |
Referenced by ~SampleOutputBase().
|
private |
Referenced by getSourceSampleTags().
|
mutableprivate |
Referenced by getRequestedSampleTags(), and getSourceSampleTags().