PLCnext API Documentation  21.6.0.46
File.hpp
1 //
3 // Copyright PHOENIX CONTACT Electronics GmbH
4 //
6 #pragma once
7 #include "Arp/System/Core/Arp.h"
8 #include <vector>
9 
10 namespace Arp { namespace System { namespace Commons { namespace Io
11 {
12 
14 class File
15 {
16 public: // construction/destruction
17  File(void) = delete;
18  File(const File& arg) = delete;
19  File& operator=(const File& arg) = delete;
20  ~File(void) = delete;
21 
22 public: // static operations
28  static bool Exists(const String& path);
29 
36  static void Delete(const String& path);
37 
45  static void Delete(const String& path, bool sync);
46 
57  static void Copy(const String& sourcePath, const String& destinationPath, bool createDirectory = true, bool overwrite = true);
58 
70  static void Copy(const String& sourcePath, const String& destinationPath, bool createDirectory, bool overwrite, bool sync);
71 
82  static void Move(const String& sourcePath, const String& destinationPath, bool createDirectory = true, bool overwrite = true);
83 
95  static void Move(const String& sourcePath, const String& destinationPath, bool createDirectory, bool overwrite, bool sync);
96 
102  static std::vector<byte> ReadAll(const String& path);
103 
108  static void WriteAll(const String& path, const std::vector<byte>& data);
109 
115  static void WriteAll(const String& path, const std::vector<byte>& data, bool sync);
116 
119  static void SyncAll(void);
120 
124  static void Sync(const String& path);
125 };
126 
128 // inline methods of class File
129 
130 }}}} // end of namespace Arp::System::Commons::Io
static void Move(const String &sourcePath, const String &destinationPath, bool createDirectory=true, bool overwrite=true)
Moves a file from source path to destination path. After successful operation, the synchronization of...
static bool Exists(const String &path)
Checks for existence of a file.
static void WriteAll(const String &path, const std::vector< byte > &data)
Writes the data in data into file identified by path. After successful operation, the synchronization...
static std::vector< byte > ReadAll(const String &path)
Reads data from file and returns it as byte array.
static void Sync(const String &path)
Force file system synchronization for the given file.
Root namespace for the PLCnext API
static void Delete(const String &path)
Deletes the file from the filesystem. After successful operation, the synchronization of the file sys...
static void SyncAll(void)
Force global file system synchronization.
API to manage and manipulate single files.
Definition: File.hpp:14
static void Copy(const String &sourcePath, const String &destinationPath, bool createDirectory=true, bool overwrite=true)
Copies a file from source path to destination path. After successful operation, the synchronization o...
System components used by the System, Device, Plc or Io domains.