Back to index

nordugrid-arc-nox  1.1.0~rc6
Classes | Namespaces | Typedefs | Functions | Variables
pythonwrapper.cpp File Reference
#include <iostream>
#include <arc/message/SOAPMessage.h>
#include <arc/message/PayloadSOAP.h>
#include <arc/message/MCCLoader.h>
#include <arc/Thread.h>
#include "pythonwrapper.h"
#include <dlfcn.h>

Go to the source code of this file.


struct  swig_type_info
struct  swig_cast_info
struct  PySwigObject
class  Arc::PythonLock
class  Arc::XMLNodeP
class  Arc::SOAPMessageP
class  Arc::PyObjectP


namespace  Arc
 ARCJSDLParser The ARCJSDLParser class, derived from the JobDescriptionParser class, is primarily a job description parser for the consolidated job description language (ARCJSDL), derived from JSDL, described in the following document


typedef void *(* swig_converter_func )(void *)
typedef struct swig_type_info *(* swig_dycast_func )(void **)
typedef struct swig_type_info swig_type_info
typedef struct swig_cast_info swig_cast_info


void * extract_swig_wrappered_pointer (PyObject *obj)
static Arc::Pluginget_service (Arc::PluginArgument *arg)


static PyThreadState * tstate = NULL
static int python_service_counter = 0
static Glib::Mutex service_lock
Arc::PluginDescriptor PLUGINS_TABLE_NAME []

Class Documentation

struct swig_type_info

Definition at line 337 of file arc_wrap.cpp.

Collaboration diagram for swig_type_info:
Class Members
struct swig_cast_info * cast
void * clientdata
swig_dycast_func dcast
const char * name
int owndata
const char * str
struct swig_cast_info

Definition at line 347 of file arc_wrap.cpp.

Collaboration diagram for swig_cast_info:
Class Members
swig_converter_func converter
struct swig_cast_info * next
struct swig_cast_info * prev
swig_type_info * type
struct PySwigObject

Definition at line 1327 of file arc_wrap.cpp.

Collaboration diagram for PySwigObject:
Class Members
PyObject * next
int own
PyObject_HEAD void * ptr
swig_type_info * ty

Typedef Documentation

typedef void*(* swig_converter_func)(void *)

Definition at line 24 of file pythonwrapper.cpp.

typedef struct swig_type_info*(* swig_dycast_func)(void **)

Definition at line 25 of file pythonwrapper.cpp.

Function Documentation

void* extract_swig_wrappered_pointer ( PyObject *  obj)

Definition at line 56 of file pythonwrapper.cpp.

    char this_str[] = "this";
    if (!PyObject_HasAttrString(obj, this_str)) {
        return NULL;
    PyObject *thisAttr = PyObject_GetAttrString(obj, this_str);
    if (thisAttr == NULL) {
        return NULL;
    void* ptr = ((PySwigObject *)thisAttr)->ptr;
    return ptr;

Here is the caller graph for this function:

static Arc::Plugin* get_service ( Arc::PluginArgument arg) [static]

Definition at line 77 of file pythonwrapper.cpp.

    Arc::ServicePluginArgument* srvarg =
    if(!srvarg) return NULL;
    Arc::ChainContext* ctx = (Arc::ChainContext*)(*srvarg);

#ifndef WIN32
    // ((Arc::PluginsFactory*)(*ctx))->load("pythonservice",false,true); // doesn't work, why?
    ::dlopen(((Arc::PluginsFactory*)(*ctx))->findLocation("pythonservice").c_str(),RTLD_NOW | RTLD_GLOBAL);

    // Initialize the Python Interpreter
    if (!Py_IsInitialized()) {
        Py_InitializeEx(0); // python does not handle signals
        PyEval_InitThreads(); // Main thread created and lock acquired
        tstate = PyThreadState_Get(); // Get current thread
        if(tstate == NULL) {
            Arc::Logger::getRootLogger().msg(Arc::ERROR, "Failed to initialize main Python thread");
            return NULL;
    } else {
        if(tstate == NULL) {
            Arc::Logger::getRootLogger().msg(Arc::ERROR, "Main Python thread was not initialized");
            return NULL;
    Arc::Logger::getRootLogger().msg(Arc::DEBUG, "Loading %u-th Python service", python_service_counter);
    Arc::RegisteredService* service = new Arc::Service_PythonWrapper((Arc::Config*)(*srvarg));
    PyEval_ReleaseThread(tstate); // Release current thread
    Arc::Logger::getRootLogger().msg(Arc::DEBUG, "Initialized %u-th Python service", python_service_counter);
    return service;

Here is the call graph for this function:

Variable Documentation

Initial value:
    { "pythonservice", "HED:SERVICE", 0, &get_service },
    { NULL, NULL, 0, NULL }

Definition at line 114 of file pythonwrapper.cpp.

int python_service_counter = 0 [static]

Definition at line 73 of file pythonwrapper.cpp.

Glib::Mutex service_lock [static]

Definition at line 74 of file pythonwrapper.cpp.

PyThreadState* tstate = NULL [static]

Definition at line 72 of file pythonwrapper.cpp.