#
# Autogenerated by Thrift Compiler (0.13.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

import sys
import MMIStandard.services.MMIServiceBase
import logging
from .ttypes import *
from thrift.Thrift import TProcessor
from thrift.transport import TTransport
all_structs = []


class Iface(MMIStandard.services.MMIServiceBase.Iface):
    def ComputeIK(self, postureValues, properties):
        """
        Parameters:
         - postureValues
         - properties

        """
        pass

    def CalculateIKPosture(self, postureValues, constraints, properties):
        """
        Parameters:
         - postureValues
         - constraints
         - properties

        """
        pass


class Client(MMIStandard.services.MMIServiceBase.Client, Iface):
    def __init__(self, iprot, oprot=None):
        MMIStandard.services.MMIServiceBase.Client.__init__(self, iprot, oprot)

    def ComputeIK(self, postureValues, properties):
        """
        Parameters:
         - postureValues
         - properties

        """
        self.send_ComputeIK(postureValues, properties)
        return self.recv_ComputeIK()

    def send_ComputeIK(self, postureValues, properties):
        self._oprot.writeMessageBegin('ComputeIK', TMessageType.CALL, self._seqid)
        args = ComputeIK_args()
        args.postureValues = postureValues
        args.properties = properties
        args.write(self._oprot)
        self._oprot.writeMessageEnd()
        self._oprot.trans.flush()

    def recv_ComputeIK(self):
        iprot = self._iprot
        (fname, mtype, rseqid) = iprot.readMessageBegin()
        if mtype == TMessageType.EXCEPTION:
            x = TApplicationException()
            x.read(iprot)
            iprot.readMessageEnd()
            raise x
        result = ComputeIK_result()
        result.read(iprot)
        iprot.readMessageEnd()
        if result.success is not None:
            return result.success
        raise TApplicationException(TApplicationException.MISSING_RESULT, "ComputeIK failed: unknown result")

    def CalculateIKPosture(self, postureValues, constraints, properties):
        """
        Parameters:
         - postureValues
         - constraints
         - properties

        """
        self.send_CalculateIKPosture(postureValues, constraints, properties)
        return self.recv_CalculateIKPosture()

    def send_CalculateIKPosture(self, postureValues, constraints, properties):
        self._oprot.writeMessageBegin('CalculateIKPosture', TMessageType.CALL, self._seqid)
        args = CalculateIKPosture_args()
        args.postureValues = postureValues
        args.constraints = constraints
        args.properties = properties
        args.write(self._oprot)
        self._oprot.writeMessageEnd()
        self._oprot.trans.flush()

    def recv_CalculateIKPosture(self):
        iprot = self._iprot
        (fname, mtype, rseqid) = iprot.readMessageBegin()
        if mtype == TMessageType.EXCEPTION:
            x = TApplicationException()
            x.read(iprot)
            iprot.readMessageEnd()
            raise x
        result = CalculateIKPosture_result()
        result.read(iprot)
        iprot.readMessageEnd()
        if result.success is not None:
            return result.success
        raise TApplicationException(TApplicationException.MISSING_RESULT, "CalculateIKPosture failed: unknown result")


