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

#include <PSQLSampleOutput.h>

Inheritance diagram for nidas::dynld::psql::PSQLSampleOutput:
Inheritance graph
[legend]

Public Member Functions

 PSQLSampleOutput ()
 
 PSQLSampleOutput (const PSQLSampleOutput &)
 
virtual ~PSQLSampleOutput ()
 
PSQLSampleOutputclone (IOChannel *iochannel=0) const
 
void setName (const std::string &val)
 
const std::string & getName () const
 
bool isRaw () const
 
void setPseudoPort (int val)
 
int getPseudoPort () const
 
void setDSMConfigs (const std::list< const DSMConfig * > &val)
 
void addDSMConfig (const DSMConfig *)
 
const std::list< const
DSMConfig * > & 
getDSMConfigs () const
 
void addSampleTag (const SampleTag *tag) throw (nidas::util::InvalidParameterException)
 
void requestConnection (SampleConnectionRequester *) throw (nidas::util::IOException)
 Request a connection, but don't wait for it. More...
 
void connected (SampleOutput *origout, SampleOutput *newout) throw ()
 
void connect () throw (nidas::util::IOException)
 
void connected (IOChannel *output) throw ()
 Implementation of IOChannelRequester::connected(). More...
 
void init () throw ()
 
bool receive (const Sample *) throw ()
 Method called to pass a sample to this client. More...
 
int getFd () const
 
void flush () throw (nidas::util::IOException)
 Ask that this SampleClient send out any buffered Samples that it may be holding. More...
 
void close () throw (nidas::util::IOException)
 
void fromDOMElement (const xercesc::DOMElement *node) throw (nidas::util::InvalidParameterException)
 Initialize myself from a xercesc::DOMElement. More...
 
IOStreamgetIOStream ()
 Get the IOStream of this SampleOutputStream. More...
 
size_t write (const void *buf, size_t len, bool streamFlush) 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 setLatency (float val) throw (nidas::util::InvalidParameterException)
 Outgoing data is buffered in an IOStream. More...
 
virtual void setIOChannel (IOChannel *val)
 Set the IOChannel for this SampleOutput. More...
 
SampleOutputgetOriginal () const
 Get pointer to SampleOutput that was cloned. More...
 
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
 
int getReconnectDelaySecs () const
 Base class implementation. More...
 
void setReconnectDelaySecs (int val)
 
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...
 
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

void submitCommand (const std::string &command) throw (nidas::util::IOException)
 
void createTables () throw (nidas::util::IOException)
 
void dropAllTables () throw ()
 
void initializeGlobalAttributes () throw (nidas::util::IOException)
 
void addVariable (const Variable *var) throw (nidas::util::IOException)
 
void addCategory (const std::string &varName, const std::string &category) throw (nidas::util::IOException)
 
size_t write (const Sample *samp, bool streamFlush) throw (nidas::util::IOException)
 
SampleOutputStreamclone (IOChannel *iochannel)
 
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
 
SampleConnectionRequesterconnectionRequester
 
std::list< const DSMConfig * > dsms
 
PSQLChannelpsqlChannel
 
std::map< float, const
SampleTag * > 
tagsByRate
 
std::map< float, std::string > tablesByRate
 
std::map< dsm_sample_id_t,
const SampleTag * > 
tagsById
 
float missingValue
 
bool first
 
int dberrors
 
IOStream_iostream
 
std::string _name
 

Constructor & Destructor Documentation

PSQLSampleOutput::PSQLSampleOutput ( )

Referenced by clone().

PSQLSampleOutput::PSQLSampleOutput ( const PSQLSampleOutput x)
PSQLSampleOutput::~PSQLSampleOutput ( )
virtual

References psqlChannel.

Member Function Documentation

void PSQLSampleOutput::addCategory ( const std::string &  varName,
const std::string &  category 
)
throw (nidas::util::IOException
)
protected
void PSQLSampleOutput::addDSMConfig ( const DSMConfig val)

References dsms.

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 nidas::dynld::psql::PSQLSampleOutput::addSampleTag ( const SampleTag tag)
throw (nidas::util::InvalidParameterException
)
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
void nidas::dynld::psql::PSQLSampleOutput::addVariable ( const Variable var)
throw (nidas::util::IOException
)
protected

Referenced by createTables().

PSQLSampleOutput * PSQLSampleOutput::clone ( IOChannel iochannel = 0) const
SampleOutputStream * SampleOutputStream::clone ( IOChannel iochannel)
protectedvirtualinherited
void PSQLSampleOutput::close ( )
throw (nidas::util::IOException
)
virtual
void PSQLSampleOutput::connect ( )
throw (nidas::util::IOException
)
void PSQLSampleOutput::connected ( SampleOutput origout,
SampleOutput newout 
)
throw (
)

References DLOG.

void PSQLSampleOutput::connected ( IOChannel ochan)
throw (
)
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.

Reimplemented from nidas::core::SampleOutputBase.

References nidas::dynld::SampleOutputStream::connected(), and DLOG.

void SampleOutputBase::createNextFile ( dsm_time_t  tt)
throw (nidas::util::IOException
)
inherited
void PSQLSampleOutput::createTables ( )
throw (nidas::util::IOException
)
protected
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 PSQLSampleOutput::dropAllTables ( )
throw (
)
protected
void PSQLSampleOutput::flush ( )
throw (nidas::util::IOException
)
virtual

