"""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 recorder_status(object):
    __slots__ = ["timestamp", "frameRate", "estimatedFPS", "exposureTime", "gain", "recording", "cameraConnected", "processorMode", "frameQueueSize", "writeQueueSize", "procQueueSize", "recordedFrames"]

    __typenames__ = ["int64_t", "int32_t", "double", "double", "double", "int8_t", "int8_t", "int8_t", "int32_t", "int32_t", "int32_t", "int32_t"]

    __dimensions__ = [None, None, None, None, None, None, None, None, None, None, None, None]

    def __init__(self):
        self.timestamp = 0
        self.frameRate = 0
        self.estimatedFPS = 0.0
        self.exposureTime = 0.0
        self.gain = 0.0
        self.recording = 0
        self.cameraConnected = 0
        self.processorMode = 0
        self.frameQueueSize = 0
        self.writeQueueSize = 0
        self.procQueueSize = 0
        self.recordedFrames = 0

    def encode(self):
        buf = BytesIO()
        buf.write(recorder_status._get_packed_fingerprint())
        self._encode_one(buf)
        return buf.getvalue()

    def _encode_one(self, buf):
        buf.write(struct.pack(">qidddbbbiiii", self.timestamp, self.frameRate, self.estimatedFPS, self.exposureTime, self.gain, self.recording, self.cameraConnected, self.processorMode, self.frameQueueSize, self.writeQueueSize, self.procQueueSize, self.recordedFrames))

    def decode(data):
        if hasattr(data, 'read'):
            buf = data
        else:
            buf = BytesIO(data)
        if buf.read(8) != recorder_status._get_packed_fingerprint():
            raise ValueError("Decode error")
        return recorder_status._decode_one(buf)
    decode = staticmethod(decode)

    def _decode_one(buf):
        self = recorder_status()
        self.timestamp, self.frameRate, self.estimatedFPS, self.exposureTime, self.gain, self.recording, self.cameraConnected, self.processorMode, self.frameQueueSize, self.writeQueueSize, self.procQueueSize, self.recordedFrames = struct.unpack(">qidddbbbiiii", buf.read(55))
        return self
    _decode_one = staticmethod(_decode_one)

    _hash = None
    def _get_hash_recursive(parents):
        if recorder_status in parents: return 0
        tmphash = (0xe2c4102d1fe76acb) & 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 recorder_status._packed_fingerprint is None:
            recorder_status._packed_fingerprint = struct.pack(">Q", recorder_status._get_hash_recursive([]))
        return recorder_status._packed_fingerprint
    _get_packed_fingerprint = staticmethod(_get_packed_fingerprint)