class Processor(MMIStandard.services.MMIServiceBase.Processor, Iface, TProcessor):
    def __init__(self, handler):
        MMIStandard.services.MMIServiceBase.Processor.__init__(self, handler)
        self._processMap["ComputeIK"] = Processor.process_ComputeIK
        self._processMap["CalculateIKPosture"] = Processor.process_CalculateIKPosture
        self._on_message_begin = None

    def on_message_begin(self, func):
        self._on_message_begin = func

    def process(self, iprot, oprot):
        (name, type, seqid) = iprot.readMessageBegin()
        if self._on_message_begin:
            self._on_message_begin(name, type, seqid)
        if name not in self._processMap:
            iprot.skip(TType.STRUCT)
            iprot.readMessageEnd()
            x = TApplicationException(TApplicationException.UNKNOWN_METHOD, 'Unknown function %s' % (name))
            oprot.writeMessageBegin(name, TMessageType.EXCEPTION, seqid)
            x.write(oprot)
            oprot.writeMessageEnd()
            oprot.trans.flush()
            return
        else:
            self._processMap[name](self, seqid, iprot, oprot)
        return True

    def process_ComputeIK(self, seqid, iprot, oprot):
        args = ComputeIK_args()
        args.read(iprot)
        iprot.readMessageEnd()
        result = ComputeIK_result()
        try:
            result.success = self._handler.ComputeIK(args.postureValues, args.properties)
            msg_type = TMessageType.REPLY
        except TTransport.TTransportException:
            raise
        except TApplicationException as ex:
            logging.exception('TApplication exception in handler')
            msg_type = TMessageType.EXCEPTION
            result = ex
        except Exception:
            logging.exception('Unexpected exception in handler')
            msg_type = TMessageType.EXCEPTION
            result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error')
        oprot.writeMessageBegin("ComputeIK", msg_type, seqid)
        result.write(oprot)
        oprot.writeMessageEnd()
        oprot.trans.flush()

    def process_CalculateIKPosture(self, seqid, iprot, oprot):
        args = CalculateIKPosture_args()
        args.read(iprot)
        iprot.readMessageEnd()
        result = CalculateIKPosture_result()
        try:
            result.success = self._handler.CalculateIKPosture(args.postureValues, args.constraints, args.properties)
            msg_type = TMessageType.REPLY
        except TTransport.TTransportException:
            raise
        except TApplicationException as ex:
            logging.exception('TApplication exception in handler')
            msg_type = TMessageType.EXCEPTION
            result = ex
        except Exception:
            logging.exception('Unexpected exception in handler')
            msg_type = TMessageType.EXCEPTION
            result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error')
        oprot.writeMessageBegin("CalculateIKPosture", msg_type, seqid)
        result.write(oprot)
        oprot.writeMessageEnd()
        oprot.trans.flush()

# HELPER FUNCTIONS AND STRUCTURES


class ComputeIK_args(object):
    """
    Attributes:
     - postureValues
     - properties

    """


    def __init__(self, postureValues=None, properties=None,):
        self.postureValues = postureValues
        self.properties = properties

    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.STRUCT:
                    self.postureValues = MMIStandard.avatar.ttypes.MAvatarPostureValues()
                    self.postureValues.read(iprot)
                else:
                    iprot.skip(ftype)
            elif fid == 2:
                if ftype == TType.LIST:
                    self.properties = []
                    (_etype162, _size159) = iprot.readListBegin()
                    for _i163 in range(_size159):
                        _elem164 = MIKProperty()
                        _elem164.read(iprot)
                        self.properties.append(_elem164)
                    iprot.readListEnd()
                else:
                    iprot.skip(ftype)
            else:
                iprot.skip(ftype)
            iprot.readFieldEnd()
        iprot.readStructEnd()

    def write(self, oprot):
        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('ComputeIK_args')
        if self.postureValues is not None:
            oprot.writeFieldBegin('postureValues', TType.STRUCT, 1)
            self.postureValues.write(oprot)
            oprot.writeFieldEnd()
        if self.properties is not None:
            oprot.writeFieldBegin('properties', TType.LIST, 2)
            oprot.writeListBegin(TType.STRUCT, len(self.properties))
            for iter165 in self.properties:
                iter165.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)
all_structs.append(ComputeIK_args)
ComputeIK_args.thrift_spec = (
    None,  # 0
    (1, TType.STRUCT, 'postureValues', [MMIStandard.avatar.ttypes.MAvatarPostureValues, None], None, ),  # 1
    (2, TType.LIST, 'properties', (TType.STRUCT, [MIKProperty, None], False), None, ),  # 2
)


class ComputeIK_result(object):
    """
    Attributes:
     - success

    """


    def __init__(self, success=None,):
        self.success = success

    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 == 0:
                if ftype == TType.STRUCT:
                    self.success = MMIStandard.avatar.ttypes.MAvatarPostureValues()
                    self.success.read(iprot)
                else:
                    iprot.skip(ftype)
            else:
                iprot.skip(ftype)
            iprot.readFieldEnd()
        iprot.readStructEnd()

    def write(self, oprot):
        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('ComputeIK_result')
        if self.success is not None:
            oprot.writeFieldBegin('success', TType.STRUCT, 0)
            self.success.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(ComputeIK_result)
