PythonInterface Class Reference

This static interface provides basic services for embedding Python into our application, running simple Python commands, and loading and executing Python scripts. More...

#include <pythoninterface.h>

List of all members.

Static Public Member Functions

static bool Start (int argc, char *argv[])
 Starts up the Python services This function must be called BEFORE using any of the other Python services.
static bool Stop ()
 Stops the Python services This function must be called BEFORE finishing the application.
static PYOBJECT Run (const char *a_sCode)
 Executes one line of Python code Interprets and executes one line of python code.
static PYOBJECT RunFile (const char *a_sFilename)
 Executes the code contained on a file in disk Interprets and executes the code contained in a file identified by the provided filename.
static void RunSimpleFile (const char *a_sFilename)
 Executes the code contained on a file in disk, discarding the result.


Detailed Description

This static interface provides basic services for embedding Python into our application, running simple Python commands, and loading and executing Python scripts.

Provides services for embedding Python.

To use, call Start at the beginning of your application. Use any of the embedding functions, then call Stop before terminating the application.

Author:
Dan Torres 2008/12/09

Definition at line 47 of file pythoninterface.h.


Member Function Documentation

static PYOBJECT PythonInterface::Run ( const char *  a_sCode  )  [static]

Executes one line of Python code Interprets and executes one line of python code.

This function is equivalent to Python's interactive loop. A pointer to the resulting PyObject instance is provided. This result can also be NULL or Py_None.

Parameters:
a_sCode A null-terminated string with Python conde
Returns:
A Python object with the result of the requested code, NULL on error

static PYOBJECT PythonInterface::RunFile ( const char *  a_sFilename  )  [static]

Executes the code contained on a file in disk Interprets and executes the code contained in a file identified by the provided filename.

A pointer to the resulting PyObject instance is provided.

Parameters:
a_sFilename Name of the file to execute
Returns:
A Python object with the result of the script. Null on error.

static void PythonInterface::RunSimpleFile ( const char *  a_sFilename  )  [static]

Executes the code contained on a file in disk, discarding the result.

Interprets and executes the code contained in a given file, but discards any returned object. Use when you just want to run a script and you are not interested on what might come back from it.

Parameters:
a_sFilename Name of the file to execute

static bool PythonInterface::Start ( int  argc,
char *  argv[] 
) [static]

Starts up the Python services This function must be called BEFORE using any of the other Python services.

Parameters:
a_appSettings Parameters used on our application
Returns:
True if all Python services are correctly initialized.

static bool PythonInterface::Stop (  )  [static]

Stops the Python services This function must be called BEFORE finishing the application.

Returns:
True if all Python services could be correctly stopped.


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

Generated on Tue Jan 20 17:57:59 2009 for EclipseRay by  doxygen 1.5.7.1