#include "sistemaautonomo.h"\r
#include "slBrevePluginAPI.h"\r
+\r
+#ifdef DEBUG\r
#include <iostream>\r
+#endif // DEBUG\r
\r
/////////////////////////// CTeoria /////////////////////////\r
\r
int SAbrTeoriaSetDatoInicial(brEval args[], brEval* result, void* data)\r
{\r
CTeoria* t = (CTeoria*) BRPOINTER(args);\r
- t->datos_iniciales.set_val(BRSTRING(args+1), BRINT(args+2));\r
+ t->datos_iniciales.set_val(BRSTRING(args+1), BRDOUBLE(args+2));\r
return EC_OK;\r
}\r
\r
int SAbrTeoriaSetDatoFinal(brEval args[], brEval* result, void* data)\r
{\r
CTeoria* t = (CTeoria*) BRPOINTER(args);\r
- t->datos_finales.set_val(BRSTRING(args+1), BRINT(args+2));\r
+ t->datos_finales.set_val(BRSTRING(args+1), BRDOUBLE(args+2));\r
return EC_OK;\r
}\r
\r
// string TeoriaGetAccion(pointer{Teoria})\r
int SAbrTeoriaGetAccion(brEval args[], brEval* result, void* data)\r
{\r
- // TODO CTeoria* t = (CTeoria*) BRPOINTER(args);\r
- // TODO result->set(t->accion.c_str());\r
- result->set("avanzar"); // FIXME\r
- return EC_OK;\r
-}\r
-\r
-// void TeoriaDelete(pointer{Teoria})\r
-int SAbrTeoriaDelete(brEval args[], brEval* result, void* data)\r
-{\r
- delete (CTeoria*) BRPOINTER(args);\r
+ CTeoria* t = (CTeoria*) BRPOINTER(args);\r
+ result->set(t->funcion.c_str());\r
return EC_OK;\r
}\r
\r
\r
/////////////////////////// CSistemaAutonomo /////////////////////////\r
\r
-// pointer{SistemaAutonomo} SistemaAutonomoNew()\r
+// pointer{SistemaAutonomo} SistemaAutonomoNew(int, int)\r
int SAbrSistemaAutonomoNew(brEval args[], brEval* result, void* data)\r
{\r
- result->set(new CSistemaAutonomo());\r
+ result->set(new CSistemaAutonomo(BRINT(args), BRINT(args+1)));\r
return EC_OK;\r
}\r
\r
{\r
CSistemaAutonomo* sa = (CSistemaAutonomo*) BRPOINTER(args);\r
CTeoria* t = (CTeoria*) BRPOINTER(args+1);\r
- sa->teorias.add(t->nombre.c_str(), *t);\r
+ sa->teorias.add(t->nombre, t);\r
+#ifdef DEBUG\r
+ std::cout << "Agrega teoria " << *t << ":\n";\r
+ std::cout << "\tdatos_iniciales:\n" << t->datos_iniciales << "\n";\r
+ std::cout << "\tdatos_finales:\n" << t->datos_finales << "\n";\r
+#endif // DEBUG\r
+#ifdef LOG\r
+ std::cout << "Agrega teoria: " << *t << "," << t->datos_iniciales << "," << t->datos_finales << "\n";\r
+#endif // LOG\r
return EC_OK;\r
}\r
\r
AT_STRING, AT_POINTER, 0);\r
brNewBreveCall(data, "TeoriaGetAccion", SAbrTeoriaGetAccion,\r
AT_STRING, AT_POINTER, 0);\r
- brNewBreveCall(data, "TeoriaDelete", SAbrTeoriaDelete,\r
- AT_NULL, AT_POINTER, 0);\r
brNewBreveCall(data, "SistemaAutonomoNew", SAbrSistemaAutonomoNew,\r
- AT_POINTER, 0);\r
+ AT_POINTER, AT_INT, AT_INT, 0);\r
brNewBreveCall(data, "SistemaAutonomoAddTeoria", SAbrSistemaAutonomoAddTeoria,\r
AT_NULL, AT_POINTER, AT_POINTER, 0);\r
brNewBreveCall(data, "SistemaAutonomoSetValue", SAbrSistemaAutonomoSetValue,\r