nidas v1.2.3
|
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. | |
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. | |
virtual void | requestConnection (IOChannelRequester *)=0 |
After the IOChannel is configured, a user of IOChannel calls requestConnection to get things started. | |
virtual int | getReconnectDelaySecs () const |
virtual void | setNonBlocking (bool val)=0 |
virtual bool | isNonBlocking () const =0 |
virtual IOChannel * | connect ()=0 |
Establish a connection. | |
virtual const ConnectionInfo & | getConnectionInfo () const |
What is the IP address of the host at the other end of the connection. | |
virtual void | setConnectionInfo (const ConnectionInfo &val) |
virtual size_t | getBufferSize () const |
Return suggested buffer length. | |
virtual size_t | read (void *buf, size_t len)=0 |
Physical read method which must be implemented in derived classes. | |
virtual size_t | write (const void *buf, size_t len)=0 |
Physical write method which must be implemented in derived classes. | |
virtual size_t | write (const struct iovec *iov, int iovcnt)=0 |
Physical write method which must be implemented in derived classes. | |
virtual void | flush () |
Default flush implementation does nothing. | |
virtual void | close ()=0 |
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. | |
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. | |
virtual void | setDSMConfig (const DSMConfig *val) |
What DSM is this IOChannel connected to? | |
virtual const DSMConfig * | getDSMConfig () const |
What DSM is this IOChannel connected to? May be NULL. | |
virtual void | addSampleTag (const nidas::core::SampleTag *) |
The special NetcdfRPCChannel subclass needs a way to add a SampleTag to the IOChannel through a virtual base class. | |
virtual void | fromDOMElement (const xercesc::DOMElement *)=0 |
Initialize myself from a xercesc::DOMElement. | |
virtual xercesc::DOMElement * | toDOMParent (xercesc::DOMElement *parent, bool complete) const |
Create a DOMElement and append it to the parent. | |
virtual xercesc::DOMElement * | toDOMElement (xercesc::DOMElement *node, bool complete) const |
Add my content into a DOMElement. | |
Static Public Member Functions | |
static IOChannel * | createIOChannel (const xercesc::DOMElement *node) |
static const XMLCh * | getNamespaceURI () |
Private Attributes | |
const DSMConfig * | _dsm |
ConnectionInfo | _conInfo |
Static Private Attributes | |
static XMLCh * | namespaceURI = 0 |
A channel for Input or Output of data.
IOChannel::IOChannel | ( | ) |
|
inlinevirtual |
|
virtual |
Derived classes must provide clone.
Implemented in nidas::core::DatagramSocket, nidas::core::FileSet, nidas::core::McSocket, nidas::core::McSocketUDP, nidas::core::MultipleUDPSockets, nidas::core::Socket, nidas::core::ServerSocket, and nidas::core::UnixIOChannel.
nidas::util::IOException |
Implemented in nidas::core::DatagramSocket, nidas::core::FileSet, nidas::core::McSocket, nidas::core::McSocketUDP, nidas::core::MultipleUDPSockets, nidas::core::Socket, nidas::core::ServerSocket, and nidas::core::UnixIOChannel.
Referenced by nidas::core::SampleOutputBase::close(), nidas::dynld::SampleInputStream::close(), nidas::core::SampleOutputBase::connected(), and nidas::dynld::SampleInputStream::setIOChannel().
Establish a connection.
On return, the connection has been established. It may return a new instance of an IOChannel.
Implemented in nidas::core::DatagramSocket, nidas::core::FileSet, nidas::core::McSocket, nidas::core::McSocketUDP, nidas::core::MultipleUDPSockets, nidas::core::Socket, nidas::core::ServerSocket, and nidas::core::UnixIOChannel.
Referenced by nidas::dynld::raf::SyncServer::init().
|
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. |
nidas::util::IOException |
Reimplemented in nidas::core::FileSet.
References nidas::core::getSample().
Referenced by nidas::core::IOStream::createFile(), and nidas::core::SampleOutputBase::createNextFile().
nidas::util::InvalidParameterException |
References nidas::core::DOMObjectFactory::createObject(), nidas::core::Socket::createSocket(), and nidas::core::getSample().
Referenced by nidas::core::DSMService::fromDOMElement(), nidas::core::SampleOutputBase::fromDOMElement(), and nidas::dynld::SampleInputStream::fromDOMElement().
Default flush implementation does nothing.
nidas::util::IOException |
Referenced by nidas::core::IOStream::flush().
|
pure virtualinherited |
Initialize myself from a xercesc::DOMElement.
nidas::util::InvalidParameterException |
Implemented in nidas::core::CharacterSensor, nidas::core::DatagramSocket, nidas::core::DSMCatalog, nidas::core::DSMConfig, nidas::core::DSMSensor, nidas::core::DSMServer, nidas::core::McSocket, nidas::core::McSocketUDP, nidas::core::MultipleUDPSockets, nidas::core::Project, nidas::core::SampleTag, nidas::core::SensorCatalog, nidas::core::ServiceCatalog, nidas::core::Site, nidas::core::Socket, nidas::core::ServerSocket, nidas::core::UnixIOChannel, nidas::core::Variable, nidas::core::VariableConverter, nidas::core::Linear, nidas::core::Polynomial, nidas::dynld::isff::CS_Krypton, nidas::dynld::raf::Arinc_IRS, nidas::dynld::raf::DSMArincSensor, nidas::dynld::raf::DSMMesaSensor, nidas::dynld::raf::IRIGSensor, nidas::core::CalFile, nidas::core::DSMService, nidas::core::FileSet, nidas::core::FsMount, nidas::core::SampleIOProcessor, nidas::core::SampleOutputBase, nidas::core::SerialSensor, nidas::dynld::isff::DAUSensor, nidas::dynld::isff::Wind2D, nidas::dynld::iss::TiltSensor, nidas::dynld::raf::CVIProcessor, nidas::dynld::raf::LamsSensor, nidas::dynld::RawSampleInputStream, nidas::dynld::RawSampleOutputStream, nidas::dynld::RawSampleService, nidas::dynld::SampleInputStream, and nidas::dynld::UDPSampleOutput.
Referenced by nidas::core::DSMConfig::fromDOMElement(), nidas::core::SampleIOProcessor::fromDOMElement(), and nidas::dynld::RawSampleOutputStream::fromDOMElement().
Return suggested buffer length.
Reimplemented in nidas::core::DatagramSocket, nidas::core::MultipleUDPSockets, and nidas::core::Socket.
Referenced by nidas::dynld::SampleInputStream::SampleInputStream(), 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.
References _conInfo.
Referenced by nidas::dynld::SampleInputStream::setIOChannel().
What DSM is this IOChannel connected to? May be NULL.
References _dsm.
Referenced by nidas::core::FileSet::setDir(), and nidas::core::FileSet::setFileName().
Implemented in nidas::core::DatagramSocket, nidas::core::FileSet, nidas::core::McSocket, nidas::core::McSocketUDP, nidas::core::MultipleUDPSockets, nidas::core::Socket, nidas::core::ServerSocket, and nidas::core::UnixIOChannel.
Referenced by nidas::core::SampleOutputBase::getFd(), and nidas::dynld::SampleInputStream::getFd().
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::Datasets::toDOMParent(), nidas::core::ProjectConfig::toDOMParent(), nidas::core::ProjectConfigs::toDOMParent(), nidas::core::DSMConfig::toDOMParent(), nidas::core::DSMSensor::toDOMParent(), nidas::core::Project::toDOMParent(), nidas::core::SampleTag::toDOMParent(), nidas::core::Site::toDOMParent(), nidas::core::ServerSocket::toDOMParent(), nidas::core::Variable::toDOMParent(), nidas::core::Datasets::writeXML(), and nidas::core::ProjectConfigs::writeXML().
Reimplemented in nidas::core::FileSet.
Referenced by nidas::core::SampleOutputBase::getReconnectDelaySecs().
|
inlinevirtual |
Reimplemented in nidas::core::McSocket, nidas::core::McSocketUDP, and nidas::core::Socket.
Referenced by nidas::dynld::RawSampleInputStream::fromDOMElement().
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::DatagramSocket, nidas::core::FileSet, nidas::core::McSocket, nidas::core::McSocketUDP, nidas::core::Socket, and nidas::core::UnixIOChannel.
Referenced by nidas::core::IOStream::read(), nidas::core::IOStream::read(), and nidas::core::IOStream::readUntil().
nidas::util::IOException |
Implemented in nidas::core::DatagramSocket, nidas::core::FileSet, nidas::core::McSocket, nidas::core::McSocketUDP, nidas::core::Socket, nidas::core::ServerSocket, and nidas::core::UnixIOChannel.
Referenced by nidas::dynld::SampleInputStream::isNonBlocking().
Physical read method which must be implemented in derived classes.
Returns the number of bytes written, which may be less than the number requested.
nidas::util::IOException |
Implemented in nidas::core::McSocket, nidas::core::McSocketUDP, nidas::core::MultipleUDPSockets, nidas::core::ServerSocket, nidas::core::DatagramSocket, nidas::core::FileSet, nidas::core::Socket, and nidas::core::UnixIOChannel.
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.
nidas::util::IOException |
Implemented in nidas::core::FileSet, nidas::core::UnixIOChannel, nidas::core::DatagramSocket, nidas::core::McSocket, nidas::core::McSocketUDP, nidas::core::Socket, and nidas::core::ServerSocket.
Referenced by nidas::dynld::SampleInputStream::requestConnection(), and nidas::core::SampleOutputBase::requestConnection().
|
inlinevirtual |
References _conInfo, and nidas::core::getSample().
Referenced by nidas::core::Socket::connect().
What DSM is this IOChannel connected to?
References _dsm, and nidas::core::getSample().
Referenced by nidas::core::SampleOutputBase::SampleOutputBase(), and nidas::core::SampleOutputBase::setIOChannel().
nidas::util::IOException |
Implemented in nidas::core::DatagramSocket, nidas::core::FileSet, nidas::core::McSocket, nidas::core::McSocketUDP, nidas::core::Socket, nidas::core::ServerSocket, and nidas::core::UnixIOChannel.
Referenced by nidas::dynld::SampleInputStream::setNonBlocking().
|
inlinevirtual |
|
virtualinherited |
Add my content into a DOMElement.
xercesc::DOMException |
Reimplemented in nidas::core::DSMConfig, nidas::core::DSMSensor, nidas::core::Project, nidas::core::SampleTag, nidas::core::Site, nidas::core::ServerSocket, and nidas::core::Variable.
Referenced by nidas::core::ServerSocket::toDOMParent().
|
virtualinherited |
Create a DOMElement and append it to the parent.
xercesc::DOMException |
Reimplemented in nidas::core::DSMConfig, nidas::core::DSMSensor, nidas::core::Project, nidas::core::SampleTag, nidas::core::Site, nidas::core::ServerSocket, and nidas::core::Variable.
Physical write method which must be implemented in derived classes.
Returns the number of bytes written, which may be less than the number requested.
nidas::util::IOException |
Implemented in nidas::core::McSocket, nidas::core::McSocketUDP, nidas::core::ServerSocket, nidas::core::DatagramSocket, nidas::core::FileSet, nidas::core::MultipleUDPSockets, nidas::core::Socket, and nidas::core::UnixIOChannel.
Physical write method which must be implemented in derived classes.
Returns the number of bytes written, which may be less than the number requested.
nidas::util::IOException |
Implemented in nidas::core::McSocket, nidas::core::McSocketUDP, nidas::core::ServerSocket, nidas::core::DatagramSocket, nidas::core::FileSet, nidas::core::MultipleUDPSockets, nidas::core::Socket, and nidas::core::UnixIOChannel.
Referenced by nidas::core::IOStream::flush(), nidas::dynld::AsciiOutput::printHeader(), nidas::dynld::AsciiOutput::receive(), nidas::dynld::raf::CVIOutput::receive(), nidas::dynld::UDPSampleOutput::write(), nidas::core::IOStream::write(), and nidas::core::SampleOutputBase::write().
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 |
Referenced by getConnectionInfo(), and setConnectionInfo().
Referenced by getDSMConfig(), operator=(), and setDSMConfig().
|
staticprivateinherited |
Referenced by nidas::core::DOMable::getNamespaceURI().