Ask that this SampleClient send out any buffered Samples that it may be holding.

Implements nidas::core::SampleClient.

References nidas::dynld::psql::PSQLChannel::flush(), and psqlChannel.

void PSQLSampleOutput::fromDOMElement ( const xercesc::DOMElement *  )
throw (nidas::util::InvalidParameterException
)
virtual

Initialize myself from a xercesc::DOMElement.

Reimplemented from nidas::core::SampleOutputBase.

References nidas::core::IOChannel::createIOChannel(), and DLOG.

const DSMConfig* nidas::core::SampleOutputBase::getDSMConfig ( ) const
inlinevirtualinherited
const std::list< const DSMConfig * > & PSQLSampleOutput::getDSMConfigs ( ) const

References dsms.

int nidas::dynld::psql::PSQLSampleOutput::getFd ( ) const
inlinevirtual

Reimplemented from nidas::core::SampleOutputBase.

IOChannel* nidas::core::SampleOutputBase::getIOChannel ( ) const
inlinevirtualinherited
IOStream* nidas::dynld::SampleOutputStream::getIOStream ( )
inlineinherited

Get the IOStream of this SampleOutputStream.

SampleOutputStream owns the pointer and will delete the IOStream in its destructor. The IOStream is available after a SammpleOutputStream is constructed with an connected IOChannel, or after the connected() method has been called and before close().

float nidas::core::SampleOutputBase::getLatency ( ) const
inlinevirtualinherited
const std::string& nidas::dynld::psql::PSQLSampleOutput::getName ( ) const
inlinevirtual

Reimplemented from nidas::core::SampleOutputBase.

References name.

Referenced by dropAllTables(), and init().

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 nidas::dynld::psql::PSQLSampleOutput::getPseudoPort ( ) const
inline
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
void PSQLSampleOutput::init ( )
throw (
)
void PSQLSampleOutput::initializeGlobalAttributes ( )
throw (nidas::util::IOException
)
protected
bool nidas::dynld::psql::PSQLSampleOutput::isRaw ( ) const
inlinevirtual

Reimplemented from nidas::core::SampleOutputBase.

bool PSQLSampleOutput::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::FLOAT_ST, nidas::core::SampleT< DataT >::getConstDataPtr(), nidas::core::SampleT< DataT >::getDataLength(), nidas::util::Logger::getInstance(), nidas::core::SampleTag::getRate(), nidas::util::Logger::log(), LOG_ERR, USECS_PER_MSEC, USECS_PER_SEC, and nidas::util::Exception::what().

void PSQLSampleOutput::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.

Reimplemented from nidas::core::SampleOutputBase.

References DLOG.

void nidas::core::SampleOutputBase::setDSMConfig ( const DSMConfig val)
inlinevirtualinherited
void PSQLSampleOutput::setDSMConfigs ( const std::list< const DSMConfig * > &  val)

References dsms.

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

Outgoing data is buffered in an IOStream.

The stream will be flushed when the difference between successive time tags exceeds this value. This is a useful parameter for real-time applications.

Parameters
valNumber of seconds between physical writes. Default is set in SampleOutputBase.

Reimplemented from nidas::core::SampleOutputBase.

References nidas::core::SampleOutputBase::setLatency(), and USECS_PER_SEC.

void nidas::dynld::psql::PSQLSampleOutput::setName ( const std::string &  val)
inlinevirtual

Reimplemented from nidas::core::SampleOutputBase.

References name.

void nidas::dynld::psql::PSQLSampleOutput::setPseudoPort ( int  val)
inline
void SampleOutputBase::setReconnectDelaySecs ( int  val)
virtualinherited
void PSQLSampleOutput::submitCommand ( const std::string &  command)
throw (nidas::util::IOException
)
protected
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 SampleOutputStream::write ( const void *  buf,
size_t  len,
bool  streamFlush 
)
throw (nidas::util::IOException
)
inherited

References len.

size_t SampleOutputStream::write ( const Sample samp,
bool  streamFlush 
)
throw (nidas::util::IOException
)
protectedinherited
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

IOStream* nidas::dynld::SampleOutputStream::_iostream
protectedinherited
std::string nidas::core::SampleOutputBase::_name
protectedinherited
SampleConnectionRequester* nidas::dynld::psql::PSQLSampleOutput::connectionRequester
protected
int nidas::dynld::psql::PSQLSampleOutput::dberrors
protected
std::list<const DSMConfig*> nidas::dynld::psql::PSQLSampleOutput::dsms
protected
bool nidas::dynld::psql::PSQLSampleOutput::first
protected
float nidas::dynld::psql::PSQLSampleOutput::missingValue
protected
std::string nidas::dynld::psql::PSQLSampleOutput::name
protected

Referenced by clone(), connect(), getName(), and setName().

PSQLChannel* nidas::dynld::psql::PSQLSampleOutput::psqlChannel
protected
std::map<float,std::string> nidas::dynld::psql::PSQLSampleOutput::tablesByRate
protected
std::map<dsm_sample_id_t,const SampleTag*> nidas::dynld::psql::PSQLSampleOutput::tagsById
protected
std::map<float,const SampleTag*> nidas::dynld::psql::PSQLSampleOutput::tagsByRate
protected

Referenced by createTables().


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