48 # define _DBG(fmt, ...) printf("%s:%d\t" fmt "\n", __FUNCTION__, __LINE__, __VA_ARGS__) 50 # define _DBG(fmt, ...) do { } while(0) 58 void*
operator new(
size_t size,
lua_State* L,
const char* mt)
61 luaL_getmetatable(L, mt);
73 #define luaM_pushobject(L, T) new(L, #T) T 74 #define luaM_pushobject_mt(L, MT, T) new(L, MT) T 77 #define luaM_checkudata(L, pos, T) reinterpret_cast<T*>(luaL_checkudata((L), (pos), #T)) 78 #define luaM_checkudata_mt(L, pos, MT, T) reinterpret_cast<T*>(luaL_checkudata((L), (pos), MT)) 81 #define luaM_testudata(L, pos, T) (T*) (luaL_testudata((L), (pos), #T)) 82 #define luaM_testudata_mt(L, pos, MT, T) (T*) (luaL_testudata((L), (pos), MT)) 89 #define luaM_checkudata_bx(L, pos, T) (T**) (luaL_checkudata((L), (pos), #T)) 90 #define luaM_checkudata_mt_bx(L, pos, MT, T) (T**) (luaL_checkudata((L), (pos), MT)) 93 #define luaM_testudata_bx(L, pos, T) (T**) (luaL_testudata((L), (pos), #T)) 94 #define luaM_testudata_mt_bx(L, pos, MT, T) (T**) (luaL_testudata((L), (pos), MT)) 97 #define gen_push_bxptr(name, MT, T) \ 98 static void name(lua_State *L, T* ptr) \ 100 T** ptrptr = (T**) lua_newuserdata(L, sizeof(T*)); \ 102 luaL_getmetatable(L, MT); \ 103 lua_setmetatable(L, -2); \ 150 for(vector<std::string>::const_iterator it = v.begin(); it != v.end(); ++it) {
167 #ifndef TYPEINFO_CACHING 168 return types::TypeInfoRepository::Instance()->type(name);
201 ti = types::TypeInfoRepository::Instance()->type(name);
347 luaL_error(L,
"Variable.tolua: can't convert type %s", dsb->getTypeName().c_str());
351 luaL_error(L,
"Variable.tolua: narrow failed for %s Variable", dsb->getTypeName().c_str());
418 varptr = parent.get();
438 memdsb = parent->getMember(mem);
476 const char *mem = luaL_checkstring(L, 2);
479 luaL_error(L,
"Variable.getMember: indexing failed, no member %s", mem);
490 const char *mem = luaL_checkstring(L, 2);
493 luaL_error(L,
"Variable.getMemberRaw: indexing failed, no member %s", mem);
509 ret =
self->update(dsb.get());
510 if (!ret) luaL_error(L,
"Variable.assign: assignment failed");
522 type = luaL_checkstring(L, 1);
524 if(!strcmp(type,
"void"))
525 luaL_error(L,
"Variable.new: can't create void variable");
527 TypeInfo* ti =
Types()->type(type);
530 luaL_error(L,
"Variable.new: unknown type %s", type);
536 #define CONVERT_TO_NUMBER(CTGT) \ 538 if (luatype == LUA_TNUMBER) x = lua_tonumber(L, valind); \ 539 else goto out_conv_err; \ 540 AssignableDataSource<CTGT> *ads = ValueDataSource<CTGT>::narrow(dsb.get()); \ 541 if (ads == NULL) luaL_error(L, "Variable_fromlua: failed to narrow target dsb to %s.", #CTGT ); \ 550 luaL_checkany(L, valind);
564 luaL_error(L,
"Variable_fromlua: failed to narrow target dsb to bool");
585 else goto out_conv_err;
587 if (ads == NULL) luaL_error(L,
"Variable_fromlua: failed to narrow target dsb to char");
588 ads->
set((
char) x[0]);
593 else goto out_conv_err;
595 if (ads == NULL) luaL_error(L,
"Variable_fromlua: failed to narrow target dsb to std::string");
596 ads->
set((std::string) x);
606 luaL_error(L,
"__lua_todsb: can't convert lua %s to %s variable",
627 if(!ti) luaL_error(L,
"Variable_fromlua: %s is not a known type. Load typekit?", type);
635 luaL_checkany(L, valind);
636 const char* type = luaL_checkstring(L, typeind);
650 luaL_error(L,
"Variable.new: invalid number of args");
687 size = luaL_checknumber(L, 2);
688 const TypeInfo *ti = (*dsbp)->getTypeInfo();
708 #define gen_opmet(name, op) \ 709 static int name(lua_State *L) \ 711 DataSourceBase::shared_ptr arg1 = *(luaM_checkudata_mt(L, 1, "Variable", DataSourceBase::shared_ptr)); \ 712 DataSourceBase::shared_ptr arg2 = *(luaM_checkudata_mt(L, 2, "Variable", DataSourceBase::shared_ptr)); \ 713 types::OperatorRepository::shared_ptr opreg = types::OperatorRepository::Instance(); \ 714 DataSourceBase *res = opreg->applyBinary(#op, arg1.get(), arg2.get()); \ 716 luaL_error(L , "%s (operator %s) failed", #name, #op); \ 718 luaM_pushobject_mt(L, "Variable", DataSourceBase::shared_ptr)(res); \ 730 #define gen_opmet_bool(name, op) \ 731 static int name(lua_State *L) \ 733 DataSourceBase::shared_ptr arg1 = *(luaM_checkudata_mt(L, 1, "Variable", DataSourceBase::shared_ptr)); \ 734 DataSourceBase::shared_ptr arg2 = *(luaM_checkudata_mt(L, 2, "Variable", DataSourceBase::shared_ptr)); \ 735 types::OperatorRepository::shared_ptr opreg = types::OperatorRepository::Instance(); \ 736 DataSourceBase *res = opreg->applyBinary(#op, arg1.get(), arg2.get()); \ 738 luaL_error(L , "%s (operator %s) failed", #name, #op); \ 740 return __Variable_tolua(L, res); \ 747 static
int Variable_opBinary(
lua_State *L)
750 const char *
op = luaL_checkstring(L, 1);
755 res = opreg->applyBinary(op, arg1.get(), arg2.get());
757 luaL_error(L ,
"Variable.opBinary '%s' not applicable to args", op);
772 const char* key = luaL_checkstring(L, 2);
791 const char* mem = luaL_checkstring(L, 2);
798 luaL_error(L,
"Variable.newindex: indexing failed, no member %s", mem);
804 if(!curval->update(newval.get())) {
805 luaL_error(L,
"Variable.newindex: failed to assign %s to member %s of type %s",
806 newval->getType().c_str(), mem, curval->getType().c_str());
827 reinterpret_cast<T*
>(dsbp)->~T();
846 {
"opBinary", Variable_opBinary },
849 {
"add", Variable_add },
850 {
"sub", Variable_sub },
851 {
"mul", Variable_mul },
852 {
"div", Variable_div },
853 {
"mod", Variable_mod },
854 {
"pow", Variable_pow },
855 {
"eq", Variable_eq },
856 {
"lt", Variable_lt },
857 {
"le", Variable_le },
873 {
"opBinary", Variable_opBinary },
876 {
"__add", Variable_add },
877 {
"__sub", Variable_sub },
878 {
"__mul", Variable_mul },
879 {
"__div", Variable_div },
880 {
"__mod", Variable_mod },
881 {
"__pow", Variable_pow },
882 {
"__eq", Variable_eq },
883 {
"__lt", Variable_lt },
884 {
"__le", Variable_le },
889 {
"__gc", VariableGC<DataSourceBase::shared_ptr> },
902 const char *type, *name, *desc;
905 type = luaL_checkstring(L, 1);
908 name = (argc > 1) ? luaL_checkstring(L, 2) :
"";
909 desc = (argc > 2) ? luaL_checkstring(L, 3) :
"";
911 types::TypeInfo *ti = types::TypeInfoRepository::Instance()->type(type);
914 luaL_error(L,
"Property.new: unknown type %s", type);
917 Property_push(L, pb);
946 if(!propdsb->update(newdsb.get()))
947 luaL_error(L,
"Property.set: failed to assign type %s to type %s",
948 newdsb->getType().c_str(), propdsb->getType().c_str());
986 luaL_getmetatable(L,
"__dead__");
999 const char* key = luaL_checkstring(L, 2);
1022 {
"new", Property_new },
1051 const char *type, *name;
1054 type = luaL_checkstring(L, 1);
1057 name = (argc > 1) ? luaL_checkstring(L, 2) :
"";
1059 types::TypeInfo *ti = types::TypeInfoRepository::Instance()->type(type);
1062 luaL_error(L,
"Attribute.new: unknown type %s", type);
1065 Attribute_push(L, pb);
1094 if(!propdsb->update(newdsb.get()))
1095 luaL_error(L,
"Attribute.set: failed to assign type %s to type %s",
1096 newdsb->getType().c_str(), propdsb->getType().c_str());
1134 luaL_getmetatable(L,
"__dead__");
1147 const char* key = luaL_checkstring(L, 2);
1170 {
"new", Attribute_new },
1199 const char* port_type = NULL;
1212 luaL_error(L,
"Port.info: invalid argument, expected Port, got %s",
1243 luaL_error(L,
"Port.info: invalid argument 1, expected Port, got %s",
1253 luaL_error(L,
"Port.connect: invalid argument 2, expected Port, got %s",
1285 luaL_error(L,
"Port.info: invalid argument 1, expected Port, got %s",
1313 const char *type, *name, *desc;
1317 type = luaL_checkstring(L, 1);
1320 name = (argc > 1) ? luaL_checkstring(L, 2) :
"";
1321 desc = (argc > 2) ? luaL_checkstring(L, 3) :
"";
1323 types::TypeInfo *ti = types::TypeInfoRepository::Instance()->type(type);
1325 luaL_error(L,
"InputPort.new: unknown type %s", type);
1330 luaL_error(L,
"InputPort.new: creating port of type %s failed", type);
1333 InputPort_push(L, ipi);
1358 else luaL_error(L,
"InputPort.read: unknown FlowStatus returned");
1382 luaL_getmetatable(L,
"__dead__");
1388 {
"new", InputPort_new },
1414 const char *type, *name, *desc;
1418 type = luaL_checkstring(L, 1);
1421 name = (argc > 1) ? luaL_checkstring(L, 2) :
"";
1422 desc = (argc > 2) ? luaL_checkstring(L, 3) :
"";
1424 types::TypeInfo *ti = types::TypeInfoRepository::Instance()->type(type);
1427 luaL_error(L,
"OutputPort.new: unknown type %s", type);
1432 luaL_error(L,
"OutputPort.new: creating port of type %s failed", type);
1435 OutputPort_push(L, opi);
1473 luaL_getmetatable(L,
"__dead__");
1479 {
"new", OutputPort_new },
1514 std::vector<internal::Reference*>
args;
1519 template<
typename T>
1531 std::vector<ArgumentDescription>
args;
1543 for (std::vector<ArgumentDescription>::iterator it = args.begin(); it != args.end(); it++) {
1562 if(oh->
arity != argc-1)
1563 luaL_error(L,
"Operation.call: wrong number of args. expected %d, got %d", oh->
arity, argc-1);
1566 for(
unsigned int arg=2; arg<=argc; arg++) {
1577 if(!dsb->isAssignable())
1578 luaL_error(L,
"Operation.call: argument %d is not assignable.", arg-1);
1580 ret = oh->
args[arg-2]->setReference(dsb);
1582 luaL_error(L,
"Operation_call: setReference failed, wrong type of argument?");
1586 luaL_error(L,
"Operation.call: call failed.");
1605 if(oh->
arity != argc-1)
1606 luaL_error(L,
"Operation.send: wrong number of args. expected %d, got %d", oh->
arity, argc-1);
1609 for(
unsigned int arg=2; arg<=argc; arg++) {
1620 oh->
args[arg-2]->setReference(dsb);
1632 }
catch(
const std::exception &exc) {
1633 luaL_error(L,
"Operation.call: caught exception '%s'", exc.what());
1635 luaL_error(L,
"Operation.call: caught unknown exception");
1645 }
catch(
const std::exception &exc) {
1646 luaL_error(L,
"Operation.send: caught exception '%s'", exc.what());
1648 luaL_error(L,
"Operation.send: caught unknown exception");
1666 {
"__gc", OperationGC<OperationHandle> },
1690 doc = luaL_checkstring(L, 2);
1717 const char* op = luaL_checkstring(L, 2);
1718 ret = srv->hasOperation(op);
1733 const char* subsrv_str;
1745 for(i=2; i<=argc; i++) {
1746 subsrv_str = luaL_checkstring(L, i);
1747 subsrv = srv->getService(subsrv_str);
1749 luaL_error(L,
"Service.provides: no subservice %s of service %s",
1750 subsrv_str, srv->getName().c_str() );
1765 const char *op = luaL_checkstring(L, 2);
1766 std::vector<ArgumentDescription>
args;
1769 luaL_error(L,
"Service.getOperationInfo failed: no such operation");
1779 for (std::vector<ArgumentDescription>::iterator it = args.begin(); it != args.end(); it++) {
1801 op_str = luaL_checkstring(L, 2);
1802 oip = srv->getOperation(op_str);
1805 luaL_error(L,
"Service_getOperation: service %s has no operation %s",
1806 srv->getName().c_str(), op_str);
1811 oh->args.reserve(oh->arity);
1819 for(
unsigned int arg=1; arg <= oh->arity; arg++) {
1821 ti = types::TypeInfoRepository::Instance()->type(type);
1823 luaL_error(L,
"Operation.call: '%s', failed to locate TypeInfo for arg %d of type '%s'",
1824 op_str, arg, type.c_str());
1828 luaL_error(L,
"Operation.call: '%s', failed to build DSB for arg %d of type '%s'",
1829 op_str, arg, type.c_str());
1831 oh->args.push_back(dynamic_cast<internal::Reference*>(dsb.get()));
1839 luaL_error(L,
"Operation.call: '%s', failed to locate TypeInfo for return value of type '%s'",
1843 luaL_error(L,
"Operation.call: '%s', failed to build DSB for return value of type '%s'",
1846 oh->occ->ret(oh->ret_dsb);
1852 if(!oh->occ->ready())
1853 luaL_error(L,
"Service.getOperation: OperationCallerC not ready!");
1868 name = luaL_checkstring(L, 2);
1870 pi = srv->getPort(name);
1872 luaL_error(L,
"Service.getPort: service %s has no port %",
1873 srv->getName().c_str(), name);
1876 if ((ipi = dynamic_cast<InputPortInterface *> (pi)) != NULL)
1877 InputPort_push(L, ipi);
1878 else if ((opi = dynamic_cast<OutputPortInterface *> (pi)) != NULL)
1879 OutputPort_push(L, opi);
1881 luaL_error(L,
"Service.getPort: unknown port type returned");
1892 name = luaL_checkstring(L, 2);
1894 prop = srv->getProperty(name);
1897 luaL_error(L,
"%s failed. No such property", __FILE__);
1899 Property_push(L, prop);
1907 std::vector<std::string> plist = srv->properties()->list();
1916 vector<PropertyBase*> props = srv->properties()->getProperties();
1920 for(vector<PropertyBase*>::iterator it = props.begin(); it != props.end(); ++it) {
1921 Property_push(L, *it);
1934 name = luaL_checkstring(L, 2);
1936 prop = srv->getAttribute(name);
1939 luaL_error(L,
"%s failed. No such Attribute", __FILE__);
1941 Attribute_push(L, prop);
1949 std::vector<std::string> plist = srv->getAttributeNames();
1958 vector<AttributeBase*> props = srv->getValues();
1962 for(vector<AttributeBase*>::iterator it = props.begin(); it != props.end(); ++it) {
1963 Attribute_push(L, *it);
2007 {
"__gc", GCMethod<Service::shared_ptr> },
2017 static
int ServiceRequester_getRequestName(
lua_State *L)
2055 const char* subsr_str;
2068 for(i=2; i<=argc; i++) {
2069 subsr_str = luaL_checkstring(L, i);
2072 luaL_error(L,
"ServiceRequester: no required subservice %s of service %s",
2075 ServiceRequester_push(L, subsr.get());
2084 {
"getRequestName", ServiceRequester_getRequestName },
2093 {
"getRequestName", ServiceRequester_getRequestName },
2108 static
int TaskContext_getName(
lua_State *L)
2120 bool b = tc->
start();
2128 bool b = tc->
stop();
2176 ts = (*tc)->getTaskState();
2180 case TaskCore::PreOperational:
lua_pushstring(L,
"PreOperational");
break;
2181 case TaskCore::FatalError:
lua_pushstring(L,
"FatalError");
break;
2185 case TaskCore::RunTimeError:
lua_pushstring(L,
"RunTimeError");
break;
2196 std::vector<std::string> plist = tc->
getPeerList();
2228 peer = luaL_checkstring(L, 2);
2229 self->removePeer(peer);
2236 std::string strpeer;
2239 strpeer = luaL_checkstring(L, 2);
2240 peer =
self->
getPeer(strpeer);
2243 luaL_error(L,
"TaskContext.getPeer: no peer %s", strpeer.c_str());
2247 TaskContext_push(L, peer);
2262 const char* name, *desc;
2268 if(pi)
goto check_name;
2271 if(pi)
goto check_name;
2273 return luaL_error(L,
"addPort: invalid argument, not a Port");
2277 name = luaL_checkstring(L, 3);
2278 (*pi)->setName(name);
2282 desc = luaL_checkstring(L, 4);
2292 const char* name, *desc;
2298 return luaL_error(L,
"addEventPort: invalid argument, not an InputPort");
2301 name = luaL_checkstring(L, 3);
2302 (*ipi)->setName(name);
2306 desc = luaL_checkstring(L, 4);
2322 name = luaL_checkstring(L, 2);
2326 luaL_error(L,
"TaskContext.getPort: no port %s for taskcontext %s",
2330 if ((ipi = dynamic_cast<InputPortInterface *> (pi)) != NULL)
2331 InputPort_push(L, ipi);
2332 else if ((opi = dynamic_cast<OutputPortInterface *> (pi)) != NULL)
2333 OutputPort_push(L, opi);
2335 luaL_error(L,
"TaskContext.getPort: unknown port returned");
2343 const char *port = luaL_checkstring(L, 2);
2350 const char *name, *desc;
2356 name = luaL_checkstring(L, 3);
2361 desc = luaL_checkstring(L, 4);
2367 luaL_error(L,
"TaskContext.addProperty: failed to add property %s.",
2379 name = luaL_checkstring(L, 2);
2384 luaL_error(L,
"%s failed. No such property", __FILE__);
2386 Property_push(L, prop);
2406 for(vector<PropertyBase*>::iterator it = props.begin(); it != props.end(); ++it) {
2407 Property_push(L, *it);
2420 name = luaL_checkstring(L, 2);
2425 luaL_error(L,
"%s failed. No such property", __FILE__);
2438 const char *name = luaL_checkstring(L, 3);
2443 luaL_error(L,
"TaskContext.addAttribute: failed to add attribute %s.",
2455 name = luaL_checkstring(L, 2);
2460 luaL_error(L,
"%s failed. No such Attribute", __FILE__);
2462 Attribute_push(L, prop);
2482 for(vector<AttributeBase*>::iterator it = props.begin(); it != props.end(); ++it) {
2483 Attribute_push(L, *it);
2493 const char *name = luaL_checkstring(L, 2);
2496 luaL_error(L,
"%s failed. No such attribute", __FILE__);
2516 const char *op = luaL_checkstring(L, 2);
2517 std::vector<ArgumentDescription>
args;
2520 luaL_error(L,
"TaskContext.getOpInfo failed: no such operation");
2530 for (std::vector<ArgumentDescription>::iterator it = args.begin(); it != args.end(); it++) {
2547 luaL_error(L,
"TaskContext.provides: no default service");
2570 luaL_error(L,
"TaskContext.requires returned NULL");
2572 ServiceRequester_push(L, sr.get());
2593 luaL_error(L,
"TaskContext.provides: no default service");
2608 luaL_error(L,
"TaskContext.getOperation: no default service");
2632 unsigned int coll_argc;
2633 std::vector<DataSourceBase::shared_ptr> coll_args;
2646 if(block && (argc == 1)) {
2648 for(
unsigned int i=1; i<=coll_argc; i++) {
2651 coll_args.push_back(dsb);
2654 }
else if (argc-1 == coll_argc) {
2656 if (!shc->
ready()) {
2657 for(
unsigned int arg=2; arg<=argc; arg++) {
2661 luaL_error(L,
"SendHandle.collect: expected Variable argument at position %d", arg-1);
2667 luaL_error(L,
"SendHandle.collect: wrong number of args. expected either 0 or %d, got %d",
2670 luaL_error(L,
"SendHandle.collectIfDone: wrong number of args. expected %d, got %d",
2675 if(block) ss = shc->
collect();
2681 for (
unsigned int i=0; i<coll_args.size(); i++)
2685 return coll_args.size() + 1;
2705 {
"__gc", GCMethod<SendHandleC> },
2716 luaL_getmetatable(L,
"__dead__");
2722 {
"getName", TaskContext_getName },
2763 {
"getName", TaskContext_getName },
2828 func = luaL_checkstring(L, 1);
2876 "Never",
"Fatal",
"Critical",
"Error",
"Warning",
"Info",
"Debug",
"RealTime", NULL
2882 log().setLogLevel(ll);
2909 mes = luaL_checkstring(L, i);
2910 Logger::log() << mes;
2912 Logger::log() << endlog();
2921 mes = luaL_checkstring(L, i);
2922 Logger::log(ll) << mes;
2924 Logger::log(ll) << endlog();
2932 unsigned long nsec, sec;
2934 sec = total_nsec / 1000000000;
2935 nsec = total_nsec % 1000000000;
2944 ts.tv_sec = luaL_checknumber(L, 1);
2945 ts.tv_nsec = luaL_checknumber(L, 2);
2969 GlobalsRepository::shared_ptr gr = GlobalsRepository::Instance();
2976 GlobalsRepository::shared_ptr gr = GlobalsRepository::Instance();
2987 name = luaL_checkstring(L, 1);
2988 GlobalsRepository::shared_ptr gr = GlobalsRepository::Instance();
2990 ab = gr->getAttribute(name);
3027 push_vect_str(L, TypeInfoRepository::Instance()->getTypes());
3031 static const struct luaL_Reg
rtt_f [] = {
3056 luaL_newmetatable(L,
"__dead__");
3066 luaL_newmetatable(L,
"TaskContext");
3069 luaL_register(L, NULL, TaskContext_m);
3070 luaL_register(L,
"rtt.TaskContext", TaskContext_f);
3072 luaL_newmetatable(L,
"Operation");
3075 luaL_register(L, NULL, Operation_m);
3076 luaL_register(L,
"rtt.Operation", Operation_f);
3078 luaL_newmetatable(L,
"Service");
3081 luaL_register(L, NULL, Service_m);
3082 luaL_register(L,
"rtt.Service", Service_f);
3084 luaL_newmetatable(L,
"ServiceRequester");
3087 luaL_register(L, NULL, ServiceRequester_m);
3088 luaL_register(L,
"rtt.ServiceRequester", ServiceRequester_f);
3090 luaL_newmetatable(L,
"SendHandle");
3093 luaL_register(L, NULL, SendHandle_m);
3094 luaL_register(L,
"rtt.SendHandle", SendHandle_f);
3096 luaL_newmetatable(L,
"InputPort");
3099 luaL_register(L, NULL, InputPort_m);
3100 luaL_register(L,
"rtt.InputPort", InputPort_f);
3102 luaL_newmetatable(L,
"OutputPort");
3105 luaL_register(L, NULL, OutputPort_m);
3106 luaL_register(L,
"rtt.OutputPort", OutputPort_f);
3108 luaL_newmetatable(L,
"Variable");
3111 luaL_register(L, NULL, Variable_m);
3112 luaL_register(L,
"rtt.Variable", Variable_f);
3114 luaL_newmetatable(L,
"Property");
3117 luaL_register(L, NULL, Property_m);
3118 luaL_register(L,
"rtt.Property", Property_f);
3120 luaL_newmetatable(L,
"Attribute");
3123 luaL_register(L, NULL, Attribute_m);
3124 luaL_register(L,
"rtt.Attribute", Attribute_f);
3126 luaL_newmetatable(L,
"EEHook");
3129 luaL_register(L, NULL, EEHook_m);
3130 luaL_register(L,
"rtt.EEHook", EEHook_f);
3133 luaL_register(L,
"rtt", rtt_f);
3145 luaL_getmetatable(L,
"TaskContext");
3155 int require_function,
int require_result)
3158 int num_res = (require_result != 0) ? 1 : 0;
3163 if(require_function)
3164 luaL_error(L,
"%s: no (required) Lua function %s", tc->
getName().c_str(), fname);
3170 Logger::log(Logger::Error) <<
"LuaComponent '"<< tc->
getName() <<
"': error calling function " 3177 if(require_result) {
3179 Logger::log(Logger::Error) <<
"LuaComponent '" << tc->
getName() <<
"': " << fname
3180 <<
" must return a bool but returned a "
bool hasAttribute(const std::string &name) const
LUA_API int() lua_pcall(lua_State *L, int nargs, int nresults, int errfunc)
LUA_API int() lua_getmetatable(lua_State *L, int objindex)
static int TaskContext_removeProperty(lua_State *L)
Variable opBinary s not applicable to args
static int Logger_logl(lua_State *L)
base::PortInterface & addPort(const std::string &name, base::PortInterface &port)
LUA_API void() lua_replace(lua_State *L, int idx)
static int globals_getProperties(lua_State *L)
LUA_API const char *() lua_typename(lua_State *L, int tp)
Property< T > & addProperty(const std::string &name, T &attr)
LUA_API void() lua_setfield(lua_State *L, int idx, const char *k)
void remove(base::PropertyBase *p)
base::DataSourceBase::shared_ptr buildReference(void *ptr) const
LUA_API void() lua_pushstring(lua_State *L, const char *s)
static TaskContext * __getTC(lua_State *)
virtual result_t get() const =0
static int Service_doc(lua_State *L)
virtual const types::TypeInfo * getTypeInfo() const =0
static int Variable_resize(lua_State *L)
static int Variable_getTypeName(lua_State *L)
static void Variable_fromlua(lua_State *L, DataSourceBase::shared_ptr &dsb, int valind)
static int Service_getOperationInfo(lua_State *L)
static const struct luaL_Reg OutputPort_m[]
LUA_API void() lua_pushinteger(lua_State *L, lua_Integer n)
LUA_API void() lua_pushvalue(lua_State *L, int idx)
base::DataSourceBase::shared_ptr ret_dsb
static int TaskContext_provides(lua_State *L)
virtual bool isLocal() const
static int TaskContext_removeAttribute(lua_State *L)
#define gen_opmet_bool(name, op)
static const struct luaL_Reg SendHandle_f[]
static int Variable_tolua(lua_State *L)
RequesterNames getRequesterNames() const
static int ServiceRequester_ready(lua_State *L)
static int TaskContext_removePort(lua_State *L)
LUA_API void *() lua_newuserdata(lua_State *L, size_t sz)
base::PortInterface * getPort(const std::string &name) const
OperationInterfacePart * oip
base::AttributeBase * buildAttribute(std::string name, base::DataSourceBase::shared_ptr source=0) const
static int Operation_send(lua_State *L)
OperationInterfacePart * getOrp()
static const struct luaL_Reg OutputPort_f[]
Service::shared_ptr provides()
static const struct luaL_Reg ServiceRequester_f[]
virtual const types::TypeInfo * getArgumentType(unsigned int arg) const =0
static int Service_getPort(lua_State *L)
virtual bool removeFunction(base::ExecutableInterface *f)
static int rtt_types(lua_State *L)
const std::string & getTypeName() const
static int Variable_unm(lua_State *L)
static int Variable_getType(lua_State *L)
static int SendHandle_collect(lua_State *L)
void push_vect_str(lua_State *L, const std::vector< std::string > &v)
ConfigurationInterface * attributes()
static int __Operation_send(lua_State *L)
static int TaskContext_removePeer(lua_State *L)
virtual bool ready() const
static int TaskContext_activate(lua_State *L)
static int Operation_info(lua_State *L)
#define lua_tostring(L, i)
LUA_API void() lua_pushlightuserdata(lua_State *L, void *p)
int rtos_nanosleep(const TIME_SPEC *rqtp, TIME_SPEC *rmtp)
PortNames getPortNames() const
static void SendStatus_push(lua_State *L, SendStatus ss)
static int Variable_tolightuserdata(lua_State *L)
static int Attribute_getRaw(lua_State *L)
std::string getDescription(const std::string &name) const
static int Port_info(lua_State *L)
static const struct luaL_Reg TaskContext_m[]
LUA_API void() lua_insert(lua_State *L, int idx)
Variable opBinary s not applicable to op
virtual void set(param_t t)=0
static int Service_getPropertyNames(lua_State *L)
LUA_API int() lua_type(lua_State *L, int idx)
static int TaskContext_requires(lua_State *L)
const std::string & getRequestName() const
virtual const types::TypeInfo * getCollectType(unsigned int arg) const =0
OperationInterface * operations()
boost::shared_ptr< ServiceRequester > shared_ptr
const std::string & getName() const
static int Attribute_index(lua_State *L)
static int Port_disconnect(lua_State *L)
virtual bool connectPeers(TaskContext *peer)
LUA_API int() lua_rawequal(lua_State *L, int idx1, int idx2)
#define luaM_pushobject(L, T)
virtual void disconnect()
LUA_API int() lua_toboolean(lua_State *L, int idx)
static int TaskContext_addPort(lua_State *L)
static int __Variable_tolua(lua_State *L, DataSourceBase::shared_ptr dsb)
static const struct luaL_Reg rtt_f[]
static int Variable_newindex(lua_State *L)
static const struct luaL_Reg EEHook_f[]
static int Property_getRaw(lua_State *L)
void list(Names &names) const
virtual std::string getName() const =0
int set_context_tc(TaskContext *tc, lua_State *L)
static int Logger_log(lua_State *L)
static const struct luaL_Reg Operation_m[]
virtual DataSourceBase::shared_ptr getDataSource() const =0
int OperationGC(lua_State *L)
boost::shared_ptr< OperatorRepository > shared_ptr
static int Attribute_del(lua_State *L)
bool hasMember(const std::string &name) const
virtual std::string description() const =0
virtual WriteStatus write(DataSourceBase::shared_ptr source)
LUA_API void() lua_rawset(lua_State *L, int idx)
static int rtt_services(lua_State *L)
base::InputPortInterface & addEventPort(const std::string &name, base::InputPortInterface &port, SlotFunction callback=SlotFunction())
void removeAttribute(const std::string &name)
static int Service_getPortNames(lua_State *L)
LUA_API void() lua_rawget(lua_State *L, int idx)
static const char *const loglevels[]
static int Variable_index(lua_State *L)
static int TaskContext_recover(lua_State *L)
static int TaskContext_getAttribute(lua_State *L)
virtual TaskContext * getPeer(const std::string &peer_name) const
static DataSourceBase::shared_ptr lookup_member(lua_State *L, DataSourceBase::shared_ptr parent, const char *mem)
static int TaskContext_getProperties(lua_State *L)
boost::shared_ptr< Service > shared_ptr
virtual unsigned int arity() const =0
static const TypeInfo * ti_lookup(lua_State *L, const char *name)
static int Variable_getMemberRaw(lua_State *L)
static int Variable_create_ival(lua_State *L, int typeind, int valind)
SendHandleC & arg(base::DataSourceBase::shared_ptr a)
LUA_API void() lua_pushnumber(lua_State *L, lua_Number n)
ServiceRequester::shared_ptr requires()
virtual bool evaluate() const =0
LUA_API int() lua_setmetatable(lua_State *L, int objindex)
static int TaskContext_getOperation(lua_State *L)
static int Variable_update(lua_State *L)
static int ServiceRequester_disconnect(lua_State *L)
virtual void disconnect()=0
static int TaskContext_addAttribute(lua_State *L)
static int TaskContext_getState(lua_State *L)
static int TaskContext_getAttributes(lua_State *L)
int luaopen_rtt(lua_State *L)
static int Variable_toString(lua_State *L)
void * luaL_testudata(lua_State *L, int ud, const char *tname)
base::DataSourceBase::shared_ptr call_dsb
static int globals_getNames(lua_State *L)
static int Property_newindex(lua_State *L)
EEHook(lua_State *_L, std::string _func)
DataFlowInterface * ports()
static int SendHandle_collectIfDone(lua_State *L)
static int ServiceRequester_requires(lua_State *L)
#define gen_opmet(name, op)
static int Service_provides(lua_State *L)
AttributeObjects const & getValues() const
static int Variable_isbasic(lua_State *L)
static const struct luaL_Reg InputPort_f[]
LUA_API void() lua_createtable(lua_State *L, int narr, int nrec)
static int OutputPort_write(lua_State *L)
virtual PeerList getPeerList() const
static int EEHook_enable(lua_State *L)
static const struct luaL_Reg Service_m[]
static int TaskContext_getPort(lua_State *L)
static int TaskContext_getPeer(lua_State *L)
struct lua_State lua_State
std::vector< internal::Reference * > args
void removePort(const std::string &name)
LUA_API void() lua_pushboolean(lua_State *L, int b)
#define luaM_checkudata_bx(L, pos, T)
static int TaskContext_start(lua_State *L)
static int Variable_getMemberNames(lua_State *L)
#define lua_getglobal(L, s)
static const struct luaL_Reg InputPort_m[]
const std::string & getDescription() const
int getArity(const std::string &name) const
static int Property_set(lua_State *L)
ServiceRequester::shared_ptr requires()
virtual std::string getType() const =0
base::AttributeBase * getAttribute(const std::string &name) const
#define luaM_checkudata_mt(L, pos, MT, T)
static int TaskContext_addProperty(lua_State *L)
SendStatus collectIfDone()
static const struct luaL_Reg TaskContext_f[]
static const struct luaL_Reg Variable_f[]
#define CONVERT_TO_NUMBER(CTGT)
#define luaM_testudata_mt(L, pos, MT, T)
static int Variable_getTypes(lua_State *L)
static const struct luaL_Reg Attribute_f[]
static int Logger_getLogLevel(lua_State *L)
static const struct luaL_Reg EEHook_m[]
const std::string & getDescription() const
static int Logger_setLogLevel(lua_State *L)
static int Service_getAttributes(lua_State *L)
static int getTC(lua_State *L)
static int TaskContext_error(lua_State *L)
std::vector< base::DataSourceBase::shared_ptr > dsb_store
base::PropertyBase * buildProperty(const std::string &name, const std::string &desc, base::DataSourceBase::shared_ptr source=0) const
static const struct luaL_Reg Property_f[]
bool addAttribute(const std::string &name, T &attr)
#define luaM_checkudata(L, pos, T)
Properties & getProperties()
static int Service_getOperation(lua_State *L)
TypeInfoRepository::shared_ptr Types()
LUA_API void() lua_rawseti(lua_State *L, int idx, int n)
static int ServiceRequester_getRequesterNames(lua_State *L)
static int Variable_new(lua_State *L)
static int Property_info(lua_State *L)
void setName(const std::string &name)
LUA_API void() lua_getfield(lua_State *L, int idx, const char *k)
virtual std::string resultType() const =0
static const struct luaL_Reg ServiceRequester_m[]
bool call_func(lua_State *L, const char *fname, TaskContext *tc, int require_function, int require_result)
static int OutputPort_del(lua_State *L)
static void Variable_coerce(lua_State *L, DataSourceBase::shared_ptr dsb)
static int TaskContext_connectServices(lua_State *L)
static int TaskContext_getPropertyNames(lua_State *L)
#define luaM_pushobject_mt(L, MT, T)
static int provides_global(lua_State *L)
static int EEHook_new(lua_State *L)
virtual std::vector< ArgumentDescription > getArgumentList() const =0
static int TaskContext_del(lua_State *L)
static const struct luaL_Reg Service_f[]
static int getTime(lua_State *L)
static int Service_getName(lua_State *L)
static const struct luaL_Reg Property_m[]
#define luaM_checkudata_mt_bx(L, pos, MT, T)
PropertyBag * properties()
static int InputPort_read(lua_State *L)
LUA_API int() lua_gettop(lua_State *L)
static int Service_getProperty(lua_State *L)
std::vector< std::string > getNames() const
static int Service_getOperationNames(lua_State *L)
static int Variable_getTypeIdName(lua_State *L)
virtual unsigned int collectArity() const =0
static int Service_getProviderNames(lua_State *L)
static int TaskContext_getOperationInfo(lua_State *L)
static int Property_del(lua_State *L)
int GCMethod(lua_State *L)
Descriptions getArgumentList(const std::string &name) const
base::PropertyBase * getProperty(const std::string &name) const
base::OutputPortInterface * outputPort(std::string const &name) const
static const struct luaL_Reg Variable_m[]
static int Port_connect(lua_State *L)
static int TaskContext_getProperty(lua_State *L)
AttributeNames getAttributeNames() const
base::DataSourceBase::shared_ptr buildValue() const
static int Service_getAttribute(lua_State *L)
virtual bool connectTo(PortInterface *other, ConnPolicy const &policy)=0
static int TaskContext_connectPeers(lua_State *L)
static int Attribute_newindex(lua_State *L)
static int rtt_sleep(lua_State *L)
const std::string & getName() const
static int TaskContext_addEventPort(lua_State *L)
static void Variable_push_coerce(lua_State *L, DataSourceBase::shared_ptr dsb)
LUA_API void *() lua_touserdata(lua_State *L, int idx)
static int __SendHandle_collect(lua_State *L, bool block)
static bool __typenames_cmp(lua_State *L, const types::TypeInfo *ti1, const char *type2)
static int EEHook_disable(lua_State *L)
static int rtt_typekits(lua_State *L)
static int TaskContext_getProviderNames(lua_State *L)
static int Service_getProperties(lua_State *L)
LUA_API void() lua_pushnil(lua_State *L)
LUA_API void() lua_pushlstring(lua_State *L, const char *s, size_t l)
static int InputPort_del(lua_State *L)
LUA_API const char *() lua_tolstring(lua_State *L, int idx, size_t *len)
int VariableGC(lua_State *L)
static int Property_get(lua_State *L)
static const struct luaL_Reg Operation_f[]
boost::intrusive_ptr< DataSourceBase > shared_ptr
virtual bool connectServices(TaskContext *peer)
static int Variable_create(lua_State *L)
const std::string & getName() const
static int TaskContext_configure(lua_State *L)
PortInterface & doc(const std::string &desc)
static int Property_index(lua_State *L)
static int Service_getAttributeNames(lua_State *L)
static int Attribute_info(lua_State *L)
virtual bool connected() const =0
static const struct luaL_Reg SendHandle_m[]
static int Attribute_set(lua_State *L)
static int globals_get(lua_State *L)
virtual bool runFunction(base::ExecutableInterface *f)
#define gen_push_bxptr(name, MT, T)
#define LUA_REGISTRYINDEX
static int Variable_getMember(lua_State *L)
LUA_API void() lua_settop(lua_State *L, int idx)
struct timespec TIME_SPEC
static int Operation_call(lua_State *L)
static int Service_hasOperation(lua_State *L)
static bool __Variable_isbasic(lua_State *L, DataSourceBase::shared_ptr &dsb)
LUA_API lua_Number() lua_tonumber(lua_State *L, int idx)
static int TaskContext_hasOperation(lua_State *L)
#define LUA_TLIGHTUSERDATA
static int TaskContext_cleanup(lua_State *L)
std::string getResultType(const std::string &name) const
base::InputPortInterface * inputPort(std::string const &name) const
static int __Operation_call(lua_State *L)
const ExecutionEngine * engine() const
static int TaskContext_getPeers(lua_State *L)
static bool Variable_is_a(lua_State *L, const types::TypeInfo *ti1, const char *type)
static int TaskContext_getOps(lua_State *L)
virtual bool addPeer(TaskContext *peer, std::string alias="")
virtual const std::string & getName() const
static int TaskContext_getAttributeNames(lua_State *L)
#define lua_isboolean(L, n)
virtual DataSourceBase::shared_ptr getDataSource() const =0
void setName(std::string const &new_name)
static int TaskContext_stop(lua_State *L)
static int Attribute_get(lua_State *L)
static void cache_clear(lua_State *L, DataSourceBase *varptr)
static int TaskContext_addPeer(lua_State *L)
void setDescription(const std::string &desc)
static int TaskContext_getPortNames(lua_State *L)
static const struct luaL_Reg Attribute_m[]