Main Page | Modules | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members

PythonScript Class Reference

Read a python script and call a function. More...

#include <pythonscript.h>

Inheritance diagram for PythonScript:

IdleScript IncomingScript List of all members.

Public Member Functions

 PythonScript (ostream &debug, unsigned short debug_level, ostream &error, string filename, string functionname, PycStringIO_CAPI *cStringIO)
 Constructor. Create Object.
virtual ~PythonScript ()
 Destructor.

Protected Member Functions

virtual void run () throw (ApplicationError)
 Reads the given python script and calls the given function.
virtual void final ()
 Called by pscript_cleanup_handler(), will delete the current object.
string prefix (bool verbose=true)
 return a prefix containing this pointer, Python script name and date for log messages

Protected Attributes

string filename
 name of the python script to read
string functionname
 name of the function to call
PyObject * args
 python tuple containing the args for the called python function
ostream & debug
 debug stream
ostream & error
 error stream
unsigned short debug_level
 debug level
PycStringIO_CAPI * cStringIO
 holds a pointer to the Python cStringIO C API

Detailed Description

Read a python script and call a function.

This class reads a given python script which must define one function with given name. This function is called with arbitrary parameters.

Author:
Gernot Hillier


Constructor & Destructor Documentation

PythonScript::PythonScript ostream &  debug,
unsigned short  debug_level,
ostream &  error,
string  filename,
string  functionname,
PycStringIO_CAPI *  cStringIO
 

Constructor. Create Object.

Parameters:
debug stream for debugging info
debug_level verbosity level for debug messages
error stream for error messages
filename file name of the python script to read
functionname name of the function to call
cStringIO pointer to the Python cStringIO C API

PythonScript::~PythonScript  )  [virtual]
 

Destructor.


Member Function Documentation

void PythonScript::final  )  [protected, virtual]
 

Called by pscript_cleanup_handler(), will delete the current object.

string PythonScript::prefix bool  verbose = true  )  [protected]
 

return a prefix containing this pointer, Python script name and date for log messages

Parameters:
verbose controls verbosity, default is true which means to log filename etc., false means only this pointer
Returns:
constructed prefix as stringstream

void PythonScript::run  )  throw (ApplicationError) [protected, virtual]
 

Reads the given python script and calls the given function.

The arguments for the function must be given in the constructor.

Exceptions:
ApplicationError Thrown when script can't be executed for any reason.

Reimplemented in IdleScript, and IncomingScript.


Member Data Documentation

PyObject* PythonScript::args [protected]
 

python tuple containing the args for the called python function

PycStringIO_CAPI* PythonScript::cStringIO [protected]
 

holds a pointer to the Python cStringIO C API

ostream& PythonScript::debug [protected]
 

debug stream

unsigned short PythonScript::debug_level [protected]
 

debug level

ostream & PythonScript::error [protected]
 

error stream

string PythonScript::filename [protected]
 

name of the python script to read

string PythonScript::functionname [protected]
 

name of the function to call


The documentation for this class was generated from the following files:
Generated on Sun Nov 28 14:37:45 2004 for CapiSuite by doxygen 1.3.8