File: example_t.cs

package info (click to toggle)
lcm 1.3.1%2Brepack1-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 2,788 kB
  • sloc: ansic: 16,184; java: 6,843; cs: 2,266; cpp: 1,594; python: 989; makefile: 348; xml: 252; sh: 59
file content (157 lines) | stat: -rw-r--r-- 4,552 bytes parent folder | download | duplicates (5)
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
/* LCM type definition class file
 * This file was automatically generated by lcm-gen
 * DO NOT MODIFY BY HAND!!!!
 */

using System;
using System.Collections.Generic;
using System.IO;
using LCM.LCM;
 
namespace exlcm
{
    public sealed class example_t : LCM.LCM.LCMEncodable
    {
        public long timestamp;
        public double[] position;
        public double[] orientation;
        public int num_ranges;
        public short[] ranges;
        public String name;
        public bool enabled;
 
        public example_t()
        {
            position = new double[3];
            orientation = new double[4];
        }
 
        public static readonly ulong LCM_FINGERPRINT;
        public static readonly ulong LCM_FINGERPRINT_BASE = 0x1baa9e29b0fbaa8bL;
 
        static example_t()
        {
            LCM_FINGERPRINT = _hashRecursive(new List<String>());
        }
 
        public static ulong _hashRecursive(List<String> classes)
        {
            if (classes.Contains("exlcm.example_t"))
                return 0L;
 
            classes.Add("exlcm.example_t");
            ulong hash = LCM_FINGERPRINT_BASE
                ;
            classes.RemoveAt(classes.Count - 1);
            return (hash<<1) + ((hash>>63)&1);
        }
 
        public void Encode(LCMDataOutputStream outs)
        {
            outs.Write((long) LCM_FINGERPRINT);
            _encodeRecursive(outs);
        }
 
        public void _encodeRecursive(LCMDataOutputStream outs)
        {
            byte[] __strbuf = null;
            outs.Write(this.timestamp); 
 
            for (int a = 0; a < 3; a++) {
                outs.Write(this.position[a]); 
            }
 
            for (int a = 0; a < 4; a++) {
                outs.Write(this.orientation[a]); 
            }
 
            outs.Write(this.num_ranges); 
 
            for (int a = 0; a < this.num_ranges; a++) {
                outs.Write(this.ranges[a]); 
            }
 
            __strbuf = System.Text.Encoding.GetEncoding("US-ASCII").GetBytes(this.name); outs.Write(__strbuf.Length+1); outs.Write(__strbuf, 0, __strbuf.Length); outs.Write((byte) 0); 
 
            outs.Write(this.enabled); 
 
        }
 
        public example_t(byte[] data) : this(new LCMDataInputStream(data))
        {
        }
 
        public example_t(LCMDataInputStream ins)
        {
            if ((ulong) ins.ReadInt64() != LCM_FINGERPRINT)
                throw new System.IO.IOException("LCM Decode error: bad fingerprint");
 
            _decodeRecursive(ins);
        }
 
        public static exlcm.example_t _decodeRecursiveFactory(LCMDataInputStream ins)
        {
            exlcm.example_t o = new exlcm.example_t();
            o._decodeRecursive(ins);
            return o;
        }
 
        public void _decodeRecursive(LCMDataInputStream ins)
        {
            byte[] __strbuf = null;
            this.timestamp = ins.ReadInt64();
 
            this.position = new double[(int) 3];
            for (int a = 0; a < 3; a++) {
                this.position[a] = ins.ReadDouble();
            }
 
            this.orientation = new double[(int) 4];
            for (int a = 0; a < 4; a++) {
                this.orientation[a] = ins.ReadDouble();
            }
 
            this.num_ranges = ins.ReadInt32();
 
            this.ranges = new short[(int) num_ranges];
            for (int a = 0; a < this.num_ranges; a++) {
                this.ranges[a] = ins.ReadInt16();
            }
 
            __strbuf = new byte[ins.ReadInt32()-1]; ins.ReadFully(__strbuf); ins.ReadByte(); this.name = System.Text.Encoding.GetEncoding("US-ASCII").GetString(__strbuf);
 
            this.enabled = ins.ReadBoolean();
 
        }
 
        public exlcm.example_t Copy()
        {
            exlcm.example_t outobj = new exlcm.example_t();
            outobj.timestamp = this.timestamp;
 
            outobj.position = new double[(int) 3];
            for (int a = 0; a < 3; a++) {
                outobj.position[a] = this.position[a];
            }
 
            outobj.orientation = new double[(int) 4];
            for (int a = 0; a < 4; a++) {
                outobj.orientation[a] = this.orientation[a];
            }
 
            outobj.num_ranges = this.num_ranges;
 
            outobj.ranges = new short[(int) num_ranges];
            for (int a = 0; a < this.num_ranges; a++) {
                outobj.ranges[a] = this.ranges[a];
            }
 
            outobj.name = this.name;
 
            outobj.enabled = this.enabled;
 
            return outobj;
        }
    }
}