"""LCM type definitions
This file automatically generated by lcm.
DO NOT MODIFY BY HAND!!!!
"""

try:
    import cStringIO.StringIO as BytesIO
except ImportError:
    from io import BytesIO
import struct

class vn_100_extra_t(object):
    __slots__ = ["utime", "timeGps", "timeSyncIn", "latitudeLongitudeAltitude", "velocity", "deltaTime", "deltaTheta", "deltaVelocity", "timeGpsPps"]

    __typenames__ = ["int64_t", "int64_t", "int64_t", "double", "double", "double", "double", "double", "int64_t"]

    __dimensions__ = [None, None, None, [3], [3], None, [3], [3], None]

    def __init__(self):
        self.utime = 0
        self.timeGps = 0
        self.timeSyncIn = 0
        self.latitudeLongitudeAltitude = [ 0.0 for dim0 in range(3) ]
        self.velocity = [ 0.0 for dim0 in range(3) ]
        self.deltaTime = 0.0
        self.deltaTheta = [ 0.0 for dim0 in range(3) ]
        self.deltaVelocity = [ 0.0 for dim0 in range(3) ]
        self.timeGpsPps = 0

    def encode(self):
        buf = BytesIO()
        buf.write(vn_100_extra_t._get_packed_fingerprint())
        self._encode_one(buf)
        return buf.getvalue()

    def _encode_one(self, buf):
        buf.write(struct.pack(">qqq", self.utime, self.timeGps, self.timeSyncIn))
        buf.write(struct.pack('>3d', *self.latitudeLongitudeAltitude[:3]))
        buf.write(struct.pack('>3d', *self.velocity[:3]))
        buf.write(struct.pack(">d", self.deltaTime))
        buf.write(struct.pack('>3d', *self.deltaTheta[:3]))
        buf.write(struct.pack('>3d', *self.deltaVelocity[:3]))
        buf.write(struct.pack(">q", self.timeGpsPps))

    def decode(data):
        if hasattr(data, 'read'):
            buf = data
        else:
            buf = BytesIO(data)
        if buf.read(8) != vn_100_extra_t._get_packed_fingerprint():
            raise ValueError("Decode error")
        return vn_100_extra_t._decode_one(buf)
    decode = staticmethod(decode)

    def _decode_one(buf):
        self = vn_100_extra_t()
        self.utime, self.timeGps, self.timeSyncIn = struct.unpack(">qqq", buf.read(24))
        self.latitudeLongitudeAltitude = struct.unpack('>3d', buf.read(24))
        self.velocity = struct.unpack('>3d', buf.read(24))
        self.deltaTime = struct.unpack(">d", buf.read(8))[0]
        self.deltaTheta = struct.unpack('>3d', buf.read(24))
        self.deltaVelocity = struct.unpack('>3d', buf.read(24))
        self.timeGpsPps = struct.unpack(">q", buf.read(8))[0]
        return self
    _decode_one = staticmethod(_decode_one)

    def _get_hash_recursive(parents):
        if vn_100_extra_t in parents: return 0
        tmphash = (0x2c62f85d2431d5ef) & 0xffffffffffffffff
        tmphash  = (((tmphash<<1)&0xffffffffffffffff) + (tmphash>>63)) & 0xffffffffffffffff
        return tmphash
    _get_hash_recursive = staticmethod(_get_hash_recursive)
    _packed_fingerprint = None

    def _get_packed_fingerprint():
        if vn_100_extra_t._packed_fingerprint is None:
            vn_100_extra_t._packed_fingerprint = struct.pack(">Q", vn_100_extra_t._get_hash_recursive([]))
        return vn_100_extra_t._packed_fingerprint
    _get_packed_fingerprint = staticmethod(_get_packed_fingerprint)

    def get_hash(self):
        """Get the LCM hash of the struct"""
        return struct.unpack(">Q", vn_100_extra_t._get_packed_fingerprint())[0]

