nidas
v1.2-1520
|
A channel for Input or Output of data. More...
#include <IOChannel.h>
Public Member Functions | |
IOChannel () | |
IOChannel (const IOChannel &x) | |
IOChannel & | operator= (const IOChannel &rhs) |
virtual | ~IOChannel () |
virtual IOChannel * | clone () const =0 |
Derived classes must provide clone. More... | |
virtual void | setName (const std::string &val)=0 |
virtual const std::string & | getName () const =0 |
virtual void | setRequestType (enum McSocketRequest) |
virtual enum McSocketRequest | getRequestType () const |
virtual bool | isNewInput () const |
Some IOChannels, namely FileSet, which opens successive files, need to indicate when a read is from the start of a new file. More... | |
virtual void | requestConnection (IOChannelRequester *)=0 throw (nidas::util::IOException) |
After the IOChannel is configured, a user of IOChannel calls requestConnection to get things started. More... | |
virtual int | getReconnectDelaySecs () const |
virtual void | setNonBlocking (bool val)=0 throw (nidas::util::IOException) |
virtual bool | isNonBlocking () const =0 throw (nidas::util::IOException) |
virtual IOChannel * | connect ()=0 throw (nidas::util::IOException,nidas::util::UnknownHostException) |
Establish a connection. More... | |
virtual const ConnectionInfo & | getConnectionInfo () const |
What is the IP address of the host at the other end of the connection. More... | |
virtual void | setConnectionInfo (const ConnectionInfo &val) |
virtual size_t | getBufferSize () const throw () |
Return suggested buffer length. More... | |
virtual size_t | read (void *buf, size_t len)=0 throw (nidas::util::IOException) |
Physical read method which must be implemented in derived classes. More... | |
virtual size_t | write (const void *buf, size_t len)=0 throw (nidas::util::IOException) |
Physical write method which must be implemented in derived classes. More... | |
virtual size_t | write (const struct iovec *iov, int iovcnt)=0 throw (nidas::util::IOException) |
Physical write method which must be implemented in derived classes. More... | |
virtual void | flush () throw (nidas::util::IOException) |
Default flush implementation does nothing. More... | |
virtual void | close ()=0 throw (nidas::util::IOException) |
virtual int | getFd () const =0 |
virtual dsm_time_t | createFile (dsm_time_t t, bool exact) |
Request that an IOChannel open a new file, with a name based on a time. More... | |
virtual bool | writeNidasHeader () const |
Should the NIDAS header be written to this IOChannel? NIDAS headers are not written to DatagramSockets, because there is no guarantee they will get there. More... | |
virtual void | setDSMConfig (const DSMConfig *val) |
What DSM is this IOChannel connected to? More... | |
virtual const DSMConfig * | getDSMConfig () const |
What DSM is this IOChannel connected to? May be NULL. More... | |
virtual void | fromDOMElement (const xercesc::DOMElement *)=0 throw (nidas::util::InvalidParameterException) |
Initialize myself from a xercesc::DOMElement. 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 IOChannel * | createIOChannel (const xercesc::DOMElement *node) throw (nidas::util::InvalidParameterException) |
static const XMLCh * | getNamespaceURI () |
Private Attributes | |
const DSMConfig * | _dsm |
ConnectionInfo | _conInfo |
A channel for Input or Output of data.
IOChannel::IOChannel | ( | ) |
|
inline |
|
inlinevirtual |
|
pure virtual |
Derived classes must provide clone.
Implemented in nidas::core::ServerSocket, nidas::core::FileSet, nidas::dynld::isff::SE_GOESXmtr, nidas::dynld::isff::SimGOESXmtr, nidas::core::DatagramSocket, nidas::core::Socket, nidas::core::McSocketUDP, nidas::core::UnixIOChannel, nidas::core::McSocket, nidas::dynld::psql::PSQLChannel, and nidas::core::MultipleUDPSockets.
|
pure virtual |
Implemented in nidas::core::ServerSocket, nidas::dynld::isff::GOESXmtr, nidas::core::Socket, nidas::core::McSocket, nidas::core::McSocketUDP, nidas::core::FileSet, nidas::core::UnixIOChannel, nidas::core::DatagramSocket, nidas::dynld::isff::SE_GOESXmtr, nidas::dynld::psql::PSQLChannel, and nidas::core::MultipleUDPSockets.
Referenced by nidas::dynld::isff::PacketInputStream::close(), nidas::core::SampleOutputBase::close(), nidas::dynld::SampleInputStream::close(), nidas::dynld::XMLConfigService::interrupt(), nidas::dynld::SampleInputStream::setIOChannel(), and nidas::core::DSMService::~DSMService().
|
pure virtual |
Establish a connection.
On return, the connection has been established. It may return a new instance of an IOChannel.
Implemented in nidas::core::ServerSocket, nidas::dynld::isff::GOESXmtr, nidas::core::McSocketUDP, nidas::core::FileSet, nidas::core::McSocket, nidas::core::UnixIOChannel, nidas::core::DatagramSocket, nidas::core::Socket, nidas::dynld::psql::PSQLChannel, and nidas::core::MultipleUDPSockets.
|
inlinevirtual |
Request that an IOChannel open a new file, with a name based on a time.
This should be implemented by derived classes which write to disk files. Other derived classes (e.g. sockets) can just use this default implementation - basically ignoring the request.
t | Time to use when creating file name. |
exact | Use exact time when creating file name, else the time is adjusted to an even time interval. |
Reimplemented in nidas::core::FileSet.
Referenced by nidas::core::IOStream::createFile().
|
static |
References nidas::core::DOMObjectFactory::createObject(), nidas::core::Socket::createSocket(), nidas::util::Process::expandEnvVars(), nidas::core::XDOMElement::getAttributeValue(), and nidas::core::XDOMElement::getNodeName().
Referenced by nidas::dynld::psql::PSQLSampleOutput::fromDOMElement(), nidas::core::DSMService::fromDOMElement(), nidas::dynld::isff::GOESOutput::fromDOMElement(), nidas::core::SampleOutputBase::fromDOMElement(), and nidas::dynld::SampleInputStream::fromDOMElement().
|
inlinevirtual |
Default flush implementation does nothing.
Reimplemented in nidas::dynld::isff::GOESXmtr, nidas::dynld::isff::SE_GOESXmtr, and nidas::dynld::psql::PSQLChannel.
Referenced by nidas::core::SampleArchiver::disconnect(), and nidas::core::IOStream::flush().
|
pure virtualinherited |
Initialize myself from a xercesc::DOMElement.
Implemented in nidas::core::DSMSensor, nidas::dynld::SampleInputStream, nidas::core::CalFile, nidas::core::Variable, nidas::core::ServerSocket, nidas::core::SampleTag, nidas::core::Polynomial, nidas::core::Site, nidas::core::Project, nidas::core::CharacterSensor, nidas::core::Linear, nidas::core::SampleOutputBase, nidas::core::SampleIOProcessor, nidas::core::Socket, nidas::core::DSMConfig, nidas::dynld::isff::GOESXmtr, nidas::core::DatagramSocket, nidas::core::VariableConverter, nidas::core::SerialSensor, nidas::core::McSocket, nidas::core::McSocketUDP, nidas::core::UnixIOChannel, nidas::core::FileSet, nidas::dynld::raf::DSMArincSensor, nidas::core::FsMount, nidas::dynld::isff::GOESOutput, nidas::dynld::raf::CVIProcessor, nidas::dynld::isff::CS_Krypton, nidas::core::DSMService, nidas::core::DSMServer, nidas::dynld::psql::PSQLChannel, nidas::dynld::raf::IRIGSensor, nidas::dynld::psql::PSQLSampleOutput, nidas::dynld::isff::Wind2D, nidas::dynld::UDPSampleOutput, nidas::core::MultipleUDPSockets, nidas::core::DSMCatalog, nidas::dynld::RawSampleInputStream, nidas::core::SensorCatalog, nidas::dynld::RawSampleService, nidas::core::ServiceCatalog, nidas::dynld::raf::LamsSensor, nidas::dynld::raf::Arinc_IRS, and nidas::dynld::RawSampleOutputStream.
Referenced by nidas::core::DSMService::fromDOMElement(), nidas::dynld::isff::GOESOutput::fromDOMElement(), nidas::core::DSMConfig::fromDOMElement(), nidas::core::SampleIOProcessor::fromDOMElement(), nidas::core::SampleOutputBase::fromDOMElement(), and nidas::dynld::SampleInputStream::fromDOMElement().
|
inlinevirtual |
Return suggested buffer length.
Reimplemented in nidas::core::Socket, nidas::core::DatagramSocket, and nidas::core::MultipleUDPSockets.
Referenced by nidas::dynld::isff::PacketInputStream::init(), nidas::dynld::isff::PacketInputStream::PacketInputStream(), and nidas::dynld::SampleInputStream::SampleInputStream().
|
inlinevirtual |
What is the IP address of the host at the other end of the connection.
If this IOChannel is not a socket then return INADDR_ANY, using the default constructor of an Inet4Address. Socket subclasses should override this.
Referenced by nidas::dynld::SampleInputStream::setIOChannel().
|
inlinevirtual |
What DSM is this IOChannel connected to? May be NULL.
Referenced by nidas::core::FileSet::setDir(), and nidas::core::FileSet::setFileName().
|
pure virtual |
Implemented in nidas::core::ServerSocket, nidas::dynld::isff::GOESXmtr, nidas::core::Socket, nidas::core::McSocket, nidas::core::McSocketUDP, nidas::core::FileSet, nidas::core::UnixIOChannel, nidas::core::DatagramSocket, nidas::dynld::psql::PSQLChannel, and nidas::core::MultipleUDPSockets.
Referenced by nidas::dynld::SampleInputStream::getFd(), and nidas::core::SampleOutputBase::getFd().
|
pure virtual |
Implemented in nidas::core::ServerSocket, nidas::core::Socket, nidas::core::DatagramSocket, nidas::core::UnixIOChannel, nidas::core::McSocketUDP, nidas::core::McSocket, nidas::dynld::isff::GOESXmtr, nidas::core::FileSet, and nidas::dynld::psql::PSQLChannel.
Referenced by nidas::dynld::isff::PacketInputStream::getName(), nidas::core::IOStream::getName(), and nidas::dynld::SampleInputStream::getName().
|
inlinestaticinherited |
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::ProjectConfig::toDOMParent(), nidas::core::Datasets::toDOMParent(), nidas::core::ProjectConfigs::toDOMParent(), nidas::core::DSMConfig::toDOMParent(), nidas::core::Project::toDOMParent(), nidas::core::Site::toDOMParent(), nidas::core::SampleTag::toDOMParent(), nidas::core::ServerSocket::toDOMParent(), nidas::core::Variable::toDOMParent(), nidas::core::DSMSensor::toDOMParent(), nidas::core::Datasets::writeXML(), and nidas::core::ProjectConfigs::writeXML().
|
inlinevirtual |
Reimplemented in nidas::core::FileSet.
Referenced by nidas::core::SampleOutputBase::getReconnectDelaySecs().
|
inlinevirtual |
Reimplemented in nidas::core::Socket, nidas::core::McSocketUDP, and nidas::core::McSocket.
|
inlinevirtual |
Some IOChannels, namely FileSet, which opens successive files, need to indicate when a read is from the start of a new file.
This method is used by code which may need to do special things at the beginning of a file, like read a SampleInputHeader.
Reimplemented in nidas::core::UnixIOChannel, nidas::core::McSocketUDP, nidas::core::McSocket, nidas::core::Socket, nidas::core::DatagramSocket, and nidas::core::FileSet.
Referenced by nidas::core::IOStream::read().
|
pure virtual |
|
pure virtual |
Physical read method which must be implemented in derived classes.
Returns the number of bytes written, which may be less than the number requested.
Implemented in nidas::dynld::isff::SE_GOESXmtr, nidas::core::ServerSocket, nidas::core::Socket, nidas::core::McSocket, nidas::core::FileSet, nidas::core::McSocketUDP, nidas::core::DatagramSocket, nidas::core::UnixIOChannel, nidas::dynld::isff::SimGOESXmtr, nidas::dynld::psql::PSQLChannel, and nidas::core::MultipleUDPSockets.
Referenced by nidas::core::IOStream::read().
|
pure virtual |
After the IOChannel is configured, a user of IOChannel calls requestConnection to get things started.
It is like opening a device, but in the case of server sockets, it just starts a thread to wait on connections. Only when the IOChannelRequester::connected() method is called back is the channel actually open and ready for IO. The IOChannel* returned by IOChannelRequester::connected may be another instance of an IOChannel.
Implemented in nidas::core::ServerSocket, nidas::dynld::isff::GOESXmtr, nidas::core::McSocketUDP, nidas::core::FileSet, nidas::core::McSocket, nidas::core::UnixIOChannel, nidas::core::DatagramSocket, and nidas::core::Socket.
Referenced by nidas::dynld::XMLConfigService::schedule().
|
inlinevirtual |
|
inlinevirtual |
What DSM is this IOChannel connected to?
Referenced by nidas::core::SampleOutputBase::fromDOMElement(), nidas::core::SampleOutputBase::SampleOutputBase(), and nidas::core::SampleOutputBase::setIOChannel().
|
pure virtual |
|
pure virtual |
|
inlinevirtual |
Reimplemented in nidas::core::Socket, nidas::core::McSocketUDP, and nidas::core::McSocket.
Referenced by nidas::dynld::XMLConfigService::schedule().
|
virtualinherited |
Add my content into a DOMElement.
Reimplemented in nidas::core::DSMSensor, nidas::core::Variable, nidas::core::ServerSocket, nidas::core::SampleTag, nidas::core::Site, nidas::core::Project, and nidas::core::DSMConfig.
Referenced by nidas::core::ServerSocket::toDOMParent().
|
virtualinherited |
Create a DOMElement and append it to the parent.
Reimplemented in nidas::core::DSMSensor, nidas::core::Variable, nidas::core::ServerSocket, nidas::core::SampleTag, nidas::core::Site, nidas::core::Project, and nidas::core::DSMConfig.
|
pure virtual |
Physical write method which must be implemented in derived classes.
Returns the number of bytes written, which may be less than the number requested.
Implemented in nidas::dynld::isff::SE_GOESXmtr, nidas::core::ServerSocket, nidas::core::Socket, nidas::core::McSocket, nidas::core::McSocketUDP, nidas::core::FileSet, nidas::core::DatagramSocket, nidas::core::UnixIOChannel, nidas::dynld::isff::SimGOESXmtr, nidas::dynld::psql::PSQLChannel, and nidas::core::MultipleUDPSockets.
Referenced by nidas::core::IOStream::flush(), and nidas::dynld::AsciiOutput::printHeader().
|
pure virtual |
Physical write method which must be implemented in derived classes.
Returns the number of bytes written, which may be less than the number requested.
Implemented in nidas::dynld::isff::SE_GOESXmtr, nidas::core::ServerSocket, nidas::core::Socket, nidas::core::McSocket, nidas::core::McSocketUDP, nidas::core::FileSet, nidas::core::DatagramSocket, nidas::core::UnixIOChannel, nidas::dynld::isff::SimGOESXmtr, and nidas::core::MultipleUDPSockets.
|
inlinevirtual |
Should the NIDAS header be written to this IOChannel? NIDAS headers are not written to DatagramSockets, because there is no guarantee they will get there.
Reimplemented in nidas::core::DatagramSocket.
Referenced by nidas::dynld::SampleInputStream::setIOChannel().
|
private |
|
private |
Referenced by operator=().