nidas v1.2.3
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
nidas::core::FileSet Class Reference

Implementation of an IOChannel using an nidas::util::FileSet. More...

#include <FileSet.h>

Inheritance diagram for nidas::core::FileSet:
Inheritance graph
[legend]

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)
 
IOChannelconnect ()
 
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.
 
FileSetclone () 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 ConnectionInfogetConnectionInfo () 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 DSMConfiggetDSMConfig () 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 FileSetgetFileSet (const std::list< std::string > &filenames)
 Convienence function to return a pointer to a nidas::core::FileSet, given a list of files.
 
static IOChannelcreateIOChannel (const xercesc::DOMElement *node)
 
static const XMLChgetNamespaceURI ()
 

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

FileSetoperator= (const FileSet &)
 No assignment.
 

Private Attributes

const DSMConfig_dsm
 
ConnectionInfo _conInfo
 

Static Private Attributes

static XMLChnamespaceURI = 0
 

Detailed Description

Implementation of an IOChannel using an nidas::util::FileSet.

Constructor & Destructor Documentation

◆ FileSet() [1/3]

FileSet::FileSet ( )

Referenced by clone(), and getFileSet().

◆ FileSet() [2/3]

FileSet::FileSet ( nidas::util::FileSet * fset)

Constructor from a pointer to a nidas::util::FileSet.

nidas::core::FileSet will own the pointer.

◆ ~FileSet()

FileSet::~FileSet ( )

References _fset, and _mount.

◆ FileSet() [3/3]

FileSet::FileSet ( const FileSet & x)
protected

Copy constructor.

References _mount.

Member Function Documentation

◆ addFileName()

void nidas::core::FileSet::addFileName ( const std::string & val)
inline

◆ addSampleTag()

void IOChannel::addSampleTag ( const nidas::core::SampleTag * )
virtualinherited

The special NetcdfRPCChannel subclass needs a way to add a SampleTag to the IOChannel through a virtual base class.

This method does nothing and serves no purpose except for that class.

◆ clone()

FileSet * nidas::core::FileSet::clone ( ) const
inlinevirtual

Clone myself.

Implements nidas::core::IOChannel.

References FileSet().

◆ close()

void FileSet::close ( )
virtual

◆ connect()

IOChannel * FileSet::connect ( )
virtual

◆ createFile()

dsm_time_t FileSet::createFile ( dsm_time_t t,
bool exact )
virtual

◆ createIOChannel()

IOChannel * IOChannel::createIOChannel ( const xercesc::DOMElement * node)
staticinherited

◆ flush()

virtual void nidas::core::IOChannel::flush ( )
inlinevirtualinherited

Default flush implementation does nothing.

Exceptions
nidas::util::IOException

Referenced by nidas::core::IOStream::flush().

◆ fromDOMElement()

void FileSet::fromDOMElement ( const xercesc::DOMElement * node)
virtual

◆ getBufferSize()

virtual size_t nidas::core::IOChannel::getBufferSize ( ) const
inlinevirtualinherited

◆ getConnectionInfo()

virtual const ConnectionInfo & nidas::core::IOChannel::getConnectionInfo ( ) const
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().

◆ getCurrentName()

const std::string & nidas::core::FileSet::getCurrentName ( ) const
inline

Get name of current file.

References _fset, and nidas::util::FileSet::getCurrentName().

Referenced by nidas::core::GetAdsFileName::execute(), and getName().

◆ getDSMConfig()

virtual const DSMConfig * nidas::core::IOChannel::getDSMConfig ( ) const
inlinevirtualinherited

What DSM is this IOChannel connected to? May be NULL.

References nidas::core::IOChannel::_dsm.

Referenced by setDir(), and setFileName().

◆ getEndTime()

nidas::util::UTime nidas::core::FileSet::getEndTime ( ) const
inline

◆ getFd()

int nidas::core::FileSet::getFd ( ) const
inlinevirtual

◆ getFileLengthSecs()

int nidas::core::FileSet::getFileLengthSecs ( ) const
inline

◆ getFileSet()

FileSet * FileSet::getFileSet ( const std::list< std::string > & filenames)
static

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.

Exceptions
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().

◆ getFileSize()

long long nidas::core::FileSet::getFileSize ( ) const
inline

◆ getLastErrno()

int nidas::core::FileSet::getLastErrno ( ) const
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().

◆ getName()

const std::string & FileSet::getName ( ) const
virtual

Implements nidas::core::IOChannel.

References _name, and getCurrentName().

Referenced by fromDOMElement(), setNonBlocking(), and write().

