lcmtypes_gps_to_local_t.cpp
Go to the documentation of this file.
1 /**************************************************************************************************
2  Software License Agreement (BSD License)
3 
4  Copyright (c) 2011-2013, LAR toolkit developers - University of Aveiro - http://lars.mec.ua.pt
5  All rights reserved.
6 
7  Redistribution and use in source and binary forms, with or without modification, are permitted
8  provided that the following conditions are met:
9 
10  *Redistributions of source code must retain the above copyright notice, this list of
11  conditions and the following disclaimer.
12  *Redistributions in binary form must reproduce the above copyright notice, this list of
13  conditions and the following disclaimer in the documentation and/or other materials provided
14  with the distribution.
15  *Neither the name of the University of Aveiro nor the names of its contributors may be used to
16  endorse or promote products derived from this software without specific prior written permission.
17 
18  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
19  IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
20  FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
21  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
24  IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
25  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 ***************************************************************************************************/
36 #include <string.h>
38 
41 
43 {
44  const __lcm_hash_ptr *fp;
45  for (fp = p; fp != NULL; fp = fp->parent)
47  return 0;
48 
49  const __lcm_hash_ptr cp = { p, (void*)__lcmtypes_gps_to_local_t_get_hash };
50  (void) cp;
51 
52  int64_t hash = 0xa68613cd43dc764eLL
57  ;
58 
59  return (hash<<1) + ((hash>>63)&1);
60 }
61 
63 {
67  }
68 
70 }
71 
72 int __lcmtypes_gps_to_local_t_encode_array(void *buf, int offset, int maxlen, const lcmtypes_gps_to_local_t *p, int elements)
73 {
74  int pos = 0, thislen, element;
75 
76  for (element = 0; element < elements; element++) {
77 
78  thislen = __int64_t_encode_array(buf, offset + pos, maxlen - pos, &(p[element].utime), 1);
79  if (thislen < 0) return thislen; else pos += thislen;
80 
81  thislen = __double_encode_array(buf, offset + pos, maxlen - pos, p[element].local, 3);
82  if (thislen < 0) return thislen; else pos += thislen;
83 
84  thislen = __double_encode_array(buf, offset + pos, maxlen - pos, p[element].lat_lon_el_theta, 4);
85  if (thislen < 0) return thislen; else pos += thislen;
86 
87  { int a;
88  for (a = 0; a < 4; a++) {
89  thislen = __float_encode_array(buf, offset + pos, maxlen - pos, p[element].gps_cov[a], 4);
90  if (thislen < 0) return thislen; else pos += thislen;
91  }
92  }
93 
94  }
95  return pos;
96 }
97 
98 int lcmtypes_gps_to_local_t_encode(void *buf, int offset, int maxlen, const lcmtypes_gps_to_local_t *p)
99 {
100  int pos = 0, thislen;
101  int64_t hash = __lcmtypes_gps_to_local_t_get_hash();
102 
103  thislen = __int64_t_encode_array(buf, offset + pos, maxlen - pos, &hash, 1);
104  if (thislen < 0) return thislen; else pos += thislen;
105 
106  thislen = __lcmtypes_gps_to_local_t_encode_array(buf, offset + pos, maxlen - pos, p, 1);
107  if (thislen < 0) return thislen; else pos += thislen;
108 
109  return pos;
110 }
111 
113 {
114  int size = 0, element;
115  for (element = 0; element < elements; element++) {
116 
117  size += __int64_t_encoded_array_size(&(p[element].utime), 1);
118 
119  size += __double_encoded_array_size(p[element].local, 3);
120 
121  size += __double_encoded_array_size(p[element].lat_lon_el_theta, 4);
122 
123  { int a;
124  for (a = 0; a < 4; a++) {
125  size += __float_encoded_array_size(p[element].gps_cov[a], 4);
126  }
127  }
128 
129  }
130  return size;
131 }
132 
134 {
136 }
137 
138 int __lcmtypes_gps_to_local_t_decode_array(const void *buf, int offset, int maxlen, lcmtypes_gps_to_local_t *p, int elements)
139 {
140  int pos = 0, thislen, element;
141 
142  for (element = 0; element < elements; element++) {
143 
144  thislen = __int64_t_decode_array(buf, offset + pos, maxlen - pos, &(p[element].utime), 1);
145  if (thislen < 0) return thislen; else pos += thislen;
146 
147  thislen = __double_decode_array(buf, offset + pos, maxlen - pos, p[element].local, 3);
148  if (thislen < 0) return thislen; else pos += thislen;
149 
150  thislen = __double_decode_array(buf, offset + pos, maxlen - pos, p[element].lat_lon_el_theta, 4);
151  if (thislen < 0) return thislen; else pos += thislen;
152 
153  { int a;
154  for (a = 0; a < 4; a++) {
155  thislen = __float_decode_array(buf, offset + pos, maxlen - pos, p[element].gps_cov[a], 4);
156  if (thislen < 0) return thislen; else pos += thislen;
157  }
158  }
159 
160  }
161  return pos;
162 }
163 
165 {
166  int element;
167  for (element = 0; element < elements; element++) {
168 
169  __int64_t_decode_array_cleanup(&(p[element].utime), 1);
170 
171  __double_decode_array_cleanup(p[element].local, 3);
172 
173  __double_decode_array_cleanup(p[element].lat_lon_el_theta, 4);
174 
175  { int a;
176  for (a = 0; a < 4; a++) {
177  __float_decode_array_cleanup(p[element].gps_cov[a], 4);
178  }
179  }
180 
181  }
182  return 0;
183 }
184 
185 int lcmtypes_gps_to_local_t_decode(const void *buf, int offset, int maxlen, lcmtypes_gps_to_local_t *p)
186 {
187  int pos = 0, thislen;
188  int64_t hash = __lcmtypes_gps_to_local_t_get_hash();
189 
190  int64_t this_hash;
191  thislen = __int64_t_decode_array(buf, offset + pos, maxlen - pos, &this_hash, 1);
192  if (thislen < 0) return thislen; else pos += thislen;
193  if (this_hash != hash) return -1;
194 
195  thislen = __lcmtypes_gps_to_local_t_decode_array(buf, offset + pos, maxlen - pos, p, 1);
196  if (thislen < 0) return thislen; else pos += thislen;
197 
198  return pos;
199 }
200 
202 {
204 }
205 
207 {
208  int element;
209  for (element = 0; element < elements; element++) {
210 
211  __int64_t_clone_array(&(p[element].utime), &(q[element].utime), 1);
212 
213  __double_clone_array(p[element].local, q[element].local, 3);
214 
215  __double_clone_array(p[element].lat_lon_el_theta, q[element].lat_lon_el_theta, 4);
216 
217  { int a;
218  for (a = 0; a < 4; a++) {
219  __float_clone_array(p[element].gps_cov[a], q[element].gps_cov[a], 4);
220  }
221  }
222 
223  }
224  return 0;
225 }
226 
228 {
231  return q;
232 }
233 
235 {
237  free(p);
238 }
void lcmtypes_gps_to_local_t_destroy(lcmtypes_gps_to_local_t *p)
static int __int64_t_decode_array(const void *_buf, int offset, int maxlen, int64_t *p, int elements)
int lcmtypes_gps_to_local_t_decode(const void *buf, int offset, int maxlen, lcmtypes_gps_to_local_t *p)
static int __float_decode_array(const void *_buf, int offset, int maxlen, float *p, int elements)
static int __float_encoded_array_size(const float *p, int elements)
lcmtypes_gps_to_local_t * lcmtypes_gps_to_local_t_copy(const lcmtypes_gps_to_local_t *p)
int64_t __lcmtypes_gps_to_local_t_hash_recursive(const __lcm_hash_ptr *p)
#define __double_decode_array_cleanup(p, sz)
int lcmtypes_gps_to_local_t_decode_cleanup(lcmtypes_gps_to_local_t *p)
static int __int64_t_encode_array(void *_buf, int offset, int maxlen, const int64_t *p, int elements)
static int __double_encoded_array_size(const double *p, int elements)
static int __int64_t_clone_array(const int64_t *p, int64_t *q, int elements)
#define __float_decode_array_cleanup(p, sz)
THIS IS AN AUTOMATICALLY GENERATED FILE. DO NOT MODIFY BY HAND!! Generated by LCM.
static int __float_encode_array(void *_buf, int offset, int maxlen, const float *p, int elements)
#define __double_hash_recursive(p)
static int __lcmtypes_gps_to_local_t_hash_computed
#define __int64_t_hash_recursive(p)
#define __float_hash_recursive(p)
int __lcmtypes_gps_to_local_t_encode_array(void *buf, int offset, int maxlen, const lcmtypes_gps_to_local_t *p, int elements)
int __lcmtypes_gps_to_local_t_clone_array(const lcmtypes_gps_to_local_t *p, lcmtypes_gps_to_local_t *q, int elements)
static int __double_clone_array(const double *p, double *q, int elements)
int lcmtypes_gps_to_local_t_encode(void *buf, int offset, int maxlen, const lcmtypes_gps_to_local_t *p)
static int __int64_t_encoded_array_size(const int64_t *p, int elements)
int __lcmtypes_gps_to_local_t_decode_array(const void *buf, int offset, int maxlen, lcmtypes_gps_to_local_t *p, int elements)
static int __double_decode_array(const void *_buf, int offset, int maxlen, double *p, int elements)
static int __double_encode_array(void *_buf, int offset, int maxlen, const double *p, int elements)
int64_t __lcmtypes_gps_to_local_t_get_hash(void)
int lcmtypes_gps_to_local_t_encoded_size(const lcmtypes_gps_to_local_t *p)
static int64_t __lcmtypes_gps_to_local_t_hash
const __lcm_hash_ptr * parent
Definition: lcm_coretypes.h:60
int __lcmtypes_gps_to_local_t_encoded_array_size(const lcmtypes_gps_to_local_t *p, int elements)
int __lcmtypes_gps_to_local_t_decode_array_cleanup(lcmtypes_gps_to_local_t *p, int elements)
#define __int64_t_decode_array_cleanup(p, sz)
static int __float_clone_array(const float *p, float *q, int elements)


mit_darpa_logs_player
Author(s): Miguel Oliveira
autogenerated on Mon Mar 2 2015 01:32:15