5 XBT_LOG_NEW_DEFAULT_CATEGORY(test,"Simple Property example");
8 int client(int argc, char *argv[]) {
11 /* Get the properties */
12 xbt_dict_t props = gras_process_properties();
13 xbt_dict_cursor_t cursor = NULL;
16 /* Print the properties of the workstation 1 */
17 xbt_dict_foreach(props,cursor,key,data) {
18 INFO2("Process property: %s has value: %s",key,data);
21 /* Try to get a property that does not exist */
22 char *noexist="Nonexisent";
23 const char *value = gras_process_property_value(noexist);
25 INFO1("Process property: %s is undefined", noexist);
27 INFO2("Process property: %s has value: %s", noexist, value);
29 /* Modify an existing property. First check it exists */\
30 INFO0("Trying to modify a process property");
31 char *exist="otherprop";
32 value = gras_process_property_value(exist);
34 INFO1("\tProperty: %s is undefined", exist);
36 INFO2("\tProperty: %s old value: %s", exist, value);
37 xbt_dict_set(props, exist, strdup("newValue"), free);
40 /* Test if we have changed the value */
41 value = gras_process_property_value(exist);
43 INFO1("\tProperty: %s is undefined", exist);
45 INFO2("\tProperty: %s new value: %s", exist, value);
51 int server(int argc, char *argv[]) {
52 gras_init(&argc,argv);
54 /* Get the properties */
55 xbt_dict_t props = gras_os_host_properties();
56 xbt_dict_cursor_t cursor = NULL;
59 /* Print the properties of the workstation 1 */
60 xbt_dict_foreach(props,cursor,key,data) {
61 INFO2("Host property: %s has value: %s",key,data);
64 /* Try to get a property that does not exist */
65 char *noexist="Nonexisent";
66 const char *value = gras_os_host_property_value(noexist);
68 INFO1("Host property: %s is undefined", noexist);
70 INFO2("Host property: %s has value: %s", noexist, value);