Hugintrunk  0.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
hpi_classes.h
Go to the documentation of this file.
1 
15 /* This program is free software; you can redistribute it and/or
16  * modify it under the terms of the GNU General Public
17  * License as published by the Free Software Foundation; either
18  * version 2 of the License, or (at your option) any later version.
19  *
20  * This software is distributed in the hope that it will be useful,
21  * but WITHOUT ANY WARRANTY; without even the implied warranty of
22  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
23  * General Public License for more details.
24  *
25  * You should have received a copy of the GNU General Public
26  * License along with this software. If not, see
27  * <http://www.gnu.org/licenses/>.
28  *
29  * KFJ 2011-01-18
30  *
31  */
32 
33 #ifdef MAC_SELF_CONTAINED_BUNDLE
34  #include <Python27/Python.h>
35 #else
36  #include <Python.h> // always first
37 #endif // MAC_SELF_CONTAINED_BUNDLE
38 #include "swigpyrun.h" // contains SWIG access
39 #include <panodata/Panorama.h>
40 
41 namespace hpi
42 {
51 {
52 private :
54  bool activated;
56  PyObject* hsi_module;
58  PyObject* hpi_module;
60  PyObject* load_module ( const char* name );
61 
62 public:
64  python_interface() : activated(false), hsi_module(NULL), hpi_module(NULL) {};
65  /* destructor, does cleanup */
67 
75  bool activate();
76 
83  int call_hpi ( const char* hpi_func ,
84  PyObject* pArgs );
85 };
86 
89 {
90  // the class members are private
91 private :
92  PyObject* pArgs;
93  int argc;
94  int have;
95 
96 public:
104  PyObject* make_hsi_object ( const char* hsi_type ,
105  void* hugin_value );
106 
111  explicit python_arglist ( int _argc );
113  ~python_arglist();
114 
115 public :
121  bool add ( PyObject* python_arg );
127  bool add ( const char* str );
131  PyObject* yield();
132 };
133 
134 }; //namespace
bool activated
flag, true if activated
Definition: hpi_classes.h:54
PyObject * hsi_module
pointer to loaded hsi module
Definition: hpi_classes.h:56
python_interface()
constructor
Definition: hpi_classes.h:64
python_arglist(int _argc)
the constructor is called with the number of arguments the argument list is meant to contain...
PyObject * pArgs
Definition: hpi_classes.h:92
PyObject * make_hsi_object(const char *hsi_type, void *hugin_value)
general function to make a Python object from a hugin object.
bool activate()
: loads the necessary modules hsi and hpi.
Definition: hpi_classes.cpp:67
a class which encapsulates the python interface.
Definition: hpi_classes.h:50
PyObject * yield()
returns the generated PyObject Note that this will only succeed if the argument count is correct...
~python_arglist()
destructor, does cleanup
PyObject * load_module(const char *name)
general module-loading function
Definition: hpi_classes.cpp:38
PyObject * hpi_module
pointer to loaded hpi module
Definition: hpi_classes.h:58
bool add(PyObject *python_arg)
add a python object to the argument list.
helper class to generated PyObject from C/C++/hugin classes
Definition: hpi_classes.h:88
int call_hpi(const char *hpi_func, PyObject *pArgs)
call a routine in the hsi module with a bunch of parameters.
Definition: hpi_classes.cpp:99