Ticket #88 (new enhancement) — at Initial Version

Opened 11 years ago

Last modified 11 years ago

Zoo kernel interface and encapsulation

Reported by: Knut Landmark Owned by:
Priority: major Milestone:
Component: zoo-kernel Version:
Keywords: Cc:

Description

Service implementation with Zoo requires specific knowledge about the Zoo kernel. Here are some examples:

  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.

map* tmp = getMapFromMaps( inputs, "Parameter", "value" );

char* value = tmp->value;

(The map struct named "value" should not be confused with the value field in the map struct.)

  1. 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.

int result[4] = { 0, 1, 2, 3 };

char size[16];

snprintf( size, sizeof( size ), "%d", sizeof( output ) );

setMapInMaps( outputs, "Result", "size", size );

setMapInMaps( outputs, "Result", "value", (char *) result );

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).

  1. 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.

char message[] = "Progress: 99 %";

char status[] = "99";

setMapInMaps( conf, "lenv", "status", status );

setMapInMaps( conf, "lenv", "message", message);

updateStatus( conf );

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

char* getInputValue( maps* inputs, const char* parameterName, size_t* numberOfBytes, int* errorCode );

int setOutputValue( maps* outputs, const char* parameterName, char* data, size_t numberOfBytes ); /* return error code */

int updateStatus( maps* config, int percentCompleted, const char* message ); /* return error code */

Note: See TracTickets for help on using tickets.

Search

Context Navigation

ZOO Sponsors

http://www.zoo-project.org/trac/chrome/site/img/geolabs-logo.pnghttp://www.zoo-project.org/trac/chrome/site/img/neogeo-logo.png http://www.zoo-project.org/trac/chrome/site/img/apptech-logo.png http://www.zoo-project.org/trac/chrome/site/img/3liz-logo.png http://www.zoo-project.org/trac/chrome/site/img/gateway-logo.png

Become a sponsor !

Knowledge partners

http://www.zoo-project.org/trac/chrome/site/img/ocu-logo.png http://www.zoo-project.org/trac/chrome/site/img/gucas-logo.png http://www.zoo-project.org/trac/chrome/site/img/polimi-logo.png http://www.zoo-project.org/trac/chrome/site/img/fem-logo.png http://www.zoo-project.org/trac/chrome/site/img/supsi-logo.png http://www.zoo-project.org/trac/chrome/site/img/cumtb-logo.png

Become a knowledge partner

Related links

http://zoo-project.org/img/ogclogo.png http://zoo-project.org/img/osgeologo.png