casa
$Rev:20696$
|
Interface for connecting to and running tasks in Python. More...
#include <PythonInterpreter.h>
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. |
Interface for connecting to and running tasks in Python.
Definition at line 39 of file PythonInterpreter.h.
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.
static String casa::PythonInterpreter::aipsPath | ( | ) | [inline, static, private] |
Returns the aips path.
Definition at line 70 of file PythonInterpreter.h.
References casa::String::find(), casa::SynthesisUtils::getenv(), casa::dbus::path(), casa::String::size(), String, and casa::String::substr().
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] |
bool casa::PythonInterpreter::m_initialized [private] |
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.
bool casa::PythonInterpreter::m_standalone [private] |
Whether the connection is standalone mode or not.
Definition at line 64 of file PythonInterpreter.h.