CPython Class Reference

Collaboration diagram for CPython:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 CPython (vector< string > &pathvec)
 Constructor for the CPython object.
 ~CPython ()

Static Public Member Functions

static void addPath (const string &path)
static void checkPyObj (const PyObject *const obj)
static PyObject * getModule (const string &module)
static PyObject * loadModule (const string &module)
static void printModules (void)
static PyObject * getCurrentDict (void)
static PyObject * getDict (const string &module)
static void setDict (PyObject *dict)
static void setDict (const string &module)
static void printDict (PyObject *dict=NULL)
static PyObject * callFunction (PyObject *callable, PyObject *args)
static QWidget * createPyWidget (QWidget *parentWidget=NULL, PyObject *data=NULL)

Static Private Member Functions

static void initHelperFunctions (void)

Static Private Attributes

static PyThreadState * _mainThreadState
static PyObject * pyMainDict_
static PyObject * pyDict_
static map< string, struct
module_data > 
modules_


Detailed Description

This is the object taking care of the interface with Python. Only one of these should be constructed.

Constructor & Destructor Documentation

CPython::CPython ( vector< string > &  pathvec  ) 

Constructor for the CPython object.

Parameters:
paths a vector of paths to append: the python interpreter looks there for modules.

CPython::~CPython (  ) 

The destructor: terminates the Python interface


Member Function Documentation

PyObject * CPython::callFunction ( PyObject *  callable,
PyObject *  args 
) [static]

if returning a PyObject pointer: it is a new reference (i.e. decref it yourself)

void CPython::checkPyObj ( const PyObject *const   obj  )  [static]

Check a PyObject for validity

QWidget * CPython::createPyWidget ( QWidget *  parentWidget = NULL,
PyObject *  args = NULL 
) [static]

Check for NULL!

Create a widget based on the currently loaded module

PyObject * CPython::getDict ( const string &  module  )  [static]

return the pointer to a previously loaded module. NULL if not found

PyObject * CPython::getModule ( const string &  module  )  [static]

return the pointer to a previously loaded module. NULL if not found

void CPython::initHelperFunctions ( void   )  [static, private]

adds functions python functions we could be calling from C to the current dictionary

PyObject * CPython::loadModule ( const string &  module  )  [static]

loads the module "name", returns a pointer to the PyObject. if the module was already loaded the pointer to that object (which was stored) is returned.

Don't Py_DECREF it! (the object is stored for later use)

void CPython::printDict ( PyObject *  dict = NULL  )  [static]

print the contents of a dictionary. Default: the current dictionary

void CPython::printModules ( void   )  [static]

Print all the modules

void CPython::setDict ( const string &  module  )  [static]

Set the dictionary to the dictionary of a module

void CPython::setDict ( PyObject *  dict  )  [static]

Set the dictionary


Member Data Documentation

PyThreadState * CPython::_mainThreadState [static, private]

Contains the state of the main Python thread

map< string, struct module_data > CPython::modules_ [static, private]

A map of the loaded module names and a struct containing module info

PyObject * CPython::pyDict_ [static, private]

the currently active dictionary

PyObject * CPython::pyMainDict_ [static, private]

the main dictionary: custom functions are added here


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

Generated on Fri Oct 16 18:59:58 2009 for HYPLOT by  doxygen 1.5.8