◆ getNamespaceURI()

static const XMLCh * nidas::core::DOMable::getNamespaceURI ( )
inlinestaticinherited

◆ getReconnectDelaySecs()

int nidas::core::FileSet::getReconnectDelaySecs ( ) const
inlinevirtual

Reimplemented from nidas::core::IOChannel.

◆ getRequestType()

virtual enum McSocketRequest nidas::core::IOChannel::getRequestType ( ) const
inlinevirtualinherited

◆ getStartTime()

nidas::util::UTime nidas::core::FileSet::getStartTime ( ) const
inline

◆ isNewInput()

bool nidas::core::FileSet::isNewInput ( ) const
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().

◆ isNonBlocking()

bool nidas::core::FileSet::isNonBlocking ( ) const
inlinevirtual

◆ keepOpening()

bool nidas::core::FileSet::keepOpening ( )
inline

◆ mounted()

void FileSet::mounted ( )

◆ operator=()

FileSet & nidas::core::FileSet::operator= ( const FileSet & )
private

No assignment.

◆ read()

size_t nidas::core::FileSet::read ( void * buf,
size_t len )
inlinevirtual

◆ requestConnection()

void FileSet::requestConnection ( IOChannelRequester * requester)
virtual

◆ setConnectionInfo()

virtual void nidas::core::IOChannel::setConnectionInfo ( const ConnectionInfo & val)
inlinevirtualinherited

◆ setDir()

void FileSet::setDir ( const std::string & val)

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().

◆ setDSMConfig()

virtual void nidas::core::IOChannel::setDSMConfig ( const DSMConfig * val)
inlinevirtualinherited

◆ setEndTime()

void nidas::core::FileSet::setEndTime ( const nidas::util::UTime & val)
inline

◆ setFileLengthSecs()

void nidas::core::FileSet::setFileLengthSecs ( int val)
inline

Set/get the file length in seconds.

References _fset, and nidas::util::FileSet::setFileLengthSecs().

Referenced by fromDOMElement(), and ARLIngest::run().

◆ setFileName()

void FileSet::setFileName ( const std::string & val)

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().

◆ setKeepOpening()

void nidas::core::FileSet::setKeepOpening ( bool keepopening)
inline

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().

◆ setMount()

void nidas::core::FileSet::setMount ( FsMount * val)
inline

FileSet will own the FsMount.

References _mount, and nidas::core::getSample().

◆ setName()

void FileSet::setName ( const std::string & val)
protectedvirtual

Recognizeable name of this IOChannel - used for informative messages.

Implements nidas::core::IOChannel.

References _name, and nidas::core::getSample().

Referenced by setDir(), and setFileName().

◆ setNonBlocking()

void nidas::core::FileSet::setNonBlocking ( bool val)
inlinevirtual

◆ setRequestType()

virtual void nidas::core::IOChannel::setRequestType ( enum McSocketRequest )
inlinevirtualinherited

◆ setStartTime()

void nidas::core::FileSet::setStartTime ( const nidas::util::UTime & val)
inline

◆ toDOMElement()

xercesc::DOMElement * DOMable::toDOMElement ( xercesc::DOMElement * node,
bool complete ) const
virtualinherited

◆ toDOMParent()

xercesc::DOMElement * DOMable::toDOMParent ( xercesc::DOMElement * parent,
bool complete ) const
virtualinherited

Create a DOMElement and append it to the parent.

Exceptions
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.

◆ write() [1/2]

size_t nidas::core::FileSet::write ( const struct iovec * iov,
int iovcnt )
inlinevirtual

◆ write() [2/2]

size_t nidas::core::FileSet::write ( const void * buf,
size_t len )
inlinevirtual

◆ writeNidasHeader()

virtual bool nidas::core::IOChannel::writeNidasHeader ( ) const
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().

Member Data Documentation

◆ _conInfo

ConnectionInfo nidas::core::IOChannel::_conInfo
privateinherited

◆ _dsm

const DSMConfig* nidas::core::IOChannel::_dsm
privateinherited

◆ _fset

nidas::util::FileSet* nidas::core::FileSet::_fset
protected

◆ _mount

FsMount* nidas::core::FileSet::_mount
protected

◆ _name

std::string nidas::core::FileSet::_name
protected

Referenced by getName(), and setName().

◆ _requester

IOChannelRequester* nidas::core::FileSet::_requester
protected

Referenced by mounted(), and requestConnection().

◆ namespaceURI

XMLCh * DOMable::namespaceURI = 0
staticprivateinherited

The documentation for this class was generated from the following files: