PDI 1.13.0

the PDI data interface

#include <context.h>

Classes

class  Iterator
 An iterator used to go through the descriptor store. More...

Public Types

typedef std::function< Datatype_template_sptr(Context &, PC_tree_t)> Datatype_template_parser
 A function that parses a PC_tree_t to create a datatype_template.

Public Member Functions

virtual ~Context ()
virtual Data_descriptor & desc (const std::string &name)=0
 Accesses the descriptor for a specific name.
virtual Data_descriptor & desc (const char *name)=0
 Accesses the descriptor for a specific name.
virtual Data_descriptor & operator[] (const std::string &name)=0
 Accesses the descriptor for a specific name.
virtual Data_descriptor & operator[] (const char *name)=0
 Accesses the descriptor for a specific name.
virtual Iterator begin ()=0
 Returns an iterator on the first descriptor.
virtual Iterator end ()=0
 Returns an iterator past the last descriptor.
virtual Iterator find (const std::string &name)=0
 Find the Data_descriptor corresponding to a given name.
virtual void event (const char *name)=0
 Triggers a PDI "event".
virtual Datatype_template_sptr datatype (PC_tree_t node)=0
 Creates a new datatype template from a paraconf-style config.
virtual void add_datatype (const std::string &name, Datatype_template_parser parser)=0
 Adds new datatype parser to the context.
virtual std::function< void()> on_init (const std::function< void()> &callback)=0
 Adds new init callback to context.
virtual std::function< void()> on_data (const std::function< void(const std::string &, Ref)> &callback, const std::string &name={})=0
 Adds new data callback to context.
virtual std::function< void()> on_data_remove (const std::function< void(const std::string &, Ref)> &callback, const std::string &name={})=0
 Adds new data remove callback to context.
virtual std::function< void()> on_event (const std::function< void(const std::string &)> &callback, const std::string &name={})=0
 Adds new event callback to context.
virtual std::function< void()> on_missing_data (const std::function< void(const std::string &)> &callback, const std::string &name={})=0
 Adds new empty desc access callback to context.

Protected Member Functions

Iterator get_iterator (const std::unordered_map< std::string, std::unique_ptr< Data_descriptor > >::iterator &data)
Iterator get_iterator (std::unordered_map< std::string, std::unique_ptr< Data_descriptor > >::iterator &&data)

Member Typedef Documentation

◆ Datatype_template_parser

A function that parses a PC_tree_t to create a datatype_template.

Constructor & Destructor Documentation

◆ ~Context()

virtual PDI::Context::~Context ( )
virtual

Member Function Documentation

◆ get_iterator() [1/2]

Iterator PDI::Context::get_iterator ( const std::unordered_map< std::string, std::unique_ptr< Data_descriptor > >::iterator & data)
protected

◆ get_iterator() [2/2]

Iterator PDI::Context::get_iterator ( std::unordered_map< std::string, std::unique_ptr< Data_descriptor > >::iterator && data)
protected

◆ desc() [1/2]

virtual Data_descriptor & PDI::Context::desc ( const std::string & name)
pure virtual

Accesses the descriptor for a specific name.

Might be uninitialized

◆ desc() [2/2]

virtual Data_descriptor & PDI::Context::desc ( const char * name)
pure virtual

Accesses the descriptor for a specific name.

Might be uninitialized

◆ operator[]() [1/2]

virtual Data_descriptor & PDI::Context::operator[] ( const std::string & name)
pure virtual

Accesses the descriptor for a specific name.

Might be uninitialized

◆ operator[]() [2/2]

virtual Data_descriptor & PDI::Context::operator[] ( const char * name)
pure virtual

Accesses the descriptor for a specific name.

Might be uninitialized

◆ begin()

virtual Iterator PDI::Context::begin ( )
pure virtual

Returns an iterator on the first descriptor.

◆ end()

virtual Iterator PDI::Context::end ( )
pure virtual

Returns an iterator past the last descriptor.

◆ find()

virtual Iterator PDI::Context::find ( const std::string & name)
pure virtual

Find the Data_descriptor corresponding to a given name.

Parameters
[in]namethe Data_descriptor name
Returns
an iterator to the requested Data_descriptor name. If no such element is found, past-the-end (see end()) iterator is returned.

◆ event()

virtual void PDI::Context::event ( const char * name)
pure virtual

Triggers a PDI "event".

Parameters
[in]namethe event name

◆ datatype()

virtual Datatype_template_sptr PDI::Context::datatype ( PC_tree_t node)
pure virtual

Creates a new datatype template from a paraconf-style config.

Parameters
[in]nodethe configuration to read
Returns
the type generated

◆ add_datatype()

virtual void PDI::Context::add_datatype ( const std::string & name,
Datatype_template_parser parser )
pure virtual

Adds new datatype parser to the context.

Parameters
[in]namename of the datatype to add
[in]parserfunction that creates new datatype_template from PC_tree_t

◆ on_init()

virtual std::function< void()> PDI::Context::on_init ( const std::function< void()> & callback)
pure virtual

Adds new init callback to context.

Parameters
[in]callbackfunction to call when data and metadata are loaded
Returns
function that removes callback

◆ on_data()

virtual std::function< void()> PDI::Context::on_data ( const std::function< void(const std::string &, Ref)> & callback,
const std::string & name = {} )
pure virtual

Adds new data callback to context.

Parameters
[in]callbackfunction to call when data is being available
[in]namethe name of the data on which call the callback, if not specified it's called on any data
Returns
function that removes callback

◆ on_data_remove()

virtual std::function< void()> PDI::Context::on_data_remove ( const std::function< void(const std::string &, Ref)> & callback,
const std::string & name = {} )
pure virtual

Adds new data remove callback to context.

Parameters
[in]callbackfunction to call when data is reclaimed/released
[in]namethe name of the data on which call the callback, if not specified it's called on any data
Returns
function that removes callback

◆ on_event()

virtual std::function< void()> PDI::Context::on_event ( const std::function< void(const std::string &)> & callback,
const std::string & name = {} )
pure virtual

Adds new event callback to context.

Parameters
[in]callbackfunction to call when event is called
[in]namethe name of the event on which call the callback, if not specified it's called on any event
Returns
function that removes callback

◆ on_missing_data()

virtual std::function< void()> PDI::Context::on_missing_data ( const std::function< void(const std::string &)> & callback,
const std::string & name = {} )
pure virtual

Adds new empty desc access callback to context.

Parameters
[in]callbackfunction to call when event is called
[in]namethe name of the data on which call the callback, if not specified it's called on any data
Returns
function that removes callback

The documentation for this class was generated from the following file: