Changes between Initial Version and Version 1 of Ticket #88
- Timestamp:
- Feb 13, 2014, 2:08:16 PM (11 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #88 – Description
initial v1 2 2 3 3 1. To set or get the value of a parameter, the programmer needs to know that Zoo internally attaches a map struct with the name "value" to the maps struct representing the parameter, e.g. 4 4 {{{ 5 5 map* tmp = getMapFromMaps( inputs, "Parameter", "value" ); 6 7 6 char* value = tmp->value; 8 7 }}} 9 8 (The map struct named "value" should not be confused with the value field in the map struct.) 10 9 11 10 2. For output data with binary content types, the programmer must know that Zoo attempts to determine the size of the data buffer from a map struct with the name "size", e.g. 12 11 {{{ 13 12 int result[4] = { 0, 1, 2, 3 }; 14 15 13 char size[16]; 16 17 14 snprintf( size, sizeof( size ), "%d", sizeof( output ) ); 18 19 15 setMapInMaps( outputs, "Result", "size", size ); 20 21 16 setMapInMaps( outputs, "Result", "value", (char *) result ); 22 17 }}} 23 18 If the "size" map is missing, Zoo assumes the data is in a text-based format and calls strlen (i.e. searches the for the first 0-byte in the buffer). 24 19 25 20 3. To update the progress status of a process, the programmer must know that the Zoo kernel refers to a map named "status" and a map named "message" in a maps struct named "lenv" in the configuration maps struct, e.g. 26 21 {{{ 27 22 char message[] = "Progress: 99 %"; 28 29 23 char status[] = "99"; 30 31 24 setMapInMaps( conf, "lenv", "status", status ); 32 33 25 setMapInMaps( conf, "lenv", "message", message); 34 35 26 updateStatus( conf ); 36 27 }}} 37 28 It should be possible to create a new interface that hides the Zoo kernel internal representations from the service implementation. For example, the above code fragments could perhaps be encapsulated in functions with signatures like 38 29 {{{ 39 30 char* getInputValue( maps* inputs, const char* parameterName, size_t* numberOfBytes, int* errorCode ); 40 41 31 int setOutputValue( maps* outputs, const char* parameterName, char* data, size_t numberOfBytes ); /* return error code */ 42 43 32 int updateStatus( maps* config, int percentCompleted, const char* message ); /* return error code */ 44 33 }}}