Elektra  0.9.11
Public Member Functions | Public Attributes | List of all members
kdb::tools::Plugin Class Reference

This is a C++ representation of a plugin. More...

#include <plugin.hpp>

Public Member Functions

 Plugin (PluginSpec const &spec, kdb::KeySet &modules)
 Do not construct a plugin yourself, use Modules.load.
 
void loadInfo ()
 Gets the configuration for the plugin. More...
 
void parse ()
 Creates symbol and info table. More...
 
void check (std::vector< std::string > &warnings)
 Does various checks on the Plugin and throws exceptions if something is not ok. More...
 
std::string lookupInfo (std::string item, std::string section="infos")
 Gets the whole string of an information item. More...
 
bool findInfo (std::string check, std::string item, std::string section="infos")
 Searches within a string of an information item. More...
 
kdb::KeySet getInfo ()
 Returns the whole keyset of information. More...
 
kdb::KeySet getNeededConfig ()
 In the plugin's contract there is a description of which config is needed in order to work together with a backend properly. More...
 
kdb::KeySet getConfig ()
 return the plugin config More...
 
func_t getSymbol (std::string which)
 Returns symbol to a function. More...
 
int open (kdb::Key &errorKey)
 Calls the open function of the plugin. More...
 
int close (kdb::Key &errorKey)
 Calls the close function of the plugin. More...
 
int get (kdb::KeySet &ks, kdb::Key &parentKey)
 Calls the get function of the plugin. More...
 
int set (kdb::KeySet &ks, kdb::Key &parentKey)
 Calls the set function of the plugin. More...
 
int commit (kdb::KeySet &ks, kdb::Key &parentKey)
 Calls the commit function of the plugin. More...
 
int error (kdb::KeySet &ks, kdb::Key &parentKey)
 Calls the error function of the plugin. More...
 
std::string name ()
 
std::string getFullName ()
 

Public Attributes

bool firstRef
 Is toggled during serialization. More...
 

Detailed Description

This is a C++ representation of a plugin.

It will load an Elektra plugin using the module loader from Elektra.

Then you can either check the plugins configuration using loadInfo(), parse() and check. Symbols can then be retrieved with getSymbol().

Or you can use the normal open(), close(), get(), set() and error() API which every plugin exports.

Member Function Documentation

◆ check()

void kdb::tools::Plugin::check ( std::vector< std::string > &  warnings)

Does various checks on the Plugin and throws exceptions if something is not ok.

  • Check if Plugin is compatible to current Version of Backend-API.
Exceptions
PluginCheckExceptionif there are errors
Parameters
warningsfor warnings
Precondition
parse()

◆ close()

int kdb::tools::Plugin::close ( kdb::Key errorKey)

Calls the close function of the plugin.

Precondition
parse()

◆ commit()

int kdb::tools::Plugin::commit ( kdb::KeySet ks,
kdb::Key parentKey 
)

Calls the commit function of the plugin.

Precondition
parse()

◆ error()

int kdb::tools::Plugin::error ( kdb::KeySet ks,
kdb::Key parentKey 
)

Calls the error function of the plugin.

Precondition
parse()

◆ findInfo()

bool kdb::tools::Plugin::findInfo ( std::string  check,
std::string  item,
std::string  section = "infos" 
)

Searches within a string of an information item.

Precondition
loadInfo()

◆ get()

int kdb::tools::Plugin::get ( kdb::KeySet ks,
kdb::Key parentKey 
)

Calls the get function of the plugin.

Precondition
parse()

◆ getConfig()

kdb::KeySet kdb::tools::Plugin::getConfig ( )

return the plugin config

Returns
the config supplied with constructor
See also
getNeededConfig()

◆ getFullName()

std::string kdb::tools::Plugin::getFullName ( )
Returns
the fullname of the plugin

◆ getInfo()

kdb::KeySet kdb::tools::Plugin::getInfo ( )
inline

Returns the whole keyset of information.

Precondition
loadInfo()

◆ getNeededConfig()

kdb::KeySet kdb::tools::Plugin::getNeededConfig ( )

In the plugin's contract there is a description of which config is needed in order to work together with a backend properly.

Returns
the keyset with the config needed for the backend.
See also
getConfig()
Precondition
loadInfo()

◆ getSymbol()

func_t kdb::tools::Plugin::getSymbol ( std::string  which)
inline

Returns symbol to a function.

Precondition
parse()

◆ loadInfo()

void kdb::tools::Plugin::loadInfo ( )

Gets the configuration for the plugin.

(will be done in Modules.load)

◆ lookupInfo()

std::string kdb::tools::Plugin::lookupInfo ( std::string  item,
std::string  section = "infos" 
)

Gets the whole string of an information item.

Precondition
loadInfo()

◆ name()

std::string kdb::tools::Plugin::name ( )
Returns
the name of the plugin (module)

◆ open()

int kdb::tools::Plugin::open ( kdb::Key errorKey)

Calls the open function of the plugin.

Precondition
parse()

◆ parse()

void kdb::tools::Plugin::parse ( )

Creates symbol and info table.

(will be done in Modules.load)

◆ set()

int kdb::tools::Plugin::set ( kdb::KeySet ks,
kdb::Key parentKey 
)

Calls the set function of the plugin.

Precondition
parse()

Member Data Documentation

◆ firstRef

bool kdb::tools::Plugin::firstRef

Is toggled during serialization.

(is a hack, only allows a single serialization!)


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