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

a generic io interface for libpressio More...

#include <stddef.h>
Include dependency graph for pressio_io.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

struct pressio_iopressio_get_io (struct pressio *library, const char *io_module)
 
void pressio_io_free (struct pressio_io *io)
 
const char * pressio_supported_io_modules ()
 
struct pressio_optionspressio_io_get_configuration (struct pressio_io const *io)
 
struct pressio_optionspressio_io_get_documentation (struct pressio_io const *io)
 
struct pressio_optionspressio_io_get_options (struct pressio_io const *io)
 
int pressio_io_set_options (struct pressio_io *io, struct pressio_options const *options)
 
int pressio_io_check_options (struct pressio_io *io, struct pressio_options const *options)
 
struct pressio_datapressio_io_read (struct pressio_io *io, struct pressio_data *data)
 
int pressio_io_write (struct pressio_io *io, struct pressio_data const *data)
 
int pressio_io_error_code (struct pressio_io const *io)
 
const char * pressio_io_error_msg (struct pressio_io const *io)
 
const char * pressio_io_version (struct pressio_io const *io)
 
int pressio_io_major_version (struct pressio_io const *io)
 
int pressio_io_minor_version (struct pressio_io const *io)
 
int pressio_io_patch_version (struct pressio_io const *io)
 
struct pressio_iopressio_io_clone (struct pressio_io *io)
 
void pressio_io_set_name (struct pressio_io *io, const char *new_name)
 
const char * pressio_io_get_name (struct pressio_io const *io)
 
int pressio_io_write_many (struct pressio_io *io, const struct pressio_data **data_begin, size_t num_data)
 
int pressio_io_read_many (struct pressio_io *io, struct pressio_data **data_begin, size_t num_data)
 

Detailed Description

a generic io interface for libpressio

Function Documentation

◆ pressio_get_io()

struct pressio_io * pressio_get_io ( struct pressio library,
const char *  io_module 
)
Parameters
[in]librarythe name of the io module
[in]io_modulethe name of the io module
Returns
a new handle to an io module

◆ pressio_io_check_options()

int pressio_io_check_options ( struct pressio_io io,
struct pressio_options const *  options 
)

Validates that only defined options have been set. This can be useful for programmer errors. This function should NOT be used with any option structure which contains options for multiple io modules. Other checks MAY be preformed implementing io modules.

Parameters
[in]iowhich io to validate the options struct against
[in]optionswhich options set to check against. It should ONLY contain options returned by pressio_io_get_options
Returns
0 if successful, 1 if there is an error. On error, an error message is set in pressio_io_error_msg.
See also
pressio_io_error_msg to get the error message

◆ pressio_io_clone()

struct pressio_io * pressio_io_clone ( struct pressio_io io)

Creates a new reference to an io module with the same configuration

Parameters
[in]iothe io module to clone
Returns
a new reference to an io module

◆ pressio_io_error_code()

int pressio_io_error_code ( struct pressio_io const *  io)
Parameters
[in]iothe io module to query
Returns
last error code for the io

◆ pressio_io_error_msg()

const char * pressio_io_error_msg ( struct pressio_io const *  io)
Parameters
[in]iothe io module to query
Returns
last error message for the io

◆ pressio_io_free()

void pressio_io_free ( struct pressio_io io)
Parameters
[in]iodeallocates a reference to a io module.

◆ pressio_io_get_configuration()

struct pressio_options * pressio_io_get_configuration ( struct pressio_io const *  io)
Returns
a pressio options struct that represents the compile time configuration of the io module
Parameters
[in]iowhich io to get compile-time configuration for

◆ pressio_io_get_documentation()

struct pressio_options * pressio_io_get_documentation ( struct pressio_io const *  io)
Returns
a pressio options struct that represents the documentation of the io module
Parameters
[in]iowhich io to get documentation for

◆ pressio_io_get_name()

const char * pressio_io_get_name ( struct pressio_io const *  io)

Get the name of a io