ComputeIK_result.thrift_spec = (
    (0, TType.STRUCT, 'success', [MMIStandard.avatar.ttypes.MAvatarPostureValues, None], None, ),  # 0
)


class CalculateIKPosture_args(object):
    """
    Attributes:
     - postureValues
     - constraints
     - properties

    """


    def __init__(self, postureValues=None, constraints=None, properties=None,):
        self.postureValues = postureValues
        self.constraints = constraints
        self.properties = properties

    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.STRUCT:
                    self.postureValues = MMIStandard.avatar.ttypes.MAvatarPostureValues()
                    self.postureValues.read(iprot)
                else:
                    iprot.skip(ftype)
            elif fid == 2:
                if ftype == TType.LIST:
                    self.constraints = []
                    (_etype169, _size166) = iprot.readListBegin()
                    for _i170 in range(_size166):
                        _elem171 = MMIStandard.constraints.ttypes.MConstraint()
                        _elem171.read(iprot)
                        self.constraints.append(_elem171)
                    iprot.readListEnd()
                else:
                    iprot.skip(ftype)
            elif fid == 3:
                if ftype == TType.MAP:
                    self.properties = {}
                    (_ktype173, _vtype174, _size172) = iprot.readMapBegin()
                    for _i176 in range(_size172):
                        _key177 = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
                        _val178 = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
                        self.properties[_key177] = _val178
                    iprot.readMapEnd()
                else:
                    iprot.skip(ftype)
            else:
                iprot.skip(ftype)
            iprot.readFieldEnd()
        iprot.readStructEnd()

    def write(self, oprot):
        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('CalculateIKPosture_args')
        if self.postureValues is not None:
            oprot.writeFieldBegin('postureValues', TType.STRUCT, 1)
            self.postureValues.write(oprot)
            oprot.writeFieldEnd()
        if self.constraints is not None:
            oprot.writeFieldBegin('constraints', TType.LIST, 2)
            oprot.writeListBegin(TType.STRUCT, len(self.constraints))
            for iter179 in self.constraints:
                iter179.write(oprot)
            oprot.writeListEnd()
            oprot.writeFieldEnd()
        if self.properties is not None:
            oprot.writeFieldBegin('properties', TType.MAP, 3)
            oprot.writeMapBegin(TType.STRING, TType.STRING, len(self.properties))
            for kiter180, viter181 in self.properties.items():
                oprot.writeString(kiter180.encode('utf-8') if sys.version_info[0] == 2 else kiter180)
                oprot.writeString(viter181.encode('utf-8') if sys.version_info[0] == 2 else viter181)
            oprot.writeMapEnd()
            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(CalculateIKPosture_args)
CalculateIKPosture_args.thrift_spec = (
    None,  # 0
    (1, TType.STRUCT, 'postureValues', [MMIStandard.avatar.ttypes.MAvatarPostureValues, None], None, ),  # 1
    (2, TType.LIST, 'constraints', (TType.STRUCT, [MMIStandard.constraints.ttypes.MConstraint, None], False), None, ),  # 2
    (3, TType.MAP, 'properties', (TType.STRING, 'UTF8', TType.STRING, 'UTF8', False), None, ),  # 3
)


class CalculateIKPosture_result(object):
    """
    Attributes:
     - success

    """


    def __init__(self, success=None,):
        self.success = success

    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 == 0:
                if ftype == TType.STRUCT:
                    self.success = MIKServiceResult()
                    self.success.read(iprot)
                else:
                    iprot.skip(ftype)
            else:
                iprot.skip(ftype)
            iprot.readFieldEnd()
        iprot.readStructEnd()

    def write(self, oprot):
        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('CalculateIKPosture_result')
        if self.success is not None:
            oprot.writeFieldBegin('success', TType.STRUCT, 0)
            self.success.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(CalculateIKPosture_result)
CalculateIKPosture_result.thrift_spec = (
    (0, TType.STRUCT, 'success', [MIKServiceResult, None], None, ),  # 0
)
fix_spec(all_structs)
del all_structs


#
# Autogenerated by Thrift Compiler (0.13.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

import sys
import MMIStandard.services.MMIServiceBase
import logging
from .ttypes import *
from thrift.Thrift import TProcessor
from thrift.transport import TTransport
all_structs = []


