source: trunk/zoo-project/zoo-services/arithmetics/test_service.c @ 615

Last change on this file since 615 was 363, checked in by djay, 12 years ago

Remove uneeded header file and small fix to compile on win32 and use correct way to fill outputs parameters.

  • Property svn:eol-style set to native
  • Property svn:mime-type set to text/x-csrc
File size: 1.0 KB
Line 
1#include "service.h"
2
3extern "C" {
4
5#ifdef WIN32
6__declspec(dllexport)
7#endif
8  int Multiply(maps*& conf,maps*& inputs,maps*& outputs){
9        fprintf(stderr,"\nService internal print\n");
10        maps* cursor=inputs;
11        int A,B,res;
12        A=0;B=0;
13        if(cursor!=NULL){
14                fprintf(stderr,"\nService internal print\n");
15                dumpMaps(cursor);
16                maps* tmp=getMaps(inputs,"A");
17                if(tmp==NULL)
18                        return SERVICE_FAILED;
19                fprintf(stderr,"\nService internal print\n");
20                dumpMap(tmp->content);
21                map* tmpv=getMap(tmp->content,"value");
22                fprintf(stderr,"\nService internal print\n");
23                A=atoi(tmpv->value);
24                fprintf(stderr,"\nService internal print (A value: %i)\n",A);
25                cursor=cursor->next;
26        }
27        if(cursor!=NULL){
28                maps* tmp=getMaps(cursor,"B");
29                map* tmpv=getMap(tmp->content,"value");
30                if(tmpv==NULL)
31                        return SERVICE_FAILED;
32                B=atoi(tmpv->value);
33                fprintf(stderr,"\nService internal print (B value: %i)\n",B);
34        }
35        res=A*B;
36        char tmp[256];
37        sprintf(tmp,"%i",res);
38        setMapInMaps(outputs,"Result","value",tmp);
39        return SERVICE_SUCCEEDED;
40  }
41
42}
Note: See TracBrowser for help on using the repository browser.

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