-
Notifications
You must be signed in to change notification settings - Fork 1
/
exlcm_location_t.h
147 lines (128 loc) · 5.38 KB
/
exlcm_location_t.h
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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
// THIS IS AN AUTOMATICALLY GENERATED FILE. DO NOT MODIFY
// BY HAND!!
//
// Generated by lcm-gen
#include <stdint.h>
#include <stdlib.h>
#include <lcm/lcm_coretypes.h>
#include <lcm/lcm.h>
#ifndef _exlcm_location_t_h
#define _exlcm_location_t_h
#ifdef __cplusplus
extern "C" {
#endif
typedef struct _exlcm_location_t exlcm_location_t;
struct _exlcm_location_t
{
int64_t timestampLogical;
int64_t timestampMS;
int64_t pid;
double position[3];
double velocity[3];
double destination[3];
};
/**
* Create a deep copy of a exlcm_location_t.
* When no longer needed, destroy it with exlcm_location_t_destroy()
*/
exlcm_location_t* exlcm_location_t_copy(const exlcm_location_t* to_copy);
/**
* Destroy an instance of exlcm_location_t created by exlcm_location_t_copy()
*/
void exlcm_location_t_destroy(exlcm_location_t* to_destroy);
/**
* Identifies a single subscription. This is an opaque data type.
*/
typedef struct _exlcm_location_t_subscription_t exlcm_location_t_subscription_t;
/**
* Prototype for a callback function invoked when a message of type
* exlcm_location_t is received.
*/
typedef void(*exlcm_location_t_handler_t)(const lcm_recv_buf_t *rbuf,
const char *channel, const exlcm_location_t *msg, void *userdata);
/**
* Publish a message of type exlcm_location_t using LCM.
*
* @param lcm The LCM instance to publish with.
* @param channel The channel to publish on.
* @param msg The message to publish.
* @return 0 on success, <0 on error. Success means LCM has transferred
* responsibility of the message data to the OS.
*/
int exlcm_location_t_publish(lcm_t *lcm, const char *channel, const exlcm_location_t *msg);
/**
* Subscribe to messages of type exlcm_location_t using LCM.
*
* @param lcm The LCM instance to subscribe with.
* @param channel The channel to subscribe to.
* @param handler The callback function invoked by LCM when a message is received.
* This function is invoked by LCM during calls to lcm_handle() and
* lcm_handle_timeout().
* @param userdata An opaque pointer passed to @p handler when it is invoked.
* @return 0 on success, <0 if an error occured
*/
exlcm_location_t_subscription_t* exlcm_location_t_subscribe(lcm_t *lcm, const char *channel, exlcm_location_t_handler_t handler, void *userdata);
/**
* Removes and destroys a subscription created by exlcm_location_t_subscribe()
*/
int exlcm_location_t_unsubscribe(lcm_t *lcm, exlcm_location_t_subscription_t* hid);
/**
* Sets the queue capacity for a subscription.
* Some LCM providers (e.g., the default multicast provider) are implemented
* using a background receive thread that constantly revceives messages from
* the network. As these messages are received, they are buffered on
* per-subscription queues until dispatched by lcm_handle(). This function
* how many messages are queued before dropping messages.
*
* @param subs the subscription to modify.
* @param num_messages The maximum number of messages to queue
* on the subscription.
* @return 0 on success, <0 if an error occured
*/
int exlcm_location_t_subscription_set_queue_capacity(exlcm_location_t_subscription_t* subs,
int num_messages);
/**
* Encode a message of type exlcm_location_t into binary form.
*
* @param buf The output buffer.
* @param offset Encoding starts at this byte offset into @p buf.
* @param maxlen Maximum number of bytes to write. This should generally
* be equal to exlcm_location_t_encoded_size().
* @param msg The message to encode.
* @return The number of bytes encoded, or <0 if an error occured.
*/
int exlcm_location_t_encode(void *buf, int offset, int maxlen, const exlcm_location_t *p);
/**
* Decode a message of type exlcm_location_t from binary form.
* When decoding messages containing strings or variable-length arrays, this
* function may allocate memory. When finished with the decoded message,
* release allocated resources with exlcm_location_t_decode_cleanup().
*
* @param buf The buffer containing the encoded message
* @param offset The byte offset into @p buf where the encoded message starts.
* @param maxlen The maximum number of bytes to read while decoding.
* @param msg Output parameter where the decoded message is stored
* @return The number of bytes decoded, or <0 if an error occured.
*/
int exlcm_location_t_decode(const void *buf, int offset, int maxlen, exlcm_location_t *msg);
/**
* Release resources allocated by exlcm_location_t_decode()
* @return 0
*/
int exlcm_location_t_decode_cleanup(exlcm_location_t *p);
/**
* Check how many bytes are required to encode a message of type exlcm_location_t
*/
int exlcm_location_t_encoded_size(const exlcm_location_t *p);
// LCM support functions. Users should not call these
int64_t __exlcm_location_t_get_hash(void);
uint64_t __exlcm_location_t_hash_recursive(const __lcm_hash_ptr *p);
int __exlcm_location_t_encode_array(void *buf, int offset, int maxlen, const exlcm_location_t *p, int elements);
int __exlcm_location_t_decode_array(const void *buf, int offset, int maxlen, exlcm_location_t *p, int elements);
int __exlcm_location_t_decode_array_cleanup(exlcm_location_t *p, int elements);
int __exlcm_location_t_encoded_array_size(const exlcm_location_t *p, int elements);
int __exlcm_location_t_clone_array(const exlcm_location_t *p, exlcm_location_t *q, int elements);
#ifdef __cplusplus
}
#endif
#endif