Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
PyResult.h
Go to the documentation of this file.
1#ifndef CPYCPPYY_PYRESULT_H
2#define CPYCPPYY_PYRESULT_H
3
4//////////////////////////////////////////////////////////////////////////////
5// //
6// TPyResult //
7// //
8// Morphing return type from evaluating python expressions. //
9// //
10//////////////////////////////////////////////////////////////////////////////
11
12// Python
13struct _object;
14typedef _object PyObject;
15
16// Bindings
17#include "CPyCppyy/CommonDefs.h"
18
19
20namespace CPyCppyy {
21
23public:
24 PyResult();
25 PyResult(PyObject* pyobject);
26 PyResult(const PyResult&);
28 virtual ~PyResult();
29
30// conversions to standard types, may fail if unconvertible
31 operator char*() const;
32 operator const char*() const;
33 operator char() const;
34
35 operator long() const;
36 operator int() const { return (int)operator long(); }
37 operator short() const { return (short)operator long(); }
38
39 operator unsigned long() const;
40 operator unsigned int() const {
41 return (unsigned int)operator unsigned long();
42 }
43 operator unsigned short() const {
44 return (unsigned short)operator unsigned long();
45 }
46
47 operator double() const;
48 operator float() const { return (float)operator double(); }
49
50// used for both general object type and PyObject conversions
51 operator void*() const;
52
53 template<class T>
54 operator T*() const { return (T*)(void*)*this; }
55
56// used strictly for PyObject conversions
57 operator PyObject*() const;
58
59private:
60 PyObject* fPyObject; //! actual python object
61};
62
63} // namespace CPyCppyy
64
65#endif // !CPYCPPYY_PYRESULT_H
double
l unsigned short
long
_object PyObject
_object PyObject
Definition PyResult.h:14
Binding & operator=(OUT(*fun)(void))
#define CPYCPPYY_CLASS_EXTERN
Definition CommonDefs.h:29
PyObject * fPyObject
Definition PyResult.h:60
Set of helper functions that are invoked from the pythonizors, on the Python side.