PDI 1.12.0-alpha.2026-05-07

the PDI data interface

PDI Namespace Reference

Classes

class  Array_datatype
 an Array_datatype is a Datatype that represents an array: i.e storage of multiple elements of the same type continuously in memory. More...
class  Callbacks
class  Context
class  Context_proxy
class  Data_descriptor
class  Datatype
 A Datatype is a Datatype_template that accepts no argument. More...
class  Datatype_template
class  Error
 An error class from which all PDI error are children. More...
class  Spectree_error
 An error class to use when there is an invalid entry in the specification tree. More...
class  Multiple_errors
 An error class to use when multiple errors of different kind have happened. More...
class  Expression
class  Logger
 Wrapper for spdlog::logger with additional pattern getter method. More...
struct  Paraconf_wrapper
 Automatically installs a paraconf error-handler that ignores errors and uninstalls it on destruction. More...
class  Yaml_region
 A region in a YAML "file", from start to end. More...
class  Ref_any
 A dynamically typed reference to data with automatic memory management and read/write locking semantic. More...
class  Plugin
 The class PDI plugins should implement. More...
class  Pointer_datatype
class  Python_ref_wrapper
class  Record_datatype
 A Record_datatype is a Datatype that represents a fixed number of elements of potentially different types layed out in a specific way in memory. More...
class  Reference_base
 A common base for all references, whatever their access privileges. More...
class  Scalar_datatype
class  PdiTest
 The fixture class for PDI plugins testing. More...
class  Tuple_datatype
 A Tuple_datatype is a Datatype that represents a fixed number of elements of potentially different types layed out in a specific way in memory. More...

Concepts

concept  range_of_exception_ptrs
 A concept that represent a "range" (list) of errors, in any kind of storage.
concept  initializable_from
 An object is initializable_from<G> if it can be initalized using the init_from member function from a reference of G.
concept  buildable_from
 An object is buildable_from<G> if it can be constructed using the init_from member function from a reference of G.

Typedefs

using Attributes_map = std::unordered_map<std::string, Expression>
using Value_error = impl::Error_impl<PDI_ERR_VALUE>
 An error class to use when a value expression is invalid.
using Plugin_error = impl::Error_impl<PDI_ERR_PLUGIN>
 An error class to use when trying to load a non-existing plugin.
using Impl_error = impl::Error_impl<PDI_ERR_IMPL>
 An error class to use for implementation limitations (typically an unimplemented feature).
