79 |
* @param args Python tuple containing the arguments to pass to the |
* @param args Python tuple containing the arguments to pass to the |
80 |
* Python class constructor. |
* Python class constructor. |
81 |
*/ |
*/ |
82 |
bool create_instance (const std::string & file, const std::string & classname, PyObject * args = NULL); |
bool create_instance (const string & file, const string & classname, PyObject * args = NULL); |
83 |
|
|
84 |
/** |
/** |
85 |
* Similar to create_instance, except that it will reload the module |
* Similar to create_instance, except that it will reload the module |
91 |
* @param args Python tuple containing the arguments to pass to the |
* @param args Python tuple containing the arguments to pass to the |
92 |
* Python class constructor. |
* Python class constructor. |
93 |
*/ |
*/ |
94 |
bool reload_instance (const std::string & file, const std::string & classname, PyObject * args = NULL); |
bool reload_instance (const string & file, const string & classname, PyObject * args = NULL); |
95 |
//@} |
//@} |
96 |
|
|
97 |
/** |
/** |
106 |
* @return the return value of the method as PyObject. Needs to be |
* @return the return value of the method as PyObject. Needs to be |
107 |
* Py_DECREF'd when no longer needed. |
* Py_DECREF'd when no longer needed. |
108 |
*/ |
*/ |
109 |
PyObject *call_method_ret (const std::string &name, PyObject *args = NULL) const; |
PyObject *call_method_ret (const string &name, PyObject *args = NULL) const; |
110 |
|
|
111 |
/** |
/** |
112 |
* Call a method of this object. |
* Call a method of this object. |
114 |
* @param name name of the method to call. |
* @param name name of the method to call. |
115 |
* @param args Python tuple containing the arguments to pass to the method. |
* @param args Python tuple containing the arguments to pass to the method. |
116 |
*/ |
*/ |
117 |
void call_method (const std::string & name, PyObject * args = NULL) const |
void call_method (const string & name, PyObject * args = NULL) const |
118 |
{ |
{ |
119 |
PyObject *result = call_method_ret (name, args); |
PyObject *result = call_method_ret (name, args); |
120 |
Py_XDECREF (result); |
Py_XDECREF (result); |
132 |
* @param name Name of the attribute to test for |
* @param name Name of the attribute to test for |
133 |
* @return <b>true</b> if the attribute exists, <b>false</b> otherwise. |
* @return <b>true</b> if the attribute exists, <b>false</b> otherwise. |
134 |
*/ |
*/ |
135 |
bool has_attribute (const std::string & name) const; |
bool has_attribute (const string & name) const; |
136 |
|
|
137 |
/** |
/** |
138 |
* Returns a new reference to an attribute of this object. |
* Returns a new reference to an attribute of this object. |
140 |
* @param name Name of the attribute to access |
* @param name Name of the attribute to access |
141 |
* @return New reference to the attribute or NULL on error |
* @return New reference to the attribute or NULL on error |
142 |
*/ |
*/ |
143 |
PyObject* get_attribute (const std::string & name) const; |
PyObject* get_attribute (const string & name) const; |
144 |
|
|
145 |
/** |
/** |
146 |
* Returns the given attribute as integer value. |
* Returns the given attribute as integer value. |
148 |
* @param name Name of the attribute to access |
* @param name Name of the attribute to access |
149 |
* @return An integer. |
* @return An integer. |
150 |
*/ |
*/ |
151 |
s_int32 get_attribute_int (const std::string & name) const; |
s_int32 get_attribute_int (const string & name) const; |
152 |
|
|
153 |
/** |
/** |
154 |
* Returns the given attribute as string value. |
* Returns the given attribute as string value. |
156 |
* @param name Name of the attribute to access |
* @param name Name of the attribute to access |
157 |
* @return A string. |
* @return A string. |
158 |
*/ |
*/ |
159 |
std::string get_attribute_string (const std::string & name) const; |
std::string get_attribute_string (const string & name) const; |
160 |
|
|
161 |
/** |
/** |
162 |
* Assign a new attribute to the module, overriding an existing |
* Assign a new attribute to the module, overriding an existing |
165 |
* @param name The attribute's name |
* @param name The attribute's name |
166 |
* @param value The attribute's value |
* @param value The attribute's value |
167 |
*/ |
*/ |
168 |
void set_attribute (const std::string & name, PyObject *value); |
void set_attribute (const string & name, PyObject *value); |
169 |
|
|
170 |
/** |
/** |
171 |
* Assign a new integer attribute to the module, overriding an |
* Assign a new integer attribute to the module, overriding an |
174 |
* @param name The attribute's name |
* @param name The attribute's name |
175 |
* @param value The attribute's value |
* @param value The attribute's value |
176 |
*/ |
*/ |
177 |
void set_attribute_int (const std::string & name, s_int32 value); |
void set_attribute_int (const string & name, s_int32 value); |
178 |
|
|
179 |
/** |
/** |
180 |
* Assign a new string attribute to the module, overriding an |
* Assign a new string attribute to the module, overriding an |
183 |
* @param name The attribute's name |
* @param name The attribute's name |
184 |
* @param value The attribute's value |
* @param value The attribute's value |
185 |
*/ |
*/ |
186 |
void set_attribute_string (const std::string & name, const std::string & value); |
void set_attribute_string (const string & name, const string & value); |
187 |
//@} |
//@} |
188 |
|
|
189 |
/** |
/** |