Main Page | Namespace List | Class Hierarchy | Class List | File List | Class Members | File Members

util.cc File Reference

Go to the history log for this file.

#include <util.h>
#include <dirent.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <fcntl.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
#include <algorithm>
#include <iostream>
#include <sstream>

Functions

string ensureStringEndsWith (string src, char suffix) throw (exception)
bool dirExists (string dirPath) throw (std::exception)
bool fileExists (string filePath) throw (std::exception)
void deleteFile (string filePath) throw (std::exception)
void listFilesWithPrefix (string dirpath, string prefix, vector< string > &filenames) throw (std::exception)
void writeData (int fd, off_t fileOffset, const char *pBuffer, ssize_t numBytesToWrite) throw (std::exception)
void readData (int fd, off_t fileOffset, char *pBuffer, ssize_t numBytesToRead) throw (std::exception)
int openFileWithFlags (string filename, int flags) throw (std::exception)
int openFileWithFlagsAndPerms (string filename, int flags, int perms) throw (std::exception)
void closeFile (int fd) throw (std::exception)
off_t getFileLen (int fd) throw (std::exception)
unsigned long getBlockSize (int fd) throw (std::exception)
off_t getFileOffset (int fd) throw (std::exception)
off_t setFileOffset (int fd, off_t offset, int whence) throw (std::exception)
void setFileLen (int fd, off_t newFileLen, bool forceAlloc) throw (std::exception)
timeval makeTimeval (long seconds, long microSeconds) throw (exception)
timeval makeNormalTimeval (unsigned long long sec, unsigned long long usec) throw (exception)
timeval getAvgTimevalBySums (unsigned long long summedSeconds, unsigned long long summedMicroSeconds, unsigned int numValues) throw (exception)
timeval getTimevalDiff (const timeval &t1, const timeval &t2) throw (exception)
string timevalToSimpleString (const timeval &tv)
string tmToSimpleString (const tm &aTime)
bool timevalsEqual (const timeval &t1, const timeval &t2)
int timevalsComp (const timeval &t1, const timeval &t2)
void subtractTimestampSums (unsigned long long &accumulatorSeconds, unsigned long long &accumulatorMicroSeconds, unsigned long long subtrahendSeconds, unsigned long long subtrahendMicroSeconds) throw (exception)
string timevalToHumanString (const timeval &tv)

Variables

 BOREALIS_NAMESPACE_BEGIN
 BOREALIS_NAMESPACE_END

Function Documentation

void closeFile int  fd  )  throw (std::exception)
 

void deleteFile string  filePath  )  throw (std::exception)
 

bool dirExists string  dirPath  )  throw (std::exception)
 

string ensureStringEndsWith string  src,
char  suffix
throw (exception)
 

bool fileExists string  filePath  )  throw (std::exception)
 

timeval getAvgTimevalBySums unsigned long long  summedSeconds,
unsigned long long  summedMicroSeconds,
unsigned int  numValues
throw (exception)
 

unsigned long getBlockSize int  fd  )  throw (std::exception)
 

off_t getFileLen int  fd  )  throw (std::exception)
 

off_t getFileOffset int  fd  )  throw (std::exception)
 

timeval getTimevalDiff const timeval &  t1,
const timeval &  t2
throw (exception)
 

void listFilesWithPrefix string  dirpath,
string  prefix,
vector< string > &  filenames
throw (std::exception)
 

timeval makeNormalTimeval unsigned long long  sec,
unsigned long long  usec
throw (exception)
 

timeval makeTimeval long  seconds,
long  microSeconds
throw (exception)
 

int openFileWithFlags string  filename,
int  flags
throw (std::exception)
 

int openFileWithFlagsAndPerms string  filename,
int  flags,
int  perms
throw (std::exception)
 

void readData int  fd,
off_t  fileOffset,
char *  pBuffer,
ssize_t  numBytesToRead
throw (std::exception)
 

void setFileLen int  fd,
off_t  newFileLen,
bool  forceAlloc
throw (std::exception)
 

off_t setFileOffset int  fd,
off_t  offset,
int  whence
throw (std::exception)
 

void subtractTimestampSums unsigned long long &  accumulatorSeconds,
unsigned long long &  accumulatorMicroSeconds,
unsigned long long  subtrahendSeconds,
unsigned long long  subtrahendMicroSeconds
throw (exception)
 

int timevalsComp const timeval &  t1,
const timeval &  t2
 

bool timevalsEqual const timeval &  t1,
const timeval &  t2
 

string timevalToHumanString const timeval &  tv  ) 
 

string timevalToSimpleString const timeval &  tv  ) 
 

string tmToSimpleString const tm &  aTime  ) 
 

void writeData int  fd,
off_t  fileOffset,
const char *  pBuffer,
ssize_t  numBytesToWrite
throw (std::exception)
 


Variable Documentation

BOREALIS_NAMESPACE_BEGIN
 

BOREALIS_NAMESPACE_END
 


Generated on Fri Nov 12 15:15:22 2004 for Borealis by doxygen 1.3.8