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

#include <AsciiOutput.h>

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

Public Types

enum  format {
  DEFAULT, ASCII, HEX, SIGNED_SHORT,
  UNSIGNED_SHORT, FLOAT, IRIG
}
 
typedef enum
nidas::dynld::AsciiOutput::format 
format_t
 

Public Member Functions

 AsciiOutput ()
 
 AsciiOutput (IOChannel *iochannel, SampleConnectionRequester *rqstr=0)
 
virtual ~AsciiOutput ()
 
void flush () throw ()
 Implementation of SampleClient::flush(). More...
 
void requestConnection (SampleConnectionRequester *requester) throw ()
 Request a connection, but don't wait for it. More...
 
void connect (nidas::core::SampleSource *) throw (nidas::util::IOException)
 
void setFormat (format_t val)
 Set the format for character samples. More...
 
bool receive (const Sample *samp) throw ()
 Method called to pass a sample to this client. More...
 
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
 
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 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

AsciiOutputclone (IOChannel *iochannel)
 
 AsciiOutput (AsciiOutput &, IOChannel *)
 Copy constructor, with a new IOChannel. More...
 
void printHeader () throw (nidas::util::IOException)
 
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...
 

Protected Attributes

std::string _name
 

Private Member Functions

 AsciiOutput (const AsciiOutput &)
 Copy constructor. More...
 

Private Attributes

std::ostringstream _ostr
 
format_t _format
 
std::map< dsm_sample_id_t,
dsm_time_t
_prevTT
 Previous time tags by sample id. More...
 
bool _headerOut
 

Member Typedef Documentation

Member Enumeration Documentation

Enumerator
DEFAULT 
ASCII 
HEX 
SIGNED_SHORT 
UNSIGNED_SHORT 
FLOAT 
IRIG 

Constructor & Destructor Documentation

AsciiOutput::AsciiOutput ( )

Referenced by clone().

AsciiOutput::AsciiOutput ( IOChannel iochannel,
SampleConnectionRequester rqstr = 0 
)
virtual nidas::dynld::AsciiOutput::~AsciiOutput ( )
inlinevirtual
AsciiOutput::AsciiOutput ( AsciiOutput x,
IOChannel ioc 
)
protected
nidas::dynld::AsciiOutput::AsciiOutput ( const AsciiOutput )
private

Copy constructor.

Member Function Documentation

void SampleOutputBase::addParameter ( Parameter val)
inherited

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 nidas::core::SampleOutputBase::_constParameters, nidas::core::SampleOutputBase::_parameters, and nidas::core::Parameter::getName().

void SampleOutputBase::addRequestedSampleTag ( SampleTag tag)
throw (nidas::util::InvalidParameterException
)
virtualinherited

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 nidas::core::SampleOutputBase::SampleOutputBase().

void SampleOutputBase::addSourceSampleTag ( const SampleTag tag)
throw (nidas::util::InvalidParameterException
)
virtualinherited

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 nidas::core::SampleOutputBase::SampleOutputBase().

void SampleOutputBase::addSourceSampleTags ( const std::list< const SampleTag * > &  tags)
throw (nidas::util::InvalidParameterException
)
virtualinherited
AsciiOutput * AsciiOutput::clone ( IOChannel iochannel)
protectedvirtual

Implements nidas::core::SampleOutput.

References AsciiOutput().

void SampleOutputBase::close ( )
throw (nidas::util::IOException
)
virtualinherited
void AsciiOutput::connect ( nidas::core::SampleSource source)
throw (nidas::util::IOException
)
SampleOutput * SampleOutputBase::connected ( IOChannel ochan)
throw (
)
virtualinherited
void SampleOutputBase::createNextFile ( dsm_time_t  tt)
throw (nidas::util::IOException
)
inherited
void SampleOutputBase::disconnect ( )
throw (nidas::util::IOException
)
protectedinherited

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 nidas::core::SampleOutputBase::_connectionRequester, nidas::core::SampleOutputBase::close(), nidas::core::SampleConnectionRequester::disconnect(), nidas::core::SampleOutputBase::getName(), and ILOG.

void nidas::dynld::AsciiOutput::flush ( )
throw (
)
inlinevirtual

Implementation of SampleClient::flush().

Implements nidas::core::SampleClient.

