/
PointField.gen.go
172 lines (144 loc) · 6.08 KB
/
PointField.gen.go
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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
/*
This file is part of rclgo
Copyright © 2021 Technology Innovation Institute, United Arab Emirates
Licensed under the Apache License, Version 2.0 (the "License");
http://www.apache.org/licenses/LICENSE-2.0
*/
/*
THIS FILE IS AUTOGENERATED BY 'rclgo-gen generate'
*/
package sensor_msgs_msg
import (
"unsafe"
"github.com/TIERS/rclgo/pkg/rclgo/types"
"github.com/TIERS/rclgo/pkg/rclgo/typemap"
primitives "github.com/TIERS/rclgo/pkg/rclgo/primitives"
)
/*
#cgo LDFLAGS: -L/opt/ros/foxy/lib -Wl,-rpath=/opt/ros/foxy/lib -lrcl -lrosidl_runtime_c -lrosidl_typesupport_c -lrcutils -lrmw_implementation
#cgo LDFLAGS: -lsensor_msgs__rosidl_typesupport_c -lsensor_msgs__rosidl_generator_c
#cgo CFLAGS: -I/opt/ros/foxy/include
#include <rosidl_runtime_c/message_type_support_struct.h>
#include <sensor_msgs/msg/point_field.h>
*/
import "C"
func init() {
typemap.RegisterMessage("sensor_msgs/PointField", PointFieldTypeSupport)
}
const (
PointField_INT8 uint8 = 1// This message holds the description of one point entry in thePointCloud2 message format.
PointField_UINT8 uint8 = 2// This message holds the description of one point entry in thePointCloud2 message format.
PointField_INT16 uint8 = 3// This message holds the description of one point entry in thePointCloud2 message format.
PointField_UINT16 uint8 = 4// This message holds the description of one point entry in thePointCloud2 message format.
PointField_INT32 uint8 = 5// This message holds the description of one point entry in thePointCloud2 message format.
PointField_UINT32 uint8 = 6// This message holds the description of one point entry in thePointCloud2 message format.
PointField_FLOAT32 uint8 = 7// This message holds the description of one point entry in thePointCloud2 message format.
PointField_FLOAT64 uint8 = 8// This message holds the description of one point entry in thePointCloud2 message format.
)
// Do not create instances of this type directly. Always use NewPointField
// function instead.
type PointField struct {
Name string `yaml:"name"`// Name of field. Common PointField names are x, y, z, intensity, rgb, rgba
Offset uint32 `yaml:"offset"`// Offset from start of point struct. Common PointField names are x, y, z, intensity, rgb, rgba
Datatype uint8 `yaml:"datatype"`// Datatype enumeration, see above. Common PointField names are x, y, z, intensity, rgb, rgba
Count uint32 `yaml:"count"`// How many elements in the field. Common PointField names are x, y, z, intensity, rgb, rgba
}
// NewPointField creates a new PointField with default values.
func NewPointField() *PointField {
self := PointField{}
self.SetDefaults()
return &self
}
func (t *PointField) Clone() *PointField {
c := &PointField{}
c.Name = t.Name
c.Offset = t.Offset
c.Datatype = t.Datatype
c.Count = t.Count
return c
}
func (t *PointField) CloneMsg() types.Message {
return t.Clone()
}
func (t *PointField) SetDefaults() {
t.Name = ""
t.Offset = 0
t.Datatype = 0
t.Count = 0
}
// ClonePointFieldSlice clones src to dst by calling Clone for each element in
// src. Panics if len(dst) < len(src).
func ClonePointFieldSlice(dst, src []PointField) {
for i := range src {
dst[i] = *src[i].Clone()
}
}
// Modifying this variable is undefined behavior.
var PointFieldTypeSupport types.MessageTypeSupport = _PointFieldTypeSupport{}
type _PointFieldTypeSupport struct{}
func (t _PointFieldTypeSupport) New() types.Message {
return NewPointField()
}
func (t _PointFieldTypeSupport) PrepareMemory() unsafe.Pointer { //returns *C.sensor_msgs__msg__PointField
return (unsafe.Pointer)(C.sensor_msgs__msg__PointField__create())
}
func (t _PointFieldTypeSupport) ReleaseMemory(pointer_to_free unsafe.Pointer) {
C.sensor_msgs__msg__PointField__destroy((*C.sensor_msgs__msg__PointField)(pointer_to_free))
}
func (t _PointFieldTypeSupport) AsCStruct(dst unsafe.Pointer, msg types.Message) {
m := msg.(*PointField)
mem := (*C.sensor_msgs__msg__PointField)(dst)
primitives.StringAsCStruct(unsafe.Pointer(&mem.name), m.Name)
mem.offset = C.uint32_t(m.Offset)
mem.datatype = C.uint8_t(m.Datatype)
mem.count = C.uint32_t(m.Count)
}
func (t _PointFieldTypeSupport) AsGoStruct(msg types.Message, ros2_message_buffer unsafe.Pointer) {
m := msg.(*PointField)
mem := (*C.sensor_msgs__msg__PointField)(ros2_message_buffer)
primitives.StringAsGoStruct(&m.Name, unsafe.Pointer(&mem.name))
m.Offset = uint32(mem.offset)
m.Datatype = uint8(mem.datatype)
m.Count = uint32(mem.count)
}
func (t _PointFieldTypeSupport) TypeSupport() unsafe.Pointer {
return unsafe.Pointer(C.rosidl_typesupport_c__get_message_type_support_handle__sensor_msgs__msg__PointField())
}
type CPointField = C.sensor_msgs__msg__PointField
type CPointField__Sequence = C.sensor_msgs__msg__PointField__Sequence
func PointField__Sequence_to_Go(goSlice *[]PointField, cSlice CPointField__Sequence) {
if cSlice.size == 0 {
return
}
*goSlice = make([]PointField, int64(cSlice.size))
for i := 0; i < int(cSlice.size); i++ {
cIdx := (*C.sensor_msgs__msg__PointField__Sequence)(unsafe.Pointer(
uintptr(unsafe.Pointer(cSlice.data)) + (C.sizeof_struct_sensor_msgs__msg__PointField * uintptr(i)),
))
PointFieldTypeSupport.AsGoStruct(&(*goSlice)[i], unsafe.Pointer(cIdx))
}
}
func PointField__Sequence_to_C(cSlice *CPointField__Sequence, goSlice []PointField) {
if len(goSlice) == 0 {
return
}
cSlice.data = (*C.sensor_msgs__msg__PointField)(C.malloc((C.size_t)(C.sizeof_struct_sensor_msgs__msg__PointField * uintptr(len(goSlice)))))
cSlice.capacity = C.size_t(len(goSlice))
cSlice.size = cSlice.capacity
for i, v := range goSlice {
cIdx := (*C.sensor_msgs__msg__PointField)(unsafe.Pointer(
uintptr(unsafe.Pointer(cSlice.data)) + (C.sizeof_struct_sensor_msgs__msg__PointField * uintptr(i)),
))
PointFieldTypeSupport.AsCStruct(unsafe.Pointer(cIdx), &v)
}
}
func PointField__Array_to_Go(goSlice []PointField, cSlice []CPointField) {
for i := 0; i < len(cSlice); i++ {
PointFieldTypeSupport.AsGoStruct(&goSlice[i], unsafe.Pointer(&cSlice[i]))
}
}
func PointField__Array_to_C(cSlice []CPointField, goSlice []PointField) {
for i := 0; i < len(goSlice); i++ {
PointFieldTypeSupport.AsCStruct(unsafe.Pointer(&cSlice[i]), &goSlice[i])
}
}