]> rtime.felk.cvut.cz Git - orte.git/blob - orte/examples/mpo/ddso/ddsos.c
Reformat the sources with orte/uncrustify script
[orte.git] / orte / examples / mpo / ddso / ddsos.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           deadline, minimumSeparation;
8 ORTESubscription  *s_octet;
9 ORTESubscription  *s_short;
10 ORTESubscription  *s_long;
11
12 ofb_octet         i2r_octet;
13 ofb_short         i2r_short;
14 ofb_long          i2r_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(deadline, 10);         //10s
25   NTPTIME_BUILD(minimumSeparation, 0); //0s
26
27   //register serialization/deserealization functions for a given types
28   ofb_octet_type_register(d);
29   ofb_short_type_register(d);
30   ofb_long_type_register(d);
31   ofb_float_type_register(d);
32   ofb_double_type_register(d);
33
34   //create of services
35   s_octet = ORTESubscriptionCreate(
36     d,
37     IMMEDIATE,
38     BEST_EFFORTS,
39     "GUID_octet",
40     "ofb_octet",
41     &i2r_octet,
42     &deadline,
43     &minimumSeparation,
44     ofb_cbr_octet,
45     NULL,
46     IPADDRESS_INVALID);
47   s_short = ORTESubscriptionCreate(
48     d,
49     IMMEDIATE,
50     BEST_EFFORTS,
51     "GUID_short",
52     "ofb_short",
53     &i2r_short,
54     &deadline,
55     &minimumSeparation,
56     ofb_cbr_short,
57     NULL,
58     IPADDRESS_INVALID);
59   s_long = ORTESubscriptionCreate(
60     d,
61     IMMEDIATE,
62     BEST_EFFORTS,
63     "GUID_long",
64     "ofb_long",
65     &i2r_long,
66     &deadline,
67     &minimumSeparation,
68     ofb_cbr_long,
69     NULL,
70     IPADDRESS_INVALID);
71
72   while (1)
73     ORTESleepMs(1);
74   return 0;
75 }