void SampleOutputBase::fromDOMElement ( const xercesc::DOMElement *  )
throw (nidas::util::InvalidParameterException
)
virtualinherited
const DSMConfig* nidas::core::SampleOutputBase::getDSMConfig ( ) const
inlinevirtualinherited
int SampleOutputBase::getFd ( ) const
virtualinherited
IOChannel* nidas::core::SampleOutputBase::getIOChannel ( ) const
inlinevirtualinherited
float nidas::core::SampleOutputBase::getLatency ( ) const
inlinevirtualinherited
const std::string& nidas::core::SampleOutputBase::getName ( ) const
inlinevirtualinherited
static const XMLCh* nidas::core::DOMable::getNamespaceURI ( )
inlinestaticinherited
dsm_time_t nidas::core::SampleOutputBase::getNextFileTime ( ) const
inlineinherited
size_t nidas::core::SampleOutputBase::getNumDiscardedSamples ( ) const
inlineinherited
SampleOutput* nidas::core::SampleOutputBase::getOriginal ( ) const
inlinevirtualinherited

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
inherited

Fetch a parameter by name.

Returns a NULL pointer if no such parameter exists.

References nidas::core::SampleOutputBase::_parameters.

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

Get list of parameters.

int SampleOutputBase::getReconnectDelaySecs ( ) const
virtualinherited

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 nidas::core::SampleOutputBase::_iochan, nidas::core::SampleOutputBase::_reconnectDelaySecs, and nidas::core::IOChannel::getReconnectDelaySecs().

std::list< const SampleTag * > SampleOutputBase::getRequestedSampleTags ( ) const
virtualinherited
SampleConnectionRequester* nidas::core::SampleOutputBase::getSampleConnectionRequester ( )
inlineprotectedinherited
list< const SampleTag * > SampleOutputBase::getSourceSampleTags ( ) const
virtualinherited
size_t nidas::core::SampleOutputBase::incrementDiscardedSamples ( )
inlineprotectedinherited
bool nidas::core::SampleOutputBase::isRaw ( ) const
inlinevirtualinherited
void AsciiOutput::printHeader ( )
throw (nidas::util::IOException
)
protected
bool AsciiOutput::receive ( const Sample s)
throw (
)
virtual

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.

Implements nidas::core::SampleClient.

References nidas::core::CHAR_ST, nidas::core::DOUBLE_ST, nidas::core::FLOAT_ST, nidas::util::UTime::format(), fp, GET_DSM_ID, GET_SHORT_ID, nidas::util::Logger::getInstance(), nidas::util::Logger::log(), LOG_ERR, nidas::dynld::raf::IRIGSensor::statusString(), USECS_PER_SEC, and nidas::util::Exception::what().

void AsciiOutput::requestConnection ( SampleConnectionRequester requester)
throw (
)
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.

Reimplemented from nidas::core::SampleOutputBase.

References nidas::core::SampleOutputBase::requestConnection().

void nidas::core::SampleOutputBase::setDSMConfig ( const DSMConfig val)
inlinevirtualinherited
void nidas::dynld::AsciiOutput::setFormat ( format_t  val)
inline

Set the format for character samples.

Raw sensor samples are character samples.

void nidas::core::SampleOutputBase::setHeaderSource ( HeaderSource val)
inlinevirtualinherited
void SampleOutputBase::setIOChannel ( IOChannel val)
virtualinherited
void nidas::core::SampleOutputBase::setLatency ( float  val)
throw (nidas::util::InvalidParameterException
)
inlinevirtualinherited

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)
inlinevirtualinherited
void SampleOutputBase::setReconnectDelaySecs ( int  val)
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
size_t SampleOutputBase::write ( const void *  buf,
size_t  len 
)
throw (nidas::util::IOException
)
overridevirtualinherited

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

format_t nidas::dynld::AsciiOutput::_format
private
bool nidas::dynld::AsciiOutput::_headerOut
private

Referenced by printHeader().

std::string nidas::core::SampleOutputBase::_name
protectedinherited
std::ostringstream nidas::dynld::AsciiOutput::_ostr
private

Referenced by printHeader().

std::map<dsm_sample_id_t,dsm_time_t> nidas::dynld::AsciiOutput::_prevTT
private

Previous time tags by sample id.

Used for displaying time diffs.


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