nidas
v1.2-1520
|
Dynamically loadable nidas::core::FileSet. More...
#include <FileSet.h>
Public Member Functions | |
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. More... | |
const std::string & | getName () const |
void | setDir (const std::string &val) |
Set the directory portion of the file search path. More... | |
void | setFileName (const std::string &val) |
Set the file portion of the file search path. More... | |
void | requestConnection (IOChannelRequester *requester) throw (nidas::util::IOException) |
After the IOChannel is configured, a user of IOChannel calls requestConnection to get things started. More... | |
IOChannel * | connect () throw (nidas::util::IOException) |
Establish a connection. More... | |
void | setNonBlocking (bool val) throw (nidas::util::IOException) |
bool | isNonBlocking () const throw (nidas::util::IOException) |
void | setMount (FsMount *val) |
FileSet will own the FsMount. More... | |
void | mounted () |
This method is called by FsMount when it is done. More... | |
FileSet * | clone () const |
Clone myself. More... | |
dsm_time_t | createFile (dsm_time_t t, bool exact) throw (nidas::util::IOException) |
Request that an IOChannel open a new file, with a name based on a time. More... | |
size_t | read (void *buf, size_t len) throw (nidas::util::IOException) |
Physical read method which must be implemented in derived classes. More... | |
size_t | write (const void *buf, size_t len) throw (nidas::util::IOException) |
Physical write method which must be implemented in derived classes. More... | |
size_t | write (const struct iovec *iov, int iovcnt) throw (nidas::util::IOException) |
Physical write method which must be implemented in derived classes. More... | |
void | close () throw (nidas::util::IOException) |
int | getFd () const |
void | fromDOMElement (const xercesc::DOMElement *node) throw (nidas::util::InvalidParameterException) |
Initialize myself from a xercesc::DOMElement. More... | |
const std::string & | getCurrentName () const |
Get name of current file. More... | |
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. More... | |
int | getFileLengthSecs () const |
void | addFileName (const std::string &val) |
long long | getFileSize () const throw (nidas::util::IOException) |
int | getLastErrno () const |
Get last error value. More... | |
void | setKeepOpening (bool keepopening) |
Set whether the FileSet should keep going to the next file when an error happens opening a file. More... | |
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. More... | |
virtual void | setConnectionInfo (const ConnectionInfo &val) |
virtual size_t | getBufferSize () const throw () |
Return suggested buffer length. More... | |
virtual void | flush () throw (nidas::util::IOException) |
Default flush implementation does nothing. 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 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 FileSet * | getFileSet (const std::list< std::string > &filenames) throw (nidas::util::InvalidParameterException) |
Convienence function to return a pointer to a nidas::core::FileSet, given a list of files. More... | |
static IOChannel * | createIOChannel (const xercesc::DOMElement *node) throw (nidas::util::InvalidParameterException) |
static const XMLCh * | getNamespaceURI () |
Protected Member Functions | |
void | setName (const std::string &val) |
Recognizeable name of this IOChannel - used for informative messages. More... | |
Protected Attributes | |
nidas::util::FileSet * | _fset |
std::string | _name |
IOChannelRequester * | _requester |
FsMount * | _mount |
Dynamically loadable nidas::core::FileSet.
|
inlineinherited |
References nidas::core::FileSet::_fset, and nidas::util::FileSet::addFileName().
Referenced by nidas::core::FileSet::getFileSet(), PacketDecode::run(), and MergeVerifier::run().
|
inlinevirtualinherited |
Clone myself.
Implements nidas::core::IOChannel.
References nidas::core::FileSet::FileSet().
Referenced by StatsProcess::run(), and DataPrep::run().
|
virtualinherited |
|
virtualinherited |
Establish a connection.
On return, the connection has been established. It may return a new instance of an IOChannel.
Implements nidas::core::IOChannel.
References nidas::core::FileSet::_mount, and nidas::core::FsMount::mount().
Referenced by nidas::dynld::raf::SyncServer::openStream(), DataDump::run(), and DataStats::run().
|
virtualinherited |
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 from nidas::core::IOChannel.
References nidas::util::UTime::toUsecs().
|
staticinherited |
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().
|
inlinevirtualinherited |
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().
|
virtualinherited |
Initialize myself from a xercesc::DOMElement.
Implements nidas::core::DOMable.
References nidas::core::XDOMAttr::getName(), and nidas::core::XDOMElement::getNodeName().
|
inlinevirtualinherited |
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().
|
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.
Referenced by nidas::dynld::SampleInputStream::setIOChannel().
|
inlineinherited |
Get name of current file.
References nidas::core::FileSet::_fset, and nidas::util::FileSet::getCurrentName().
Referenced by nidas::core::GetAdsFileName::execute(), nidas::core::FileSet::getName(), and nidas::core::SampleArchiver::printStatus().
|
inlinevirtualinherited |
What DSM is this IOChannel connected to? May be NULL.
Referenced by nidas::core::FileSet::setDir(), and nidas::core::FileSet::setFileName().
|
inlineinherited |
References nidas::core::FileSet::_fset, and nidas::util::FileSet::getStartTime().
|
inlinevirtualinherited |
Implements nidas::core::IOChannel.
References nidas::core::FileSet::_fset, and nidas::util::FileSet::getFd().
|
inlineinherited |
References nidas::core::FileSet::_fset, and nidas::util::FileSet::getFileLengthSecs().
|
staticinherited |
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.
References nidas::core::FileSet::addFileName().
Referenced by nidas::dynld::raf::SyncServer::openStream(), MergeVerifier::run(), NidsMerge::run(), SensorExtract::run(), StatsProcess::run(), SyncDumper::run(), ExtractFast2D::run(), ExtractDMT::run(), DataPrep::run(), DataDump::run(), and DataStats::run().
|
inlineinherited |
References nidas::core::FileSet::_fset, and nidas::util::FileSet::getFileSize().
Referenced by nidas::core::SampleArchiver::printStatus().
|
inlineinherited |
Get last error value.
Should be 0. Currently only supported for an output file, to be queried by a system status thread.
References nidas::core::FileSet::_fset, and nidas::util::FileSet::getLastErrno().
|
virtualinherited |
Implements nidas::core::IOChannel.
References nidas::core::FileSet::_name, and nidas::core::FileSet::getCurrentName().
Referenced by MergeVerifier::run(), NidsMerge::run(), nidas::core::FileSet::setNonBlocking(), and nidas::core::FileSet::write().
|
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().
|
inlinevirtualinherited |
Reimplemented from nidas::core::IOChannel.
|
inlinevirtualinherited |
Reimplemented in nidas::core::Socket, nidas::core::McSocketUDP, and nidas::core::McSocket.
|
inlineinherited |
References nidas::core::FileSet::_fset, and nidas::util::FileSet::getStartTime().
|
inlinevirtualinherited |
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 nidas::core::FileSet::_fset, and nidas::util::FileSet::isNewFile().
|
inlinevirtualinherited |
Implements nidas::core::IOChannel.
|
inlineinherited |
References nidas::core::FileSet::_fset, and nidas::util::FileSet::keepOpening().
|
inherited |
This method is called by FsMount when it is done.
References nidas::core::FileSet::_mount, nidas::core::FileSet::_requester, nidas::core::IOChannelRequester::connected(), and nidas::core::FsMount::isMounted().
Referenced by nidas::core::FsMount::finished().
|
inlinevirtualinherited |
Physical read method which must be implemented in derived classes.
Returns the number of bytes written, which may be less than the number requested.
Implements nidas::core::IOChannel.
References nidas::core::FileSet::_fset, len, and nidas::util::FileSet::read().
|
virtualinherited |
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.
Implements nidas::core::IOChannel.
|
inlinevirtualinherited |
|
inherited |
Set the directory portion of the file search path.
This may contain environment variables, and tokens like $DSM, $SITE, $AIRCRAFT.
References nidas::core::FileSet::_fset, nidas::core::IOChannel::getDSMConfig(), nidas::core::Project::getInstance(), nidas::util::FileSet::getPath(), nidas::util::FileSet::setDir(), and nidas::core::FileSet::setName().
|
inlinevirtualinherited |
What DSM is this IOChannel connected to?
Referenced by nidas::core::SampleOutputBase::fromDOMElement(), nidas::core::SampleOutputBase::SampleOutputBase(), and nidas::core::SampleOutputBase::setIOChannel().
|
inlineinherited |
References nidas::core::FileSet::_fset, and nidas::util::FileSet::setEndTime().
Referenced by MergeVerifier::run(), NidsMerge::run(), StatsProcess::run(), and DataPrep::run().
|
inlineinherited |
Set/get the file length in seconds.
References nidas::core::FileSet::_fset, and nidas::util::FileSet::setFileLengthSecs().
Referenced by NidsMerge::run(), SensorExtract::run(), and ARLIngest::run().
|
inherited |
Set the file portion of the file search path.
This may contain environment variables, and tokens like $DSM, $SITE, $AIRCRAFT.
References nidas::core::FileSet::_fset, nidas::core::IOChannel::getDSMConfig(), nidas::core::Project::getInstance(), nidas::util::FileSet::getPath(), nidas::util::FileSet::setFileName(), and nidas::core::FileSet::setName().
Referenced by MergeVerifier::run(), NidsMerge::run(), SensorExtract::run(), and ARLIngest::run().
|
inlineinherited |
Set whether the FileSet should keep going to the next file when an error happens opening a file.
References nidas::core::FileSet::_fset, and nidas::util::FileSet::setKeepOpening().
Referenced by NidsMerge::run().
|
inlineinherited |
References nidas::core::FileSet::_mount.
|
protectedvirtualinherited |
Recognizeable name of this IOChannel - used for informative messages.
Implements nidas::core::IOChannel.
References nidas::core::FileSet::_name.
Referenced by nidas::core::FileSet::setDir(), and nidas::core::FileSet::setFileName().
|
inlinevirtualinherited |
Implements nidas::core::IOChannel.
References nidas::core::FileSet::getName(), and PLOG.
|
inlinevirtualinherited |
Reimplemented in nidas::core::Socket, nidas::core::McSocketUDP, and nidas::core::McSocket.
Referenced by nidas::dynld::XMLConfigService::schedule().
|
inlineinherited |
References nidas::core::FileSet::_fset, and nidas::util::FileSet::setStartTime().
Referenced by MergeVerifier::run(), NidsMerge::run(), StatsProcess::run(), and DataPrep::run().
|
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.
|
inlinevirtualinherited |
Physical write method which must be implemented in derived classes.
Returns the number of bytes written, which may be less than the number requested.
Implements nidas::core::IOChannel.
References nidas::core::FileSet::_fset, nidas::core::FileSet::getName(), len, and nidas::util::FileSet::write().
|
inlinevirtualinherited |
Physical write method which must be implemented in derived classes.
Returns the number of bytes written, which may be less than the number requested.
Implements nidas::core::IOChannel.
References nidas::core::FileSet::_fset, and nidas::util::FileSet::write().
|
inlinevirtualinherited |
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().
|
protectedinherited |
Referenced by nidas::core::FileSet::addFileName(), nidas::core::FileSet::close(), nidas::core::FileSet::getCurrentName(), nidas::core::FileSet::getEndTime(), nidas::core::FileSet::getFd(), nidas::core::FileSet::getFileLengthSecs(), nidas::core::FileSet::getFileSize(), nidas::core::FileSet::getLastErrno(), nidas::core::FileSet::getStartTime(), nidas::core::FileSet::isNewInput(), nidas::core::FileSet::keepOpening(), nidas::core::FileSet::read(), nidas::core::FileSet::setDir(), nidas::core::FileSet::setEndTime(), nidas::core::FileSet::setFileLengthSecs(), nidas::core::FileSet::setFileName(), nidas::core::FileSet::setKeepOpening(), nidas::core::FileSet::setStartTime(), nidas::core::FileSet::write(), and nidas::core::FileSet::~FileSet().
|
protectedinherited |
|
protectedinherited |
Referenced by nidas::core::FileSet::getName(), and nidas::core::FileSet::setName().
|
protectedinherited |
Referenced by nidas::core::FileSet::mounted().