PLCnext API Documentation 25.0.2.69
Public Types | Public Member Functions | Static Public Member Functions | List of all members
Arp::System::Commons::Services::Io::IFileService Class Referenceabstract

Provides common file operations for reading and writing files as well as deleting/moving/copying files on the device. More...

#include <IFileService.hpp>

Inheritance diagram for Arp::System::Commons::Services::Io::IFileService:
Inheritance graph

Public Types

using Ptr = std::shared_ptr< IFileService >
 
- Public Types inherited from Arp::Base::Rsc::Commons::IRscService
using Ptr = std::shared_ptr< IRscService >
 The shared_ptr type of IRscService.
 

Public Member Functions

 IFileService (void)=default
 Constructs an IFileService instance.
 
virtual boolean Exists (const RscString< 512 > &path)=0
 Checks if the specified file exists. More...
 
virtual FileSystemError Write (const RscString< 512 > &filePath, boolean overwrite, const std::vector< TraitItem > &traitItems, RscStream data)=0
 Writes the given data to the specified file. More...
 
virtual FileSystemError Read (Traits fileTraits, const RscString< 512 > &filePath, RscStream data, std::vector< TraitItem > &traitItems)=0
 Reads the specified file from device. More...
 
virtual FileSystemError Delete (const RscString< 512 > &filePath)=0
 Deletes the specified file. More...
 
virtual FileSystemError Move (boolean createDirectory, boolean overwrite, const RscString< 512 > &sourceFilePath, const RscString< 512 > &destinationFilePath)=0
 Moves the specified file. More...
 
virtual FileSystemError Copy (boolean createDirectory, boolean overwrite, const RscString< 512 > &sourceFilePath, const RscString< 512 > &destinationFilePath)=0
 Copies the specified files. More...
 
- Public Member Functions inherited from Arp::Base::Rsc::Commons::IRscService
 IRscService (void)=default
 The default constructor.
 
 IRscService (const IRscService &arg)=delete
 The deleted copy constructor. More...
 
 IRscService (IRscService &&arg) noexcept=default
 The default move constructor. More...
 
IRscServiceoperator= (const IRscService &arg)=delete
 The deleted assignment operator. More...
 
IRscServiceoperator= (IRscService &&arg) noexcept=default
 The default move-assignment operator. More...
 
virtual ~IRscService (void)=default
 Destructs this instance and frees all resources.
 

Static Public Member Functions

static IRscServiceProxyFactoryGetProxyFactory (void)
 
- Static Public Member Functions inherited from Arp::Base::Rsc::Commons::IRscService
static IRscServiceProxyFactoryGetProxyFactory (void)
 Returns a reference to service proxy factory to create a proxy instance of this service. More...
 

Detailed Description

Provides common file operations for reading and writing files as well as deleting/moving/copying files on the device.

The path separator is always '/'.

This service itself has no limitation to the file size. The service has been tested with file transfers up to 4GB. Depending on the target, the client, their configuration and their resources the actual size limit may vary.

This service is defined in library Arp.System.Commons.Services.

Realtime Usage: This API call does not have to be deterministic in runtime behaviour, so an asynchronous execution should be considered.

Member Function Documentation

◆ Copy()

virtual FileSystemError Arp::System::Commons::Services::Io::IFileService::Copy ( boolean  createDirectory,
boolean  overwrite,
const RscString< 512 > &  sourceFilePath,
const RscString< 512 > &  destinationFilePath 
)
pure virtual

Copies the specified files.

Parameters
createDirectoryif set to true the directory of the file is created (recursively), if it does not exists yet.
overwriteif set to true the destination file is overwritten, if it yet exists, otherwise an error is returned.
sourceFilePathThe source path of the file to copy.
destinationFilePathThe destination path of the file to copy.
Returns
Result of the action.

◆ Delete()

virtual FileSystemError Arp::System::Commons::Services::Io::IFileService::Delete ( const RscString< 512 > &  filePath)
pure virtual

Deletes the specified file.

Parameters
filePathThe pathe of the file to delete.
Returns
Result of the action.

◆ Exists()

virtual boolean Arp::System::Commons::Services::Io::IFileService::Exists ( const RscString< 512 > &  path)
pure virtual

Checks if the specified file exists.

Parameters
pathPath of the file to check.
Returns
true if the file exists, otherwise false.

◆ Move()

virtual FileSystemError Arp::System::Commons::Services::Io::IFileService::Move ( boolean  createDirectory,
boolean  overwrite,
const RscString< 512 > &  sourceFilePath,
const RscString< 512 > &  destinationFilePath 
)
pure virtual

Moves the specified file.

Parameters
createDirectoryif set to true the directory of the file is created (recursively), if it does not exists yet.
overwriteif set to true the destination file is overwritten, if it yet exists, otherwise an error is returned.
sourceFilePathThe source path of the file to move.
destinationFilePathThe destination path of the file to move.
Returns
Result of the action.

◆ Read()

virtual FileSystemError Arp::System::Commons::Services::Io::IFileService::Read ( Traits  fileTraits,
const RscString< 512 > &  filePath,
RscStream  data,
std::vector< TraitItem > &  traitItems 
)
pure virtual

Reads the specified file from device.

Parameters
fileTraitsSpecifies the file traits to read, if this value is not Arp.System.Commons.Services.Io.Traits.None.
filePathThe path of the file to read.
dataData read from the specified file.
traitItemsSpecified trait items read from the specified file.
Returns
Result of the action.

◆ Write()

virtual FileSystemError Arp::System::Commons::Services::Io::IFileService::Write ( const RscString< 512 > &  filePath,
boolean  overwrite,
const std::vector< TraitItem > &  traitItems,
RscStream  data 
)
pure virtual

Writes the given data to the specified file.

Parameters
filePathPath of the file on the target.
overwriteIf set to true the destination file is overwritten, if it yet exists, otherwise an error is returned.
traitItemsTrait items to set up after writing the file.
dataData to writing into the specified file.
Returns
Result of the action.

The documentation for this class was generated from the following file: