#
# Autogenerated by Thrift Compiler (0.21.0)
#
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
#
#  options string: py
#

from thrift.Thrift import TType, TMessageType, TFrozenDict, TException, TApplicationException
from thrift.protocol.TProtocol import TProtocolException
from thrift.TRecursive import fix_spec
from uuid import UUID

import sys

from thrift.transport import TTransport
all_structs = []


class BaseTypes(object):
    BOOL = 0
    BYTE = 1
    SHORT = 2
    INT = 3
    LONG = 4
    DOUBLE = 5
    STRING = 6
    COMPLEX = 7
    F32VECTOR = 8
    F64VECTOR = 9
    S64VECTOR = 10
    S32VECTOR = 11
    S16VECTOR = 12
    S8VECTOR = 13
    C32VECTOR = 14

    _VALUES_TO_NAMES = {
        0: "BOOL",
        1: "BYTE",
        2: "SHORT",
        3: "INT",
        4: "LONG",
        5: "DOUBLE",
        6: "STRING",
        7: "COMPLEX",
        8: "F32VECTOR",
        9: "F64VECTOR",
        10: "S64VECTOR",
        11: "S32VECTOR",
        12: "S16VECTOR",
        13: "S8VECTOR",
        14: "C32VECTOR",
    }

    _NAMES_TO_VALUES = {
        "BOOL": 0,
        "BYTE": 1,
        "SHORT": 2,
        "INT": 3,
        "LONG": 4,
        "DOUBLE": 5,
        "STRING": 6,
        "COMPLEX": 7,
        "F32VECTOR": 8,
        "F64VECTOR": 9,
        "S64VECTOR": 10,
        "S32VECTOR": 11,
        "S16VECTOR": 12,
        "S8VECTOR": 13,
        "C32VECTOR": 14,
    }


class KnobType(object):
    KNOBBOOL = 0
    KNOBCHAR = 1
    KNOBINT = 2
    KNOBDOUBLE = 3
    KNOBSTRING = 4
    KNOBLONG = 5
    KNOBVECBOOL = 6
    KNOBVECCHAR = 7
    KNOBVECINT = 8
    KNOBVECDOUBLE = 9
    KNOBVECSTRING = 10
    KNOBVECLONG = 11
    KNOBSHORT = 12

    _VALUES_TO_NAMES = {
        0: "KNOBBOOL",
        1: "KNOBCHAR",
        2: "KNOBINT",
        3: "KNOBDOUBLE",
        4: "KNOBSTRING",
        5: "KNOBLONG",
        6: "KNOBVECBOOL",
        7: "KNOBVECCHAR",
        8: "KNOBVECINT",
        9: "KNOBVECDOUBLE",
        10: "KNOBVECSTRING",
        11: "KNOBVECLONG",
        12: "KNOBSHORT",
    }

    _NAMES_TO_VALUES = {
        "KNOBBOOL": 0,
        "KNOBCHAR": 1,
        "KNOBINT": 2,
        "KNOBDOUBLE": 3,
        "KNOBSTRING": 4,
        "KNOBLONG": 5,
        "KNOBVECBOOL": 6,
        "KNOBVECCHAR": 7,
        "KNOBVECINT": 8,
        "KNOBVECDOUBLE": 9,
        "KNOBVECSTRING": 10,
        "KNOBVECLONG": 11,
        "KNOBSHORT": 12,
    }


class complex(object):
    """
    Attributes:
     - re
     - im

    """
    thrift_spec = None


    def __init__(self, re = None, im = None,):
        self.re = re
        self.im = im

    def read(self, iprot):
        if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
            iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec])
            return
        iprot.readStructBegin()
        while True:
            (fname, ftype, fid) = iprot.readFieldBegin()
            if ftype == TType.STOP:
                break
            if fid == 1:
                if ftype == TType.DOUBLE:
                    self.re = iprot.readDouble()
                else:
                    iprot.skip(ftype)
            elif fid == 2:
                if ftype == TType.DOUBLE:
                    self.im = iprot.readDouble()
                else:
                    iprot.skip(ftype)
            else:
                iprot.skip(ftype)
            iprot.readFieldEnd()
        iprot.readStructEnd()

    def write(self, oprot):
        self.validate()
        if oprot._fast_encode is not None and self.thrift_spec is not None:
            oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))
            return
        oprot.writeStructBegin('complex')
        if self.re is not None:
            oprot.writeFieldBegin('re', TType.DOUBLE, 1)
            oprot.writeDouble(self.re)
            oprot.writeFieldEnd()
        if self.im is not None:
            oprot.writeFieldBegin('im', TType.DOUBLE, 2)
            oprot.writeDouble(self.im)
            oprot.writeFieldEnd()
        oprot.writeFieldStop()
        oprot.writeStructEnd()

    def validate(self):
        return

    def __repr__(self):
        L = ['%s=%r' % (key, value)
             for key, value in self.__dict__.items()]
        return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

    def __eq__(self, other):
        return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

    def __ne__(self, other):
        return not (self == other)


class KnobBase(object):
    """
    Attributes:
     - a_bool
     - a_byte
     - a_short
     - a_int
     - a_long
     - a_double
     - a_string
     - a_complex
     - a_f32vector
     - a_f64vector
     - a_s64vector
     - a_s32vector
     - a_s16vector
     - a_s8vector
     - a_c32vector

    """
    thrift_spec = None


    def __init__(self, a_bool = None, a_byte = None, a_short = None, a_int = None, a_long = None, a_double = None, a_string = None, a_complex = None, a_f32vector = None, a_f64vector = None, a_s64vector = None, a_s32vector = None, a_s16vector = None, a_s8vector = None, a_c32vector = None,):
        self.a_bool = a_bool
        self.a_byte = a_byte
        self.a_short = a_short
        self.a_int = a_int
        self.a_long = a_long
        self.a_double = a_double
        self.a_string = a_string
        self.a_complex = a_complex
        self.a_f32vector = a_f32vector
        self.a_f64vector = a_f64vector
        self.a_s64vector = a_s64vector
        self.a_s32vector = a_s32vector
        self.a_s16vector = a_s16vector
        self.a_s8vector = a_s8vector
        self.a_c32vector = a_c32vector

    def read(self, iprot):
        if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
            iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec])
            return
        iprot.readStructBegin()
        while True:
            (fname, ftype, fid) = iprot.readFieldBegin()
            if ftype == TType.STOP:
                break
            if fid == 1:
                if ftype == TType.BOOL:
                    self.a_bool = iprot.readBool()
                else:
                    iprot.skip(ftype)
            elif fid == 2:
                if ftype == TType.BYTE:
                    self.a_byte = iprot.readByte()
                else:
                    iprot.skip(ftype)
            elif fid == 3:
                if ftype == TType.I16:
                    self.a_short = iprot.readI16()
                else:
                    iprot.skip(ftype)
            elif fid == 4:
                if ftype == TType.I32:
                    self.a_int = iprot.readI32()
                else:
                    iprot.skip(ftype)
            elif fid == 5:
                if ftype == TType.I64:
                    self.a_long = iprot.readI64()
                else:
                    iprot.skip(ftype)
            elif fid == 6:
                if ftype == TType.DOUBLE:
                    self.a_double = iprot.readDouble()
                else:
                    iprot.skip(ftype)
            elif fid == 7:
                if ftype == TType.STRING:
                    self.a_string = iprot.readString().decode('utf-8', errors='replace') if sys.version_info[0] == 2 else iprot.readString()
                else:
                    iprot.skip(ftype)
            elif fid == 8:
                if ftype == TType.STRUCT:
                    self.a_complex = complex()
                    self.a_complex.read(iprot)
                else:
                    iprot.skip(ftype)
            elif fid == 9:
                if ftype == TType.LIST:
                    self.a_f32vector = []
                    (_etype3, _size0) = iprot.readListBegin()
                    for _i4 in range(_size0):
                        _elem5 = iprot.readDouble()
                        self.a_f32vector.append(_elem5)
                    iprot.readListEnd()
                else:
                    iprot.skip(ftype)
            elif fid == 10:
                if ftype == TType.LIST:
                    self.a_f64vector = []
                    (_etype9, _size6) = iprot.readListBegin()
                    for _i10 in range(_size6):
                        _elem11 = iprot.readDouble()
                        self.a_f64vector.append(_elem11)
                    iprot.readListEnd()
                else:
                    iprot.skip(ftype)
            elif fid == 11:
                if ftype == TType.LIST:
                    self.a_s64vector = []
                    (_etype15, _size12) = iprot.readListBegin()
                    for _i16 in range(_size12):
                        _elem17 = iprot.readI64()
                        self.a_s64vector.append(_elem17)
                    iprot.readListEnd()
                else:
                    iprot.skip(ftype)
            elif fid == 12:
                if ftype == TType.LIST:
                    self.a_s32vector = []
                    (_etype21, _size18) = iprot.readListBegin()
                    for _i22 in range(_size18):
                        _elem23 = iprot.readI32()
                        self.a_s32vector.append(_elem23)
                    iprot.readListEnd()
                else:
                    iprot.skip(ftype)
            elif fid == 13:
                if ftype == TType.LIST:
                    self.a_s16vector = []
                    (_etype27, _size24) = iprot.readListBegin()
                    for _i28 in range(_size24):
                        _elem29 = iprot.readI16()
                        self.a_s16vector.append(_elem29)
                    iprot.readListEnd()
                else:
                    iprot.skip(ftype)
            elif fid == 14:
                if ftype == TType.STRING:
                    self.a_s8vector = iprot.readBinary()
                else:
                    iprot.skip(ftype)
            elif fid == 15:
                if ftype == TType.LIST:
                    self.a_c32vector = []
                    (_etype33, _size30) = iprot.readListBegin()
                    for _i34 in range(_size30):
                        _elem35 = complex()
                        _elem35.read(iprot)
                        self.a_c32vector.append(_elem35)
                    iprot.readListEnd()
                else:
                    iprot.skip(ftype)
            else:
                iprot.skip(ftype)
            iprot.readFieldEnd()
        iprot.readStructEnd()

    def write(self, oprot):
        self.validate()
        if oprot._fast_encode is not None and self.thrift_spec is not None:
            oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))
            return
        oprot.writeStructBegin('KnobBase')
        if self.a_bool is not None:
            oprot.writeFieldBegin('a_bool', TType.BOOL, 1)
            oprot.writeBool(self.a_bool)
            oprot.writeFieldEnd()
        if self.a_byte is not None:
            oprot.writeFieldBegin('a_byte', TType.BYTE, 2)
            oprot.writeByte(self.a_byte)
            oprot.writeFieldEnd()
        if self.a_short is not None:
            oprot.writeFieldBegin('a_short', TType.I16, 3)
            oprot.writeI16(self.a_short)
            oprot.writeFieldEnd()
        if self.a_int is not None:
            oprot.writeFieldBegin('a_int', TType.I32, 4)
            oprot.writeI32(self.a_int)
            oprot.writeFieldEnd()
        if self.a_long is not None:
            oprot.writeFieldBegin('a_long', TType.I64, 5)
            oprot.writeI64(self.a_long)
            oprot.writeFieldEnd()
        if self.a_double is not None:
            oprot.writeFieldBegin('a_double', TType.DOUBLE, 6)
            oprot.writeDouble(self.a_double)
            oprot.writeFieldEnd()
        if self.a_string is not None:
            oprot.writeFieldBegin('a_string', TType.STRING, 7)
            oprot.writeString(self.a_string.encode('utf-8') if sys.version_info[0] == 2 else self.a_string)
            oprot.writeFieldEnd()
        if self.a_complex is not None:
            oprot.writeFieldBegin('a_complex', TType.STRUCT, 8)
            self.a_complex.write(oprot)
            oprot.writeFieldEnd()
        if self.a_f32vector is not None:
            oprot.writeFieldBegin('a_f32vector', TType.LIST, 9)
            oprot.writeListBegin(TType.DOUBLE, len(self.a_f32vector))
            for iter36 in self.a_f32vector:
                oprot.writeDouble(iter36)
            oprot.writeListEnd()
            oprot.writeFieldEnd()
        if self.a_f64vector is not None:
            oprot.writeFieldBegin('a_f64vector', TType.LIST, 10)
            oprot.writeListBegin(TType.DOUBLE, len(self.a_f64vector))
            for iter37 in self.a_f64vector:
                oprot.writeDouble(iter37)
            oprot.writeListEnd()
            oprot.writeFieldEnd()
        if self.a_s64vector is not None:
            oprot.writeFieldBegin('a_s64vector', TType.LIST, 11)
            oprot.writeListBegin(TType.I64, len(self.a_s64vector))
            for iter38 in self.a_s64vector:
                oprot.writeI64(iter38)
            oprot.writeListEnd()
            oprot.writeFieldEnd()
        if self.a_s32vector is not None:
            oprot.writeFieldBegin('a_s32vector', TType.LIST, 12)
            oprot.writeListBegin(TType.I32, len(self.a_s32vector))
            for iter39 in self.a_s32vector:
                oprot.writeI32(iter39)
            oprot.writeListEnd()
            oprot.writeFieldEnd()
        if self.a_s16vector is not None:
            oprot.writeFieldBegin('a_s16vector', TType.LIST, 13)
            oprot.writeListBegin(TType.I16, len(self.a_s16vector))
            for iter40 in self.a_s16vector:
                oprot.writeI16(iter40)
            oprot.writeListEnd()
            oprot.writeFieldEnd()
        if self.a_s8vector is not None:
            oprot.writeFieldBegin('a_s8vector', TType.STRING, 14)
            oprot.writeBinary(self.a_s8vector)
            oprot.writeFieldEnd()
        if self.a_c32vector is not None:
            oprot.writeFieldBegin('a_c32vector', TType.LIST, 15)
            oprot.writeListBegin(TType.STRUCT, len(self.a_c32vector))
            for iter41 in self.a_c32vector:
                iter41.write(oprot)
            oprot.writeListEnd()
            oprot.writeFieldEnd()
        oprot.writeFieldStop()
        oprot.writeStructEnd()

    def validate(self):
        return

    def __repr__(self):
        L = ['%s=%r' % (key, value)
             for key, value in self.__dict__.items()]
        return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

    def __eq__(self, other):
        return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

    def __ne__(self, other):
        return not (self == other)


class Knob(object):
    """
    Attributes:
     - type
     - value

    """
    thrift_spec = None


    def __init__(self, type = None, value = None,):
        self.type = type
        self.value = value

    def read(self, iprot):
        if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
            iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec])
            return
        iprot.readStructBegin()
        while True:
            (fname, ftype, fid) = iprot.readFieldBegin()
            if ftype == TType.STOP:
                break
            if fid == 1:
                if ftype == TType.I32:
                    self.type = iprot.readI32()
                else:
                    iprot.skip(ftype)
            elif fid == 2:
                if ftype == TType.STRUCT:
                    self.value = KnobBase()
                    self.value.read(iprot)
                else:
                    iprot.skip(ftype)
            else:
                iprot.skip(ftype)
            iprot.readFieldEnd()
        iprot.readStructEnd()

    def write(self, oprot):
        self.validate()
        if oprot._fast_encode is not None and self.thrift_spec is not None:
            oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))
            return
        oprot.writeStructBegin('Knob')
        if self.type is not None:
            oprot.writeFieldBegin('type', TType.I32, 1)
            oprot.writeI32(self.type)
            oprot.writeFieldEnd()
        if self.value is not None:
            oprot.writeFieldBegin('value', TType.STRUCT, 2)
            self.value.write(oprot)
            oprot.writeFieldEnd()
        oprot.writeFieldStop()
        oprot.writeStructEnd()

    def validate(self):
        return

    def __repr__(self):
        L = ['%s=%r' % (key, value)
             for key, value in self.__dict__.items()]
        return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

    def __eq__(self, other):
        return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

    def __ne__(self, other):
        return not (self == other)


class KnobProp(object):
    """
    Attributes:
     - type
     - units
     - description
     - display
     - min
     - max
     - defaultvalue

    """
    thrift_spec = None


    def __init__(self, type = None, units = None, description = None, display = None, min = None, max = None, defaultvalue = None,):
        self.type = type
        self.units = units
        self.description = description
        self.display = display
        self.min = min
        self.max = max
        self.defaultvalue = defaultvalue

    def read(self, iprot):
        if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
            iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec])
            return
        iprot.readStructBegin()
        while True:
            (fname, ftype, fid) = iprot.readFieldBegin()
            if ftype == TType.STOP:
                break
            if fid == 1:
                if ftype == TType.I32:
                    self.type = iprot.readI32()
                else:
                    iprot.skip(ftype)
            elif fid == 2:
                if ftype == TType.STRING:
                    self.units = iprot.readString().decode('utf-8', errors='replace') if sys.version_info[0] == 2 else iprot.readString()
                else:
                    iprot.skip(ftype)
            elif fid == 3:
                if ftype == TType.STRING:
                    self.description = iprot.readString().decode('utf-8', errors='replace') if sys.version_info[0] == 2 else iprot.readString()
                else:
                    iprot.skip(ftype)
            elif fid == 4:
                if ftype == TType.I32:
                    self.display = iprot.readI32()
                else:
                    iprot.skip(ftype)
            elif fid == 5:
                if ftype == TType.STRUCT:
                    self.min = Knob()
                    self.min.read(iprot)
                else:
                    iprot.skip(ftype)
            elif fid == 6:
                if ftype == TType.STRUCT:
                    self.max = Knob()
                    self.max.read(iprot)
                else:
                    iprot.skip(ftype)
            elif fid == 7:
                if ftype == TType.STRUCT:
                    self.defaultvalue = Knob()
                    self.defaultvalue.read(iprot)
                else:
                    iprot.skip(ftype)
            else:
                iprot.skip(ftype)
            iprot.readFieldEnd()
        iprot.readStructEnd()

    def write(self, oprot):
        self.validate()
        if oprot._fast_encode is not None and self.thrift_spec is not None:
            oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))
            return
        oprot.writeStructBegin('KnobProp')
        if self.type is not None:
            oprot.writeFieldBegin('type', TType.I32, 1)
            oprot.writeI32(self.type)
            oprot.writeFieldEnd()
        if self.units is not None:
            oprot.writeFieldBegin('units', TType.STRING, 2)
            oprot.writeString(self.units.encode('utf-8') if sys.version_info[0] == 2 else self.units)
            oprot.writeFieldEnd()
        if self.description is not None:
            oprot.writeFieldBegin('description', TType.STRING, 3)
            oprot.writeString(self.description.encode('utf-8') if sys.version_info[0] == 2 else self.description)
            oprot.writeFieldEnd()
        if self.display is not None:
            oprot.writeFieldBegin('display', TType.I32, 4)
            oprot.writeI32(self.display)
            oprot.writeFieldEnd()
        if self.min is not None:
            oprot.writeFieldBegin('min', TType.STRUCT, 5)
            self.min.write(oprot)
            oprot.writeFieldEnd()
        if self.max is not None:
            oprot.writeFieldBegin('max', TType.STRUCT, 6)
            self.max.write(oprot)
            oprot.writeFieldEnd()
        if self.defaultvalue is not None:
            oprot.writeFieldBegin('defaultvalue', TType.STRUCT, 7)
            self.defaultvalue.write(oprot)
            oprot.writeFieldEnd()
        oprot.writeFieldStop()
        oprot.writeStructEnd()

    def validate(self):
        return

    def __repr__(self):
        L = ['%s=%r' % (key, value)
             for key, value in self.__dict__.items()]
        return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

    def __eq__(self, other):
        return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

    def __ne__(self, other):
        return not (self == other)
all_structs.append(complex)
complex.thrift_spec = (
    None,  # 0
    (1, TType.DOUBLE, 're', None, None, ),  # 1
    (2, TType.DOUBLE, 'im', None, None, ),  # 2
)
all_structs.append(KnobBase)
KnobBase.thrift_spec = (
    None,  # 0
    (1, TType.BOOL, 'a_bool', None, None, ),  # 1
    (2, TType.BYTE, 'a_byte', None, None, ),  # 2
    (3, TType.I16, 'a_short', None, None, ),  # 3
    (4, TType.I32, 'a_int', None, None, ),  # 4
    (5, TType.I64, 'a_long', None, None, ),  # 5
    (6, TType.DOUBLE, 'a_double', None, None, ),  # 6
    (7, TType.STRING, 'a_string', 'UTF8', None, ),  # 7
    (8, TType.STRUCT, 'a_complex', [complex, None], None, ),  # 8
    (9, TType.LIST, 'a_f32vector', (TType.DOUBLE, None, False), None, ),  # 9
    (10, TType.LIST, 'a_f64vector', (TType.DOUBLE, None, False), None, ),  # 10
    (11, TType.LIST, 'a_s64vector', (TType.I64, None, False), None, ),  # 11
    (12, TType.LIST, 'a_s32vector', (TType.I32, None, False), None, ),  # 12
    (13, TType.LIST, 'a_s16vector', (TType.I16, None, False), None, ),  # 13
    (14, TType.STRING, 'a_s8vector', 'BINARY', None, ),  # 14
    (15, TType.LIST, 'a_c32vector', (TType.STRUCT, [complex, None], False), None, ),  # 15
)
all_structs.append(Knob)
Knob.thrift_spec = (
    None,  # 0
    (1, TType.I32, 'type', None, None, ),  # 1
    (2, TType.STRUCT, 'value', [KnobBase, None], None, ),  # 2
)
all_structs.append(KnobProp)
KnobProp.thrift_spec = (
    None,  # 0
    (1, TType.I32, 'type', None, None, ),  # 1
    (2, TType.STRING, 'units', 'UTF8', None, ),  # 2
    (3, TType.STRING, 'description', 'UTF8', None, ),  # 3
    (4, TType.I32, 'display', None, None, ),  # 4
    (5, TType.STRUCT, 'min', [Knob, None], None, ),  # 5
    (6, TType.STRUCT, 'max', [Knob, None], None, ),  # 6
    (7, TType.STRUCT, 'defaultvalue', [Knob, None], None, ),  # 7
)
fix_spec(all_structs)
del all_structs
