casa  $Rev:20696$
Public Member Functions | Static Private Member Functions | Private Attributes
casa::PythonInterpreter Class Reference

Interface for connecting to and running tasks in Python. More...

#include <PythonInterpreter.h>

List of all members.

Public Member Functions

 PythonInterpreter (PyObject *ipythonShell)
 Constructor.
 ~PythonInterpreter ()
 Destructor.
bool init (bool showLogger=true)
 Initialize the connection.
void command (String command)
 Run the given command in python.

Static Private Member Functions

static String aipsPath ()
 Returns the aips path.
static String casapyPath ()
 Returns the casapy python path.
static String pythonPath ()
 Returns the python path.
static String casapyLoc ()
 Returns the location of the casapy.py script.

Private Attributes

bool m_initialized
 Whether the connection is initialized.
bool m_standalone
 Whether the connection is standalone mode or not.
PyObject * m_shell
 Handle to the ipython shell or the standalone interpreter.

Detailed Description

Interface for connecting to and running tasks in Python.

Definition at line 39 of file PythonInterpreter.h.


Constructor & Destructor Documentation

casa::PythonInterpreter::PythonInterpreter ( PyObject *  ipythonShell)

Constructor.

If ipythonShell is NULL, then the connection is in standalone mode -- i.e., a new casapy instance will be created. If ipythonShell is not NULL, it is assumed to be either an IPython.ipapi.IPApi instance (accesible as _ip in casapy) or an IPython.iplib.InteractiveShell object (accessible as _ip.IP in casapy).

casa::PythonInterpreter::~PythonInterpreter ( )

Destructor.


Member Function Documentation

static String casa::PythonInterpreter::aipsPath ( ) [inline, static, private]
static String casa::PythonInterpreter::casapyLoc ( ) [inline, static, private]

Returns the location of the casapy.py script.

Definition at line 112 of file PythonInterpreter.h.

References casapyPath(), and casa::String::empty().

static String casa::PythonInterpreter::casapyPath ( ) [inline, static, private]

Returns the casapy python path.

Definition at line 84 of file PythonInterpreter.h.

References String.

Referenced by casapyLoc().

void casa::PythonInterpreter::command ( String  command)

Run the given command in python.

bool casa::PythonInterpreter::init ( bool  showLogger = true)

Initialize the connection.

In standalone mode, creates the python interpreter, runs casapy, and then connects to it. showLogger has no effect if not in standalone mode.

static String casa::PythonInterpreter::pythonPath ( ) [inline, static, private]

Returns the python path.

Definition at line 103 of file PythonInterpreter.h.

References String.


Member Data Documentation

Whether the connection is initialized.

Definition at line 61 of file PythonInterpreter.h.

PyObject* casa::PythonInterpreter::m_shell [private]

Handle to the ipython shell or the standalone interpreter.

Definition at line 67 of file PythonInterpreter.h.

Whether the connection is standalone mode or not.

Definition at line 64 of file PythonInterpreter.h.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines