Fawkes API  Fawkes Development Version
fawkesblackboard_tolua.cpp
1 /*
2 ** Lua binding: fawkesblackboard
3 ** Generated automatically by tolua++-1.0.92
4 */
5 /* This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version. A runtime exception applies to
9  * this software (see LICENSE.GPL_WRE file mentioned below for details).
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU Library General Public License for more details.
15  *
16  * Read the full text in the LICENSE.GPL_WRE file in the doc directory.
17  */
18 
19 #include <core/exception.h>
20 
21 #ifndef __cplusplus
22 #include "stdlib.h"
23 #endif
24 #include "string.h"
25 
26 #include "tolua++.h"
27 
28 /* Exported function */
29 TOLUA_API int tolua_fawkesblackboard_open (lua_State* tolua_S);
30 
31 #include <blackboard/blackboard.h>
32 #include <list>
33 #include <string>
34 
35 /* function to register type */
36 static void tolua_reg_types (lua_State* tolua_S)
37 {
38  tolua_usertype(tolua_S,"fawkes::Interface");
39  tolua_usertype(tolua_S,"fawkes::BlackBoard");
40 }
41 
42 /* method: open_for_reading of class fawkes::BlackBoard */
43 #ifndef TOLUA_DISABLE_tolua_fawkesblackboard_fawkes_BlackBoard_open_for_reading_generic00
44 static int tolua_fawkesblackboard_fawkes_BlackBoard_open_for_reading_generic00(lua_State* tolua_S)
45 {
46 #ifndef TOLUA_RELEASE
47  tolua_Error tolua_err;
48  if (
49  !tolua_isusertype(tolua_S,1,"fawkes::BlackBoard",0,&tolua_err) ||
50  !tolua_isstring(tolua_S,2,0,&tolua_err) ||
51  !tolua_isstring(tolua_S,3,0,&tolua_err) ||
52  !tolua_isnoobj(tolua_S,4,&tolua_err)
53  )
54  goto tolua_lerror;
55  else
56 #endif
57  {
58  fawkes::BlackBoard* self = (fawkes::BlackBoard*) tolua_tousertype(tolua_S,1,0);
59  const char* interface_type = ((const char*) tolua_tostring(tolua_S,2,0));
60  const char* identifier = ((const char*) tolua_tostring(tolua_S,3,0));
61 #ifndef TOLUA_RELEASE
62  if (!self) tolua_error(tolua_S,"invalid 'self' in function 'open_for_reading'", NULL);
63 #endif
64  bool exc_caught = false;
65  try {
66  {
67  fawkes::Interface* tolua_ret = (fawkes::Interface*) self->open_for_reading(interface_type,identifier);
68  tolua_pushusertype(tolua_S,(void*)tolua_ret,"fawkes::Interface");
69  }
70  } catch (fawkes::Exception &e) {
71  exc_caught = true;
72  lua_pushstring(tolua_S, e.what_no_backtrace());
73  }
74  catch (std::exception &e) {
75  exc_caught = true;
76  lua_pushstring(tolua_S, e.what());
77  }
78  if (exc_caught) lua_error(tolua_S);
79 
80  }
81  return 1;
82 #ifndef TOLUA_RELEASE
83  tolua_lerror:
84  tolua_error(tolua_S,"#ferror in function 'open_for_reading_generic'.",&tolua_err);
85  return 0;
86 #endif
87 }
88 #endif //#ifndef TOLUA_DISABLE
89 
90 /* method: open_for_writing of class fawkes::BlackBoard */
91 #ifndef TOLUA_DISABLE_tolua_fawkesblackboard_fawkes_BlackBoard_open_for_writing_generic00
92 static int tolua_fawkesblackboard_fawkes_BlackBoard_open_for_writing_generic00(lua_State* tolua_S)
93 {
94 #ifndef TOLUA_RELEASE
95  tolua_Error tolua_err;
96  if (
97  !tolua_isusertype(tolua_S,1,"fawkes::BlackBoard",0,&tolua_err) ||
98  !tolua_isstring(tolua_S,2,0,&tolua_err) ||
99  !tolua_isstring(tolua_S,3,0,&tolua_err) ||
100  !tolua_isnoobj(tolua_S,4,&tolua_err)
101  )
102  goto tolua_lerror;
103  else
104 #endif
105  {
106  fawkes::BlackBoard* self = (fawkes::BlackBoard*) tolua_tousertype(tolua_S,1,0);
107  const char* interface_type = ((const char*) tolua_tostring(tolua_S,2,0));
108  const char* identifier = ((const char*) tolua_tostring(tolua_S,3,0));
109 #ifndef TOLUA_RELEASE
110  if (!self) tolua_error(tolua_S,"invalid 'self' in function 'open_for_writing'", NULL);
111 #endif
112  bool exc_caught = false;
113  try {
114  {
115  fawkes::Interface* tolua_ret = (fawkes::Interface*) self->open_for_writing(interface_type,identifier);
116  tolua_pushusertype(tolua_S,(void*)tolua_ret,"fawkes::Interface");
117  }
118  } catch (fawkes::Exception &e) {
119  exc_caught = true;
120  lua_pushstring(tolua_S, e.what_no_backtrace());
121  }
122  catch (std::exception &e) {
123  exc_caught = true;
124  lua_pushstring(tolua_S, e.what());
125  }
126  if (exc_caught) lua_error(tolua_S);
127 
128  }
129  return 1;
130 #ifndef TOLUA_RELEASE
131  tolua_lerror:
132  tolua_error(tolua_S,"#ferror in function 'open_for_writing_generic'.",&tolua_err);
133  return 0;
134 #endif
135 }
136 #endif //#ifndef TOLUA_DISABLE
137 
138 /* method: close of class fawkes::BlackBoard */
139 #ifndef TOLUA_DISABLE_tolua_fawkesblackboard_fawkes_BlackBoard_close_generic00
140 static int tolua_fawkesblackboard_fawkes_BlackBoard_close_generic00(lua_State* tolua_S)
141 {
142 #ifndef TOLUA_RELEASE
143  tolua_Error tolua_err;
144  if (
145  !tolua_isusertype(tolua_S,1,"fawkes::BlackBoard",0,&tolua_err) ||
146  !tolua_isusertype(tolua_S,2,"fawkes::Interface",0,&tolua_err) ||
147  !tolua_isnoobj(tolua_S,3,&tolua_err)
148  )
149  goto tolua_lerror;
150  else
151 #endif
152  {
153  fawkes::BlackBoard* self = (fawkes::BlackBoard*) tolua_tousertype(tolua_S,1,0);
154  fawkes::Interface* interface = ((fawkes::Interface*) tolua_tousertype(tolua_S,2,0));
155 #ifndef TOLUA_RELEASE
156  if (!self) tolua_error(tolua_S,"invalid 'self' in function 'close'", NULL);
157 #endif
158  bool exc_caught = false;
159  try {
160  {
161  self->close(interface);
162  }
163  } catch (fawkes::Exception &e) {
164  exc_caught = true;
165  lua_pushstring(tolua_S, e.what_no_backtrace());
166  }
167  catch (std::exception &e) {
168  exc_caught = true;
169  lua_pushstring(tolua_S, e.what());
170  }
171  if (exc_caught) lua_error(tolua_S);
172 
173  }
174  return 0;
175 #ifndef TOLUA_RELEASE
176  tolua_lerror:
177  tolua_error(tolua_S,"#ferror in function 'close_generic'.",&tolua_err);
178  return 0;
179 #endif
180 }
181 #endif //#ifndef TOLUA_DISABLE
182 
183 /* method: is_alive of class fawkes::BlackBoard */
184 #ifndef TOLUA_DISABLE_tolua_fawkesblackboard_fawkes_BlackBoard_is_alive00
185 static int tolua_fawkesblackboard_fawkes_BlackBoard_is_alive00(lua_State* tolua_S)
186 {
187 #ifndef TOLUA_RELEASE
188  tolua_Error tolua_err;
189  if (
190  !tolua_isusertype(tolua_S,1,"const fawkes::BlackBoard",0,&tolua_err) ||
191  !tolua_isnoobj(tolua_S,2,&tolua_err)
192  )
193  goto tolua_lerror;
194  else
195 #endif
196  {
197  const fawkes::BlackBoard* self = (const fawkes::BlackBoard*) tolua_tousertype(tolua_S,1,0);
198 #ifndef TOLUA_RELEASE
199  if (!self) tolua_error(tolua_S,"invalid 'self' in function 'is_alive'", NULL);
200 #endif
201  bool exc_caught = false;
202  try {
203  {
204  bool tolua_ret = (bool) self->is_alive();
205  tolua_pushboolean(tolua_S,(bool)tolua_ret);
206  }
207  } catch (fawkes::Exception &e) {
208  exc_caught = true;
209  lua_pushstring(tolua_S, e.what_no_backtrace());
210  }
211  catch (std::exception &e) {
212  exc_caught = true;
213  lua_pushstring(tolua_S, e.what());
214  }
215  if (exc_caught) lua_error(tolua_S);
216 
217  }
218  return 1;
219 #ifndef TOLUA_RELEASE
220  tolua_lerror:
221  tolua_error(tolua_S,"#ferror in function 'is_alive'.",&tolua_err);
222  return 0;
223 #endif
224 }
225 #endif //#ifndef TOLUA_DISABLE
226 
227 /* method: try_aliveness_restore of class fawkes::BlackBoard */
228 #ifndef TOLUA_DISABLE_tolua_fawkesblackboard_fawkes_BlackBoard_try_aliveness_restore00
229 static int tolua_fawkesblackboard_fawkes_BlackBoard_try_aliveness_restore00(lua_State* tolua_S)
230 {
231 #ifndef TOLUA_RELEASE
232  tolua_Error tolua_err;
233  if (
234  !tolua_isusertype(tolua_S,1,"fawkes::BlackBoard",0,&tolua_err) ||
235  !tolua_isnoobj(tolua_S,2,&tolua_err)
236  )
237  goto tolua_lerror;
238  else
239 #endif
240  {
241  fawkes::BlackBoard* self = (fawkes::BlackBoard*) tolua_tousertype(tolua_S,1,0);
242 #ifndef TOLUA_RELEASE
243  if (!self) tolua_error(tolua_S,"invalid 'self' in function 'try_aliveness_restore'", NULL);
244 #endif
245  bool exc_caught = false;
246  try {
247  {
248  bool tolua_ret = (bool) self->try_aliveness_restore();
249  tolua_pushboolean(tolua_S,(bool)tolua_ret);
250  }
251  } catch (fawkes::Exception &e) {
252  exc_caught = true;
253  lua_pushstring(tolua_S, e.what_no_backtrace());
254  }
255  catch (std::exception &e) {
256  exc_caught = true;
257  lua_pushstring(tolua_S, e.what());
258  }
259  if (exc_caught) lua_error(tolua_S);
260 
261  }
262  return 1;
263 #ifndef TOLUA_RELEASE
264  tolua_lerror:
265  tolua_error(tolua_S,"#ferror in function 'try_aliveness_restore'.",&tolua_err);
266  return 0;
267 #endif
268 }
269 #endif //#ifndef TOLUA_DISABLE
270 
271 /* Open function */
272 TOLUA_API int tolua_fawkesblackboard_open (lua_State* tolua_S)
273 {
274  tolua_open(tolua_S);
275  tolua_reg_types(tolua_S);
276  tolua_module(tolua_S,NULL,0);
277  tolua_beginmodule(tolua_S,NULL);
278  tolua_module(tolua_S,"fawkes",0);
279  tolua_beginmodule(tolua_S,"fawkes");
280  tolua_cclass(tolua_S,"BlackBoard","fawkes::BlackBoard","",NULL);
281  tolua_beginmodule(tolua_S,"BlackBoard");
282  tolua_function(tolua_S,"open_for_reading_generic",tolua_fawkesblackboard_fawkes_BlackBoard_open_for_reading_generic00);
283  tolua_function(tolua_S,"open_for_writing_generic",tolua_fawkesblackboard_fawkes_BlackBoard_open_for_writing_generic00);
284  tolua_function(tolua_S,"close_generic",tolua_fawkesblackboard_fawkes_BlackBoard_close_generic00);
285  tolua_function(tolua_S,"is_alive",tolua_fawkesblackboard_fawkes_BlackBoard_is_alive00);
286  tolua_function(tolua_S,"try_aliveness_restore",tolua_fawkesblackboard_fawkes_BlackBoard_try_aliveness_restore00);
287  tolua_endmodule(tolua_S);
288 
289  { /* begin embedded lua code */
290  int top = lua_gettop(tolua_S);
291  static const unsigned char B[] = {
292  10,102,117,110, 99,116,105,111,110, 32,102, 97,119,107,101,
293  115, 46, 66,108, 97, 99,107, 66,111, 97,114,100, 58,111,112,
294  101,110, 95,102,111,114, 95,114,101, 97,100,105,110,103, 40,
295  105,110,116,101,114,102, 97, 99,101, 95,116,121,112,101, 44,
296  32,105,100,101,110,116,105,102,105,101,114, 41, 10,114,101,
297  113,117,105,114,101, 40, 34,105,110,116,101,114,102, 97, 99,
298  101,115, 46, 34, 46, 46,105,110,116,101,114,102, 97, 99,101,
299  95,116,121,112,101, 41, 10,108,111, 99, 97,108, 32,105,110,
300  116,101,114,102, 97, 99,101, 32, 61, 32,115,101,108,102, 58,
301  111,112,101,110, 95,102,111,114, 95,114,101, 97,100,105,110,
302  103, 95,103,101,110,101,114,105, 99, 40,105,110,116,101,114,
303  102, 97, 99,101, 95,116,121,112,101, 44, 32,105,100,101,110,
304  116,105,102,105,101,114, 41, 10,114,101,116,117,114,110, 32,
305  116,111,108,117, 97, 46, 99, 97,115,116, 40,105,110,116,101,
306  114,102, 97, 99,101, 44, 32, 34,102, 97,119,107,101,115, 58,
307  58, 34, 32, 46, 46, 32,105,110,116,101,114,102, 97, 99,101,
308  58,116,121,112,101, 40, 41, 41, 10,101,110,100, 10,102,117,
309  110, 99,116,105,111,110, 32,102, 97,119,107,101,115, 46, 66,
310  108, 97, 99,107, 66,111, 97,114,100, 58,111,112,101,110, 95,
311  102,111,114, 95,119,114,105,116,105,110,103, 40,105,110,116,
312  101,114,102, 97, 99,101, 95,116,121,112,101, 44, 32,105,100,
313  101,110,116,105,102,105,101,114, 41, 10,114,101,113,117,105,
314  114,101, 40, 34,105,110,116,101,114,102, 97, 99,101,115, 46,
315  34, 46, 46,105,110,116,101,114,102, 97, 99,101, 95,116,121,
316  112,101, 41, 10,108,111, 99, 97,108, 32,105,110,116,101,114,
317  102, 97, 99,101, 32, 61, 32,115,101,108,102, 58,111,112,101,
318  110, 95,102,111,114, 95,119,114,105,116,105,110,103, 95,103,
319  101,110,101,114,105, 99, 40,105,110,116,101,114,102, 97, 99,
320  101, 95,116,121,112,101, 44, 32,105,100,101,110,116,105,102,
321  105,101,114, 41, 10,114,101,116,117,114,110, 32,116,111,108,
322  117, 97, 46, 99, 97,115,116, 40,105,110,116,101,114,102, 97,
323  99,101, 44, 32, 34,102, 97,119,107,101,115, 58, 58, 34, 32,
324  46, 46, 32,105,110,116,101,114,102, 97, 99,101, 58,116,121,
325  112,101, 40, 41, 41, 10,101,110,100, 10,102,117,110, 99,116,
326  105,111,110, 32,102, 97,119,107,101,115, 46, 66,108, 97, 99,
327  107, 66,111, 97,114,100, 58, 99,108,111,115,101, 40,105,110,
328  116,101,114,102, 97, 99,101, 41, 10,108,111, 99, 97,108, 32,
329  103,101,110, 95,105,110,116,101,114,102, 97, 99,101, 32, 61,
330  32,116,111,108,117, 97, 46, 99, 97,115,116, 40,105,110,116,
331  101,114,102, 97, 99,101, 44, 32, 34,102, 97,119,107,101,115,
332  58, 58, 73,110,116,101,114,102, 97, 99,101, 34, 41, 10,115,
333  101,108,102, 58, 99,108,111,115,101, 95,103,101,110,101,114,
334  105, 99, 40,103,101,110, 95,105,110,116,101,114,102, 97, 99,
335  101, 41, 10,101,110,100, 32, 45, 45, 45, 45,32
336  };
337  tolua_dobuffer(tolua_S,(char*)B,sizeof(B),"tolua: embedded Lua code 1");
338  lua_settop(tolua_S, top);
339  } /* end of embedded lua code */
340 
341  tolua_endmodule(tolua_S);
342  tolua_endmodule(tolua_S);
343  return 1;
344 }
345 
346 
347 extern "C" {
348 #if defined(LUA_VERSION_NUM) && LUA_VERSION_NUM >= 501
349  TOLUA_API int luaopen_fawkesblackboard (lua_State* tolua_S) {
350  return tolua_fawkesblackboard_open(tolua_S);
351 };
352 #endif
353 }
354 
355 
Base class for all Fawkes BlackBoard interfaces.
Definition: interface.h:79
Base class for exceptions in Fawkes.
Definition: exception.h:36
virtual const char * what_no_backtrace() const
Get primary string (does not implicitly print the back trace).
Definition: exception.cpp:686
The BlackBoard abstract class.
Definition: blackboard.h:48