Mercurial > pytave
comparison oct-py-types.h @ 402:c4b78e449c62
maint: indent functions declared in the pytave namespace
* oct-py-eval.cc, oct-py-eval.h, oct-py-types.cc, oct-py-types.h,
oct-py-util.cc, oct-py-util.h: Indent functions declared in the pytave
namespace, adjust line wrap where necessary.
author | Mike Miller <mtmiller@octave.org> |
---|---|
date | Fri, 28 Apr 2017 14:07:57 -0700 |
parents | d362cdd1ddeb |
children | 3613ffbd52b2 |
comparison
equal
deleted
inserted
replaced
401:3a64a336d214 | 402:c4b78e449c62 |
---|---|
35 class octave_value; | 35 class octave_value; |
36 | 36 |
37 namespace pytave | 37 namespace pytave |
38 { | 38 { |
39 | 39 |
40 //! Extract the integer value of the given Python bool object. | 40 //! Extract the integer value of the given Python bool object. |
41 //! | 41 //! |
42 //! @param obj Python bool object | 42 //! @param obj Python bool object |
43 //! @return @c true or @c false value of @a obj | 43 //! @return @c true or @c false value of @a obj |
44 bool | 44 bool |
45 extract_py_bool (PyObject *obj); | 45 extract_py_bool (PyObject *obj); |
46 | 46 |
47 //! Create a Python bool object with the value of the given @c bool value. | 47 //! Create a Python bool object with the value of the given @c bool value. |
48 //! | 48 //! |
49 //! @param value @c true or @c false value | 49 //! @param value @c true or @c false value |
50 //! @return Python bool object | 50 //! @return Python bool object |
51 PyObject * | 51 PyObject * |
52 make_py_bool (bool value); | 52 make_py_bool (bool value); |
53 | 53 |
54 //! Extract the complex value of the given Python complex object. | 54 //! Extract the complex value of the given Python complex object. |
55 //! | 55 //! |
56 //! @param obj Python complex object | 56 //! @param obj Python complex object |
57 //! @return complex value of @a obj | 57 //! @return complex value of @a obj |
58 std::complex<double> | 58 std::complex<double> |
59 extract_py_complex (PyObject *obj); | 59 extract_py_complex (PyObject *obj); |
60 | 60 |
61 //! Create a Python complex object with the value of the given @c complex value. | 61 //! Create a Python complex object with the value of the given @c complex |
62 //! | 62 //! value. |
63 //! @param value complex value | 63 //! |
64 //! @return Python complex object | 64 //! @param value complex value |
65 PyObject * | 65 //! @return Python complex object |
66 make_py_complex (std::complex<double> value); | 66 PyObject * |
67 | 67 make_py_complex (std::complex<double> value); |
68 //! Extract the floating point value of the given Python float object. | 68 |
69 //! | 69 //! Extract the floating point value of the given Python float object. |
70 //! @param obj Python float object | 70 //! |
71 //! @return floating point value of @a obj | 71 //! @param obj Python float object |
72 double | 72 //! @return floating point value of @a obj |
73 extract_py_float (PyObject *obj); | 73 double |
74 | 74 extract_py_float (PyObject *obj); |
75 //! Create a Python float object with the value of the given @c double value. | 75 |
76 //! | 76 //! Create a Python float object with the value of the given @c double value. |
77 //! @param value floating point value | 77 //! |
78 //! @return Python float object | 78 //! @param value floating point value |
79 PyObject * | 79 //! @return Python float object |
80 make_py_float (double value); | 80 PyObject * |
81 | 81 make_py_float (double value); |
82 //! Extract an Octave scalar map from the given Python dict object. | 82 |
83 //! | 83 //! Extract an Octave scalar map from the given Python dict object. |
84 //! @param obj Python dict object | 84 //! |
85 //! @return Octave scalar map containing the items of @a obj | 85 //! @param obj Python dict object |
86 octave_scalar_map | 86 //! @return Octave scalar map containing the items of @a obj |
87 extract_py_scalar_map (PyObject *obj); | 87 octave_scalar_map |
88 | 88 extract_py_scalar_map (PyObject *obj); |
89 //! Create a Python dict object from the given Octave scalar map value. | 89 |
90 //! | 90 //! Create a Python dict object from the given Octave scalar map value. |
91 //! The values contained in the map are recursively converted to appropriate | 91 //! |
92 //! Python values. | 92 //! The values contained in the map are recursively converted to appropriate |
93 //! | 93 //! Python values. |
94 //! @param map Octave scalar map | 94 //! |
95 //! @return Python dict object | 95 //! @param map Octave scalar map |
96 PyObject * | 96 //! @return Python dict object |
97 make_py_dict (const octave_scalar_map& map); | 97 PyObject * |
98 | 98 make_py_dict (const octave_scalar_map& map); |
99 //! Extract the integer value of the given Python int or long object. | 99 |
100 //! | 100 //! Extract the integer value of the given Python int or long object. |
101 //! @param obj Python int or long object | 101 //! |
102 //! @return integer value of @a obj | 102 //! @param obj Python int or long object |
103 int64_t | 103 //! @return integer value of @a obj |
104 extract_py_int64 (PyObject *obj); | 104 int64_t |
105 | 105 extract_py_int64 (PyObject *obj); |
106 //! Extract the integer value of the given Python int or long object. | 106 |
107 //! | 107 //! Extract the integer value of the given Python int or long object. |
108 //! @param obj Python int or long object | 108 //! |
109 //! @return integer value of @a obj | 109 //! @param obj Python int or long object |
110 uint64_t | 110 //! @return integer value of @a obj |
111 extract_py_uint64 (PyObject *obj); | 111 uint64_t |
112 | 112 extract_py_uint64 (PyObject *obj); |
113 //! Create a Python int object with the value of the given @c int32_t value. | 113 |
114 //! | 114 //! Create a Python int object with the value of the given @c int32_t value. |
115 //! @param value integer value | 115 //! |
116 //! @return Python int or long object | 116 //! @param value integer value |
117 PyObject * | 117 //! @return Python int or long object |
118 make_py_int (int32_t value); | 118 PyObject * |
119 | 119 make_py_int (int32_t value); |
120 //! Create a Python int object with the value of the given @c uint32_t value. | 120 |
121 //! | 121 //! Create a Python int object with the value of the given @c uint32_t value. |
122 //! @param value integer value | 122 //! |
123 //! @return Python int or long object | 123 //! @param value integer value |
124 PyObject * | 124 //! @return Python int or long object |
125 make_py_int (uint32_t value); | 125 PyObject * |
126 | 126 make_py_int (uint32_t value); |
127 //! Create a Python int object with the value of the given @c int64_t value. | 127 |
128 //! | 128 //! Create a Python int object with the value of the given @c int64_t value. |
129 //! @param value integer value | 129 //! |
130 //! @return Python int or long object | 130 //! @param value integer value |
131 PyObject * | 131 //! @return Python int or long object |
132 make_py_int (int64_t value); | 132 PyObject * |
133 | 133 make_py_int (int64_t value); |
134 //! Create a Python int object with the value of the given @c uint64_t value. | 134 |
135 //! | 135 //! Create a Python int object with the value of the given @c uint64_t value. |
136 //! @param value integer value | 136 //! |
137 //! @return Python int or long object | 137 //! @param value integer value |
138 PyObject * | 138 //! @return Python int or long object |
139 make_py_int (uint64_t value); | 139 PyObject * |
140 | 140 make_py_int (uint64_t value); |
141 //! Create a Python array object with the value of the given Octave array. | 141 |
142 //! | 142 //! Create a Python array object with the value of the given Octave array. |
143 //! @param nda array value | 143 //! |
144 //! @return Python array object | 144 //! @param nda array value |
145 PyObject * | 145 //! @return Python array object |
146 make_py_array (const NDArray& nda); | 146 PyObject * |
147 | 147 make_py_array (const NDArray& nda); |
148 //! Create a Python array object with the value of the given Octave array. | 148 |
149 //! | 149 //! Create a Python array object with the value of the given Octave array. |
150 //! @param nda array value | 150 //! |
151 //! @return Python array object | 151 //! @param nda array value |
152 PyObject * | 152 //! @return Python array object |
153 make_py_array (const FloatNDArray& nda); | 153 PyObject * |
154 | 154 make_py_array (const FloatNDArray& nda); |
155 //! Create a Python array object with the value of the given Octave array. | 155 |
156 //! | 156 //! Create a Python array object with the value of the given Octave array. |
157 //! @param nda array value | 157 //! |
158 //! @return Python array object | 158 //! @param nda array value |
159 template <typename T> | 159 //! @return Python array object |
160 PyObject * | 160 template <typename T> |
161 make_py_array (const intNDArray<T>& nda); | 161 PyObject * |
162 | 162 make_py_array (const intNDArray<T>& nda); |
163 //! Create a Python array object from the given Octave numeric vector. | 163 |
164 //! | 164 //! Create a Python array object from the given Octave numeric vector. |
165 //! All Octave real floating point and integer values are converted to | 165 //! |
166 //! corresponding Python array types by this function. | 166 //! All Octave real floating point and integer values are converted to |
167 //! | 167 //! corresponding Python array types by this function. |
168 //! @warning Depending on the version of Python and how it is configured, | 168 //! |
169 //! @c int64 and @c uint64 vectors may not be supported. | 169 //! @warning Depending on the version of Python and how it is configured, |
170 //! | 170 //! @c int64 and @c uint64 vectors may not be supported. |
171 //! @param value Octave numeric or boolean scalar value | 171 //! |
172 //! @return Python array object | 172 //! @param value Octave numeric or boolean scalar value |
173 PyObject * | 173 //! @return Python array object |
174 make_py_array (const octave_value& value); | 174 PyObject * |
175 | 175 make_py_array (const octave_value& value); |
176 //! Create a Python tuple object from the given Octave cell array value. | 176 |
177 //! | 177 //! Create a Python tuple object from the given Octave cell array value. |
178 //! The values contained in the cell array are recursively converted to | 178 //! |
179 //! appropriate Python values. | 179 //! The values contained in the cell array are recursively converted to |
180 //! | 180 //! appropriate Python values. |
181 //! @param cell Octave cell array | 181 //! |
182 //! @return Python tuple object | 182 //! @param cell Octave cell array |
183 PyObject * | 183 //! @return Python tuple object |
184 make_py_tuple (const Cell& cell); | 184 PyObject * |
185 | 185 make_py_tuple (const Cell& cell); |
186 //! Create a Python numeric object from the given Octave numeric or boolean | 186 |
187 //! scalar value. | 187 //! Create a Python numeric object from the given Octave numeric or boolean |
188 //! | 188 //! scalar value. |
189 //! The following implicit type conversions are implemented by this function: | 189 //! |
190 //! | 190 //! The following implicit type conversions are implemented by this function: |
191 //! @arg @c bool from Octave logical scalar, | 191 //! |
192 //! @arg @c complex from Octave double or single precision complex scalar, | 192 //! @arg @c bool from Octave logical scalar, |
193 //! @arg @c float from Octave double or single precision scalar, | 193 //! @arg @c complex from Octave double or single precision complex scalar, |
194 //! @arg @c int from any Octave integer-valued scalar, | 194 //! @arg @c float from Octave double or single precision scalar, |
195 //! @arg @c long from any Octave @c uint32, @c int64, or @c uint64, and only | 195 //! @arg @c int from any Octave integer-valued scalar, |
196 //! if running against Python 2. | 196 //! @arg @c long from any Octave @c uint32, @c int64, or @c uint64, and only |
197 //! | 197 //! if running against Python 2. |
198 //! @param value Octave numeric or boolean scalar value | 198 //! |
199 //! @return Python numeric object (@c bool, @c int, @c long, @c float, or | 199 //! @param value Octave numeric or boolean scalar value |
200 //! @c complex) | 200 //! @return Python numeric object (@c bool, @c int, @c long, @c float, or |
201 PyObject * | 201 //! @c complex) |
202 make_py_numeric_value (const octave_value& value); | 202 PyObject * |
203 | 203 make_py_numeric_value (const octave_value& value); |
204 //! Extract the string value of the given Python str, bytes, or unicode object. | 204 |
205 //! | 205 //! Extract the string value of the given Python str, bytes, or unicode |
206 //! @param obj Python str, bytes, or unicode object | 206 //! object. |
207 //! @return string value of @a obj | 207 //! |
208 std::string | 208 //! @param obj Python str, bytes, or unicode object |
209 extract_py_str (PyObject *obj); | 209 //! @return string value of @a obj |
210 | 210 std::string |
211 //! Create a Python str object from the given @c string value. | 211 extract_py_str (PyObject *obj); |
212 //! | 212 |
213 //! @param str string value | 213 //! Create a Python str object from the given @c string value. |
214 //! @return Python str object | 214 //! |
215 PyObject * | 215 //! @param str string value |
216 make_py_str (const std::string& str); | 216 //! @return Python str object |
217 PyObject * | |
218 make_py_str (const std::string& str); | |
217 | 219 |
218 } | 220 } |
219 | 221 |
220 #endif | 222 #endif |