adtf_file_library  0.13.1
Namespaces | Classes | Typedefs | Functions
utils5ext Namespace Reference

Namespaces

 exceptions
 namespace to collect special exceptions for file operations.
 

Classes

class  File
 
class  FileRingBuffer
 

Typedefs

using FilePos = int64_t
 Type for a file position.
 
using FileSize = FilePos
 Type for the file size.
 
typedef int FileHandle
 The type FileHandle is used internally only.
 

Functions

a_util::datetime::DateTime getTimeAccess (const a_util::filesystem::Path filename)
 This function returns the last access time of the file. More...
 
a_util::datetime::DateTime getTimeCreation (const a_util::filesystem::Path filename)
 This function returns the creation time of the file. More...
 
a_util::datetime::DateTime getTimeChange (const a_util::filesystem::Path filename)
 This function returns the last change (write) time of the file. More...
 
size_t getDefaultSectorSize () noexcept
 Get the Default Sector Size. More...
 
void * allocPageAlignedMemory (size_t size, size_t page_size)
 allocates a memory buffer for the size of size (in bytes), page aligned in size to page_size More...
 
void freePageAlignedMemory (void *memory)
 frees the memory buffer allocated with utils5ext::allocPageAlignedMemory More...
 
size_t getSectorSizeFor (const a_util::filesystem::Path &filename) noexcept
 Get the sector size of a file within windows file system. More...
 
void memZero (void *data, size_t bytes)
 Helper function to set a memory buffer to zero. More...
 
void fileRename (const a_util::filesystem::Path &from, const a_util::filesystem::Path &to)
 Renames or moves a file. More...
 

Detailed Description

Namespace for Utils5 Extension utilities.

The Utils5 Extension package will provide some further helper classes needed to create an indexed file (ifhd).

Function Documentation

◆ allocPageAlignedMemory()

void* utils5ext::allocPageAlignedMemory ( size_t  size,
size_t  page_size 
)

allocates a memory buffer for the size of size (in bytes), page aligned in size to page_size

Parameters
sizethe size in bytes to allocate and to use
page_sizethe page size the buffer will be aligned to in size
Returns
void* the buffer
Remarks
if allocated with allocPageAlignedMemory you must free the buffer with utils5ext::freePageAlignedMemory

◆ fileRename()

void utils5ext::fileRename ( const a_util::filesystem::Path &  from,
const a_util::filesystem::Path &  to 
)

Renames or moves a file.

Parameters
fromthe file to rename or move
tothe destination file
Exceptions
exceptions::ErrorFileAccess

◆ freePageAlignedMemory()

void utils5ext::freePageAlignedMemory ( void *  memory)

frees the memory buffer allocated with utils5ext::allocPageAlignedMemory

Parameters
memorythe memory buffer

◆ getDefaultSectorSize()

size_t utils5ext::getDefaultSectorSize ( )
noexcept

Get the Default Sector Size.

Returns
size_t the default sector size

◆ getSectorSizeFor()

size_t utils5ext::getSectorSizeFor ( const a_util::filesystem::Path &  filename)
noexcept

Get the sector size of a file within windows file system.

Parameters
filenamethe filename to retrieve the sector size from
Returns
size_t the sector size.
Remarks
this function returns the getDefaultSectorSize() within linux!

◆ getTimeAccess()

a_util::datetime::DateTime utils5ext::getTimeAccess ( const a_util::filesystem::Path  filename)

This function returns the last access time of the file.

Parameters
filenameFilename of the file to be checked
Returns
OK if the time has been retrieved, ERR_INVALID_ARG if filename is empty, ERR_UNKNOWN if time cannot be read;
Attention
From MSDN chapter "File Times": Not all file systems can record creation and last access times, and not all file systems record them in the same manner.
For example, the resolution of create time on FAT is 10 milliseconds, while write time has a resolution of 2 seconds and access time has a resolution of 1 day, so it is really the access date.
The NTFS file system delays updates to the last access time for a file by up to 1 hour after the last access.
Exceptions
exceptions::ErrorFileAccess,throwstd::runtime_error

◆ getTimeChange()

a_util::datetime::DateTime utils5ext::getTimeChange ( const a_util::filesystem::Path  filename)

This function returns the last change (write) time of the file.

Parameters
filenameFilename of the file to be checked
Returns
OK if the time has been retrieved, ERR_INVALID_ARG if filename is empty, ERR_UNKNOWN if time cannot be read;
Attention
From MSDN chapter "File Times": Not all file systems can record creation and last access times, and not all file systems record them in the same manner.
For example, the resolution of create time on FAT is 10 milliseconds, while write time has a resolution of 2 seconds and access time has a resolution of 1 day, so it is really the access date.
The NTFS file system delays updates to the last access time for a file by up to 1 hour after the last access.
Exceptions
exceptions::ErrorFileAccess,throwstd::runtime_error

◆ getTimeCreation()

a_util::datetime::DateTime utils5ext::getTimeCreation ( const a_util::filesystem::Path  filename)

This function returns the creation time of the file.

Parameters
filenameFilename of the file to be checked
Returns
OK if the time has been retrieved, ERR_INVALID_ARG if filename is empty, ERR_UNKNOWN if time cannot be read;
Attention
From MSDN chapter "File Times": Not all file systems can record creation and last access times, and not all file systems record them in the same manner.
For example, the resolution of create time on FAT is 10 milliseconds, while write time has a resolution of 2 seconds and access time has a resolution of 1 day, so it is really the access date.
The NTFS file system delays updates to the last access time for a file by up to 1 hour after the last access.
Exceptions
exceptions::ErrorFileAccess,throwstd::runtime_error

◆ memZero()

void utils5ext::memZero ( void *  data,
size_t  bytes 
)
inline

Helper function to set a memory buffer to zero.

Parameters
datathe buffer
bytesthe buffer size in bytes.

Copyright © CARIAD SE.
Generated on Fri Apr 19 2024 by doxygen 1.9.1
GIT Commit Hash: 82d535f82776c20b12fc60740bdae991b62444a7