41 #ifndef NIDAS_UTIL_FILESET_H
42 #define NIDAS_UTIL_FILESET_H
55 #include <sys/types.h>
58 namespace nidas {
namespace util {
100 virtual void setDir(
const std::string& val);
189 virtual
size_t read(
void* buf,
size_t count) throw(IOException);
194 virtual
size_t write(const
void* buf,
size_t count) throw(IOException);
196 virtual
size_t write(const struct iovec* iov,
int iovcnt) throw(IOException);
221 static std::
string makePath(const std::
string& dir,const std::
string& file);
223 #if !defined(NIDAS_EMBEDDED)
268 static void replaceChars(std::string& in,
const std::string& pat,
269 const std::string& rep);
const std::time_put< char > & _timeputter
Definition: FileSet.h:271
void setStartTime(const UTime &val)
Definition: FileSet.h:152
long long _fileLength
File length, in microseconds.
Definition: FileSet.h:310
static std::string getDirPortion(const std::string &path)
Utility function to return the directory portion of a file path.
Definition: FileSet.cc:416
virtual UTime createFile(UTime tfile, bool exact)
Create a new file, with a name formed from a time.
Definition: FileSet.cc:223
virtual void setDir(const std::string &val)
Set directory portion of file path.
Definition: FileSet.cc:109
static std::string makePath(const std::string &dir, const std::string &file)
Utility function to create a full path name from a directory and file portion.
Definition: FileSet.cc:433
virtual const std::string & getFileName()
Definition: FileSet.h:117
A class for parsing, formatting and doing operations on time, based on Unix time conventions, where leap seconds are ignored, so that there are always 60 seconds in a minute, 3600 seconds in an hour and 86400 seconds in a day.
Definition: UTime.h:76
static void createDirectory(const std::string &name, mode_t mode)
Definition: FileSet.cc:169
virtual void openFileForWriting(const std::string &filename)
Open a new file for writing.
Definition: FileSet.cc:210
FileSet & operator=(const FileSet &x)
Assignment operator.
Definition: FileSet.cc:75
int _fd
Definition: FileSet.h:280
A description of a set of output files, consisting of a directory name and a file name format contain...
Definition: FileSet.h:66
virtual FileSet * clone() const
Virtual constructor.
Definition: FileSet.cc:96
void setFileLengthSecs(int val)
Set/get the file length in seconds.
Definition: FileSet.h:129
virtual void addFileName(const std::string &val)
Definition: FileSet.h:124
static void replaceChars(std::string &in, const std::string &pat, const std::string &rep)
Definition: FileSet.cc:632
void setEndTime(const UTime &val)
Definition: FileSet.h:156
std::list< std::string > matchFiles(const UTime &t1, const UTime &t2)
Definition: FileSet.cc:490
virtual const std::string & getPath()
Get the full path, the concatenation of getDir() and getFileName().
Definition: FileSet.h:122
virtual ~FileSet()
Destructor.
Definition: FileSet.cc:101
int getFileLengthSecs() const
Definition: FileSet.h:137
virtual size_t read(void *buf, size_t count)
Read from current file.
Definition: FileSet.cc:290
std::string formatName(const UTime &t1)
Definition: FileSet.cc:439
virtual const std::string & getDir()
Definition: FileSet.h:102
std::string _fullpath
Definition: FileSet.h:294
virtual size_t write(const void *buf, size_t count)
Write to current file.
Definition: FileSet.cc:305
static std::string getFilePortion(const std::string &path)
Utility function to return the file portion of a file path.
Definition: FileSet.cc:425
std::list< std::string > _fileset
Definition: FileSet.h:301
int _lastErrno
This value can get set by getFileSize() which is a const method.
Definition: FileSet.h:278
void initialize()
Definition: FileSet.cc:326
void checkPathFormat(const UTime &t1, const UTime &t2)
Check that any date or time descriptors, e.g.
Definition: FileSet.cc:445
std::list< std::string >::iterator _fileiter
Definition: FileSet.h:303
UTime getStartTime() const
Definition: FileSet.h:154
void setKeepOpening(bool keepopening)
Set whether the FileSet should keep going to the next file when an error happens opening a file...
Definition: FileSet.h:253
virtual void setFileName(const std::string &val)
Set file name portion of file path.
Definition: FileSet.cc:115
long long getFileSize() const
Definition: FileSet.cc:155
bool _initialized
Definition: FileSet.h:305
UTime _startTime
Definition: FileSet.h:297
bool isNewFile() const
Definition: FileSet.h:106
std::string _dir
Definition: FileSet.h:288
static const char pathSeparator
Definition: FileSet.h:198
Definition: IOException.h:37
bool keepOpening()
Definition: FileSet.h:259
FileSet()
constructor
Definition: FileSet.cc:52
UTime getEndTime() const
Definition: FileSet.h:158
std::string _filename
Definition: FileSet.h:290
void openNextFile()
Open the next file to be read.
Definition: FileSet.cc:378
#define USECS_PER_SEC
Definition: ublox.cc:59
std::string _currname
Definition: FileSet.h:292
int getLastErrno() const
Get last error value.
Definition: FileSet.h:243
bool _keepopening
Definition: FileSet.h:282
int getFd() const
Definition: FileSet.h:104
virtual void closeFile()
Closes any file currently open.
Definition: FileSet.cc:122
const std::string & getCurrentName() const
Get name of current file.
Definition: FileSet.h:163
UTime _endTime
Definition: FileSet.h:299
bool _newFile
Definition: FileSet.h:273