class Iface(MMIStandard.services.MMIServiceBase.Iface):
    def ComputeIK(self, postureValues, properties):
        """
        Parameters:
         - postureValues
         - properties

        """
        pass

    def CalculateIKPosture(self, postureValues, constraints, properties):
        """
        Parameters:
         - postureValues
         - constraints
         - properties

        """
        pass


class Client(MMIStandard.services.MMIServiceBase.Client, Iface):
    def __init__(self, iprot, oprot=None):
        MMIStandard.services.MMIServiceBase.Client.__init__(self, iprot, oprot)

    def ComputeIK(self, postureValues, properties):
        """
        Parameters:
         - postureValues
         - properties

        """
        self.send_ComputeIK(postureValues, properties)
        return self.recv_ComputeIK()

    def send_ComputeIK(self, postureValues, properties):
        self._oprot.writeMessageBegin('ComputeIK', TMessageType.CALL, self._seqid)
        args = ComputeIK_args()
        args.postureValues = postureValues
        args.properties = properties
        args.write(self._oprot)
        self._oprot.writeMessageEnd()
        self._oprot.trans.flush()

    def recv_ComputeIK(self):
        iprot = self._iprot
        (fname, mtype, rseqid) = iprot.readMessageBegin()
        if mtype == TMessageType.EXCEPTION:
            x = TApplicationException()
            x.read(iprot)
            iprot.readMessageEnd()
            raise x
        result = ComputeIK_result()
        result.read(iprot)
        iprot.readMessageEnd()
        if result.success is not None:
            return result.success
        raise TApplicationException(TApplicationException.MISSING_RESULT, "ComputeIK failed: unknown result")

    def CalculateIKPosture(self, postureValues, constraints, properties):
        """
        Parameters:
         - postureValues
         - constraints
         - properties

        """
        self.send_CalculateIKPosture(postureValues, constraints, properties)
        return self.recv_CalculateIKPosture()

    def send_CalculateIKPosture(self, postureValues, constraints, properties):
        self._oprot.writeMessageBegin('CalculateIKPosture', TMessageType.CALL, self._seqid)
        args = CalculateIKPosture_args()
        args.postureValues = postureValues
        args.constraints = constraints
        args.properties = properties
        args.write(self._oprot)
        self._oprot.writeMessageEnd()
        self._oprot.trans.flush()

    def recv_CalculateIKPosture(self):
        iprot = self._iprot
        (fname, mtype, rseqid) = iprot.readMessageBegin()
        if mtype == TMessageType.EXCEPTION:
            x = TApplicationException()
            x.read(iprot)
            iprot.readMessageEnd()
            raise x
        result = CalculateIKPosture_result()
        result.read(iprot)
        iprot.readMessageEnd()
        if result.success is not None:
            return result.success
        raise TApplicationException(TApplicationException.MISSING_RESULT, "CalculateIKPosture failed: unknown result")


