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

import cStringIO as StringIO
import struct

import command2_t

class sheriff_cmd2_t(object):
    __slots__ = ["cmd", "desired_runid", "force_quit", "sheriff_id"]

    def __init__(self):
        self.cmd = None
        self.desired_runid = 0
        self.force_quit = 0
        self.sheriff_id = 0

    def encode(self):
        buf = StringIO.StringIO()
        buf.write(sheriff_cmd2_t._get_packed_fingerprint())
        self._encode_one(buf)
        return buf.getvalue()

    def _encode_one(self, buf):
        assert self.cmd._get_packed_fingerprint() == command2_t.command2_t._get_packed_fingerprint()
        self.cmd._encode_one(buf)
        buf.write(struct.pack(">ibi", self.desired_runid, self.force_quit, self.sheriff_id))

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

    def _decode_one(buf):
        self = sheriff_cmd2_t()
        self.cmd = command2_t.command2_t._decode_one(buf)
        self.desired_runid, self.force_quit, self.sheriff_id = struct.unpack(">ibi", buf.read(9))
        return self
    _decode_one = staticmethod(_decode_one)

    _hash = None
    def _get_hash_recursive(parents):
        if sheriff_cmd2_t in parents: return 0
        newparents = parents + [sheriff_cmd2_t]
        tmphash = (0xc749fe5a5de67849+ command2_t.command2_t._get_hash_recursive(newparents)) & 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 sheriff_cmd2_t._packed_fingerprint is None:
            sheriff_cmd2_t._packed_fingerprint = struct.pack(">Q", sheriff_cmd2_t._get_hash_recursive([]))
        return sheriff_cmd2_t._packed_fingerprint
    _get_packed_fingerprint = staticmethod(_get_packed_fingerprint)


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

import cStringIO as StringIO
import struct

import command2_t

class sheriff_cmd2_t(object):
    __slots__ = ["cmd", "desired_runid", "force_quit", "sheriff_id"]

    def __init__(self):
        self.cmd = None
        self.desired_runid = 0
        self.force_quit = 0
        self.sheriff_id = 0

    def encode(self):
        buf = StringIO.StringIO()
        buf.write(sheriff_cmd2_t._get_packed_fingerprint())
        self._encode_one(buf)
        return buf.getvalue()

    def _encode_one(self, buf):
        assert self.cmd._get_packed_fingerprint() == command2_t.command2_t._get_packed_fingerprint()
        self.cmd._encode_one(buf)
        buf.write(struct.pack(">ibi", self.desired_runid, self.force_quit, self.sheriff_id))

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

    def _decode_one(buf):
        self = sheriff_cmd2_t()
        self.cmd = command2_t.command2_t._decode_one(buf)
        self.desired_runid, self.force_quit, self.sheriff_id = struct.unpack(">ibi", buf.read(9))
        return self
    _decode_one = staticmethod(_decode_one)

    _hash = None
    def _get_hash_recursive(parents):
        if sheriff_cmd2_t in parents: return 0
        newparents = parents + [sheriff_cmd2_t]
        tmphash = (0xc749fe5a5de67849+ command2_t.command2_t._get_hash_recursive(newparents)) & 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 sheriff_cmd2_t._packed_fingerprint is None:
            sheriff_cmd2_t._packed_fingerprint = struct.pack(">Q", sheriff_cmd2_t._get_hash_recursive([]))
        return sheriff_cmd2_t._packed_fingerprint
    _get_packed_fingerprint = staticmethod(_get_packed_fingerprint)


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