nidas  v1.2-1520
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes | List of all members
nidas::core::SampleOutputBase Class Referenceabstract

Implementation of portions of SampleOutput. More...

#include <SampleOutput.h>

Inheritance diagram for nidas::core::SampleOutputBase:
Inheritance graph
[legend]

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...
 
SampleOutputgetOriginal () 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...
 
SampleOutputconnected (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...
 
IOChannelgetIOChannel () const
 
void setHeaderSource (HeaderSource *val)
 
void setDSMConfig (const DSMConfig *val)
 
const DSMConfiggetDSMConfig () 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 ParametergetParameter (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 ()
 
SampleConnectionRequestergetSampleConnectionRequester ()
 
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 SampleOutputclone (IOChannel *iochannel)=0
 

Protected Attributes

std::string _name
 

Private Member Functions

 SampleOutputBase (const SampleOutputBase &)
 No copy. More...
 
SampleOutputBaseoperator= (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
 

Detailed Description

Implementation of portions of SampleOutput.

Constructor & Destructor Documentation

SampleOutputBase::SampleOutputBase ( )
SampleOutputBase::SampleOutputBase ( IOChannel iochan,
SampleConnectionRequester rqstr = 0 
)

Create a SampleOutput with a connected IOChannel.

Parameters
rqstr,:If non-NULL, who to call to notify that the connection has dropped.
SampleOutputBase::~SampleOutputBase ( )

References _iochan, _parameters, and _requestedTags.

SampleOutputBase::SampleOutputBase ( SampleOutputBase x,
IOChannel ioc 
)
protected
nidas::core::SampleOutputBase::SampleOutputBase ( const SampleOutputBase )
private

No copy.

Member Function Documentation

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

void SampleOutputBase::addRequestedSampleTag ( SampleTag tag)
throw (nidas::util::InvalidParameterException
)
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().

void SampleOutputBase::addSourceSampleTag ( const SampleTag tag)
throw (nidas::util::InvalidParameterException
)
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().

void SampleOutputBase::addSourceSampleTags ( const std::list< const SampleTag * > &  tags)
throw (nidas::util::InvalidParameterException
)
virtual
virtual SampleOutput* nidas::core::SampleOutput::clone ( IOChannel iochannel)
protectedpure virtualinherited
void SampleOutputBase::close ( )
throw (nidas::util::IOException
)
virtual
SampleOutput * SampleOutputBase::connected ( IOChannel ochan)
throw (
)
virtual
void SampleOutputBase::createNextFile ( dsm_time_t  tt)
throw (nidas::util::IOException
)
void SampleOutputBase::disconnect ( )
throw (nidas::util::IOException
)
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.

virtual void nidas::core::SampleClient::flush ( )
throw (
)
pure virtualinherited
void SampleOutputBase::fromDOMElement ( const xercesc::DOMElement *  )
throw (nidas::util::InvalidParameterException
)
virtual
const DSMConfig* nidas::core::SampleOutputBase::getDSMConfig ( ) const
inlinevirtual
int SampleOutputBase::getFd ( ) const
virtual
IOChannel* nidas::core::SampleOutputBase::getIOChannel ( ) const
inlinevirtual
float nidas::core::SampleOutputBase::getLatency ( ) const
inlinevirtual
const std::string& nidas::core::SampleOutputBase::getName ( ) const
inlinevirtual
static const XMLCh* nidas::core::DOMable::getNamespaceURI ( )
inlinestaticinherited
dsm_time_t nidas::core::SampleOutputBase::getNextFileTime ( ) const
inline
size_t nidas::core::SampleOutputBase::getNumDiscardedSamples ( ) const
inline
SampleOutput* nidas::core::SampleOutputBase::getOriginal ( ) const
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.

const std::list<const Parameter*>& nidas::core::SampleOutputBase::getParameters ( ) const
inline

Get list of parameters.

int SampleOutputBase::getReconnectDelaySecs ( ) const
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().

std::list< const SampleTag * > SampleOutputBase::getRequestedSampleTags ( ) const
virtual
SampleConnectionRequester* nidas::core::SampleOutputBase::getSampleConnectionRequester ( )
inlineprotected
list< const SampleTag * > SampleOutputBase::getSourceSampleTags ( ) const
virtual

Implements nidas::core::SampleOutput.

References _sourceTags, and _tagsMutex.

Referenced by SampleOutputBase().

size_t nidas::core::SampleOutputBase::incrementDiscardedSamples ( )
inlineprotected
bool nidas::core::SampleOutputBase::isRaw ( ) const
inlinevirtual
SampleOutputBase& nidas::core::SampleOutputBase::operator= ( const SampleOutputBase )
private

No assignment.

virtual bool nidas::core::SampleClient::receive ( const Sample s)
throw (
)
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.

void SampleOutputBase::requestConnection ( SampleConnectionRequester requester)
throw (nidas::util::IOException
)
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().

void nidas::core::SampleOutputBase::setDSMConfig ( const DSMConfig val)
inlinevirtual
void nidas::core::SampleOutputBase::setHeaderSource ( HeaderSource val)
inlinevirtual
void SampleOutputBase::setIOChannel ( IOChannel val)
virtual
void nidas::core::SampleOutputBase::setLatency ( float  val)
throw (nidas::util::InvalidParameterException
)
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.

Parameters
valLatency, in seconds.

Implements nidas::core::SampleOutput.

Reimplemented in nidas::dynld::SampleOutputStream.

Referenced by nidas::dynld::SampleOutputStream::setLatency().

void nidas::core::SampleOutputBase::setName ( const std::string &  val)
inlinevirtual
void SampleOutputBase::setReconnectDelaySecs ( int  val)
virtual
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
size_t SampleOutputBase::write ( const void *  buf,
size_t  len 
)
throw (nidas::util::IOException
)
overridevirtual

Raw write method, typically used to write the initial header.

Implements nidas::core::SampleOutput.

Reimplemented in nidas::dynld::isff::GOESOutput.

References len.

Member Data Documentation

SampleConnectionRequester* nidas::core::SampleOutputBase::_connectionRequester
private

Referenced by disconnect().

std::list<const Parameter*> nidas::core::SampleOutputBase::_constParameters
private

List of const pointers to Parameters for providing via getParameters().

Referenced by addParameter().

std::list<const SampleTag*> nidas::core::SampleOutputBase::_constRequestedTags
private

Referenced by getRequestedSampleTags().

const DSMConfig* nidas::core::SampleOutputBase::_dsm
private
HeaderSource* nidas::core::SampleOutputBase::_headerSource
private
IOChannel* nidas::core::SampleOutputBase::_iochan
private
float nidas::core::SampleOutputBase::_latency
private
std::string nidas::core::SampleOutputBase::_name
protected
dsm_time_t nidas::core::SampleOutputBase::_nextFileTime
private

Referenced by close().

size_t nidas::core::SampleOutputBase::_nsamplesDiscarded
private
SampleOutput* nidas::core::SampleOutputBase::_original
private

Pointer to the SampleOutput that I was cloned from.

std::map<std::string,Parameter*> nidas::core::SampleOutputBase::_parameters
private

Map of parameters by name.

Referenced by addParameter(), getParameter(), and ~SampleOutputBase().

int nidas::core::SampleOutputBase::_reconnectDelaySecs
private
std::list<SampleTag*> nidas::core::SampleOutputBase::_requestedTags
private

Referenced by ~SampleOutputBase().

std::list<const SampleTag*> nidas::core::SampleOutputBase::_sourceTags
private

Referenced by getSourceSampleTags().

nidas::util::Mutex nidas::core::SampleOutputBase::_tagsMutex
mutableprivate

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