Parameters
[in]iothe io to get the name of
Returns
a string with the io name. The string becomes invalid if the name is set_name is called.

◆ pressio_io_get_options()

struct pressio_options * pressio_io_get_options ( struct pressio_io const *  io)
Returns
a pressio options struct that represents the current options of the io module
Parameters
[in]iowhich io to get options for

◆ pressio_io_major_version()

int pressio_io_major_version ( struct pressio_io const *  io)
Parameters
[in]iothe io module to query
Returns
the major version number or 0 if there is none

◆ pressio_io_minor_version()

int pressio_io_minor_version ( struct pressio_io const *  io)
Parameters
[in]iothe io module to query
Returns
the major version number or 0 if there is none

◆ pressio_io_patch_version()

int pressio_io_patch_version ( struct pressio_io const *  io)
Parameters
[in]iothe io module to query
Returns
the major version number or 0 if there is none

◆ pressio_io_read()

struct pressio_data * pressio_io_read ( struct pressio_io io,
struct pressio_data data 
)

reads a pressio_data buffer from some persistent storage

Parameters
[in]iothe object to preform the read
[in]datadata object to populate, or nullptr to allocate it from the file if supported by the plugin. Data passed to this call should be considered "moved" in a c++11 sense.
Returns
nullptr on failures, non-null on success

◆ pressio_io_read_many()

int pressio_io_read_many ( struct pressio_io io,
struct pressio_data **  data_begin,
size_t  num_data 
)

read multiple buffers

Parameters
[in]iothe io to use to read
[in,out]data_beginpointer to an array of data objects, these can be nullptr on input and are replaced with the read data
[in]num_datathe number of buffers to write

◆ pressio_io_set_name()

void pressio_io_set_name ( struct pressio_io io,
const char *  new_name 
)

Assign a new name to a io. Names are used to prefix options in meta-ios.

sub-ios will be renamed either by the of the sub-ios prefix or by the $prefix:name configuration option

i.e. for some new_name and a io with prefix foo and subios with prefixs "abc", "def", "ghi" respectively

  • if foo:names = ['one', 'two', 'three'], then the names will be `$new_name/one, $new_name/two $new_name/three
  • otherwise the names will be $new_name/abc, $new_name/def, $new_name/ghi
Parameters
[in]iothe io to get the name of
[in]new_namethe name to set

◆ pressio_io_set_options()

int pressio_io_set_options ( struct pressio_io io,
struct pressio_options const *  options 
)

sets the options for the pressio_io. io modules MAY choose to ignore some subset of options passed in if there valid but conflicting settings (i.e. two settings that adjust the same underlying configuration). io modules SHOULD return an error value if configuration failed due to a missing required setting or an invalid one. Users MAY call pressio_io_error_msg() to get more information about the warnings or errors io modules MUST ignore any and all options set that they do not support.

Parameters
[in]iowhich io to get options for
[in]optionsthe options to set
Returns
0 if successful, positive values on errors, negative values on warnings
See also
pressio_io_error_msg

◆ pressio_io_version()

const char * pressio_io_version ( struct pressio_io const *  io)

Get the version and feature information. The version string may include more information than major/minor/patch provide.

Parameters
[in]iothe io to query
Returns
a implementation specific version string

◆ pressio_io_write()

int pressio_io_write ( struct pressio_io io,
struct pressio_data const *  data 
)

write a pressio_data buffer from some persistent storage

Parameters
[in]iothe object to preform the write
[in]datadata object to write
Returns
0 if successful, positive values on errors, negative values on warnings

◆ pressio_io_write_many()

int pressio_io_write_many ( struct pressio_io io,
const struct pressio_data **  data_begin,
size_t  num_data 
)

write multiple buffers

Parameters
[in]iothe io to use to write
[in]data_beginpointer to an array of data objects
[in]num_datathe number of buffers to write

◆ pressio_supported_io_modules()

const char * pressio_supported_io_modules ( )
Returns
the list supported io_modules seperated by whitespace