/* 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 semisorted_arnerve
{
    public sealed class user_update_t : LCM.LCM.LCMEncodable
    {
        public long timestamp;
        public String name;
        public byte role;
        public String pilotcraft;
        public String plannergroup;
        public semisorted_arnerve.kinect_update_t kinect;
        public semisorted_arnerve.oculus_update_t oculus;
        public semisorted_arnerve.wearable_update_t wearable;
 
        public user_update_t()
        {
        }
 
        public static readonly ulong LCM_FINGERPRINT;
        public static readonly ulong LCM_FINGERPRINT_BASE = 0x7771dcc02708970eL;
 
        public const int Observer = 0;
        public const int Pilot = 1;
        public const int Planner = 2;
        public const int Commander = 3;

        static user_update_t()
        {
            LCM_FINGERPRINT = _hashRecursive(new List<String>());
        }
 
        public static ulong _hashRecursive(List<String> classes)
        {
            if (classes.Contains("semisorted_arnerve.user_update_t"))
                return 0L;
 
            classes.Add("semisorted_arnerve.user_update_t");
            ulong hash = LCM_FINGERPRINT_BASE
                 + semisorted_arnerve.kinect_update_t._hashRecursive(classes)
                 + semisorted_arnerve.oculus_update_t._hashRecursive(classes)
                 + semisorted_arnerve.wearable_update_t._hashRecursive(classes)
                ;
            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); 
 
            __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.role); 
 
            __strbuf = System.Text.Encoding.GetEncoding("US-ASCII").GetBytes(this.pilotcraft); outs.Write(__strbuf.Length+1); outs.Write(__strbuf, 0, __strbuf.Length); outs.Write((byte) 0); 
 
            __strbuf = System.Text.Encoding.GetEncoding("US-ASCII").GetBytes(this.plannergroup); outs.Write(__strbuf.Length+1); outs.Write(__strbuf, 0, __strbuf.Length); outs.Write((byte) 0); 
 
            this.kinect._encodeRecursive(outs); 
 
            this.oculus._encodeRecursive(outs); 
 
            this.wearable._encodeRecursive(outs); 
 
        }
 
        public user_update_t(byte[] data) : this(new LCMDataInputStream(data))
        {
        }
 
        public user_update_t(LCMDataInputStream ins)
        {
            if ((ulong) ins.ReadInt64() != LCM_FINGERPRINT)
                throw new System.IO.IOException("LCM Decode error: bad fingerprint");
 
            _decodeRecursive(ins);
        }
 
        public static semisorted_arnerve.user_update_t _decodeRecursiveFactory(LCMDataInputStream ins)
        {
            semisorted_arnerve.user_update_t o = new semisorted_arnerve.user_update_t();
            o._decodeRecursive(ins);
            return o;
        }
 
        public void _decodeRecursive(LCMDataInputStream ins)
        {
            byte[] __strbuf = null;
            this.timestamp = ins.ReadInt64();
 
            __strbuf = new byte[ins.ReadInt32()-1]; ins.ReadFully(__strbuf); ins.ReadByte(); this.name = System.Text.Encoding.GetEncoding("US-ASCII").GetString(__strbuf);
 
            this.role = ins.ReadByte();
 
            __strbuf = new byte[ins.ReadInt32()-1]; ins.ReadFully(__strbuf); ins.ReadByte(); this.pilotcraft = System.Text.Encoding.GetEncoding("US-ASCII").GetString(__strbuf);
 
            __strbuf = new byte[ins.ReadInt32()-1]; ins.ReadFully(__strbuf); ins.ReadByte(); this.plannergroup = System.Text.Encoding.GetEncoding("US-ASCII").GetString(__strbuf);
 
            this.kinect = semisorted_arnerve.kinect_update_t._decodeRecursiveFactory(ins);
 
            this.oculus = semisorted_arnerve.oculus_update_t._decodeRecursiveFactory(ins);
 
            this.wearable = semisorted_arnerve.wearable_update_t._decodeRecursiveFactory(ins);
 
        }
 
        public semisorted_arnerve.user_update_t Copy()
        {
            semisorted_arnerve.user_update_t outobj = new semisorted_arnerve.user_update_t();
            outobj.timestamp = this.timestamp;
 
            outobj.name = this.name;
 
            outobj.role = this.role;
 
            outobj.pilotcraft = this.pilotcraft;
 
            outobj.plannergroup = this.plannergroup;
 
            outobj.kinect = this.kinect.Copy();
 
            outobj.oculus = this.oculus.Copy();
 
            outobj.wearable = this.wearable.Copy();
 
            return outobj;
        }
    }
}

