13 #ifndef CARMA_UTIL_FILEUTILS_H
14 #define CARMA_UTIL_FILEUTILS_H
54 static bool exists(
const std::string& fileName);
62 static void rename(
const std::string & from,
const std::string & to );
69 static void removeFile(
const std::string & target );
79 mode_t mode = S_IRWXU | S_IRWXG | S_IROTH );
87 static void hardLink(
const std::string & target,
88 const std::string & link );
97 static unsigned lineCount(
const std::string& fileName);
103 static off_t
size(
const std::string& fileName);
104 static off64_t size64(
const std::string& fileName);
110 static std::string
getError(
const std::string& fileName);
129 static time_t
changeTime(
const std::string& fileName);
138 static time_t
accessTime(
const std::string& fileName);
149 const std::string& signature);
160 std::string& signature);
175 static std::vector<std::string>
scandir(
const std::string & dir );
179 #endif // CARMA_UTIL_FILEUTILS_H
static std::string getError(const std::string &fileName)
get file error diagnostic message
static void rename(const std::string &from, const std::string &to)
Rename a file or directory.
static void makeDirectory(const std::string &path, mode_t mode=S_IRWXU|S_IRWXG|S_IROTH)
Make a directory.
unsigned int frameType
Half second frames since Jan 1, 2000.
static void hardLink(const std::string &target, const std::string &link)
Create a hard link to a file.
Common file functions Additional file-related functions can be added here.
static void writeMonitorDataFlatFileHeader(FILE *&file, const carma::util::frameType &frameCount, const std::string &signature)
write the header of a monitor data flat file
static bool exists(const std::string &fileName)
does the specified file exist?
static off_t size(const std::string &fileName)
the total size of the file in bytes
DigestType
digest type <ui> MD5 md5 SHA1 sha1
static time_t changeTime(const std::string &fileName)
static std::string computeSha1Sum(const std::string &fileName)
compute the SHA1 sum of the file
static unsigned getMonitorDataFlatFileHeaderLength(const unsigned &sigLength)
get the length in bytes, including the new line character, of a monitor data flat file having a signa...
static std::string computeMessageDigest(const std::string &fileName, const DigestType &digestType)
compute the specified message digest for the specified file
static std::vector< std::string > scandir(const std::string &dir)
Return contents of a directory as a vector of strings.
static void removeFile(const std::string &target)
Delete a file.
static time_t accessTime(const std::string &fileName)
static time_t modificationTime(const std::string &fileName)
static unsigned lineCount(const std::string &fileName)
get the number of lines in the specified file
static void readMonitorDataFlatFileHeader(const std::string &fileName, carma::util::frameType &frameCount, std::string &signature)
read and parse the header of a monitor data flat file