Loading...
Searching...
No Matches
BALL::PyCAPIKernel Class Reference

`#include <BALL/PYTHON/pyCAPIKernel.h>`

Inheritance diagram for BALL::PyCAPIKernel:

## Public Member Functions

| PyCAPIKernel ()
| ~PyCAPIKernel () override
bool | isStarted () const override
std::string | getErrorMessage () const override
std::pair< bool, std::string > | run (std::string str) override
BALL_DEPRECATED bool | runFile (std::string filename) override
bool | execute (const std::string &module, const std::string &func, const KeyValArgs &args) override
Public Member Functions inherited from BALL::PyKernel
| PyKernel ()=default
virtual | ~PyKernel ()=default

## Additional Inherited Members

Public Types inherited from BALL::PyKernel
using | KeyValArgs = std::map<std::string, std::string>
Protected Member Functions inherited from BALL::PyKernel
virtual void | loadScriptDir ()

## Detailed Description

Definition at line 10 of file pyCAPIKernel.h.

## Constructor & Destructor Documentation

## PyCAPIKernel()

BALL::PyCAPIKernel::PyCAPIKernel | ( |  | ) |

## ~PyCAPIKernel()

BALL::PyCAPIKernel::~PyCAPIKernel | ( |  | ) |

override

## Member Function Documentation

## execute()

bool BALL::PyCAPIKernel::execute | ( | const std::string & | module,
|  | const std::string & | func,
|  | const KeyValArgs & | args )

override virtual

Calls a single function from a given module.

Parameters

  module | a Python module
  func | a function from the given module
  args | function arguments as key-value pairs

Returns
  true if the execution succeeded

Implements BALL::PyKernel.

## getErrorMessage()

std::string BALL::PyCAPIKernel::getErrorMessage | ( |  | ) | const

inline override virtual

Returns the most recent error message emitted by the Python interpreter.

Returns
  most recent error message

Implements BALL::PyKernel.

Definition at line 17 of file pyCAPIKernel.h.

## isStarted()

bool BALL::PyCAPIKernel::isStarted | ( |  | ) | const

override virtual

Checks whether the kernel is started.

Returns
  true if kernel is started, else otherwise

Implements BALL::PyKernel.

## run()

std::pair< bool, std::string > BALL::PyCAPIKernel::run | ( | std::string | str | ) |

override virtual

Executes a single Python string.

Parameters

  str | correctly indented Python string

Returns
  The first value indicated whether the execution succeeded. The second value is the output generated by the execution, if any.

Implements BALL::PyKernel.

## runFile()

BALL_DEPRECATED bool BALL::PyCAPIKernel::runFile | ( | std::string | filename | ) |

override virtual

Executes a single Python file.

Parameters

  filename | Python file name

Returns
  true if the execution succeeded

Deprecated
  Use Jupyter notebook plugin instead

Implements BALL::PyKernel.