filesystem.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <filesystem>
4 #include <map>
5 #include <string>
6 #include <vector>
7 
9 
11 {
12  namespace detail
13  {
14  inline const std::map<std::string, std::string> EscapeTable = {{"/", "|"}};
15 
16  std::string escapeName(const std::string& segmentName);
17 
18  std::string unescapeName(const std::string& escapedName);
19 
20  std::string toDayString(const Time& t);
21 
22  std::string toSecondsString(const Time& t);
23 
24  bool isNumberString(const std::string& s);
25 
26  bool isDateString(const std::string& s);
27 
28  std::string extractLastDirectoryFromPath(const std::string& path);
29  } // namespace detail
30 
31  std::filesystem::path toPath(const std::filesystem::path& base, const armem::MemoryID& id);
32 
33  bool directoryExists(const std::filesystem::path& p);
34 
35  bool fileExists(const std::filesystem::path& p);
36 
37  void ensureDirectoryExists(const std::filesystem::path& p, bool createIfNotExistent = false);
38 
39  void ensureFileExists(const std::filesystem::path& p, bool createIfNotExistent = false);
40 
41  void writeDataToFile(const std::filesystem::path& p, const std::vector<unsigned char>& data);
42 
43  std::vector<unsigned char> readDataFromFile(const std::filesystem::path& p);
44 
45  std::vector<std::filesystem::path> getAllDirectories(const std::filesystem::path& p);
46 
47  std::vector<std::filesystem::path> getAllFiles(const std::filesystem::path& p);
48 
49 } // namespace armarx::armem::server::ltm::util::fs
armarx::armem::server::ltm::util::fs::detail::toDayString
std::string toDayString(const Time &t)
Definition: filesystem.cpp:56
armarx::armem::server::ltm::util::fs::ensureFileExists
void ensureFileExists(const std::filesystem::path &p, bool createIfNotExistent=false)
Definition: filesystem.cpp:159
MemoryID.h
armarx::armem::server::ltm::util::fs::writeDataToFile
void writeDataToFile(const std::filesystem::path &p, const std::vector< unsigned char > &data)
Definition: filesystem.cpp:178
detail
Definition: OpenCVUtil.cpp:127
armarx::armem::server::ltm::util::fs
Definition: filesystem.h:10
armarx::armem::server::ltm::util::fs::detail::unescapeName
std::string unescapeName(const std::string &escapedName)
Definition: filesystem.cpp:31
armarx::armem::server::ltm::util::fs::readDataFromFile
std::vector< unsigned char > readDataFromFile(const std::filesystem::path &p)
Definition: filesystem.cpp:192
armarx::armem::server::ltm::util::fs::ensureDirectoryExists
void ensureDirectoryExists(const std::filesystem::path &p, bool createIfNotExistent=false)
Definition: filesystem.cpp:142
armarx::armem::server::ltm::util::fs::detail::escapeName
std::string escapeName(const std::string &segmentName)
Definition: filesystem.cpp:19
armarx::armem::MemoryID
A memory ID.
Definition: MemoryID.h:47
data
uint8_t data[1]
Definition: EtherCATFrame.h:68
armarx::armem::server::ltm::util::fs::detail::EscapeTable
const std::map< std::string, std::string > EscapeTable
Definition: filesystem.h:14
armarx::armem::server::ltm::util::fs::getAllDirectories
std::vector< std::filesystem::path > getAllDirectories(const std::filesystem::path &p)
Definition: filesystem.cpp:202
armarx::armem::server::ltm::util::fs::detail::extractLastDirectoryFromPath
std::string extractLastDirectoryFromPath(const std::string &path)
Definition: filesystem.cpp:44
armarx::armem::server::ltm::util::fs::detail::isNumberString
bool isNumberString(const std::string &s)
Definition: filesystem.cpp:68
armarx::armem::server::ltm::util::fs::toPath
std::filesystem::path toPath(const std::filesystem::path &base, const armem::MemoryID &id)
Definition: filesystem.cpp:94
armarx::armem::server::ltm::util::fs::directoryExists
bool directoryExists(const std::filesystem::path &p)
Definition: filesystem.cpp:130
armarx::core::time::DateTime
Represents a point in time.
Definition: DateTime.h:24
armarx::armem::server::ltm::util::fs::detail::isDateString
bool isDateString(const std::string &s)
Definition: filesystem.cpp:81
armarx::armem::server::ltm::util::fs::detail::toSecondsString
std::string toSecondsString(const Time &t)
Definition: filesystem.cpp:62
armarx::ctrlutil::s
double s(double t, double s0, double v0, double a0, double j)
Definition: CtrlUtil.h:33
armarx::armem::server::ltm::util::fs::fileExists
bool fileExists(const std::filesystem::path &p)
Definition: filesystem.cpp:136
armarx::armem::server::ltm::util::fs::getAllFiles
std::vector< std::filesystem::path > getAllFiles(const std::filesystem::path &p)
Definition: filesystem.cpp:221