~ajdobbs/maus/event-selection

« back to all changes in this revision

Viewing changes to src/py_cpp/optics/PyOpticsModel.hh

  • Committer: Chris Rogers
  • Date: 2013-07-11 05:48:08 UTC
  • mto: (663.6.290 merge)
  • mto: This revision was merged to the branch mainline in revision 688.
  • Revision ID: chris.rogers@stfc.ac.uk-20130711054808-hd04qt0hl7cty4p5
Working on PyOpticsModel API

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* This file is part of MAUS: http://micewww.pp.rl.ac.uk:8080/projects/maus
 
2
 *
 
3
 * MAUS is free software: you can redistribute it and/or modify
 
4
 * it under the terms of the GNU General Public License as published by
 
5
 * the Free Software Foundation, either version 3 of the License, or
 
6
 * (at your option) any later version.
 
7
 *
 
8
 * MAUS is distributed in the hope that it will be useful,
 
9
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
10
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
11
 * GNU General Public License for more details.
 
12
 *
 
13
 * You should have received a copy of the GNU General Public License
 
14
 * along with MAUS.  If not, see <http://www.gnu.org/licenses/>.
 
15
 *
 
16
 */
 
17
 
 
18
#ifndef _SRC_PY_CPP_PYOPTICSMODEL_HH_
 
19
#define _SRC_PY_CPP_PYOPTICSMODEL_HH_
 
20
 
 
21
// These ifdefs are required to avoid cpp compiler warning
 
22
#ifdef _POSIX_C_SOURCE
 
23
#undef _POSIX_C_SOURCE
 
24
#endif
 
25
 
 
26
#ifdef _XOPEN_SOURCE
 
27
#undef _XOPEN_SOURCE
 
28
#endif
 
29
 
 
30
#include <Python.h>
 
31
 
 
32
namespace MAUS {
 
33
 
 
34
class OpticsModel; // note this is just in MAUS namespace
 
35
 
 
36
namespace PyOpticsModel {
 
37
 
 
38
/** PyOpticsModel is the python implementation of the C++ OpticsModel class
 
39
 */
 
40
typedef struct {
 
41
    PyObject_HEAD;
 
42
    OpticsModel* model;
 
43
} PyOpticsModel;
 
44
 
 
45
/** _alloc allocates memory for PyOpticsModel
 
46
 */
 
47
PyObject *_alloc(PyTypeObject *self, Py_ssize_t nitems);
 
48
 
 
49
/** _new allocates and initialises memory for PyOpticsModel
 
50
 */
 
51
PyObject *_new(PyTypeObject *self, Py_ssize_t nitems);
 
52
 
 
53
/** _init initialises an allocated PyOpticsModel object
 
54
 */
 
55
int _init(PyObject* self, PyObject *args, PyObject *kwds);
 
56
 
 
57
/** deallocate memory */
 
58
void _dealloc(PyOpticsModel * self);
 
59
 
 
60
/** synonym for dealloc */
 
61
void _free(PyOpticsModel * self);
 
62
 
 
63
/** Initialise optics_model module
 
64
 *
 
65
 *  This is called by import optics_model; it initialises the OpticsModel type
 
66
 *  allowing user to construct and call methods on OpticsModel objects
 
67
 */
 
68
PyMODINIT_FUNC initoptics_model(void);
 
69
 
 
70
/** Return the C++ optics model associated with a PyOpticsModel 
 
71
 *  
 
72
 *  OpticsModel still owns the memory allocated to PyOpticsModel
 
73
 */
 
74
OpticsModel* get_optics_model(PyOpticsModel* py_model);
 
75
 
 
76
}  // namespace PyOpticsModel
 
77
}  // namespace MAUS
 
78
 
 
79
#endif  // _SRC_PY_CPP_PYFIELDS_HH_