MADARA  3.1.0
SpliceKnowledgeUpdateSplDcps.cpp
Go to the documentation of this file.
3 
4 #include <v_copyIn.h>
5 #include <v_topic.h>
6 #include <os_stdlib.h>
7 #include <string.h>
8 #include <os_report.h>
9 
10 v_copyin_result
12  c_base base,
15 {
16  v_copyin_result result = V_COPYIN_RESULT_OK;
17  (void) base;
18 
19 /* Code generated by C:\cygwin64\home\dds\OvernightTests\tmp_8NJ2wuOEtm\build\src\tools\idlpp\code\idl_genCorbaCxxCopyin.c at line 2645 */
20 
21  static c_type type0 = NULL;
22  c_type subtype0 = NULL;
23  c_ulong length0;
24  c_octet *dest0;
25 
26  if (type0 == NULL) {
27  subtype0 = c_type(c_metaResolve (c_metaObject(base), "c_octet"));
28  type0 = c_metaSequenceTypeNew(c_metaObject(base),"C_SEQUENCE<c_octet>",subtype0,0);
29  c_free(subtype0);
30  }
31  length0 = (*from).length();
32 #ifdef OSPL_BOUNDS_CHECK
33  dest0 = (c_octet *)c_newSequence_s(c_collectionType(type0), length0);
34  if(dest0 != NULL) {
35  /* Code generated by C:\cygwin64\home\dds\OvernightTests\tmp_8NJ2wuOEtm\build\src\tools\idlpp\code\idl_genCorbaCxxCopyin.c at line 2025 */
36  const c_octet *buf0;
37  buf0 = (const c_octet *)(*from).get_buffer();
38  memcpy (dest0,buf0,length0* sizeof(*dest0));
39  *to = (_Knowledge_seq_oct)dest0;
40  } else {
41  result = V_COPYIN_RESULT_OUT_OF_MEMORY;
42  }
43 #else
44  dest0 = (c_octet *)c_newSequence_s(c_collectionType(type0), length0);
45  if(dest0 != NULL) {
46  /* Code generated by C:\cygwin64\home\dds\OvernightTests\tmp_8NJ2wuOEtm\build\src\tools\idlpp\code\idl_genCorbaCxxCopyin.c at line 2025 */
47  const c_octet *buf0;
48  buf0 = (const c_octet *)(*from).get_buffer();
49  memcpy (dest0,buf0,length0* sizeof(*dest0));
50  *to = (_Knowledge_seq_oct)dest0;
51  } else {
52  result = V_COPYIN_RESULT_OUT_OF_MEMORY;
53  }
54 #endif
55  return result;
56 }
57 
58 v_copyin_result
60  c_base base,
61  const struct ::Knowledge::Update *from,
62  struct _Knowledge_Update *to)
63 {
64  v_copyin_result result = V_COPYIN_RESULT_OK;
65  (void) base;
66 
67 #ifdef OSPL_BOUNDS_CHECK
68  if(from->originator){
69  to->originator = c_stringNew_s(base, from->originator);
70  if(to->originator == NULL) {
71  result = V_COPYIN_RESULT_OUT_OF_MEMORY;
72  }
73  } else {
74  OS_REPORT (OS_ERROR, "copyIn", 0,"Member 'Knowledge::Update.originator' of type 'c_string' is NULL.");
75  result = V_COPYIN_RESULT_INVALID;
76  }
77 #else
78  to->originator = c_stringNew_s(base, from->originator);
79  if(to->originator == NULL) {
80  result = V_COPYIN_RESULT_OUT_OF_MEMORY;
81  }
82 #endif
83  if(V_COPYIN_RESULT_IS_OK(result)){
85  result = __Knowledge_seq_oct__copyIn(base, &from->buffer, &to->buffer);
86  }
87  to->quality = (c_ulong)from->quality;
88 #ifdef OSPL_BOUNDS_CHECK
89  if(from->madara_id){
90  to->madara_id = c_stringNew_s(base, from->madara_id);
91  if(to->madara_id == NULL) {
92  result = V_COPYIN_RESULT_OUT_OF_MEMORY;
93  }
94  } else {
95  OS_REPORT (OS_ERROR, "copyIn", 0,"Member 'Knowledge::Update.madara_id' of type 'c_string' is NULL.");
96  result = V_COPYIN_RESULT_INVALID;
97  }
98 #else
99  to->madara_id = c_stringNew_s(base, from->madara_id);
100  if(to->madara_id == NULL) {
101  result = V_COPYIN_RESULT_OUT_OF_MEMORY;
102  }
103 #endif
104  to->updates = (c_ulong)from->updates;
105  to->type = (c_ulong)from->type;
106  to->clock = (c_ulonglong)from->clock;
107  to->timestamp = (c_ulonglong)from->timestamp;
108  to->ttl = (c_ulong)from->ttl;
109  return result;
110 }
111 
112 void
114  const void *_from,
115  void *_to)
116 {
117  const _Knowledge_seq_oct *from = (const _Knowledge_seq_oct *)_from;
119  long size0;
120  const c_octet *src0 = (const c_octet *)(*from);
121 
122  size0 = c_arraySize(c_sequence(src0));
123  (*to).length(size0);
124  {
125  c_octet *buf0;
126  buf0 = (c_octet *)(*to).get_buffer();
127  memcpy ((void *)buf0,src0,size0* sizeof(*buf0));
128  }
129 }
130 
131 void
133  const void *_from,
134  void *_to)
135 {
136  const struct _Knowledge_Update *from = (const struct _Knowledge_Update *)_from;
137  struct ::Knowledge::Update *to = (struct ::Knowledge::Update *)_to;
138  to->originator = DDS::string_dup(from->originator ? from->originator : "");
139  {
140  extern void __Knowledge_seq_oct__copyOut(const void *, void *);
141  __Knowledge_seq_oct__copyOut((const void *)&from->buffer, (void *)&to->buffer);
142  }
143  to->quality = (::DDS::ULong)from->quality;
144  to->madara_id = DDS::string_dup(from->madara_id ? from->madara_id : "");
145  to->updates = (::DDS::ULong)from->updates;
146  to->type = (::DDS::ULong)from->type;
147  to->clock = (::DDS::ULongLong)from->clock;
148  to->timestamp = (::DDS::ULongLong)from->timestamp;
149  to->ttl = (::DDS::ULong)from->ttl;
150 }
151 
v_copyin_result __Knowledge_seq_oct__copyIn(c_base base, const ::Knowledge::seq_oct *from, _Knowledge_seq_oct *to)
DDS_DCPSUFLSeq< DDS::Octet, struct seq_oct_uniq_ > seq_oct
void __Knowledge_seq_oct__copyOut(const void *_from, void *_to)
c_sequence _Knowledge_seq_oct
DDS::String_mgr madara_id
void __Knowledge_Update__copyOut(const void *_from, void *_to)
DDS::String_mgr originator
v_copyin_result __Knowledge_Update__copyIn(c_base base, const struct::Knowledge::Update *from, struct _Knowledge_Update *to)
DDS::ULongLong timestamp