]> rtime.felk.cvut.cz Git - orte.git/blob - orte/examples/mpo/ddso/ddsop.c
upgrade to new version 0.3.1
[orte.git] / orte / examples / mpo / ddso / ddsop.c
1 #include <stdio.h>
2 #include <orte.h>
3 #include <ddso.h>
4 #include "ddso_cb.h"
5
6 ORTEDomain        *d=NULL; 
7 NtpTime           persistence, delay;
8 ORTEPublication   *p_octet;
9 ORTEPublication   *p_short;
10 ORTEPublication   *p_long;
11
12 ofb_octet         i2s_octet;
13 ofb_short         i2s_short;
14 ofb_long          i2s_long;
15
16 int main(int argc,char *argv[]) {
17   //init
18   ORTEInit();
19   d=ORTEDomainAppCreate(ORTE_DEFAULT_DOMAIN,NULL,NULL,ORTE_FALSE);
20   if (!d) return -1;
21   NTPTIME_BUILD(persistence,3);  //3s
22   NTPTIME_BUILD(delay,1);        //1s
23   i2s_octet.guid=0x123456;
24   i2s_octet.value=0;
25   i2s_short.guid=0x654321;
26   i2s_short.value=0;
27   i2s_long.guid=0x123654;
28   i2s_long.value=0;
29
30   //register serialization/deserealization functions for a given types
31   ofb_octet_type_register(d);
32   ofb_short_type_register(d);
33   ofb_long_type_register(d);
34   ofb_float_type_register(d);
35   ofb_double_type_register(d);
36
37   //create of services
38   p_octet=ORTEPublicationCreate(
39        d,
40       "GUID_octet",
41       "ofb_octet",
42       &i2s_octet,
43       &persistence,
44       1,
45       &ofb_cbs_octet,
46       NULL,
47       &delay);
48   p_short=ORTEPublicationCreate(
49        d,
50       "GUID_short",
51       "ofb_short",
52       &i2s_short,
53       &persistence,
54       1,
55       &ofb_cbs_short,
56       NULL,
57       &delay);
58   p_long=ORTEPublicationCreate(
59        d,
60       "GUID_long",
61       "ofb_long",
62       &i2s_long,
63       &persistence,
64       1,
65       &ofb_cbs_long,
66       NULL,
67       &delay);
68   
69   while(1) {
70     ORTESleepMs(1);
71   }
72   return 0;
73 }