filesystem.h File Reference
#include <filesystem>
#include <map>
#include <string>
#include <vector>
#include <RobotAPI/libraries/armem/core/MemoryID.h>
+ Include dependency graph for filesystem.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  armarx
 This file offers overloads of toIce() and fromIce() functions for STL container types.
 
namespace  armarx::armem
 
namespace  armarx::armem::server
 
namespace  armarx::armem::server::ltm
 
namespace  armarx::armem::server::ltm::util
 
namespace  armarx::armem::server::ltm::util::fs
 
namespace  armarx::armem::server::ltm::util::fs::detail
 

Enumerations

enum class  WriteMode { Plain , Atomic , AtomicDurable }
 How writeDataToFile() should get the bytes onto disk. More...
 

Functions

bool canCreateFiles (const std::filesystem::path &dir)
 Check if we can create files in this directory.
 
bool directoryExists (const std::filesystem::path &p)
 
void ensureDirectoryExists (const std::filesystem::path &p, bool createIfNotExistent=false)
 
void ensureFileExists (const std::filesystem::path &p, bool createIfNotExistent=false)
 
std::string escapeName (const std::string &segmentName)
 
std::string extractLastDirectoryFromPath (const std::string &path)
 
bool fileExists (const std::filesystem::path &p)
 
std::vector< std::filesystem::path > getAllDirectories (const std::filesystem::path &p)
 
std::vector< std::filesystem::path > getAllFiles (const std::filesystem::path &p)
 
std::vector< unsigned char > gzipCompress (const std::vector< unsigned char > &data, int level=1)
 Compress data into a gzip container (i.e.
 
std::vector< unsigned char > gzipDecompress (const std::vector< unsigned char > &data)
 Inverse of gzipCompress. Throws if the data is not a valid gzip stream.
 
bool hasWritePermission (const std::filesystem::path &p)
 Check if directory has write permission.
 
bool isDateString (const std::string &s)
 
bool isGzip (const std::vector< unsigned char > &data)
 Gzip magic bytes (0x1f 0x8b) — used to detect compressed content defensively.
 
bool isNumberString (const std::string &s)
 
std::vector< unsigned char > readDataFromFile (const std::filesystem::path &p)
 
std::string toDayString (const Time &t)
 
std::filesystem::path toPath (const std::filesystem::path &base, const armem::MemoryID &id)
 
std::string toSecondsString (const Time &t)
 
std::string unescapeName (const std::string &escapedName)
 
void writeDataToFile (const std::filesystem::path &p, const std::vector< unsigned char > &data, WriteMode mode=WriteMode::AtomicDurable)
 

Variables

const std::map< std::string, std::string > EscapeTable = {{"/", "|"}}