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::dynld::isff::GOESOutput Class Reference

A SampleOutput for packaging data for a GOES DCP Transmitter. More...

#include <GOESOutput.h>

Inheritance diagram for nidas::dynld::isff::GOESOutput:
Inheritance graph
[legend]

Public Member Functions

 GOESOutput (nidas::core::IOChannel *ioc=0, SampleConnectionRequester *rqstr=0)
 Constructor. More...
 
 ~GOESOutput ()
 Destructor. More...
 
void flush () throw ()
 Implementation of SampleClient::flush(). More...
 
void setIOChannel (nidas::core::IOChannel *val)
 Set the IOChannel for this SampleOutput. More...
 
GOESOutputclone (nidas::core::IOChannel *iochannel=0)
 Clone invokes copy constructor. More...
 
SampleOutputconnected (nidas::core::IOChannel *ochan) throw ()
 Implemention of IOChannelRequester::connected(). More...
 
int getXmitInterval () const
 The GOES transmit interval, in seconds. More...
 
int getXmitOffset () const
 The GOES transmit offset, in seconds. More...
 
void addRequestedSampleTag (nidas::core::SampleTag *tag) throw (nidas::util::InvalidParameterException)
 Some SampleOutputs don't send out all the Samples that they receive. More...
 
void addSourceSampleTag (const nidas::core::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 close () throw ()
 
size_t write (const void *, size_t) throw (nidas::util::IOException)
 Raw write not supported. More...
 
bool receive (const Sample *) throw ()
 Send a data record to the RPC server. More...
 
void fromDOMElement (const xercesc::DOMElement *node) throw (nidas::util::InvalidParameterException)
 Initialize myself from a xercesc::DOMElement. More...
 
int run () throw (nidas::util::Exception)
 The method which will run in its own thread. More...
 
void interrupt ()
 Interrupt this run method. More...
 
bool isInterrupted () const
 Has the run method been interrupted? 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
 
std::list< const SampleTag * > getRequestedSampleTags () const
 
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...
 
int getReconnectDelaySecs () const
 Base class implementation. More...
 
void setReconnectDelaySecs (int val)
 
int getFd () const
 
dsm_time_t getNextFileTime () const
 
void createNextFile (dsm_time_t) throw (nidas::util::IOException)
 
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

 GOESOutput (GOESOutput &, nidas::core::IOChannel *)
 Copy constructor, with a new IOChannel*. More...
 
void joinThread () throw ()
 
void cancelThread () throw ()
 
void killThread () throw ()
 
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...
 
void testCancel () const
 Check if we have been cancelled. More...
 
virtual bool amInterrupted () const
 Call testCancel, and return true when this thread has been interrupted. More...
 

Protected Attributes

std::string _name
 

Private Member Functions

 GOESOutput (const GOESOutput &)
 No normal copy. More...
 
GOESOutputoperator= (const GOESOutput &)
 No assignment. More...
 

Private Attributes

GOESXmtr_goesXmtr
 
std::map< dsm_sample_id_t,
std::vector< std::vector
< std::pair< int, int > > > > 
_sampleMap
 
std::vector< SampleT< float > * > _outputSamples
 
nidas::util::Mutex _sampleMutex
 
nidas::util::ThreadRunnable_xmitThread
 
bool _interrupted
 
int _configid
 
int _stationNumber
 
long long _maxPeriodUsec
 Not sure what the plan was for this. More...
 

Detailed Description

A SampleOutput for packaging data for a GOES DCP Transmitter.

Constructor & Destructor Documentation

GOESOutput::GOESOutput ( nidas::core::IOChannel ioc = 0,
SampleConnectionRequester rqstr = 0 
)

Constructor.

References nidas::util::Logger::getInstance(), nidas::util::Logger::log(), and LOG_ERR.

Referenced by clone().

GOESOutput::~GOESOutput ( )

Destructor.

References _xmitThread, cancelThread(), and joinThread().

GOESOutput::GOESOutput ( GOESOutput x,
nidas::core::IOChannel ioc 
)
protected
nidas::dynld::isff::GOESOutput::GOESOutput ( const GOESOutput )
private

No normal copy.

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 GOESOutput::addRequestedSampleTag ( nidas::core::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.

Reimplemented from nidas::core::SampleOutputBase.

References nidas::core::SampleOutputBase::addRequestedSampleTag(), GET_DSM_ID, GET_SPS_ID, nidas::core::Parameter::getLength(), nidas::core::Parameter::getName(), nidas::core::Parameter::getStringValue(), nidas::core::Parameter::getType(), nidas::core::Variable::setName(), and nidas::core::Parameter::STRING_PARAM.

void GOESOutput::addSourceSampleTag ( const nidas::core::SampleTag tag)
throw (nidas::util::InvalidParameterException
)
virtual
void SampleOutputBase::addSourceSampleTags ( const std::list< const SampleTag * > &  tags)
throw (nidas::util::InvalidParameterException
)
virtualinherited
bool Runnable::amInterrupted ( ) const
protectedvirtualinherited

Call testCancel, and return true when this thread has been interrupted.

This is protected because it should only called within the run method of the thread.

Referenced by nidas::core::SampleOutputRequestThread::run(), nidas::core::Looper::run(), run(), nidas::core::DSMServerStat::run(), and nidas::util::Thread::test().

void GOESOutput::cancelThread ( )
throw (
)
protected
GOESOutput* nidas::dynld::isff::GOESOutput::clone ( nidas::core::IOChannel iochannel = 0)
inlinevirtual

Clone invokes copy constructor.

Implements nidas::core::SampleOutput.

References GOESOutput().

void GOESOutput::close ( )
throw (
)
virtual
SampleOutput * GOESOutput::connected ( nidas::core::IOChannel ochan)
throw (
)
virtual
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::isff::GOESOutput::flush ( )
throw (
)
inlinevirtual

Implementation of SampleClient::flush().

Implements nidas::core::SampleClient.

void GOESOutput::fromDOMElement ( const xercesc::DOMElement *  )
throw (nidas::util::InvalidParameterException
)
virtual
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
int nidas::dynld::isff::GOESOutput::getXmitInterval ( ) const
inline

The GOES transmit interval, in seconds.

References _goesXmtr, and nidas::dynld::isff::GOESXmtr::getXmitInterval().

Referenced by nidas::dynld::isff::GOESProject::GOESProject(), and run().

int nidas::dynld::isff::GOESOutput::getXmitOffset ( ) const
inline

The GOES transmit offset, in seconds.

References _goesXmtr, and nidas::dynld::isff::GOESXmtr::getXmitOffset().

Referenced by run().

size_t nidas::core::SampleOutputBase::incrementDiscardedSamples ( )
inlineprotectedinherited
void GOESOutput::interrupt ( )
virtual

Interrupt this run method.

This sets a flag which can be tested with isInterrupted(). It is up to the run() implementation to return when interrupted.

Implements nidas::util::Runnable.

References _interrupted.

bool nidas::dynld::isff::GOESOutput::isInterrupted ( ) const
inlinevirtual

Has the run method been interrupted?

Implements nidas::util::Runnable.

References _interrupted.

bool nidas::core::SampleOutputBase::isRaw ( ) const
inlinevirtualinherited
void GOESOutput::joinThread ( )
throw (
)
protected
void GOESOutput::killThread ( )
throw (
)
protected
GOESOutput& nidas::dynld::isff::GOESOutput::operator= ( const GOESOutput )
private

No assignment.

bool GOESOutput::receive ( const Sample samp)
throw (
)
virtual
void SampleOutputBase::requestConnection ( SampleConnectionRequester requester)
throw (nidas::util::IOException
)
virtualinherited

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

int GOESOutput::run ( )
throw (nidas::util::Exception
)
virtual
void nidas::core::SampleOutputBase::setDSMConfig ( const DSMConfig val)
inlinevirtualinherited
void nidas::core::SampleOutputBase::setHeaderSource ( HeaderSource val)
inlinevirtualinherited
void GOESOutput::setIOChannel ( nidas::core::IOChannel val)
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 from nidas::core::SampleOutputBase.

References _goesXmtr, nidas::util::Logger::getInstance(), nidas::core::SampleOutputBase::getIOChannel(), nidas::core::SampleOutputBase::getName(), nidas::util::Logger::log(), LOG_ERR, nidas::core::SampleOutputBase::setIOChannel(), and nidas::core::SampleOutputBase::setName().

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
void nidas::util::Runnable::testCancel ( ) const
inlineprotectedinherited

Check if we have been cancelled.

Calls pthread_testcancel. This is protected since it only checks the current thread - i.e. it must be called within the run method. Since it just calls pthread_testcancel, it is a cancellation point.

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 nidas::dynld::isff::GOESOutput::write ( const void *  ,
size_t   
)
throw (nidas::util::IOException
)
inlinevirtual

Raw write not supported.

Reimplemented from nidas::core::SampleOutputBase.

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

Member Data Documentation

int nidas::dynld::isff::GOESOutput::_configid
private

Referenced by run().

GOESXmtr* nidas::dynld::isff::GOESOutput::_goesXmtr
private
bool nidas::dynld::isff::GOESOutput::_interrupted
private

Referenced by interrupt(), isInterrupted(), and run().

long long nidas::dynld::isff::GOESOutput::_maxPeriodUsec
private

Not sure what the plan was for this.

Not currently used.

std::string nidas::core::SampleOutputBase::_name
protectedinherited
std::vector<SampleT<float>*> nidas::dynld::isff::GOESOutput::_outputSamples
private

Referenced by run().

std::map<dsm_sample_id_t,std::vector<std::vector<std::pair<int,int> > > > nidas::dynld::isff::GOESOutput::_sampleMap
private
nidas::util::Mutex nidas::dynld::isff::GOESOutput::_sampleMutex
private

Referenced by run().

int nidas::dynld::isff::GOESOutput::_stationNumber
private
nidas::util::ThreadRunnable* nidas::dynld::isff::GOESOutput::_xmitThread
private

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