nidas v1.2.3
|
Implementation of an IOChannel using an nidas::util::FileSet. More...
#include <FileSet.h>
Public Member Functions | |
FileSet () | |
FileSet (nidas::util::FileSet *fset) | |
Constructor from a pointer to a nidas::util::FileSet. | |
~FileSet () | |
int | getReconnectDelaySecs () const |
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. | |
const std::string & | getName () const |
void | setDir (const std::string &val) |
Set the directory portion of the file search path. | |
void | setFileName (const std::string &val) |
Set the file portion of the file search path. | |
void | requestConnection (IOChannelRequester *requester) |
IOChannel * | connect () |
void | setNonBlocking (bool val) |
bool | isNonBlocking () const |
void | setMount (FsMount *val) |
FileSet will own the FsMount. | |
void | mounted () |
This method is called by FsMount when it is done. | |
FileSet * | clone () const |
Clone myself. | |
dsm_time_t | createFile (dsm_time_t t, bool exact) |
size_t | read (void *buf, size_t len) |
size_t | write (const void *buf, size_t len) |
size_t | write (const struct iovec *iov, int iovcnt) |
void | close () |
int | getFd () const |
void | fromDOMElement (const xercesc::DOMElement *node) |
const std::string & | getCurrentName () const |
Get name of current file. | |
void | setStartTime (const nidas::util::UTime &val) |
nidas::util::UTime | getStartTime () const |
void | setEndTime (const nidas::util::UTime &val) |
nidas::util::UTime | getEndTime () const |
void | setFileLengthSecs (int val) |
Set/get the file length in seconds. | |
int | getFileLengthSecs () const |
void | addFileName (const std::string &val) |
long long | getFileSize () const |
int | getLastErrno () const |
Get last error value. | |
void | setKeepOpening (bool keepopening) |
Set whether the FileSet should keep going to the next file when an error happens opening a file. | |
bool | keepOpening () |
virtual void | setRequestType (enum McSocketRequest) |
virtual enum McSocketRequest | getRequestType () 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 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 FileSet * | getFileSet (const std::list< std::string > &filenames) |
Convienence function to return a pointer to a nidas::core::FileSet, given a list of files. | |
static IOChannel * | createIOChannel (const xercesc::DOMElement *node) |
static const XMLCh * | getNamespaceURI () |
Protected Member Functions | |
FileSet (const FileSet &x) | |
Copy constructor. | |
void | setName (const std::string &val) |
Recognizeable name of this IOChannel - used for informative messages. | |
Protected Attributes | |
nidas::util::FileSet * | _fset |
std::string | _name |
IOChannelRequester * | _requester |
FsMount * | _mount |
Private Member Functions | |
FileSet & | operator= (const FileSet &) |
No assignment. | |
Private Attributes | |
const DSMConfig * | _dsm |
ConnectionInfo | _conInfo |
Static Private Attributes | |
static XMLCh * | namespaceURI = 0 |
Implementation of an IOChannel using an nidas::util::FileSet.
FileSet::FileSet | ( | ) |
Referenced by clone(), and getFileSet().
FileSet::FileSet | ( | nidas::util::FileSet * | fset | ) |
Constructor from a pointer to a nidas::util::FileSet.
nidas::core::FileSet will own the pointer.
References _fset, and nidas::util::FileSet::addFileName().
|
virtualinherited |
|
inlinevirtual |
|
virtual |
nidas::util::IOException |
Implements nidas::core::IOChannel.
References _fset, _mount, nidas::core::FsMount::cancel(), nidas::util::FileSet::closeFile(), and nidas::core::FsMount::unmount().
|
virtual |
nidas::util::IOException |
Implements nidas::core::IOChannel.
References _mount, and nidas::core::FsMount::mount().
|
virtual |
nidas::util::IOException |
Reimplemented from nidas::core::IOChannel.
References _fset, nidas::util::FileSet::createFile(), and nidas::core::getSample().
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.
References _mount, nidas::core::FsMount::fromDOMElement(), getName(), nidas::core::getSample(), setDir(), setFileLengthSecs(), and setFileName().
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().
|
inline |
Get name of current file.
References _fset, and nidas::util::FileSet::getCurrentName().
Referenced by nidas::core::GetAdsFileName::execute(), and getName().
What DSM is this IOChannel connected to? May be NULL.
References nidas::core::IOChannel::_dsm.
Referenced by setDir(), and setFileName().
|
inline |
References _fset, and nidas::util::FileSet::getStartTime().
|
inlinevirtual |
Implements nidas::core::IOChannel.
References _fset, and nidas::util::FileSet::getFd().
|
inline |
References _fset, and nidas::util::FileSet::getFileLengthSecs().
Convienence function to return a pointer to a nidas::core::FileSet, given a list of files.
If one or more of the files have a .bz2 suffix, the FileSet returned will be a nidas::core::Bzip2FileSet. Note that a Bzip2FileSet cannot be used to read a non-compressed file, so one should not mix compressed and non-compressed files in the list.
nidas::util::InvalidParameterException |
References FileSet(), and nidas::core::getSample().
Referenced by nidas::dynld::raf::SyncServer::openStream(), DataStats::run(), DataPrep::run(), MergeVerifier::run(), NidsMerge::run(), ExtractFast2D::run(), ExtractDMT::run(), SensorExtract::run(), StatsProcess::run(), and SyncDumper::run().
nidas::util::IOException |
References _fset, and nidas::util::FileSet::getFileSize().
|
inline |
Get last error value.
Should be 0. Currently only supported for an output file, to be queried by a system status thread.
References _fset, and nidas::util::FileSet::getLastErrno().
|
virtual |
Implements nidas::core::IOChannel.
References _name, and getCurrentName().
Referenced by fromDOMElement(), setNonBlocking(), 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().
|
inlinevirtual |
Reimplemented from nidas::core::IOChannel.
|
inlinevirtualinherited |
Reimplemented in nidas::core::McSocket, nidas::core::McSocketUDP, and nidas::core::Socket.
Referenced by nidas::dynld::RawSampleInputStream::fromDOMElement().
|
inline |
References _fset, and nidas::util::FileSet::getStartTime().
|
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 from nidas::core::IOChannel.
References _fset, and nidas::util::FileSet::isNewFile().
|
inlinevirtual |
nidas::util::IOException |
Implements nidas::core::IOChannel.
|
inline |
References _fset, and nidas::util::FileSet::keepOpening().
void FileSet::mounted | ( | ) |
This method is called by FsMount when it is done.
References _mount, _requester, nidas::core::IOChannelRequester::connected(), and nidas::core::FsMount::isMounted().
Referenced by nidas::core::FsMount::finished(), and nidas::core::FsMount::mount().
nidas::util::IOException |
Implements nidas::core::IOChannel.
References _fset, len, and nidas::util::FileSet::read().
|
virtual |
nidas::util::IOException |
Implements nidas::core::IOChannel.
References _mount, _requester, nidas::core::getSample(), nidas::core::FsMount::isMounted(), and nidas::core::FsMount::mount().
|
inlinevirtualinherited |
References nidas::core::IOChannel::_conInfo, and nidas::core::getSample().
Referenced by nidas::core::Socket::connect().
Set the directory portion of the file search path.
This may contain environment variables, and tokens like $DSM, $SITE, $AIRCRAFT.
References _fset, nidas::core::IOChannel::getDSMConfig(), nidas::core::Project::getInstance(), nidas::util::FileSet::getPath(), nidas::util::FileSet::setDir(), and setName().
Referenced by fromDOMElement().
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().
|
inline |
References _fset, and nidas::util::FileSet::setEndTime().
Set/get the file length in seconds.
References _fset, and nidas::util::FileSet::setFileLengthSecs().
Referenced by fromDOMElement(), and ARLIngest::run().
Set the file portion of the file search path.
This may contain environment variables, and tokens like $DSM, $SITE, $AIRCRAFT.
References _fset, nidas::core::IOChannel::getDSMConfig(), nidas::core::Project::getInstance(), nidas::util::FileSet::getPath(), nidas::util::FileSet::setFileName(), and setName().
Referenced by fromDOMElement(), and ARLIngest::run().
Set whether the FileSet should keep going to the next file when an error happens opening a file.
References _fset, and nidas::util::FileSet::setKeepOpening().
References _mount, and nidas::core::getSample().
Recognizeable name of this IOChannel - used for informative messages.
Implements nidas::core::IOChannel.
References _name, and nidas::core::getSample().
Referenced by setDir(), and setFileName().
nidas::util::IOException |
Implements nidas::core::IOChannel.
References getName(), nidas::core::getSample(), and PLOG.
|
inlinevirtualinherited |
|
inline |
References _fset, and nidas::util::FileSet::setStartTime().
|
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.
nidas::util::IOException |
Implements nidas::core::IOChannel.
References _fset, and nidas::util::FileSet::write().
nidas::util::IOException |
Implements nidas::core::IOChannel.
References _fset, getName(), len, and nidas::util::FileSet::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 addFileName(), close(), createFile(), getCurrentName(), getEndTime(), getFd(), getFileLengthSecs(), getFileSize(), getLastErrno(), getStartTime(), isNewInput(), keepOpening(), read(), setDir(), setEndTime(), setFileLengthSecs(), setFileName(), setKeepOpening(), setStartTime(), write(), write(), and ~FileSet().
|
protected |
Referenced by close(), connect(), FileSet(), fromDOMElement(), mounted(), requestConnection(), setMount(), and ~FileSet().
|
protected |
Referenced by mounted(), and requestConnection().
|
staticprivateinherited |
Referenced by nidas::core::DOMable::getNamespaceURI().