VAPOR3 3.9.4
Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
Wasp::MyPython Class Reference

#include <MyPython.h>

Inheritance diagram for Wasp::MyPython:
Wasp::MyBase

Public Member Functions

int Initialize ()
 
string PyErr ()
 
string PyOut ()
 Return stdout message as a string.
 
- Public Member Functions inherited from Wasp::MyBase
 MyBase ()
 
const string & getClassName () const
 

Static Public Member Functions

static MyPythonInstance ()
 
static PyObject * CreatePyFunc (string moduleName, string funcName, string script)
 
- Static Public Member Functions inherited from Wasp::MyBase
static void SetErrMsg (const char *format,...)
 Record a formatted error message.
 
static void SetErrMsg (int errcode, const char *format,...)
 Record a formatted error message and an error code.
 
static const char * GetErrMsg ()
 
static void SetErrCode (int err_code)
 Record an error code.
 
static int GetErrCode ()
 Retrieve the current error code.
 
static void SetErrMsgCB (ErrMsgCB_T cb)
 
static ErrMsgCB_T GetErrMsgCB ()
 
static void SetErrMsgFilePtr (FILE *fp)
 
static const FILE * SetErrMsgFilePtr ()
 
static void SetDiagMsg (const char *format,...)
 Record a formatted diagnostic message.
 
static const char * GetDiagMsg ()
 
static void SetDiagMsgCB (DiagMsgCB_T cb)
 
static DiagMsgCB_T GetDiagMsgCB ()
 
static void SetDiagMsgFilePtr (FILE *fp)
 
static bool EnableErrMsg (bool enable)
 
static bool GetEnableErrMsg ()
 

Static Public Attributes

static bool IsRunningFromPython
 
- Static Public Attributes inherited from Wasp::MyBase
static char * ErrMsg
 
static int ErrCode
 
static int ErrMsgSize
 
static FILE * ErrMsgFilePtr
 
static ErrMsgCB_T ErrMsgCB
 
static char * DiagMsg
 
static int DiagMsgSize
 
static FILE * DiagMsgFilePtr
 
static DiagMsgCB_T DiagMsgCB
 
static bool Enabled
 

Additional Inherited Members

- Public Types inherited from Wasp::MyBase
typedef void(* ErrMsgCB_T) (const char *msg, int err_code)
 
typedef void(* DiagMsgCB_T) (const char *msg)
 
- Protected Member Functions inherited from Wasp::MyBase
void SetClassName (const string &name)
 

Detailed Description

Definition at line 60 of file MyPython.h.

Member Function Documentation

◆ CreatePyFunc()

static PyObject * Wasp::MyPython::CreatePyFunc ( string  moduleName,
string  funcName,
string  script 
)
static

Create a python function object from a script

This method create a python function, named by funcName, from the Python script script. The script script must contain a python function definition for a function named by funcName. The function will be defined in the module named by moduleName. This module must already exist in the python environment.

Parameters
[in]moduleNameName of module in which to define the function.
[in]nameof function defined in the script script
[in]scriptA string containing a valid python script
Return values
pFuncA new PyObject reference to the defined function, or NULL if any Python API calls fail

◆ Initialize()

int Wasp::MyPython::Initialize ( )

Initialize the Python interpreter

Checks value of VAPOR_PYHONHOME environment variable. If set, passes it's value to Py_SetPythonHome(). Otherwise uses GetAppsPath() to find the location of Python .so's and calls Py_SetPythonHome() with path returned by GetAppsPath(). Finally calls Py_Initialize()

◆ Instance()

static MyPython * Wasp::MyPython::Instance ( )
static

◆ PyErr()

string Wasp::MyPython::PyErr ( )

Return python errors as a string

This method can be used to return errors generated by scripts launched by the python C API. For example, if a script run by PyRun_SimpleString fails and raises an exception this method will return the error string generated

◆ PyOut()

string Wasp::MyPython::PyOut ( )

Return stdout message as a string.

Member Data Documentation

◆ IsRunningFromPython

bool Wasp::MyPython::IsRunningFromPython
static

Definition at line 62 of file MyPython.h.


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