PDI 1.0.1

Data exchange made easy

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  Config_error
 
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
 
class  Expression
 
class  Impl_error
 
struct  Paraconf_wrapper
 Automatically installs a paraconf error-handler that ignores errors and uninstalls it on destruction. More...
 
class  Plugin
 The class PDI plugins should implement. More...
 
class  Plugin_error
 
class  Pointer_datatype
 
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  Ref_any
 A dynamically typed reference to data with automatic memory management and read/write locking semantic. More...
 
class  Reference_base
 A common base for all references, whatever their access privileges. More...
 
class  Right_error
 
class  Scalar_datatype
 
class  State_error
 
class  System_error
 
class  Type_error
 
class  Unavailable_error
 
class  Value_error
 

Typedefs

typedef std::unique_ptr< Datatype_templateDatatype_template_uptr
 
typedef std::unique_ptr< DatatypeDatatype_uptr
 
typedef std::shared_ptr< spdlog::logger > Logger_sptr
 A shared pointer to a logger instance. More...
 
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  Scalar_kind : uint8_t {
  Scalar_kind::UNKNOWN,
  Scalar_kind::SIGNED,
  Scalar_kind::UNSIGNED,
  Scalar_kind::FLOAT
}
 Different possible interpretations for a scalar. More...
 

Functions

Logger_sptr configure_logger (PC_tree_t config, const std::string &name, spdlog::level::level_enum level=spdlog::level::info)
 Reads configuration tree and sets up the logger. More...
 
int len (PC_tree_t tree)
 Returns the length of a node. More...
 
int len (PC_tree_t tree, int dflt)
 Returns the length of a node. More...
 
long to_long (PC_tree_t tree)
 Returns the int value of a scalar node. More...
 
long to_long (PC_tree_t tree, long dflt)
 Returns the int value of a scalar node. More...
 
double to_double (PC_tree_t tree)
 Returns the floating point value of a scalar node. More...
 
double to_double (PC_tree_t tree, double dflt)
 Returns the floating point value of a scalar node. More...
 
std::string to_string (PC_tree_t tree)
 Returns the string content of a scalar node. More...
 
std::string to_string (PC_tree_t tree, const std::string &dflt)
 Returns the string content of a scalar node. More...
 
bool to_bool (PC_tree_t tree)
 Returns the boolean value of a scalar node. More...
 
bool to_bool (PC_tree_t tree, bool dflt)
 Returns the boolean value of a scalar node. More...
 
bool is_list (PC_tree_t tree)
 Checks if the tree is a list. More...
 
bool is_map (PC_tree_t tree)
 Checks if the tree is a map. More...
 
bool is_scalar (PC_tree_t tree)
 Checks if the tree is a scalar. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
unsigned long plugin_api_version (unsigned long expected_version=0)
 Checks compatibility with a plugin API. More...
 

Variables

const Scalar_datatype UNDEF_TYPE = {Scalar_kind::UNKNOWN, 0}
 

Typedef Documentation

◆ Datatype_template_uptr

◆ Datatype_uptr

typedef std::unique_ptr<Datatype> PDI::Datatype_uptr

◆ Logger_sptr

typedef std::shared_ptr<spdlog::logger> PDI::Logger_sptr

A shared pointer to a logger instance.

◆ 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 PDI::Scalar_kind : uint8_t
strong

Different possible interpretations for a scalar.

Enumerator
UNKNOWN 
SIGNED 
UNSIGNED 
FLOAT 

Function Documentation

◆ configure_logger()

Logger_sptr PDI::configure_logger ( PC_tree_t  config,
const std::string &  name,
spdlog::level::level_enum  level = spdlog::level::info 
)

Reads configuration tree and sets up the logger.

Parameters
[in]configconfiguration tree from config file
[in]namename of the module (e.g. global, test, decl_hdf5)
[in]leveldefault level of the logger
Returns
a configured logger

◆ 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

Variable Documentation

◆ UNDEF_TYPE

const Scalar_datatype PDI::UNDEF_TYPE = {Scalar_kind::UNKNOWN, 0}