libpressio 0.93.0
Loading...
Searching...
No Matches
Macros | Functions
posix.h File Reference

IO functions for POSIX compatible systems. More...

#include <stdio.h>
Include dependency graph for posix.h:

Go to the source code of this file.

Functions

struct pressio_datapressio_io_data_fread (struct pressio_data *dims, FILE *in_file)
 
struct pressio_datapressio_io_data_read (struct pressio_data *dims, int in_filedes)
 
struct pressio_datapressio_io_data_path_read (struct pressio_data *dims, const char *out_file)
 
size_t pressio_io_data_fwrite (struct pressio_data const *data, FILE *out_file)
 
size_t pressio_io_data_write (struct pressio_data const *data, int out_filedes)
 
size_t pressio_io_data_path_write (struct pressio_data const *data, const char *path)
 

Detailed Description

IO functions for POSIX compatible systems.

NOTE attempting to read files written by different machines has undefined behavior!!

Function Documentation

◆ pressio_io_data_fread()

struct pressio_data * pressio_io_data_fread ( struct pressio_data dims,
FILE *  in_file 
)

read in a file from a POSIX FILE pointer

NOTE attempting to read files written by different machines has undefined behavior!!

Parameters
[in,out]dimsdescription of the dimension of the data if it known or NULL.
If dims is NULL, the remainder of the file will be read and the size of the resulting pointer will be a 1d pressio_byte_dtype of appropriate length If dims is not null, The user SHOULD assume that the memory pointed to by this pointer has been "moved" in a C++11 sense and the user MUST not rely on its contents. The implementation MAY return this pointer and reuse the underlying space if pressio_data_has_data(dims) returns true.
[in,out]in_filean file open for reading seeked to the beginning of the data to read in.
Returns
a pointer to a new pressio data structure.

◆ pressio_io_data_fwrite()

size_t pressio_io_data_fwrite ( struct pressio_data const *  data,
FILE *  out_file 
)

write in a file to the specified POSIX FILE pointer

Parameters
[in]datathe data to be written.
[in,out]out_file
Returns
the number of bytes written

◆ pressio_io_data_path_read()

struct pressio_data * pressio_io_data_path_read ( struct pressio_data dims,
const char *  out_file 
)

read in a file at a specifed location on the file-system

NOTE attempting to read files written by different machines has undefined behavior!!

Parameters
[in,out]dimsdescription of the dimension of the data if it known or NULL.
If dims is NULL, the remainder of the file will be read and the size of the resulting pointer will be a 1d pressio_byte_dtype of appropriate length If dims is not null, The user SHOULD assume that the memory pointed to by this pointer has been "moved" in a C++11 sense and the user MUST not rely on its contents. The implementation MAY return this pointer and reuse the underlying space if pressio_data_has_data(dims) returns true.
[in,out]out_filean file open for reading seeked to the beginning of the data to read in.
Returns
a pointer to a new pressio data structure.

◆ pressio_io_data_path_write()

size_t pressio_io_data_path_write ( struct pressio_data const *  data,
const char *  path 
)

write in a file to the specified path on the file-system

Parameters
[in]datathe data to be written.
[in,out]paththe path to write to
Returns
the number of bytes written

◆ pressio_io_data_read()

struct pressio_data * pressio_io_data_read ( struct pressio_data dims,
int  in_filedes 
)

read in a file from a POSIX file descriptor

NOTE attempting to read files written by different machines has undefined behavior!!

Parameters
[in,out]dimsdescription of the dimension of the data if it known or NULL.
If dims is NULL, the remainder of the file will be read and the size of the resulting pointer will be a 1d pressio_byte_dtype of appropriate length If dims is not null, The user SHOULD assume that the memory pointed to by this pointer has been "moved" in a C++11 sense and the user MUST not rely on its contents. The implementation MAY return this pointer and reuse the underlying space if pressio_data_has_data(ptr) returns true.
[in,out]in_filedesan file open for reading seeked to the beginning of the data to read in. If dims is not null, only pressio_data_get_bytes(dims) bytes are read.
Returns
a pointer to a new pressio data structure.

◆ pressio_io_data_write()

size_t pressio_io_data_write ( struct pressio_data const *  data,
int  out_filedes 
)

write in a file to the specified POSIX file descriptor

Parameters
[in]datathe data to be written.
[in,out]out_filedesthe file descriptor to write to
Returns
the number of bytes written