Update of
/cvsroot/playerstage/code/player/client_libs/libplayerc/bindings/python
In directory
sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28583/client_libs/libplayerc/bindings/python
Modified Files:
playerc.i
Log Message:
changed blackboard interface to use a string group id instead of an integer
Index: playerc.i
===================================================================
RCS file:
/cvsroot/playerstage/code/player/client_libs/libplayerc/bindings/python/playerc.i,v
retrieving revision 1.30
retrieving revision 1.31
diff -C2 -d -r1.30 -r1.31
*** playerc.i 30 Jan 2008 02:06:46 -0000 1.30
--- playerc.i 6 Feb 2008 19:38:36 -0000 1.31
***************
*** 431,435 ****
dict = PyDict_New();
PyDict_SetItem(dict, PyString_FromString("key"),
PyString_FromString(entry.key));
! PyDict_SetItem(dict, PyString_FromString("group_id"),
PyLong_FromLong(entry.group_id));
PyDict_SetItem(dict, PyString_FromString("type"),
PyLong_FromLong(entry.type));
PyDict_SetItem(dict, PyString_FromString("subtype"),
PyLong_FromLong(entry.subtype));
--- 431,435 ----
dict = PyDict_New();
PyDict_SetItem(dict, PyString_FromString("key"),
PyString_FromString(entry.key));
! PyDict_SetItem(dict, PyString_FromString("group"),
PyString_FromString(entry.group));
PyDict_SetItem(dict, PyString_FromString("type"),
PyLong_FromLong(entry.type));
PyDict_SetItem(dict, PyString_FromString("subtype"),
PyLong_FromLong(entry.subtype));
***************
*** 495,499 ****
}
! PyObject * subscribe_to_key(const char *key, int group_id)
{
char *str;
--- 495,499 ----
}
! PyObject * subscribe_to_key(const char *key, const char *group)
{
char *str;
***************
*** 504,508 ****
assert(self);
! int result = playerc_blackboard_subscribe_to_key(self, key, group_id,
&entry);
if (result != 0)
{
--- 504,508 ----
assert(self);
! int result = playerc_blackboard_subscribe_to_key(self, key, group,
&entry);
if (result != 0)
{
***************
*** 516,520 ****
dict = PyDict_New();
PyDict_SetItem(dict, PyString_FromString("key"),
PyString_FromString(entry->key));
! PyDict_SetItem(dict, PyString_FromString("group_id"),
PyLong_FromLong(entry->group_id));
PyDict_SetItem(dict, PyString_FromString("type"),
PyLong_FromLong(entry->type));
PyDict_SetItem(dict, PyString_FromString("subtype"),
PyLong_FromLong(entry->subtype));
--- 516,520 ----
dict = PyDict_New();
PyDict_SetItem(dict, PyString_FromString("key"),
PyString_FromString(entry->key));
! PyDict_SetItem(dict, PyString_FromString("group"),
PyString_FromString(entry->group));
PyDict_SetItem(dict, PyString_FromString("type"),
PyLong_FromLong(entry->type));
PyDict_SetItem(dict, PyString_FromString("subtype"),
PyLong_FromLong(entry->subtype));
***************
*** 554,557 ****
--- 554,558 ----
PyDict_SetItem(dict, PyString_FromString("data"), data);
free(entry->key);
+ free(entry->group);
free(entry->data);
free(entry);
***************
*** 562,566 ****
{
PyObject *key;
! PyObject *group_id;
PyObject *type;
PyObject *subtype;
--- 563,567 ----
{
PyObject *key;
! PyObject *group;
PyObject *type;
PyObject *subtype;
***************
*** 583,587 ****
key = PyDict_GetItem(dict, PyString_FromString("key"));
! group_id = PyDict_GetItem(dict, PyString_FromString("group_id"));
type = PyDict_GetItem(dict, PyString_FromString("type"));
subtype = PyDict_GetItem(dict, PyString_FromString("subtype"));
--- 584,588 ----
key = PyDict_GetItem(dict, PyString_FromString("key"));
! group = PyDict_GetItem(dict, PyString_FromString("group"));
type = PyDict_GetItem(dict, PyString_FromString("type"));
subtype = PyDict_GetItem(dict, PyString_FromString("subtype"));
***************
*** 590,594 ****
data = PyDict_GetItem(dict, PyString_FromString("data"));
! if (key == NULL || group_id == NULL || type == NULL || subtype == NULL
|| timestamp_sec == NULL || timestamp_usec == NULL || data == NULL)
{
printf("Dictionary object missing keys.\n");
--- 591,595 ----
data = PyDict_GetItem(dict, PyString_FromString("data"));
! if (key == NULL || group == NULL || type == NULL || subtype == NULL ||
timestamp_sec == NULL || timestamp_usec == NULL || data == NULL)
{
printf("Dictionary object missing keys.\n");
***************
*** 596,602 ****
}
entry.key = PyString_AsString(key);
entry.key_count = strlen(entry.key) + 1;
! entry.group_id = PyInt_AsLong(group_id);
entry.type = PyInt_AsLong(type);
entry.subtype = PyInt_AsLong(subtype);
--- 597,640 ----
}
+ if (!PyString_Check(key))
+ {
+ printf("key should be a string type.\n");
+ return PyLong_FromLong(-1);
+ }
+
+ if (!PyString_Check(group))
+ {
+ printf("group should be a string type.\n");
+ return PyLong_FromLong(-1);
+ }
+
+ if (!PyLong_Check(type))
+ {
+ printf("type should be a long type.\n");
+ return PyLong_FromLong(-1);
+ }
+
+ if (!PyLong_Check(subtype))
+ {
+ printf("subtype should be a long type.\n");
+ return PyLong_FromLong(-1);
+ }
+
+ if (!PyLong_Check(timestamp_sec))
+ {
+ printf("timestamp_sec should be a long type.\n");
+ return PyLong_FromLong(-1);
+ }
+
+ if (!PyLong_Check(timestamp_usec))
+ {
+ printf("timestamp_usec should be a long type.\n");
+ return PyLong_FromLong(-1);
+ }
+
entry.key = PyString_AsString(key);
entry.key_count = strlen(entry.key) + 1;
! entry.group = PyString_AsString(key);
! entry.group_count = strlen(entry.group) + 1;
entry.type = PyInt_AsLong(type);
entry.subtype = PyInt_AsLong(subtype);
***************
*** 611,614 ****
--- 649,657 ----
break;
case PLAYERC_BLACKBOARD_DATA_SUBTYPE_STRING:
+ if (!PyString_Check(data))
+ {
+ printf("data should be a string type.\n");
+ return PyLong_FromLong(-1);
+ }
str = NULL;
str = PyString_AsString(data);
***************
*** 621,624 ****
--- 664,672 ----
break;
case PLAYERC_BLACKBOARD_DATA_SUBTYPE_INT:
+ if (!PyLong_Check(data))
+ {
+ printf("data should be a long type.\n");
+ return PyLong_FromLong(-1);
+ }
i = 0;
i = PyInt_AsLong(data);
***************
*** 630,633 ****
--- 678,686 ----
break;
case PLAYERC_BLACKBOARD_DATA_SUBTYPE_DOUBLE:
+ if (!PyLong_Check(data))
+ {
+ printf("data should be a long type.\n");
+ return PyLong_FromLong(-1);
+ }
d = 0.0;
d = PyLong_AsDouble(data);
***************
*** 647,651 ****
printf("key:%s\n", entry.key);
printf("key_count:%d\n", entry.key_count);
! printf("group_id:%d\n", entry.group_id);
printf("data:%s\n", (char*)entry.data);
printf("data_count:%d\n", entry.data_count);
--- 700,704 ----
printf("key:%s\n", entry.key);
printf("key_count:%d\n", entry.key_count);
! printf("group:%s\n", entry.group);
printf("data:%s\n", (char*)entry.data);
printf("data_count:%d\n", entry.data_count);
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit