nidas v1.2.3
|
Implementation of portions of SampleOutput. More...
#include <SampleOutput.h>
Static Public Member Functions | |
static const XMLCh * | getNamespaceURI () |
Protected Member Functions | |
SampleOutputBase (SampleOutputBase &, IOChannel *) | |
Protected copy constructor, with a new, connected IOChannel. | |
size_t | incrementDiscardedSamples () |
SampleConnectionRequester * | getSampleConnectionRequester () |
void | disconnect () |
Close the IOChannel and notify whoever did the requestConnection that it is time to disconnect, perhaps because of an IOException. | |
virtual SampleOutput * | clone (IOChannel *iochannel)=0 |
Protected Attributes | |
std::string | _name |
Private Member Functions | |
SampleOutputBase (const SampleOutputBase &) | |
No copy. | |
SampleOutputBase & | operator= (const SampleOutputBase &) |
No assignment. | |
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. | |
std::list< const Parameter * > | _constParameters |
List of const pointers to Parameters for providing via getParameters(). | |
std::list< const SampleTag * > | _sourceTags |
SampleOutput * | _original |
Pointer to the SampleOutput that I was cloned from. | |
float | _latency |
int | _reconnectDelaySecs |
dsm_time_t | _startTime |
Clipping time window. | |
dsm_time_t | _endTime |
Static Private Attributes | |
static XMLCh * | namespaceURI = 0 |
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, _requestedTags, and nidas::core::getSample().
|
protected |
Protected copy constructor, with a new, connected IOChannel.
References _iochan, addRequestedSampleTag(), addSourceSampleTag(), getDSMConfig(), nidas::core::getSample(), and nidas::core::IOChannel::setDSMConfig().
|
private |
No copy.
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::getSample().
Referenced by fromDOMElement().
nidas::util::InvalidParameterException |
Implements nidas::core::SampleOutput.
References _constRequestedTags, _requestedTags, _tagsMutex, and nidas::core::getSample().
Referenced by nidas::dynld::raf::CVIOutput::addRequestedSampleTag(), and SampleOutputBase().
nidas::util::InvalidParameterException |
Implements nidas::core::SampleOutput.
References _sourceTags, _tagsMutex, and nidas::core::getSample().
Referenced by addSourceSampleTags(), and SampleOutputBase().
nidas::util::InvalidParameterException |
Implements nidas::core::SampleOutput.
References addSourceSampleTag(), and nidas::core::getSample().
|
protectedpure virtualinherited |
Implemented in nidas::dynld::AsciiOutput, nidas::dynld::RawSampleOutputStream, nidas::dynld::SampleOutputStream, nidas::dynld::raf::CVIOutput, and nidas::dynld::UDPSampleOutput.
Referenced by connected().
|
virtual |
nidas::util::IOException |
Implements nidas::core::SampleOutput.
Reimplemented in nidas::dynld::SampleOutputStream, and nidas::dynld::UDPSampleOutput.
References _iochan, _nextFileTime, nidas::core::IOChannel::close(), DLOG, getName(), and nidas::core::getSample().
Referenced by nidas::dynld::SampleOutputStream::close(), nidas::dynld::UDPSampleOutput::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::SampleOutputStream, and nidas::dynld::UDPSampleOutput.
References _connectionRequester, _iochan, _nextFileTime, nidas::core::SampleOutput::clone(), nidas::core::IOChannel::close(), nidas::core::SampleConnectionRequester::connect(), nidas::core::getSample(), setIOChannel(), and setName().
Referenced by nidas::dynld::SampleOutputStream::connected(), and nidas::dynld::UDPSampleOutput::connected().
void SampleOutputBase::createNextFile | ( | dsm_time_t | tt | ) |
nidas::util::IOException |
References _headerSource, _nextFileTime, nidas::core::IOChannel::createFile(), getIOChannel(), nidas::core::HeaderSource::sendDefaultHeader(), and nidas::core::HeaderSource::sendHeader().
Referenced by nidas::dynld::AsciiOutput::receive(), and nidas::dynld::raf::CVIOutput::receive().
|
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().
nidas::util::IOException |
References _connectionRequester, close(), nidas::core::SampleConnectionRequester::disconnect(), getName(), nidas::core::getSample(), and ILOG.
Referenced by nidas::dynld::AsciiOutput::receive(), and nidas::dynld::raf::CVIOutput::receive().
Ask that this SampleClient send out any buffered Samples that it may be holding.
)
Implemented in DumpClient, SampleDispatcher, DataStats, DumpClient, nidas::core::DSMSensor, nidas::core::NearestResampler, nidas::core::NearestResamplerAtRate, nidas::core::RemoteSerialConnection, nidas::core::SampleAverager, nidas::core::SampleBuffer, nidas::core::SampleSorter, nidas::dynld::AsciiOutput, nidas::dynld::raf::CVIOutput, nidas::dynld::raf::CVIProcessor, nidas::dynld::raf::SyncRecordReader, nidas::dynld::raf::SyncRecordSource, nidas::dynld::SampleOutputStream, nidas::dynld::StatisticsCruncher, nidas::dynld::UDPSampleOutput, nidas::core::Resampler, and nidas::core::SampleThread.
Referenced by nidas::core::DSMEngine::closeOutputs(), nidas::core::SampleArchiver::flush(), nidas::dynld::raf::CVIProcessor::flush(), nidas::dynld::SampleProcessor::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().
nidas::util::InvalidParameterException |
Implements nidas::core::DOMable.
Reimplemented in nidas::dynld::UDPSampleOutput.
References addParameter(), nidas::core::IOChannel::createIOChannel(), nidas::core::Parameter::createParameter(), getDSMConfig(), nidas::core::Project::getInstance(), getIOChannel(), getName(), nidas::core::getSample(), setIOChannel(), setLatency(), setName(), and WLOG.
Referenced by nidas::dynld::UDPSampleOutput::fromDOMElement().
Implements nidas::core::SampleOutput.
References _dsm.
Referenced by fromDOMElement(), SampleOutputBase(), and setIOChannel().
|
virtual |
Implements nidas::core::SampleOutput.
References _iochan, and nidas::core::IOChannel::getFd().
|
inlinevirtual |
Implements nidas::core::SampleOutput.
References _iochan.
Referenced by nidas::dynld::AsciiOutput::AsciiOutput(), nidas::dynld::AsciiOutput::AsciiOutput(), nidas::dynld::AsciiOutput::connect(), createNextFile(), nidas::dynld::raf::CVIOutput::CVIOutput(), nidas::dynld::raf::CVIOutput::CVIOutput(), fromDOMElement(), nidas::dynld::RawSampleOutputStream::fromDOMElement(), nidas::dynld::UDPSampleOutput::fromDOMElement(), nidas::dynld::AsciiOutput::printHeader(), nidas::dynld::RawSampleOutputStream::RawSampleOutputStream(), nidas::dynld::RawSampleOutputStream::RawSampleOutputStream(), nidas::dynld::AsciiOutput::receive(), nidas::dynld::raf::CVIOutput::receive(), nidas::dynld::raf::CVIOutput::requestConnection(), nidas::dynld::SampleOutputStream::SampleOutputStream(), nidas::dynld::SampleOutputStream::SampleOutputStream(), nidas::dynld::raf::CVIOutput::setIOChannel(), and nidas::dynld::UDPSampleOutput::write().
|
inlinevirtual |
Implements nidas::core::SampleOutput.
References _latency.
Referenced by nidas::dynld::SampleOutputStream::SampleOutputStream(), and nidas::dynld::SampleOutputStream::SampleOutputStream().
|
inlinevirtual |
Implements nidas::core::SampleOutput.
References _name.
Referenced by nidas::dynld::UDPSampleOutput::ConnectionMonitor::addConnection(), nidas::dynld::AsciiOutput::AsciiOutput(), nidas::dynld::AsciiOutput::AsciiOutput(), nidas::dynld::UDPSampleOutput::XMLSocketListener::checkWorkers(), close(), nidas::dynld::raf::CVIOutput::CVIOutput(), nidas::dynld::raf::CVIOutput::CVIOutput(), disconnect(), nidas::dynld::UDPSampleOutput::XMLSocketListener::fireWorkers(), nidas::dynld::SampleOutputStream::flush(), fromDOMElement(), nidas::dynld::UDPSampleOutput::fromDOMElement(), nidas::dynld::RawSampleOutputStream::RawSampleOutputStream(), nidas::dynld::RawSampleOutputStream::RawSampleOutputStream(), nidas::dynld::AsciiOutput::receive(), nidas::dynld::raf::CVIOutput::receive(), nidas::dynld::UDPSampleOutput::ConnectionMonitor::removeConnection(), nidas::dynld::SampleOutputStream::SampleOutputStream(), nidas::dynld::SampleOutputStream::SampleOutputStream(), nidas::dynld::raf::CVIOutput::setIOChannel(), and nidas::dynld::SampleOutputStream::setLatency().
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::Datasets::toDOMParent(), nidas::core::ProjectConfig::toDOMParent(), nidas::core::ProjectConfigs::toDOMParent(), nidas::core::DSMConfig::toDOMParent(), nidas::core::DSMSensor::toDOMParent(), nidas::core::Project::toDOMParent(), nidas::core::SampleTag::toDOMParent(), nidas::core::Site::toDOMParent(), nidas::core::ServerSocket::toDOMParent(), nidas::core::Variable::toDOMParent(), nidas::core::Datasets::writeXML(), and nidas::core::ProjectConfigs::writeXML().
|
inline |
References _nextFileTime.
Referenced by nidas::dynld::AsciiOutput::receive(), and nidas::dynld::raf::CVIOutput::receive().
|
inline |
References _nsamplesDiscarded.
|
inlinevirtual |
Get pointer to SampleOutput that was cloned.
Will be NULL if this SampleOutput is an un-cloned original.
Implements nidas::core::SampleOutput.
References _original.
Fetch a parameter by name.
Returns a NULL pointer if no such parameter exists.
References _parameters.
|
inline |
Get list of parameters.
References _constParameters.
Referenced by nidas::dynld::UDPSampleOutput::fromDOMElement().
|
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().
Implements nidas::core::SampleOutput.
References _constRequestedTags, _tagsMutex, and nidas::core::getSample().
|
inlineprotected |
References _connectionRequester.
Implements nidas::core::SampleOutput.
References _sourceTags, _tagsMutex, and nidas::core::getSample().
|
inlineprotected |
References _nsamplesDiscarded.
|
inlinevirtual |
Implements nidas::core::SampleOutput.
|
private |
No assignment.
Return true if SampleOutputBase considers the sample handled, such as if it is outside the clipping window.
Otherwise return false to indicate the subclass should handle the sample.
Implements nidas::core::SampleClient.
Reimplemented in nidas::dynld::UDPSampleOutput, and nidas::dynld::SampleOutputStream.
References _endTime, and _startTime.
|
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.
nidas::util::IOException |
Implements nidas::core::SampleOutput.
References _connectionRequester, _iochan, nidas::core::getSample(), and nidas::core::IOChannel::requestConnection().
Referenced by nidas::dynld::AsciiOutput::requestConnection(), and nidas::dynld::raf::CVIOutput::requestConnection().
Implements nidas::core::SampleOutput.
References _dsm, and nidas::core::getSample().
|
inlinevirtual |
Implements nidas::core::SampleOutput.
References _headerSource, and nidas::core::getSample().
Referenced by ARLIngest::run(), NidsMerge::run(), and SensorExtract::run().
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.
References _iochan, getDSMConfig(), nidas::core::getSample(), and nidas::core::IOChannel::setDSMConfig().
Referenced by nidas::dynld::AsciiOutput::connect(), connected(), fromDOMElement(), and nidas::dynld::raf::CVIOutput::setIOChannel().
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. |
nidas::util::InvalidParameterException |
Implements nidas::core::SampleOutput.
Reimplemented in nidas::dynld::SampleOutputStream.
References _latency, and nidas::core::getSample().
Referenced by fromDOMElement(), and nidas::dynld::SampleOutputStream::setLatency().
Implements nidas::core::SampleOutput.
References _name, and nidas::core::getSample().
Referenced by nidas::dynld::AsciiOutput::AsciiOutput(), nidas::dynld::AsciiOutput::AsciiOutput(), connected(), nidas::dynld::raf::CVIOutput::CVIOutput(), nidas::dynld::raf::CVIOutput::CVIOutput(), fromDOMElement(), nidas::dynld::RawSampleOutputStream::RawSampleOutputStream(), nidas::dynld::RawSampleOutputStream::RawSampleOutputStream(), nidas::dynld::SampleOutputStream::SampleOutputStream(), nidas::dynld::SampleOutputStream::SampleOutputStream(), and nidas::dynld::raf::CVIOutput::setIOChannel().
Implements nidas::core::SampleOutput.
References _reconnectDelaySecs, and nidas::core::getSample().
Referenced by nidas::dynld::raf::SyncServer::init().
void SampleOutputBase::setTimeClippingWindow | ( | const nidas::util::UTime & | startTime, |
const nidas::util::UTime & | endTime ) |
The sample output can have a time window which clips the samples outside the window.
Only samples at or after startTime
and before endTime
will be passed along. One or both of start and end time can be zero, in which case only the non-zero times are used to clip samples.
References _endTime, _startTime, and nidas::util::UTime::toUsecs().
Referenced by nidas::core::NidasApp::setOutputClipping().
|
virtualinherited |
Add my content into a DOMElement.
xercesc::DOMException |
Reimplemented in nidas::core::DSMConfig, nidas::core::DSMSensor, nidas::core::Project, nidas::core::SampleTag, nidas::core::Site, nidas::core::ServerSocket, and nidas::core::Variable.
Referenced by nidas::core::ServerSocket::toDOMParent().
|
virtualinherited |
Create a DOMElement and append it to the parent.
xercesc::DOMException |
Reimplemented in nidas::core::DSMConfig, nidas::core::DSMSensor, nidas::core::Project, nidas::core::SampleTag, nidas::core::Site, nidas::core::ServerSocket, and nidas::core::Variable.
Raw write method, typically used to write the initial header.
nidas::util::IOException |
Implements nidas::core::SampleOutput.
References _iochan, nidas::core::getSample(), len, and nidas::core::IOChannel::write().
|
private |
Referenced by connected(), disconnect(), getSampleConnectionRequester(), and requestConnection().
List of const pointers to Parameters for providing via getParameters().
Referenced by addParameter(), and getParameters().
Referenced by addRequestedSampleTag(), and getRequestedSampleTags().
Referenced by getDSMConfig(), and setDSMConfig().
|
private |
Referenced by receive(), and setTimeClippingWindow().
|
private |
Referenced by createNextFile(), and setHeaderSource().
|
private |
Referenced by close(), connected(), getFd(), getIOChannel(), getReconnectDelaySecs(), requestConnection(), SampleOutputBase(), setIOChannel(), write(), and ~SampleOutputBase().
|
private |
Referenced by getLatency(), and setLatency().
|
private |
Referenced by close(), connected(), createNextFile(), and getNextFileTime().
|
private |
Referenced by getNumDiscardedSamples(), and incrementDiscardedSamples().
|
private |
Pointer to the SampleOutput that I was cloned from.
Referenced by getOriginal().
|
private |
Map of parameters by name.
Referenced by addParameter(), getParameter(), and ~SampleOutputBase().
|
private |
Referenced by getReconnectDelaySecs(), and setReconnectDelaySecs().
|
private |
Referenced by addRequestedSampleTag(), and ~SampleOutputBase().
Referenced by addSourceSampleTag(), and getSourceSampleTags().
|
private |
Clipping time window.
Samples outside the given time window will not pass.
Referenced by receive(), and setTimeClippingWindow().
|
mutableprivate |
Referenced by addRequestedSampleTag(), addSourceSampleTag(), getRequestedSampleTags(), and getSourceSampleTags().
|
staticprivateinherited |
Referenced by nidas::core::DOMable::getNamespaceURI().