-
Notifications
You must be signed in to change notification settings - Fork 0
/
example.c
119 lines (103 loc) · 2.24 KB
/
example.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
/*
WARNING: THIS FILE IS AUTO-GENERATED. DO NOT MODIFY.
This file was generated from example.idl using "rtiddsgen".
The rtiddsgen tool is part of the RTI Data Distribution Service distribution.
For more information, type 'rtiddsgen -help' at a command shell
or consult the RTI Data Distribution Service manual.
*/
#include "example.h"
#ifndef UNUSED_ARG
#define UNUSED_ARG(x) (void)(x)
#endif
/*** SOURCE_BEGIN ***/
/* ========================================================================= */
const char *my_typeTYPENAME = "my_type";
RTI_BOOL
my_type_initialize(my_type* sample)
{
if (sample == NULL)
{
return RTI_FALSE;
}
CDR_Primitive_init_long(&sample->id);
if (!CDR_String_initialize(
&sample->msg,
(128)))
{
return RTI_FALSE;
}
return RTI_TRUE;
}
my_type *
my_type_create(void)
{
my_type* sample;
OSAPI_Heap_allocate_struct(&sample, my_type);
if (sample != NULL)
{
if (!my_type_initialize(sample))
{
OSAPI_Heap_free_struct(sample);
sample = NULL;
}
}
return sample;
}
#ifndef RTI_CERT
RTI_BOOL
my_type_finalize(my_type* sample)
{
if (sample == NULL)
{
return RTI_FALSE;
}
CDR_String_finalize(&sample->msg);
return RTI_TRUE;
}
#ifndef RTI_CERT
void
my_type_delete(my_type* sample)
{
if (sample != NULL)
{
/* my_type_finalize() always
returns RTI_TRUE when called with sample != NULL */
my_type_finalize(sample);
OSAPI_Heap_free_struct(sample);
}
}
#endif
#endif
RTI_BOOL
my_type_copy(my_type* dst,const my_type* src)
{
if ((dst == NULL) || (src == NULL))
{
return RTI_FALSE;
}
CDR_Primitive_copy_long(&dst->id, &src->id);
if (!CDR_String_copy(
&dst->msg, &src->msg,
(128)))
{
return RTI_FALSE;
}
return RTI_TRUE;
}
/**
* <<IMPLEMENTATION>>
*
* Defines: TSeq, T
*
* Configure and implement 'my_type' sequence class.
*/
#define REDA_SEQUENCE_USER_API
#define T my_type
#define TSeq my_typeSeq
#define T_initialize my_type_initialize
#define T_finalize my_type_finalize
#define T_copy my_type_copy
#include "reda/reda_sequence_defn.h"
#undef T_copy
#undef T_finalize
#undef T_initialize