+ variables:
ptr (pointer).
- + to init named name (string) with-action action (int)
+ + to init named name (string) with-action action (string)
executed k = 1 (int) succeeded p = 1 (int):
ptr = TeoriaNew(name, action, k, p).
+ to add teoria theTeoria (object):
SistemaAutonomoAddTeoria(ptr, (theTeoria get-ptr)).
+ + to set value theValue (float) with-name theName (string):
+ SistemaAutonomoSetValue(ptr, theName, theValue).
+
+ + to update entorno theEntorno (hash):
+ foreach nombre in keys(theEntorno): {
+ self set value theEntorno{nombre} with-name nombre.
+ }
+
+ + to plan:
+ SistemaAutonomoPlan(ptr).
+
+ + to get-next-action:
+ return SistemaAutonomoGetNextAction(ptr).
+
+ + to validate-current-theory:
+ return SistemaAutonomoValidateCurrentTheory(ptr).
+
+ to destroy:
SistemaAutonomoDelete(ptr).
}
\r
double NoOp(CEntorno&) { return 0.0; } // FIXME (hack horrible porque no puedo usar ptr a fun)\r
\r
-// pointer{Teoria} TeoriaNew(string, int, int, int)\r
+// pointer{Teoria} TeoriaNew(string, string, int, int)\r
int SAbrTeoriaNew(brEval args[], brEval* result, void* data)\r
{\r
result->set(new CTeoria(\r
BRSTRING(args),\r
NoOp, // FIXME (no hay puntero a funcion, poner BRINT(args+1))\r
+ //BRSTRING(args+1),\r
BRINT(args+2),\r
BRINT(args+3)));\r
return EC_OK;\r
return EC_OK;\r
}\r
\r
+// void SistemaAutonomoSetValue(pointer{SistemaAutonomo}, string, float)\r
+int SAbrSistemaAutonomoSetValue(brEval args[], brEval* result, void* data)\r
+{\r
+ CSistemaAutonomo* sa = (CSistemaAutonomo*) BRPOINTER(args);\r
+ sa->p_entorno->datos.set_val(BRSTRING(args), BRDOUBLE(args+1));\r
+ return EC_OK;\r
+}\r
+\r
+// void SistemaAutonomoPlan(pointer{SistemaAutonomo})\r
+int SAbrSistemaAutonomoPlan(brEval args[], brEval* result, void* data)\r
+{\r
+ // TODO CSistemaAutonomo* sa = (CSistemaAutonomo*) BRPOINTER(args);\r
+ // TODO sa->plan();\r
+ return EC_OK;\r
+}\r
+\r
+// string SistemaAutonomoGetNextAction(pointer{SistemaAutonomo})\r
+int SAbrSistemaAutonomoGetNextAction(brEval args[], brEval* result, void* data)\r
+{\r
+ // TODO CSistemaAutonomo* sa = (CSistemaAutonomo*) BRPOINTER(args);\r
+ // TODO sa->get_next_action();\r
+ result->set("avanzar"); // FIXME\r
+ return EC_OK;\r
+}\r
+\r
+// bool SistemaAutonomoValidateCurrentTheory(pointer{SistemaAutonomo})\r
+int SAbrSistemaAutonomoValidateCurrentTheory(brEval args[], brEval* result, void* data)\r
+{\r
+ // TODO CSistemaAutonomo* sa = (CSistemaAutonomo*) BRPOINTER(args);\r
+ // TODO sa->validate_current_theory();\r
+ result->set(true); // FIXME\r
+ return EC_OK;\r
+}\r
+\r
// void SistemaAutonomoDelete(pointer{SistemaAutonomo})\r
int SAbrSistemaAutonomoDelete(brEval args[], brEval* result, void* data)\r
{\r
DLLEXPORT void SAbrFunctions(void *data)\r
{\r
brNewBreveCall(data, "TeoriaNew", SAbrTeoriaNew,\r
- AT_POINTER, AT_STRING, AT_INT, AT_INT, AT_INT, 0);\r
+ AT_POINTER, AT_STRING, AT_STRING, AT_INT, AT_INT, 0);\r
brNewBreveCall(data, "TeoriaAddDatoInicial", SAbrTeoriaAddDatoInicial,\r
AT_NULL, AT_POINTER, AT_STRING, AT_DOUBLE, 0);\r
brNewBreveCall(data, "TeoriaAddDatoFinal", SAbrTeoriaAddDatoFinal,\r
AT_POINTER, 0);\r
brNewBreveCall(data, "SistemaAutonomoAddTeoria", SAbrSistemaAutonomoAddTeoria,\r
AT_NULL, AT_POINTER, AT_POINTER, 0);\r
+ brNewBreveCall(data, "SistemaAutonomoSetValue", SAbrSistemaAutonomoSetValue,\r
+ AT_NULL, AT_POINTER, AT_STRING, AT_DOUBLE, 0);\r
+ brNewBreveCall(data, "SistemaAutonomoPlan", SAbrSistemaAutonomoPlan,\r
+ AT_NULL, AT_POINTER, 0);\r
+ brNewBreveCall(data, "SistemaAutonomoGetNextAction", SAbrSistemaAutonomoGetNextAction,\r
+ AT_STRING, AT_POINTER, 0);\r
+ brNewBreveCall(data, "SistemaAutonomoValidateCurrentTheory", SAbrSistemaAutonomoValidateCurrentTheory,\r
+ AT_INT, AT_POINTER, 0);\r
brNewBreveCall(data, "SistemaAutonomoDelete", SAbrSistemaAutonomoDelete,\r
AT_NULL, AT_POINTER, 0);\r
}\r