class Processor(MMIStandard.services.MMIServiceBase.Processor, Iface, TProcessor):
    def __init__(self, handler):
        MMIStandard.services.MMIServiceBase.Processor.__init__(self, handler)
        self._processMap["ComputeIK"] = Processor.process_ComputeIK
        self._processMap["CalculateIKPosture"] = Processor.process_CalculateIKPosture
        self._on_message_begin = None

    def on_message_begin(self, func):
        self._on_message_begin = func

    def process(self, iprot, oprot):
        (name, type, seqid) = iprot.readMessageBegin()
        if self._on_message_begin:
            self._on_message_begin(name, type, seqid)
        if name not in self._processMap:
            iprot.skip(TType.STRUCT)
            iprot.readMessageEnd()
            x = TApplicationException(TApplicationException.UNKNOWN_METHOD, 'Unknown function %s' % (name))
            oprot.writeMessageBegin(name, TMessageType.EXCEPTION, seqid)
            x.write(oprot)
            oprot.writeMessageEnd()
            oprot.trans.flush()
            return
        else:
            self._processMap[name](self, seqid, iprot, oprot)
        return True

    def process_ComputeIK(self, seqid, iprot, oprot):
        args = ComputeIK_args()
        args.read(iprot)
        iprot.readMessageEnd()
        result = ComputeIK_result()
        try:
            result.success = self._handler.ComputeIK(args.postureValues, args.properties)
            msg_type = TMessageType.REPLY
        except TTransport.TTransportException:
            raise
        except TApplicationException as ex:
            logging.exception('TApplication exception in handler')
            msg_type = TMessageType.EXCEPTION
            result = ex
        except Exception:
            logging.exception('Unexpected exception in handler')
            msg_type = TMessageType.EXCEPTION
            result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error')
        oprot.writeMessageBegin("ComputeIK", msg_type, seqid)
        result.write(oprot)
        oprot.writeMessageEnd()
        oprot.trans.flush()

    def process_CalculateIKPosture(self, seqid, iprot, oprot):
        args = CalculateIKPosture_args()
        args.read(iprot)
        iprot.readMessageEnd()
        result = CalculateIKPosture_result()
        try:
            result.success = self._handler.CalculateIKPosture(args.postureValues, args.constraints, args.properties)
            msg_type = TMessageType.REPLY
        except TTransport.TTransportException:
            raise
        except TApplicationException as ex:
            logging.exception('TApplication exception in handler')
            msg_type = TMessageType.EXCEPTION
            result = ex
        except Exception:
            logging.exception('Unexpected exception in handler')
            msg_type = TMessageType.EXCEPTION
            result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error')
        oprot.writeMessageBegin("CalculateIKPosture", msg_type, seqid)
        result.write(oprot)
        oprot.writeMessageEnd()
        oprot.trans.flush()

# HELPER FUNCTIONS AND STRUCTURES


class ComputeIK_args(object):
    """
    Attributes:
     - postureValues
     - properties

    """


    def __init__(self, postureValues=None, properties=None,):
        self.postureValues = postureValues
        self.properties = properties

    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.STRUCT:
                    self.postureValues = MMIStandard.avatar.ttypes.MAvatarPostureValues()
                    self.postureValues.read(iprot)
                else:
                    iprot.skip(ftype)
            elif fid == 2:
                if ftype == TType.LIST:
                    self.properties = []
                    (_etype162, _size159) = iprot.readListBegin()
                    for _i163 in range(_size159):
                        _elem164 = MIKProperty()
                        _elem164.read(iprot)
                        self.properties.append(_elem164)
                    iprot.readListEnd()
                else:
                    iprot.skip(ftype)
            else:
                iprot.skip(ftype)
            iprot.readFieldEnd()
        iprot.readStructEnd()

    def write(self, oprot):
        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('ComputeIK_args')
        if self.postureValues is not None:
            oprot.writeFieldBegin('postureValues', TType.STRUCT, 1)
            self.postureValues.write(oprot)
            oprot.writeFieldEnd()
        if self.properties is not None:
            oprot.writeFieldBegin('properties', TType.LIST, 2)
            oprot.writeListBegin(TType.STRUCT, len(self.properties))
            for iter165 in self.properties:
                iter165.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)
all_structs.append(ComputeIK_args)
ComputeIK_args.thrift_spec = (
    None,  # 0
    (1, TType.STRUCT, 'postureValues', [MMIStandard.avatar.ttypes.MAvatarPostureValues, None], None, ),  # 1
    (2, TType.LIST, 'properties', (TType.STRUCT, [MIKProperty, None], False), None, ),  # 2
)


class ComputeIK_result(object):
    """
    Attributes:
     - success

    """


    def __init__(self, success=None,):
        self.success = success

    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 == 0:
                if ftype == TType.STRUCT:
                    self.success = MMIStandard.avatar.ttypes.MAvatarPostureValues()
                    self.success.read(iprot)
                else:
                    iprot.skip(ftype)
            else:
                iprot.skip(ftype)
            iprot.readFieldEnd()
        iprot.readStructEnd()

    def write(self, oprot):
        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('ComputeIK_result')
        if self.success is not None:
            oprot.writeFieldBegin('success', TType.STRUCT, 0)
            self.success.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(ComputeIK_result)
ComputeIK_result.thrift_spec = (
    (0, TType.STRUCT, 'success', [MMIStandard.avatar.ttypes.MAvatarPostureValues, None], None, ),  # 0
)


