]> rtime.felk.cvut.cz Git - orte.git/blob - orte/examples/mpo/ddso/ddsop.c
Reformat the sources with orte/uncrustify script
[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
17 main(int argc, char *argv[])
18 {
19   //init
20   ORTEInit();
21   d = ORTEDomainAppCreate(ORTE_DEFAULT_DOMAIN, NULL, NULL, ORTE_FALSE);
22   if (!d)
23     return -1;
24   NTPTIME_BUILD(persistence, 3);  //3s
25   NTPTIME_BUILD(delay, 1);        //1s
26   i2s_octet.guid = 0x123456;
27   i2s_octet.value = 0;
28   i2s_short.guid = 0x654321;
29   i2s_short.value = 0;
30   i2s_long.guid = 0x123654;
31   i2s_long.value = 0;
32
33   //register serialization/deserealization functions for a given types
34   ofb_octet_type_register(d);
35   ofb_short_type_register(d);
36   ofb_long_type_register(d);
37   ofb_float_type_register(d);
38   ofb_double_type_register(d);
39
40   //create of services
41   p_octet = ORTEPublicationCreate(
42     d,
43     "GUID_octet",
44     "ofb_octet",
45     &i2s_octet,
46     &persistence,
47     1,
48     &ofb_cbs_octet,
49     NULL,
50     &delay);
51   p_short = ORTEPublicationCreate(
52     d,
53     "GUID_short",
54     "ofb_short",
55     &i2s_short,
56     &persistence,
57     1,
58     &ofb_cbs_short,
59     NULL,
60     &delay);
61   p_long = ORTEPublicationCreate(
62     d,
63     "GUID_long",
64     "ofb_long",
65     &i2s_long,
66     &persistence,
67     1,
68     &ofb_cbs_long,
69     NULL,
70     &delay);
71
72   while (1)
73     ORTESleepMs(1);
74   return 0;
75 }