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

#include <BALL/PYTHON/pyCAPIKernel.h>

Inheritance diagram for BALL::PyCAPIKernel:
BALL::PyKernel

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 )
overridevirtual

Calls a single function from a given module.

Parameters
modulea Python module
funca function from the given module
argsfunction arguments as key-value pairs
Returns
true if the execution succeeded

Implements BALL::PyKernel.

◆ getErrorMessage()

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

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
overridevirtual

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)
overridevirtual

Executes a single Python string.

Parameters
strcorrectly 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)
overridevirtual

Executes a single Python file.

Parameters
filenamePython file name
Returns
true if the execution succeeded
Deprecated
Use Jupyter notebook plugin instead

Implements BALL::PyKernel.