class CalculateIKPosture_args(object):
    """
    Attributes:
     - postureValues
     - constraints
     - properties

    """


    def __init__(self, postureValues=None, constraints=None, properties=None,):
        self.postureValues = postureValues
        self.constraints = constraints
        self.properties = properties

    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.STRUCT:
                    self.postureValues = MMIStandard.avatar.ttypes.MAvatarPostureValues()
                    self.postureValues.read(iprot)
                else:
                    iprot.skip(ftype)
            elif fid == 2:
                if ftype == TType.LIST:
                    self.constraints = []
                    (_etype169, _size166) = iprot.readListBegin()
                    for _i170 in range(_size166):
                        _elem171 = MMIStandard.constraints.ttypes.MConstraint()
                        _elem171.read(iprot)
                        self.constraints.append(_elem171)
                    iprot.readListEnd()
                else:
                    iprot.skip(ftype)
            elif fid == 3:
                if ftype == TType.MAP:
                    self.properties = {}
                    (_ktype173, _vtype174, _size172) = iprot.readMapBegin()
                    for _i176 in range(_size172):
                        _key177 = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
                        _val178 = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
                        self.properties[_key177] = _val178
                    iprot.readMapEnd()
                else:
                    iprot.skip(ftype)
            else:
                iprot.skip(ftype)
            iprot.readFieldEnd()
        iprot.readStructEnd()

    def write(self, oprot):
        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('CalculateIKPosture_args')
        if self.postureValues is not None:
            oprot.writeFieldBegin('postureValues', TType.STRUCT, 1)
            self.postureValues.write(oprot)
            oprot.writeFieldEnd()
        if self.constraints is not None:
            oprot.writeFieldBegin('constraints', TType.LIST, 2)
            oprot.writeListBegin(TType.STRUCT, len(self.constraints))
            for iter179 in self.constraints:
                iter179.write(oprot)
            oprot.writeListEnd()
            oprot.writeFieldEnd()
        if self.properties is not None:
            oprot.writeFieldBegin('properties', TType.MAP, 3)
            oprot.writeMapBegin(TType.STRING, TType.STRING, len(self.properties))
            for kiter180, viter181 in self.properties.items():
                oprot.writeString(kiter180.encode('utf-8') if sys.version_info[0] == 2 else kiter180)
                oprot.writeString(viter181.encode('utf-8') if sys.version_info[0] == 2 else viter181)
            oprot.writeMapEnd()
            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(CalculateIKPosture_args)
CalculateIKPosture_args.thrift_spec = (
    None,  # 0
    (1, TType.STRUCT, 'postureValues', [MMIStandard.avatar.ttypes.MAvatarPostureValues, None], None, ),  # 1
    (2, TType.LIST, 'constraints', (TType.STRUCT, [MMIStandard.constraints.ttypes.MConstraint, None], False), None, ),  # 2
    (3, TType.MAP, 'properties', (TType.STRING, 'UTF8', TType.STRING, 'UTF8', False), None, ),  # 3
)


class CalculateIKPosture_result(object):
    """
    Attributes:
     - success

    """


    def __init__(self, success=None,):
        self.success = success

    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 == 0:
                if ftype == TType.STRUCT:
                    self.success = MIKServiceResult()
                    self.success.read(iprot)
                else:
                    iprot.skip(ftype)
            else:
                iprot.skip(ftype)
            iprot.readFieldEnd()
        iprot.readStructEnd()

    def write(self, oprot):
        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('CalculateIKPosture_result')
        if self.success is not None:
            oprot.writeFieldBegin('success', TType.STRUCT, 0)
            self.success.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(CalculateIKPosture_result)
CalculateIKPosture_result.thrift_spec = (
    (0, TType.STRUCT, 'success', [MIKServiceResult, None], None, ),  # 0
)
fix_spec(all_structs)
del all_structs


# # Autogenerated by Thrift Compiler (0.13.0) # # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING # #  options string: py # Parameters:          - postureValues          - properties Parameters:          - postureValues          - constraints          - properties Parameters:          - postureValues          - properties Parameters:          - postureValues          - constraints          - properties # HELPER FUNCTIONS AND STRUCTURES Attributes:      - postureValues      - properties # 0 # 1 # 2 Attributes:      - success # 0 Attributes:      - postureValues      - constraints      - properties # 0 # 1 # 2 # 3 Attributes:      - success # 0