nidas v1.2.3
|
Simple implementation of an IOChannel, over an opened file descriptor. More...
#include <UnixIOChannel.h>
Public Member Functions | |
UnixIOChannel (const std::string &name, int fd) | |
Constructor. | |
~UnixIOChannel () | |
Destructor. | |
UnixIOChannel * | clone () const |
Clone invokes default copy constructor. | |
void | requestConnection (IOChannelRequester *rqstr) |
RequestConnection just returns connected immediately. | |
IOChannel * | connect () |
Pretty simple, we're connected already. | |
void | setNonBlocking (bool val) |
Set the state of O_NONBLOCK with fcntl system call. | |
bool | isNonBlocking () const |
Do fcntl to determine value of O_NONBLOCK flag. | |
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. | |
size_t | read (void *buf, size_t len) |
Do the actual hardware read. | |
size_t | write (const void *buf, size_t len) |
Do the actual hardware write. | |
size_t | write (const struct iovec *iov, int iovcnt) |
Do the actual hardware write. | |
void | close () |
int | getFd () const |
const std::string & | getName () const |
void | setName (const std::string &val) |
void | fromDOMElement (const xercesc::DOMElement *) |
virtual void | setRequestType (enum McSocketRequest) |
virtual enum McSocketRequest | getRequestType () const |
virtual int | getReconnectDelaySecs () const |
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 void | flush () |
Default flush implementation does nothing. | |
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 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 () |
Protected Member Functions | |
UnixIOChannel (const UnixIOChannel &x) | |
Constructor. | |
Protected Attributes | |
std::string | _name |
int | _fd |
bool | _newInput |
Private Attributes | |
const DSMConfig * | _dsm |
ConnectionInfo | _conInfo |
Static Private Attributes | |
static XMLCh * | namespaceURI = 0 |
Simple implementation of an IOChannel, over an opened file descriptor.
Constructor.
Referenced by clone().
|
inline |
Destructor.
Does not close the device.
|
inlineprotected |
Constructor.
|
virtualinherited |
|
inlinevirtual |
Clone invokes default copy constructor.
Implements nidas::core::IOChannel.
References UnixIOChannel().
|
inlinevirtual |
nidas::util::IOException |
Implements nidas::core::IOChannel.
References _fd, close(), and getName().
Referenced by close().
|
inlinevirtual |
Pretty simple, we're connected already.
nidas::util::IOException |
Implements nidas::core::IOChannel.
|
inlinevirtualinherited |
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().
nidas::util::InvalidParameterException |
Implements nidas::core::DOMable.
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().
|
inlinevirtualinherited |
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 nidas::core::IOChannel::_conInfo.
Referenced by nidas::dynld::SampleInputStream::setIOChannel().
What DSM is this IOChannel connected to? May be NULL.
References nidas::core::IOChannel::_dsm.
Referenced by nidas::core::FileSet::setDir(), and nidas::core::FileSet::setFileName().
|
inlinevirtual |
Implements nidas::core::IOChannel.
References _fd.
|
inlinevirtual |
Implements nidas::core::IOChannel.
References _name.
Referenced by close(), isNonBlocking(), read(), setNonBlocking(), write(), and write().
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().
|
inlinevirtualinherited |
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 from nidas::core::IOChannel.
References _newInput.
|
virtual |
Do fcntl to determine value of O_NONBLOCK flag.
nidas::util::IOException |
Implements nidas::core::IOChannel.
Do the actual hardware read.
nidas::util::IOException |
Implements nidas::core::IOChannel.
References _fd, _newInput, getName(), nidas::core::getSample(), len, and read().
Referenced by read().
|
inlinevirtual |
RequestConnection just returns connected immediately.
nidas::util::IOException |
Implements nidas::core::IOChannel.
|
inlinevirtualinherited |
References nidas::core::IOChannel::_conInfo, and nidas::core::getSample().
Referenced by nidas::core::Socket::connect().
What DSM is this IOChannel connected to?
References nidas::core::IOChannel::_dsm, and nidas::core::getSample().
Referenced by nidas::core::SampleOutputBase::SampleOutputBase(), and nidas::core::SampleOutputBase::setIOChannel().
Implements nidas::core::IOChannel.
References _name, and nidas::core::getSample().
Set the state of O_NONBLOCK with fcntl system call.
nidas::util::IOException |
Implements nidas::core::IOChannel.
References _fd, getName(), and nidas::core::getSample().
|
inlinevirtualinherited |
|
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.
Do the actual hardware write.
nidas::util::IOException |
Implements nidas::core::IOChannel.
References _fd, _newInput, getName(), and nidas::core::getSample().
Do the actual hardware write.
nidas::util::IOException |
Implements nidas::core::IOChannel.
References _fd, _newInput, getName(), nidas::core::getSample(), len, and write().
Referenced by 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().
|
privateinherited |
|
protected |
Referenced by close(), getFd(), isNonBlocking(), read(), setNonBlocking(), write(), and write().
|
protected |
Referenced by isNewInput(), read(), write(), and write().
|
staticprivateinherited |
Referenced by nidas::core::DOMable::getNamespaceURI().