using State_error = impl::Error_impl<PDI_ERR_STATE>
 An error class to use when a call to a function has been made at a wrong time (e.g.
using Permission_error = impl::Error_impl<PDI_ERR_PERMISSION>
 An error class to use when a conflict of ownership over a content has been raised.
using System_error = impl::Error_impl<PDI_ERR_SYSTEM>
 An error class to use when a system error occurred (OS, etc.).
using Type_error = impl::Error_impl<PDI_ERR_TYPE>
 An error class to use for invalid types.
using Invalid_action_error = impl::Error_impl<PDI_ERR_INVALIDACTION>
 An error class to use when an action described in the specification tree is invalid.
using Datatype_template_sptr = std::shared_ptr<const Datatype_template>
using Datatype_sptr = std::shared_ptr<const Datatype>
typedef Ref_any< false, false > Ref
typedef Ref_any< true, false > Ref_r
typedef Ref_any< false, true > Ref_w
typedef Ref_any< true, true > Ref_rw

Enumerations

enum class  Scalar_kind : uint8_t {
  UNKNOWN ,
  SIGNED ,
  UNSIGNED ,
  FLOAT
}
 Different possible interpretations for a scalar. More...

Functions

void rethrow_with_simple_context (std::exception_ptr err, std::string msg)
 Throws a new exception by adding context to an existing exception.
void rethrow_with_simple_context (std::vector< std::exception_ptr > errors, std::string msg)
 Throws a new exception by adding context to an existing set of exceptions.
int len (PC_tree_t tree)
 Returns the length of a node.
int len (PC_tree_t tree, int dflt)
 Returns the length of a node.
long to_long (PC_tree_t tree)
 Returns the int value of a scalar node.
long to_long (PC_tree_t tree, long dflt)
 Returns the int value of a scalar node.
double to_double (PC_tree_t tree)
 Returns the floating point value of a scalar node.
double to_double (PC_tree_t tree, double dflt)
 Returns the floating point value of a scalar node.
std::string to_string (PC_tree_t tree)
 Returns the string content of a scalar node.
std::string to_string (PC_tree_t tree, const std::string &dflt)
 Returns the string content of a scalar node.
bool to_bool (PC_tree_t tree)
 Returns the boolean value of a scalar node.
bool to_bool (PC_tree_t tree, bool dflt)
 Returns the boolean value of a scalar node.
bool is_list (PC_tree_t tree)
 Checks if the tree is a list.
bool is_map (PC_tree_t tree)
 Checks if the tree is a map.
bool is_scalar (PC_tree_t tree)
 Checks if the tree is a scalar.
void each (PC_tree_t tree, std::function< void(PC_tree_t)> operation)
 Iterates and apply the provided function to all elements of a PC list.
void opt_each (PC_tree_t tree, std::function< void(PC_tree_t)> operation)
 Iterates and apply the provided function to all elements of a PC list or directly to the provided element if it is not a list.
void each (PC_tree_t tree, std::function< void(PC_tree_t, PC_tree_t)> operation)
 Iterates and apply the provided function to all elements of a PC mapping.
void each_in_omap (PC_tree_t tree, std::function< void(PC_tree_t, PC_tree_t)> operation)
 Iterates and apply the provided function to all elements of a PC ordered mapping.
unsigned long plugin_api_version (unsigned long expected_version=0)
 Checks compatibility with a plugin API.
pybind11::object to_python (Ref r, bool force_const=false)
 Wraps a PDI reference in a python object.
Datatype_sptr python_type (const pybind11::array &a)
 Function takes python numpy array and converts it into PDI datatype.
pybind11::dtype to_python (const std::shared_ptr< const Scalar_datatype > &scalar_type)
 Convert a Scalar_datatype to a pybind11 data type.

Variables

const auto UNDEF_TYPE = Scalar_datatype::make(Scalar_kind::UNKNOWN, 0)

Typedef Documentation

◆ Attributes_map

using PDI::Attributes_map = std::unordered_map<std::string, Expression>

◆ Value_error

using PDI::Value_error = impl::Error_impl<PDI_ERR_VALUE>

An error class to use when a value expression is invalid.

◆ Plugin_error

using PDI::Plugin_error = impl::Error_impl<PDI_ERR_PLUGIN>

An error class to use when trying to load a non-existing plugin.

◆ Impl_error

using PDI::Impl_error = impl::Error_impl<PDI_ERR_IMPL>

An error class to use for implementation limitations (typically an unimplemented feature).

◆ State_error

using PDI::State_error = impl::Error_impl<PDI_ERR_STATE>

An error class to use when a call to a function has been made at a wrong time (e.g.

closing an unopened transaction)

◆ Permission_error

using PDI::Permission_error = impl::Error_impl<PDI_ERR_PERMISSION>

An error class to use when a conflict of ownership over a content has been raised.

◆ System_error

using PDI::System_error = impl::Error_impl<PDI_ERR_SYSTEM>

An error class to use when a system error occurred (OS, etc.).

◆ Type_error

using PDI::Type_error = impl::Error_impl<PDI_ERR_TYPE>

An error class to use for invalid types.

◆ Invalid_action_error

An error class to use when an action described in the specification tree is invalid.

◆ Datatype_template_sptr

using PDI::Datatype_template_sptr = std::shared_ptr<const Datatype_template>

◆ Datatype_sptr

using PDI::Datatype_sptr = std::shared_ptr<const Datatype>

◆ Ref

typedef Ref_any<false, false> PDI::Ref

◆ Ref_r

typedef Ref_any<true, false> PDI::Ref_r

◆ Ref_w

typedef Ref_any<false, true> PDI::Ref_w

◆ Ref_rw

typedef Ref_any<true, true> PDI::Ref_rw

Enumeration Type Documentation

◆ Scalar_kind

enum class PDI::Scalar_kind : uint8_t
strong

Different possible interpretations for a scalar.

Enumerator
UNKNOWN 
SIGNED 
UNSIGNED 
FLOAT 

Function Documentation

◆ rethrow_with_simple_context() [1/2]

void PDI::rethrow_with_simple_context ( std::exception_ptr err,
std::string msg )

Throws a new exception by adding context to an existing exception.

Parameters
[in]erroriginal error
[in]msgsome context to prepend to the error

◆ rethrow_with_simple_context() [2/2]

void PDI::rethrow_with_simple_context ( std::vector< std::exception_ptr > errors,
std::string msg )

Throws a new exception by adding context to an existing set of exceptions.

  • if the set of exception (errors) is empty, do nothing,
  • if it contains a single exception, throw it with additional context
  • if it contains multiple exceptions, throw a Multiple_errors
Parameters
[in]errorsa list of original errors
[in]msgsome context to prepend to the error

◆ len() [1/2]

int PDI::len ( PC_tree_t tree)

Returns the length of a node.

  • for a sequence: the number of nodes,
  • for a mapping: the number of pairs,
  • for a scalar: the string length.

throws an Error if the provided tree is in error

Parameters
[in]treethe sequence or mapping
Returns
the length

◆ len() [2/2]

int PDI::len ( PC_tree_t tree,
int dflt )

Returns the length of a node.

  • for a sequence: the number of nodes,
  • for a mapping: the number of pairs,
  • for a scalar: the string length.

returns the default value in case of error

Parameters
[in]treethe sequence or mapping
[in]dfltthe default value in case of error
Returns
the length

◆ to_long() [1/2]

long PDI::to_long ( PC_tree_t tree)

Returns the int value of a scalar node.

throws an Error if the provided tree is in error

Parameters
[in]treethe int-valued node
Returns
the int value of the scalar node

◆ to_long() [2/2]

long PDI::to_long ( PC_tree_t tree,
long dflt )

Returns the int value of a scalar node.

returns the default value in case of error

Parameters
[in]treethe int-valued node
[in]dfltthe default value in case of error
Returns
the int value of the scalar node

◆ to_double() [1/2]

double PDI::to_double ( PC_tree_t tree)

Returns the floating point value of a scalar node.

throws an Error if the provided tree is in error

Parameters
[in]treethe floating-point-valued node
Returns
the floating point value of the scalar node

◆ to_double() [2/2]

double PDI::to_double ( PC_tree_t tree,
double dflt )

Returns the floating point value of a scalar node.

returns the default value in case of error

Parameters
[in]treethe floating-point-valued node
[in]dfltthe default value in case of error
Returns
the floating point value of the scalar node

◆ to_string() [1/2]

std::string PDI::to_string ( PC_tree_t tree)

Returns the string content of a scalar node.

throws an Error if the provided tree is in error

Parameters
[in]treethe node
Returns
the content of the scalar node

◆ to_string() [2/2]

std::string PDI::to_string ( PC_tree_t tree,
const std::string & dflt )

Returns the string content of a scalar node.

returns the default value in case of error

Parameters
[in]treethe node
[in]dfltthe default value in case of error
Returns
the content of the scalar node

◆ to_bool() [1/2]

bool PDI::to_bool ( PC_tree_t tree)

Returns the boolean value of a scalar node.

throws an Error if the provided tree is in error

Parameters
[in]treethe node
Returns
the boolean value of the scalar node

◆ to_bool() [2/2]

bool PDI::to_bool ( PC_tree_t tree,
bool dflt )

Returns the boolean value of a scalar node.

returns the default value in case of error

Parameters
[in]treethe node
[in]dfltthe default value in case of error
Returns
the boolean value of the scalar node

◆ is_list()

bool PDI::is_list ( PC_tree_t tree)

Checks if the tree is a list.

Parameters
[in]treethe node
Returns
true if tree is a list, false otherwise

◆ is_map()

bool PDI::is_map ( PC_tree_t tree)

Checks if the tree is a map.

Parameters
[in]treethe node
Returns
true if tree is a map, false otherwise

◆ is_scalar()

bool PDI::is_scalar ( PC_tree_t tree)

Checks if the tree is a scalar.

Parameters
[in]treethe node
Returns
true if tree is a scalar, false otherwise

◆ each() [1/2]

void PDI::each ( PC_tree_t tree,
std::function< void(PC_tree_t)> operation )

Iterates and apply the provided function to all elements of a PC list.

Parameters
treethe tree containing the list
operationthe operation to apply to each element of the tree

◆ opt_each()

void PDI::opt_each ( PC_tree_t tree,
std::function< void(PC_tree_t)> operation )

Iterates and apply the provided function to all elements of a PC list or directly to the provided element if it is not a list.

Parameters
treethe tree containing the list or the single element
operationthe operation to apply to the elements

◆ each() [2/2]

void PDI::each ( PC_tree_t tree,
std::function< void(PC_tree_t, PC_tree_t)> operation )

Iterates and apply the provided function to all elements of a PC mapping.

Parameters
treethe tree containing the mapping
operationthe operation to apply to each element of the tree

◆ each_in_omap()

void PDI::each_in_omap ( PC_tree_t tree,
std::function< void(PC_tree_t, PC_tree_t)> operation )

Iterates and apply the provided function to all elements of a PC ordered mapping.

Parameters
treethe tree containing the ordered mapping
operationthe operation to apply to each element of the tree

◆ plugin_api_version()

unsigned long PDI::plugin_api_version ( unsigned long expected_version = 0)

Checks compatibility with a plugin API.

Parameters
expected_versionthe expected version of the API or 0 for no check
Returns
the version of the API provided by PDI
Exceptions
PDI::Errorif the provided version is incompatible with the expected one

◆ to_python() [1/2]

pybind11::object PDI::to_python ( Ref r,
bool force_const = false )

Wraps a PDI reference in a python object.

Parameters
rPDI reference to wrap
force_constwhether the object should be const even if the ref can be write accessed
Returns
python object wrapper for the PDI reference

◆ python_type()

Datatype_sptr PDI::python_type ( const pybind11::array & a)

Function takes python numpy array and converts it into PDI datatype.

Parameters
apython numpy array data
Returns
PDI datatype of python object

◆ to_python() [2/2]

pybind11::dtype PDI::to_python ( const std::shared_ptr< const Scalar_datatype > & scalar_type)

Convert a Scalar_datatype to a pybind11 data type.

Parameters
scalar_typeto convert to pybind11 data type
Returns
pybind11 data type for the given scalar type

Variable Documentation

◆ UNDEF_TYPE

const auto PDI::UNDEF_TYPE = Scalar_datatype::make(Scalar_kind::UNKNOWN, 0)