Xmipp  v3.23.11-Nereus
python_program.h
Go to the documentation of this file.
1 /***************************************************************************
2  *
3  * Authors: J.M. De la Rosa Trevin (jmdelarosa@cnb.csic.es)
4  * Roberto Marabini (roberto@cnb.csic.es)
5  *
6  * Unidad de Bioinformatica of Centro Nacional de Biotecnologia , CSIC
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
21  * 02111-1307 USA
22  *
23  * All comments concerning this program package may be sent to the
24  * e-mail address 'xmipp@cnb.csic.es'
25  ***************************************************************************/
26 
27 #ifndef _PYTHON_PROGRAM_H
28 #define _PYTHON_PROGRAM_H
29 
30 #include <Python.h>
31 #include "core/xmipp_program.h"
32 
33 extern PyObject * PyXmippError;
34 
35 /***************************************************************/
36 /* Program */
37 /**************************************************************/
38 
43 {
44 public:
47  PythonProgram();
48  void endDefinition();
49  virtual void read(int argc, const char ** argv, bool reportErrors = true) override;
50  virtual void read(int argc, char ** argv, bool reportErrors = true) override;
51 
52 protected:
53  virtual void defineParams() override;
54  virtual void readParams() override;
55  virtual void show() const override;
56  virtual void run() override;
57 }
58 ;// end of class XmippProgramGeneric
59 
60 
61 #define Program_Check(v) (((v)->ob_type == &ProgramType))
62 #define Program_Value(v) ((*((ProgramObject*)(v))->program))
63 
64 /*Program Object*/
65 typedef struct
66 {
67  PyObject_HEAD
69 }
71 
72 #define ProgramObject_New() (ProgramObject*)malloc(sizeof(ProgramObject))
73 
74 /* Destructor */
75 void Program_dealloc(ProgramObject* self);
76 
77 /* Constructor */
78 PyObject *
79 Program_new(PyTypeObject *type, PyObject *args, PyObject *kwargs);
80 
81 /* addUsageLine */
82 PyObject *
83 Program_addUsageLine(PyObject *obj, PyObject *args, PyObject *kwargs);
84 
85 /* addExampleLine */
86 PyObject *
87 Program_addExampleLine(PyObject *obj, PyObject *args, PyObject *kwargs);
88 
89 /* addParamsLine */
90 PyObject *
91 Program_addParamsLine(PyObject *obj, PyObject *args, PyObject *kwargs);
92 
93 /* usage */
94 PyObject *
95 Program_usage(PyObject *obj, PyObject *args, PyObject *kwargs);
96 
97 /* endDefinition */
98 PyObject *
99 Program_endDefinition(PyObject *obj, PyObject *args, PyObject *kwargs);
100 
101 /* read */
102 PyObject *
103 Program_read(PyObject *obj, PyObject *args, PyObject *kwargs);
104 
105 /* checkParam */
106 PyObject *
107 Program_checkParam(PyObject *obj, PyObject *args, PyObject *kwargs);
108 
109 /* getParam */
110 PyObject *
111 Program_getParam(PyObject *obj, PyObject *args, PyObject *kwargs);
112 
113 /* getListParam */
114 PyObject *
115 Program_getListParam(PyObject *obj, PyObject *args, PyObject *kwargs);
116 
117 /* Program methods */
118 extern PyMethodDef Program_methods[];
119 extern PyTypeObject ProgramType;
120 #endif
virtual void show() const override
virtual void readParams() override
PyObject * Program_usage(PyObject *obj, PyObject *args, PyObject *kwargs)
bool definitionComplete
PyObject_HEAD PythonProgram * program
PyObject * Program_endDefinition(PyObject *obj, PyObject *args, PyObject *kwargs)
void Program_dealloc(ProgramObject *self)
int argc
Original command line arguments.
Definition: xmipp_program.h:86
PyObject * Program_read(PyObject *obj, PyObject *args, PyObject *kwargs)
PyMethodDef Program_methods[]
viol type
PyTypeObject ProgramType
virtual void defineParams() override
virtual void read(int argc, const char **argv, bool reportErrors=true) override
const char ** argv
Definition: xmipp_program.h:87
PyObject * Program_addExampleLine(PyObject *obj, PyObject *args, PyObject *kwargs)
PyObject * Program_getParam(PyObject *obj, PyObject *args, PyObject *kwargs)
PyObject * Program_checkParam(PyObject *obj, PyObject *args, PyObject *kwargs)
PyObject * Program_getListParam(PyObject *obj, PyObject *args, PyObject *kwargs)
PyObject * Program_addParamsLine(PyObject *obj, PyObject *args, PyObject *kwargs)
PyObject * PyXmippError
Definition: xmippmodule.cpp:47
void(* obj)()
virtual void run() override
PyObject * Program_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
PythonProgram()
Constructor.
PyObject * Program_addUsageLine(PyObject *obj, PyObject *args, PyObject *kwargs)