From 6d5fc3057310f5a929e840c3ff1dc42d344d27dd Mon Sep 17 00:00:00 2001 From: Lars Ivar Hatledal Date: Tue, 21 Jul 2020 19:13:54 +0200 Subject: [PATCH] remove demo stuff --- client-demos/browser/thrift/generate_js.bat | 1 - client-demos/browser/thrift/generate_js.sh | 1 - client-demos/browser/thrift/index.html | 67 - .../browser/thrift/js/service_types.js | 2033 ------- client-demos/browser/thrift/js/thrift.js | 1569 ------ client-demos/browser/thrift/serve.bat | 1 - client-demos/browser/thrift/serve.sh | 1 - client-demos/python/thrift-client/__init__.py | 0 .../python/thrift-client/client/__init__.py | 129 - .../python/thrift-client/generate.bat | 6 - client-demos/python/thrift-client/generate.sh | 10 - .../thrift-client/service/FmuService.py | 4712 ----------------- .../python/thrift-client/service/__init__.py | 1 - .../python/thrift-client/service/ttypes.py | 2083 -------- .../python/thrift-client/test/test.py | 36 - test/start_proxy.sh | 2 - 16 files changed, 10652 deletions(-) delete mode 100644 client-demos/browser/thrift/generate_js.bat delete mode 100755 client-demos/browser/thrift/generate_js.sh delete mode 100644 client-demos/browser/thrift/index.html delete mode 100644 client-demos/browser/thrift/js/service_types.js delete mode 100644 client-demos/browser/thrift/js/thrift.js delete mode 100644 client-demos/browser/thrift/serve.bat delete mode 100755 client-demos/browser/thrift/serve.sh delete mode 100644 client-demos/python/thrift-client/__init__.py delete mode 100644 client-demos/python/thrift-client/client/__init__.py delete mode 100644 client-demos/python/thrift-client/generate.bat delete mode 100755 client-demos/python/thrift-client/generate.sh delete mode 100644 client-demos/python/thrift-client/service/FmuService.py delete mode 100644 client-demos/python/thrift-client/service/__init__.py delete mode 100644 client-demos/python/thrift-client/service/ttypes.py delete mode 100644 client-demos/python/thrift-client/test/test.py delete mode 100755 test/start_proxy.sh diff --git a/client-demos/browser/thrift/generate_js.bat b/client-demos/browser/thrift/generate_js.bat deleted file mode 100644 index 2b01350b..00000000 --- a/client-demos/browser/thrift/generate_js.bat +++ /dev/null @@ -1 +0,0 @@ -thrift --gen js -out js ../../../rpc-definitions/thrift/service.thrift \ No newline at end of file diff --git a/client-demos/browser/thrift/generate_js.sh b/client-demos/browser/thrift/generate_js.sh deleted file mode 100755 index 2b01350b..00000000 --- a/client-demos/browser/thrift/generate_js.sh +++ /dev/null @@ -1 +0,0 @@ -thrift --gen js -out js ../../../rpc-definitions/thrift/service.thrift \ No newline at end of file diff --git a/client-demos/browser/thrift/index.html b/client-demos/browser/thrift/index.html deleted file mode 100644 index eb424837..00000000 --- a/client-demos/browser/thrift/index.html +++ /dev/null @@ -1,67 +0,0 @@ - - - - - - Thrift Javascript test - - - - - - - - - - - - diff --git a/client-demos/browser/thrift/js/service_types.js b/client-demos/browser/thrift/js/service_types.js deleted file mode 100644 index 13457567..00000000 --- a/client-demos/browser/thrift/js/service_types.js +++ /dev/null @@ -1,2033 +0,0 @@ -// -// Autogenerated by Thrift Compiler (0.12.0) -// -// DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING -// - - -Status = { - 'OK_STATUS' : 0, - 'WARNING_STATUS' : 1, - 'DISCARD_STATUS' : 2, - 'ERROR_STATUS' : 3, - 'FATAL_STATUS' : 4, - 'PENDING_STATUS' : 5 -}; -IntegerAttribute = function(args) { - this.min = null; - this.max = null; - this.start = null; - this.quantity = null; - if (args) { - if (args.min !== undefined && args.min !== null) { - this.min = args.min; - } - if (args.max !== undefined && args.max !== null) { - this.max = args.max; - } - if (args.start !== undefined && args.start !== null) { - this.start = args.start; - } - if (args.quantity !== undefined && args.quantity !== null) { - this.quantity = args.quantity; - } - } -}; -IntegerAttribute.prototype = {}; -IntegerAttribute.prototype.read = function(input) { - input.readStructBegin(); - while (true) { - var ret = input.readFieldBegin(); - var ftype = ret.ftype; - var fid = ret.fid; - if (ftype == Thrift.Type.STOP) { - break; - } - switch (fid) { - case 1: - if (ftype == Thrift.Type.I32) { - this.min = input.readI32().value; - } else { - input.skip(ftype); - } - break; - case 2: - if (ftype == Thrift.Type.I32) { - this.max = input.readI32().value; - } else { - input.skip(ftype); - } - break; - case 3: - if (ftype == Thrift.Type.I32) { - this.start = input.readI32().value; - } else { - input.skip(ftype); - } - break; - case 4: - if (ftype == Thrift.Type.STRING) { - this.quantity = input.readString().value; - } else { - input.skip(ftype); - } - break; - default: - input.skip(ftype); - } - input.readFieldEnd(); - } - input.readStructEnd(); - return; -}; - -IntegerAttribute.prototype.write = function(output) { - output.writeStructBegin('IntegerAttribute'); - if (this.min !== null && this.min !== undefined) { - output.writeFieldBegin('min', Thrift.Type.I32, 1); - output.writeI32(this.min); - output.writeFieldEnd(); - } - if (this.max !== null && this.max !== undefined) { - output.writeFieldBegin('max', Thrift.Type.I32, 2); - output.writeI32(this.max); - output.writeFieldEnd(); - } - if (this.start !== null && this.start !== undefined) { - output.writeFieldBegin('start', Thrift.Type.I32, 3); - output.writeI32(this.start); - output.writeFieldEnd(); - } - if (this.quantity !== null && this.quantity !== undefined) { - output.writeFieldBegin('quantity', Thrift.Type.STRING, 4); - output.writeString(this.quantity); - output.writeFieldEnd(); - } - output.writeFieldStop(); - output.writeStructEnd(); - return; -}; - -RealAttribute = function(args) { - this.min = null; - this.max = null; - this.start = null; - this.quantity = null; - if (args) { - if (args.min !== undefined && args.min !== null) { - this.min = args.min; - } - if (args.max !== undefined && args.max !== null) { - this.max = args.max; - } - if (args.start !== undefined && args.start !== null) { - this.start = args.start; - } - if (args.quantity !== undefined && args.quantity !== null) { - this.quantity = args.quantity; - } - } -}; -RealAttribute.prototype = {}; -RealAttribute.prototype.read = function(input) { - input.readStructBegin(); - while (true) { - var ret = input.readFieldBegin(); - var ftype = ret.ftype; - var fid = ret.fid; - if (ftype == Thrift.Type.STOP) { - break; - } - switch (fid) { - case 1: - if (ftype == Thrift.Type.DOUBLE) { - this.min = input.readDouble().value; - } else { - input.skip(ftype); - } - break; - case 2: - if (ftype == Thrift.Type.DOUBLE) { - this.max = input.readDouble().value; - } else { - input.skip(ftype); - } - break; - case 3: - if (ftype == Thrift.Type.DOUBLE) { - this.start = input.readDouble().value; - } else { - input.skip(ftype); - } - break; - case 4: - if (ftype == Thrift.Type.STRING) { - this.quantity = input.readString().value; - } else { - input.skip(ftype); - } - break; - default: - input.skip(ftype); - } - input.readFieldEnd(); - } - input.readStructEnd(); - return; -}; - -RealAttribute.prototype.write = function(output) { - output.writeStructBegin('RealAttribute'); - if (this.min !== null && this.min !== undefined) { - output.writeFieldBegin('min', Thrift.Type.DOUBLE, 1); - output.writeDouble(this.min); - output.writeFieldEnd(); - } - if (this.max !== null && this.max !== undefined) { - output.writeFieldBegin('max', Thrift.Type.DOUBLE, 2); - output.writeDouble(this.max); - output.writeFieldEnd(); - } - if (this.start !== null && this.start !== undefined) { - output.writeFieldBegin('start', Thrift.Type.DOUBLE, 3); - output.writeDouble(this.start); - output.writeFieldEnd(); - } - if (this.quantity !== null && this.quantity !== undefined) { - output.writeFieldBegin('quantity', Thrift.Type.STRING, 4); - output.writeString(this.quantity); - output.writeFieldEnd(); - } - output.writeFieldStop(); - output.writeStructEnd(); - return; -}; - -StringAttribute = function(args) { - this.start = null; - if (args) { - if (args.start !== undefined && args.start !== null) { - this.start = args.start; - } - } -}; -StringAttribute.prototype = {}; -StringAttribute.prototype.read = function(input) { - input.readStructBegin(); - while (true) { - var ret = input.readFieldBegin(); - var ftype = ret.ftype; - var fid = ret.fid; - if (ftype == Thrift.Type.STOP) { - break; - } - switch (fid) { - case 1: - if (ftype == Thrift.Type.STRING) { - this.start = input.readString().value; - } else { - input.skip(ftype); - } - break; - case 0: - input.skip(ftype); - break; - default: - input.skip(ftype); - } - input.readFieldEnd(); - } - input.readStructEnd(); - return; -}; - -StringAttribute.prototype.write = function(output) { - output.writeStructBegin('StringAttribute'); - if (this.start !== null && this.start !== undefined) { - output.writeFieldBegin('start', Thrift.Type.STRING, 1); - output.writeString(this.start); - output.writeFieldEnd(); - } - output.writeFieldStop(); - output.writeStructEnd(); - return; -}; - -BooleanAttribute = function(args) { - this.start = null; - if (args) { - if (args.start !== undefined && args.start !== null) { - this.start = args.start; - } - } -}; -BooleanAttribute.prototype = {}; -BooleanAttribute.prototype.read = function(input) { - input.readStructBegin(); - while (true) { - var ret = input.readFieldBegin(); - var ftype = ret.ftype; - var fid = ret.fid; - if (ftype == Thrift.Type.STOP) { - break; - } - switch (fid) { - case 1: - if (ftype == Thrift.Type.BOOL) { - this.start = input.readBool().value; - } else { - input.skip(ftype); - } - break; - case 0: - input.skip(ftype); - break; - default: - input.skip(ftype); - } - input.readFieldEnd(); - } - input.readStructEnd(); - return; -}; - -BooleanAttribute.prototype.write = function(output) { - output.writeStructBegin('BooleanAttribute'); - if (this.start !== null && this.start !== undefined) { - output.writeFieldBegin('start', Thrift.Type.BOOL, 1); - output.writeBool(this.start); - output.writeFieldEnd(); - } - output.writeFieldStop(); - output.writeStructEnd(); - return; -}; - -EnumerationAttribute = function(args) { - this.min = null; - this.max = null; - this.start = null; - this.quantity = null; - if (args) { - if (args.min !== undefined && args.min !== null) { - this.min = args.min; - } - if (args.max !== undefined && args.max !== null) { - this.max = args.max; - } - if (args.start !== undefined && args.start !== null) { - this.start = args.start; - } - if (args.quantity !== undefined && args.quantity !== null) { - this.quantity = args.quantity; - } - } -}; -EnumerationAttribute.prototype = {}; -EnumerationAttribute.prototype.read = function(input) { - input.readStructBegin(); - while (true) { - var ret = input.readFieldBegin(); - var ftype = ret.ftype; - var fid = ret.fid; - if (ftype == Thrift.Type.STOP) { - break; - } - switch (fid) { - case 1: - if (ftype == Thrift.Type.I32) { - this.min = input.readI32().value; - } else { - input.skip(ftype); - } - break; - case 2: - if (ftype == Thrift.Type.I32) { - this.max = input.readI32().value; - } else { - input.skip(ftype); - } - break; - case 3: - if (ftype == Thrift.Type.I32) { - this.start = input.readI32().value; - } else { - input.skip(ftype); - } - break; - case 4: - if (ftype == Thrift.Type.STRING) { - this.quantity = input.readString().value; - } else { - input.skip(ftype); - } - break; - default: - input.skip(ftype); - } - input.readFieldEnd(); - } - input.readStructEnd(); - return; -}; - -EnumerationAttribute.prototype.write = function(output) { - output.writeStructBegin('EnumerationAttribute'); - if (this.min !== null && this.min !== undefined) { - output.writeFieldBegin('min', Thrift.Type.I32, 1); - output.writeI32(this.min); - output.writeFieldEnd(); - } - if (this.max !== null && this.max !== undefined) { - output.writeFieldBegin('max', Thrift.Type.I32, 2); - output.writeI32(this.max); - output.writeFieldEnd(); - } - if (this.start !== null && this.start !== undefined) { - output.writeFieldBegin('start', Thrift.Type.I32, 3); - output.writeI32(this.start); - output.writeFieldEnd(); - } - if (this.quantity !== null && this.quantity !== undefined) { - output.writeFieldBegin('quantity', Thrift.Type.STRING, 4); - output.writeString(this.quantity); - output.writeFieldEnd(); - } - output.writeFieldStop(); - output.writeStructEnd(); - return; -}; - -ScalarVariableAttribute = function(args) { - this.integer_attribute = null; - this.real_attribute = null; - this.string_attribute = null; - this.boolean_attribute = null; - this.enumeration_attribute = null; - if (args) { - if (args.integer_attribute !== undefined && args.integer_attribute !== null) { - this.integer_attribute = new IntegerAttribute(args.integer_attribute); - } - if (args.real_attribute !== undefined && args.real_attribute !== null) { - this.real_attribute = new RealAttribute(args.real_attribute); - } - if (args.string_attribute !== undefined && args.string_attribute !== null) { - this.string_attribute = new StringAttribute(args.string_attribute); - } - if (args.boolean_attribute !== undefined && args.boolean_attribute !== null) { - this.boolean_attribute = new BooleanAttribute(args.boolean_attribute); - } - if (args.enumeration_attribute !== undefined && args.enumeration_attribute !== null) { - this.enumeration_attribute = new EnumerationAttribute(args.enumeration_attribute); - } - } -}; -ScalarVariableAttribute.prototype = {}; -ScalarVariableAttribute.prototype.read = function(input) { - input.readStructBegin(); - while (true) { - var ret = input.readFieldBegin(); - var ftype = ret.ftype; - var fid = ret.fid; - if (ftype == Thrift.Type.STOP) { - break; - } - switch (fid) { - case 1: - if (ftype == Thrift.Type.STRUCT) { - this.integer_attribute = new IntegerAttribute(); - this.integer_attribute.read(input); - } else { - input.skip(ftype); - } - break; - case 2: - if (ftype == Thrift.Type.STRUCT) { - this.real_attribute = new RealAttribute(); - this.real_attribute.read(input); - } else { - input.skip(ftype); - } - break; - case 3: - if (ftype == Thrift.Type.STRUCT) { - this.string_attribute = new StringAttribute(); - this.string_attribute.read(input); - } else { - input.skip(ftype); - } - break; - case 4: - if (ftype == Thrift.Type.STRUCT) { - this.boolean_attribute = new BooleanAttribute(); - this.boolean_attribute.read(input); - } else { - input.skip(ftype); - } - break; - case 5: - if (ftype == Thrift.Type.STRUCT) { - this.enumeration_attribute = new EnumerationAttribute(); - this.enumeration_attribute.read(input); - } else { - input.skip(ftype); - } - break; - default: - input.skip(ftype); - } - input.readFieldEnd(); - } - input.readStructEnd(); - return; -}; - -ScalarVariableAttribute.prototype.write = function(output) { - output.writeStructBegin('ScalarVariableAttribute'); - if (this.integer_attribute !== null && this.integer_attribute !== undefined) { - output.writeFieldBegin('integer_attribute', Thrift.Type.STRUCT, 1); - this.integer_attribute.write(output); - output.writeFieldEnd(); - } - if (this.real_attribute !== null && this.real_attribute !== undefined) { - output.writeFieldBegin('real_attribute', Thrift.Type.STRUCT, 2); - this.real_attribute.write(output); - output.writeFieldEnd(); - } - if (this.string_attribute !== null && this.string_attribute !== undefined) { - output.writeFieldBegin('string_attribute', Thrift.Type.STRUCT, 3); - this.string_attribute.write(output); - output.writeFieldEnd(); - } - if (this.boolean_attribute !== null && this.boolean_attribute !== undefined) { - output.writeFieldBegin('boolean_attribute', Thrift.Type.STRUCT, 4); - this.boolean_attribute.write(output); - output.writeFieldEnd(); - } - if (this.enumeration_attribute !== null && this.enumeration_attribute !== undefined) { - output.writeFieldBegin('enumeration_attribute', Thrift.Type.STRUCT, 5); - this.enumeration_attribute.write(output); - output.writeFieldEnd(); - } - output.writeFieldStop(); - output.writeStructEnd(); - return; -}; - -ScalarVariable = function(args) { - this.name = null; - this.value_reference = null; - this.description = null; - this.initial = null; - this.causality = null; - this.variability = null; - this.attribute = null; - if (args) { - if (args.name !== undefined && args.name !== null) { - this.name = args.name; - } - if (args.value_reference !== undefined && args.value_reference !== null) { - this.value_reference = args.value_reference; - } - if (args.description !== undefined && args.description !== null) { - this.description = args.description; - } - if (args.initial !== undefined && args.initial !== null) { - this.initial = args.initial; - } - if (args.causality !== undefined && args.causality !== null) { - this.causality = args.causality; - } - if (args.variability !== undefined && args.variability !== null) { - this.variability = args.variability; - } - if (args.attribute !== undefined && args.attribute !== null) { - this.attribute = new ScalarVariableAttribute(args.attribute); - } - } -}; -ScalarVariable.prototype = {}; -ScalarVariable.prototype.read = function(input) { - input.readStructBegin(); - while (true) { - var ret = input.readFieldBegin(); - var ftype = ret.ftype; - var fid = ret.fid; - if (ftype == Thrift.Type.STOP) { - break; - } - switch (fid) { - case 1: - if (ftype == Thrift.Type.STRING) { - this.name = input.readString().value; - } else { - input.skip(ftype); - } - break; - case 2: - if (ftype == Thrift.Type.I64) { - this.value_reference = input.readI64().value; - } else { - input.skip(ftype); - } - break; - case 3: - if (ftype == Thrift.Type.STRING) { - this.description = input.readString().value; - } else { - input.skip(ftype); - } - break; - case 4: - if (ftype == Thrift.Type.STRING) { - this.initial = input.readString().value; - } else { - input.skip(ftype); - } - break; - case 5: - if (ftype == Thrift.Type.STRING) { - this.causality = input.readString().value; - } else { - input.skip(ftype); - } - break; - case 6: - if (ftype == Thrift.Type.STRING) { - this.variability = input.readString().value; - } else { - input.skip(ftype); - } - break; - case 7: - if (ftype == Thrift.Type.STRUCT) { - this.attribute = new ScalarVariableAttribute(); - this.attribute.read(input); - } else { - input.skip(ftype); - } - break; - default: - input.skip(ftype); - } - input.readFieldEnd(); - } - input.readStructEnd(); - return; -}; - -ScalarVariable.prototype.write = function(output) { - output.writeStructBegin('ScalarVariable'); - if (this.name !== null && this.name !== undefined) { - output.writeFieldBegin('name', Thrift.Type.STRING, 1); - output.writeString(this.name); - output.writeFieldEnd(); - } - if (this.value_reference !== null && this.value_reference !== undefined) { - output.writeFieldBegin('value_reference', Thrift.Type.I64, 2); - output.writeI64(this.value_reference); - output.writeFieldEnd(); - } - if (this.description !== null && this.description !== undefined) { - output.writeFieldBegin('description', Thrift.Type.STRING, 3); - output.writeString(this.description); - output.writeFieldEnd(); - } - if (this.initial !== null && this.initial !== undefined) { - output.writeFieldBegin('initial', Thrift.Type.STRING, 4); - output.writeString(this.initial); - output.writeFieldEnd(); - } - if (this.causality !== null && this.causality !== undefined) { - output.writeFieldBegin('causality', Thrift.Type.STRING, 5); - output.writeString(this.causality); - output.writeFieldEnd(); - } - if (this.variability !== null && this.variability !== undefined) { - output.writeFieldBegin('variability', Thrift.Type.STRING, 6); - output.writeString(this.variability); - output.writeFieldEnd(); - } - if (this.attribute !== null && this.attribute !== undefined) { - output.writeFieldBegin('attribute', Thrift.Type.STRUCT, 7); - this.attribute.write(output); - output.writeFieldEnd(); - } - output.writeFieldStop(); - output.writeStructEnd(); - return; -}; - -Unknown = function(args) { - this.index = null; - this.dependencies = null; - this.dependencies_kind = null; - if (args) { - if (args.index !== undefined && args.index !== null) { - this.index = args.index; - } - if (args.dependencies !== undefined && args.dependencies !== null) { - this.dependencies = Thrift.copyList(args.dependencies, [null]); - } - if (args.dependencies_kind !== undefined && args.dependencies_kind !== null) { - this.dependencies_kind = Thrift.copyList(args.dependencies_kind, [null]); - } - } -}; -Unknown.prototype = {}; -Unknown.prototype.read = function(input) { - input.readStructBegin(); - while (true) { - var ret = input.readFieldBegin(); - var ftype = ret.ftype; - var fid = ret.fid; - if (ftype == Thrift.Type.STOP) { - break; - } - switch (fid) { - case 1: - if (ftype == Thrift.Type.I32) { - this.index = input.readI32().value; - } else { - input.skip(ftype); - } - break; - case 2: - if (ftype == Thrift.Type.LIST) { - this.dependencies = []; - var _rtmp31 = input.readListBegin(); - var _size0 = _rtmp31.size || 0; - for (var _i2 = 0; _i2 < _size0; ++_i2) { - var elem3 = null; - elem3 = input.readI32().value; - this.dependencies.push(elem3); - } - input.readListEnd(); - } else { - input.skip(ftype); - } - break; - case 3: - if (ftype == Thrift.Type.LIST) { - this.dependencies_kind = []; - var _rtmp35 = input.readListBegin(); - var _size4 = _rtmp35.size || 0; - for (var _i6 = 0; _i6 < _size4; ++_i6) { - var elem7 = null; - elem7 = input.readString().value; - this.dependencies_kind.push(elem7); - } - input.readListEnd(); - } else { - input.skip(ftype); - } - break; - default: - input.skip(ftype); - } - input.readFieldEnd(); - } - input.readStructEnd(); - return; -}; - -Unknown.prototype.write = function(output) { - output.writeStructBegin('Unknown'); - if (this.index !== null && this.index !== undefined) { - output.writeFieldBegin('index', Thrift.Type.I32, 1); - output.writeI32(this.index); - output.writeFieldEnd(); - } - if (this.dependencies !== null && this.dependencies !== undefined) { - output.writeFieldBegin('dependencies', Thrift.Type.LIST, 2); - output.writeListBegin(Thrift.Type.I32, this.dependencies.length); - for (var iter8 in this.dependencies) { - if (this.dependencies.hasOwnProperty(iter8)) { - iter8 = this.dependencies[iter8]; - output.writeI32(iter8); - } - } - output.writeListEnd(); - output.writeFieldEnd(); - } - if (this.dependencies_kind !== null && this.dependencies_kind !== undefined) { - output.writeFieldBegin('dependencies_kind', Thrift.Type.LIST, 3); - output.writeListBegin(Thrift.Type.STRING, this.dependencies_kind.length); - for (var iter9 in this.dependencies_kind) { - if (this.dependencies_kind.hasOwnProperty(iter9)) { - iter9 = this.dependencies_kind[iter9]; - output.writeString(iter9); - } - } - output.writeListEnd(); - output.writeFieldEnd(); - } - output.writeFieldStop(); - output.writeStructEnd(); - return; -}; - -ModelStructure = function(args) { - this.outputs = null; - this.derivatives = null; - this.initial_unknowns = null; - if (args) { - if (args.outputs !== undefined && args.outputs !== null) { - this.outputs = Thrift.copyList(args.outputs, [Unknown]); - } - if (args.derivatives !== undefined && args.derivatives !== null) { - this.derivatives = Thrift.copyList(args.derivatives, [Unknown]); - } - if (args.initial_unknowns !== undefined && args.initial_unknowns !== null) { - this.initial_unknowns = Thrift.copyList(args.initial_unknowns, [Unknown]); - } - } -}; -ModelStructure.prototype = {}; -ModelStructure.prototype.read = function(input) { - input.readStructBegin(); - while (true) { - var ret = input.readFieldBegin(); - var ftype = ret.ftype; - var fid = ret.fid; - if (ftype == Thrift.Type.STOP) { - break; - } - switch (fid) { - case 1: - if (ftype == Thrift.Type.LIST) { - this.outputs = []; - var _rtmp311 = input.readListBegin(); - var _size10 = _rtmp311.size || 0; - for (var _i12 = 0; _i12 < _size10; ++_i12) { - var elem13 = null; - elem13 = new Unknown(); - elem13.read(input); - this.outputs.push(elem13); - } - input.readListEnd(); - } else { - input.skip(ftype); - } - break; - case 2: - if (ftype == Thrift.Type.LIST) { - this.derivatives = []; - var _rtmp315 = input.readListBegin(); - var _size14 = _rtmp315.size || 0; - for (var _i16 = 0; _i16 < _size14; ++_i16) { - var elem17 = null; - elem17 = new Unknown(); - elem17.read(input); - this.derivatives.push(elem17); - } - input.readListEnd(); - } else { - input.skip(ftype); - } - break; - case 3: - if (ftype == Thrift.Type.LIST) { - this.initial_unknowns = []; - var _rtmp319 = input.readListBegin(); - var _size18 = _rtmp319.size || 0; - for (var _i20 = 0; _i20 < _size18; ++_i20) { - var elem21 = null; - elem21 = new Unknown(); - elem21.read(input); - this.initial_unknowns.push(elem21); - } - input.readListEnd(); - } else { - input.skip(ftype); - } - break; - default: - input.skip(ftype); - } - input.readFieldEnd(); - } - input.readStructEnd(); - return; -}; - -ModelStructure.prototype.write = function(output) { - output.writeStructBegin('ModelStructure'); - if (this.outputs !== null && this.outputs !== undefined) { - output.writeFieldBegin('outputs', Thrift.Type.LIST, 1); - output.writeListBegin(Thrift.Type.STRUCT, this.outputs.length); - for (var iter22 in this.outputs) { - if (this.outputs.hasOwnProperty(iter22)) { - iter22 = this.outputs[iter22]; - iter22.write(output); - } - } - output.writeListEnd(); - output.writeFieldEnd(); - } - if (this.derivatives !== null && this.derivatives !== undefined) { - output.writeFieldBegin('derivatives', Thrift.Type.LIST, 2); - output.writeListBegin(Thrift.Type.STRUCT, this.derivatives.length); - for (var iter23 in this.derivatives) { - if (this.derivatives.hasOwnProperty(iter23)) { - iter23 = this.derivatives[iter23]; - iter23.write(output); - } - } - output.writeListEnd(); - output.writeFieldEnd(); - } - if (this.initial_unknowns !== null && this.initial_unknowns !== undefined) { - output.writeFieldBegin('initial_unknowns', Thrift.Type.LIST, 3); - output.writeListBegin(Thrift.Type.STRUCT, this.initial_unknowns.length); - for (var iter24 in this.initial_unknowns) { - if (this.initial_unknowns.hasOwnProperty(iter24)) { - iter24 = this.initial_unknowns[iter24]; - iter24.write(output); - } - } - output.writeListEnd(); - output.writeFieldEnd(); - } - output.writeFieldStop(); - output.writeStructEnd(); - return; -}; - -DefaultExperiment = function(args) { - this.startTime = null; - this.stopTime = null; - this.tolerance = null; - this.stepSize = null; - if (args) { - if (args.startTime !== undefined && args.startTime !== null) { - this.startTime = args.startTime; - } - if (args.stopTime !== undefined && args.stopTime !== null) { - this.stopTime = args.stopTime; - } - if (args.tolerance !== undefined && args.tolerance !== null) { - this.tolerance = args.tolerance; - } - if (args.stepSize !== undefined && args.stepSize !== null) { - this.stepSize = args.stepSize; - } - } -}; -DefaultExperiment.prototype = {}; -DefaultExperiment.prototype.read = function(input) { - input.readStructBegin(); - while (true) { - var ret = input.readFieldBegin(); - var ftype = ret.ftype; - var fid = ret.fid; - if (ftype == Thrift.Type.STOP) { - break; - } - switch (fid) { - case 1: - if (ftype == Thrift.Type.DOUBLE) { - this.startTime = input.readDouble().value; - } else { - input.skip(ftype); - } - break; - case 2: - if (ftype == Thrift.Type.DOUBLE) { - this.stopTime = input.readDouble().value; - } else { - input.skip(ftype); - } - break; - case 3: - if (ftype == Thrift.Type.DOUBLE) { - this.tolerance = input.readDouble().value; - } else { - input.skip(ftype); - } - break; - case 4: - if (ftype == Thrift.Type.DOUBLE) { - this.stepSize = input.readDouble().value; - } else { - input.skip(ftype); - } - break; - default: - input.skip(ftype); - } - input.readFieldEnd(); - } - input.readStructEnd(); - return; -}; - -DefaultExperiment.prototype.write = function(output) { - output.writeStructBegin('DefaultExperiment'); - if (this.startTime !== null && this.startTime !== undefined) { - output.writeFieldBegin('startTime', Thrift.Type.DOUBLE, 1); - output.writeDouble(this.startTime); - output.writeFieldEnd(); - } - if (this.stopTime !== null && this.stopTime !== undefined) { - output.writeFieldBegin('stopTime', Thrift.Type.DOUBLE, 2); - output.writeDouble(this.stopTime); - output.writeFieldEnd(); - } - if (this.tolerance !== null && this.tolerance !== undefined) { - output.writeFieldBegin('tolerance', Thrift.Type.DOUBLE, 3); - output.writeDouble(this.tolerance); - output.writeFieldEnd(); - } - if (this.stepSize !== null && this.stepSize !== undefined) { - output.writeFieldBegin('stepSize', Thrift.Type.DOUBLE, 4); - output.writeDouble(this.stepSize); - output.writeFieldEnd(); - } - output.writeFieldStop(); - output.writeStructEnd(); - return; -}; - -StepResult = function(args) { - this.status = null; - this.simulation_time = null; - if (args) { - if (args.status !== undefined && args.status !== null) { - this.status = args.status; - } - if (args.simulation_time !== undefined && args.simulation_time !== null) { - this.simulation_time = args.simulation_time; - } - } -}; -StepResult.prototype = {}; -StepResult.prototype.read = function(input) { - input.readStructBegin(); - while (true) { - var ret = input.readFieldBegin(); - var ftype = ret.ftype; - var fid = ret.fid; - if (ftype == Thrift.Type.STOP) { - break; - } - switch (fid) { - case 1: - if (ftype == Thrift.Type.I32) { - this.status = input.readI32().value; - } else { - input.skip(ftype); - } - break; - case 2: - if (ftype == Thrift.Type.DOUBLE) { - this.simulation_time = input.readDouble().value; - } else { - input.skip(ftype); - } - break; - default: - input.skip(ftype); - } - input.readFieldEnd(); - } - input.readStructEnd(); - return; -}; - -StepResult.prototype.write = function(output) { - output.writeStructBegin('StepResult'); - if (this.status !== null && this.status !== undefined) { - output.writeFieldBegin('status', Thrift.Type.I32, 1); - output.writeI32(this.status); - output.writeFieldEnd(); - } - if (this.simulation_time !== null && this.simulation_time !== undefined) { - output.writeFieldBegin('simulation_time', Thrift.Type.DOUBLE, 2); - output.writeDouble(this.simulation_time); - output.writeFieldEnd(); - } - output.writeFieldStop(); - output.writeStructEnd(); - return; -}; - -IntegerRead = function(args) { - this.value = null; - this.status = null; - if (args) { - if (args.value !== undefined && args.value !== null) { - this.value = Thrift.copyList(args.value, [null]); - } - if (args.status !== undefined && args.status !== null) { - this.status = args.status; - } - } -}; -IntegerRead.prototype = {}; -IntegerRead.prototype.read = function(input) { - input.readStructBegin(); - while (true) { - var ret = input.readFieldBegin(); - var ftype = ret.ftype; - var fid = ret.fid; - if (ftype == Thrift.Type.STOP) { - break; - } - switch (fid) { - case 1: - if (ftype == Thrift.Type.LIST) { - this.value = []; - var _rtmp326 = input.readListBegin(); - var _size25 = _rtmp326.size || 0; - for (var _i27 = 0; _i27 < _size25; ++_i27) { - var elem28 = null; - elem28 = input.readI32().value; - this.value.push(elem28); - } - input.readListEnd(); - } else { - input.skip(ftype); - } - break; - case 2: - if (ftype == Thrift.Type.I32) { - this.status = input.readI32().value; - } else { - input.skip(ftype); - } - break; - default: - input.skip(ftype); - } - input.readFieldEnd(); - } - input.readStructEnd(); - return; -}; - -IntegerRead.prototype.write = function(output) { - output.writeStructBegin('IntegerRead'); - if (this.value !== null && this.value !== undefined) { - output.writeFieldBegin('value', Thrift.Type.LIST, 1); - output.writeListBegin(Thrift.Type.I32, this.value.length); - for (var iter29 in this.value) { - if (this.value.hasOwnProperty(iter29)) { - iter29 = this.value[iter29]; - output.writeI32(iter29); - } - } - output.writeListEnd(); - output.writeFieldEnd(); - } - if (this.status !== null && this.status !== undefined) { - output.writeFieldBegin('status', Thrift.Type.I32, 2); - output.writeI32(this.status); - output.writeFieldEnd(); - } - output.writeFieldStop(); - output.writeStructEnd(); - return; -}; - -RealRead = function(args) { - this.value = null; - this.status = null; - if (args) { - if (args.value !== undefined && args.value !== null) { - this.value = Thrift.copyList(args.value, [null]); - } - if (args.status !== undefined && args.status !== null) { - this.status = args.status; - } - } -}; -RealRead.prototype = {}; -RealRead.prototype.read = function(input) { - input.readStructBegin(); - while (true) { - var ret = input.readFieldBegin(); - var ftype = ret.ftype; - var fid = ret.fid; - if (ftype == Thrift.Type.STOP) { - break; - } - switch (fid) { - case 1: - if (ftype == Thrift.Type.LIST) { - this.value = []; - var _rtmp331 = input.readListBegin(); - var _size30 = _rtmp331.size || 0; - for (var _i32 = 0; _i32 < _size30; ++_i32) { - var elem33 = null; - elem33 = input.readDouble().value; - this.value.push(elem33); - } - input.readListEnd(); - } else { - input.skip(ftype); - } - break; - case 2: - if (ftype == Thrift.Type.I32) { - this.status = input.readI32().value; - } else { - input.skip(ftype); - } - break; - default: - input.skip(ftype); - } - input.readFieldEnd(); - } - input.readStructEnd(); - return; -}; - -RealRead.prototype.write = function(output) { - output.writeStructBegin('RealRead'); - if (this.value !== null && this.value !== undefined) { - output.writeFieldBegin('value', Thrift.Type.LIST, 1); - output.writeListBegin(Thrift.Type.DOUBLE, this.value.length); - for (var iter34 in this.value) { - if (this.value.hasOwnProperty(iter34)) { - iter34 = this.value[iter34]; - output.writeDouble(iter34); - } - } - output.writeListEnd(); - output.writeFieldEnd(); - } - if (this.status !== null && this.status !== undefined) { - output.writeFieldBegin('status', Thrift.Type.I32, 2); - output.writeI32(this.status); - output.writeFieldEnd(); - } - output.writeFieldStop(); - output.writeStructEnd(); - return; -}; - -StringRead = function(args) { - this.value = null; - this.status = null; - if (args) { - if (args.value !== undefined && args.value !== null) { - this.value = Thrift.copyList(args.value, [null]); - } - if (args.status !== undefined && args.status !== null) { - this.status = args.status; - } - } -}; -StringRead.prototype = {}; -StringRead.prototype.read = function(input) { - input.readStructBegin(); - while (true) { - var ret = input.readFieldBegin(); - var ftype = ret.ftype; - var fid = ret.fid; - if (ftype == Thrift.Type.STOP) { - break; - } - switch (fid) { - case 1: - if (ftype == Thrift.Type.LIST) { - this.value = []; - var _rtmp336 = input.readListBegin(); - var _size35 = _rtmp336.size || 0; - for (var _i37 = 0; _i37 < _size35; ++_i37) { - var elem38 = null; - elem38 = input.readString().value; - this.value.push(elem38); - } - input.readListEnd(); - } else { - input.skip(ftype); - } - break; - case 2: - if (ftype == Thrift.Type.I32) { - this.status = input.readI32().value; - } else { - input.skip(ftype); - } - break; - default: - input.skip(ftype); - } - input.readFieldEnd(); - } - input.readStructEnd(); - return; -}; - -StringRead.prototype.write = function(output) { - output.writeStructBegin('StringRead'); - if (this.value !== null && this.value !== undefined) { - output.writeFieldBegin('value', Thrift.Type.LIST, 1); - output.writeListBegin(Thrift.Type.STRING, this.value.length); - for (var iter39 in this.value) { - if (this.value.hasOwnProperty(iter39)) { - iter39 = this.value[iter39]; - output.writeString(iter39); - } - } - output.writeListEnd(); - output.writeFieldEnd(); - } - if (this.status !== null && this.status !== undefined) { - output.writeFieldBegin('status', Thrift.Type.I32, 2); - output.writeI32(this.status); - output.writeFieldEnd(); - } - output.writeFieldStop(); - output.writeStructEnd(); - return; -}; - -BooleanRead = function(args) { - this.value = null; - this.status = null; - if (args) { - if (args.value !== undefined && args.value !== null) { - this.value = Thrift.copyList(args.value, [null]); - } - if (args.status !== undefined && args.status !== null) { - this.status = args.status; - } - } -}; -BooleanRead.prototype = {}; -BooleanRead.prototype.read = function(input) { - input.readStructBegin(); - while (true) { - var ret = input.readFieldBegin(); - var ftype = ret.ftype; - var fid = ret.fid; - if (ftype == Thrift.Type.STOP) { - break; - } - switch (fid) { - case 1: - if (ftype == Thrift.Type.LIST) { - this.value = []; - var _rtmp341 = input.readListBegin(); - var _size40 = _rtmp341.size || 0; - for (var _i42 = 0; _i42 < _size40; ++_i42) { - var elem43 = null; - elem43 = input.readBool().value; - this.value.push(elem43); - } - input.readListEnd(); - } else { - input.skip(ftype); - } - break; - case 2: - if (ftype == Thrift.Type.I32) { - this.status = input.readI32().value; - } else { - input.skip(ftype); - } - break; - default: - input.skip(ftype); - } - input.readFieldEnd(); - } - input.readStructEnd(); - return; -}; - -BooleanRead.prototype.write = function(output) { - output.writeStructBegin('BooleanRead'); - if (this.value !== null && this.value !== undefined) { - output.writeFieldBegin('value', Thrift.Type.LIST, 1); - output.writeListBegin(Thrift.Type.BOOL, this.value.length); - for (var iter44 in this.value) { - if (this.value.hasOwnProperty(iter44)) { - iter44 = this.value[iter44]; - output.writeBool(iter44); - } - } - output.writeListEnd(); - output.writeFieldEnd(); - } - if (this.status !== null && this.status !== undefined) { - output.writeFieldBegin('status', Thrift.Type.I32, 2); - output.writeI32(this.status); - output.writeFieldEnd(); - } - output.writeFieldStop(); - output.writeStructEnd(); - return; -}; - -ModelDescription = function(args) { - this.guid = null; - this.fmi_version = null; - this.modelName = null; - this.license = null; - this.copyright = null; - this.author = null; - this.version = null; - this.description = null; - this.generation_tool = null; - this.generation_date_and_time = null; - this.default_experiment = null; - this.variable_naming_convention = null; - this.model_variables = null; - this.model_structure = null; - this.model_identifier = null; - this.can_get_and_set_fmu_state = null; - this.can_serialize_fmu_state = null; - this.provides_directional_derivative = null; - this.can_handle_variable_communication_step_size = null; - this.can_interpolate_inputs = null; - this.max_output_derivative_order = null; - if (args) { - if (args.guid !== undefined && args.guid !== null) { - this.guid = args.guid; - } - if (args.fmi_version !== undefined && args.fmi_version !== null) { - this.fmi_version = args.fmi_version; - } - if (args.modelName !== undefined && args.modelName !== null) { - this.modelName = args.modelName; - } - if (args.license !== undefined && args.license !== null) { - this.license = args.license; - } - if (args.copyright !== undefined && args.copyright !== null) { - this.copyright = args.copyright; - } - if (args.author !== undefined && args.author !== null) { - this.author = args.author; - } - if (args.version !== undefined && args.version !== null) { - this.version = args.version; - } - if (args.description !== undefined && args.description !== null) { - this.description = args.description; - } - if (args.generation_tool !== undefined && args.generation_tool !== null) { - this.generation_tool = args.generation_tool; - } - if (args.generation_date_and_time !== undefined && args.generation_date_and_time !== null) { - this.generation_date_and_time = args.generation_date_and_time; - } - if (args.default_experiment !== undefined && args.default_experiment !== null) { - this.default_experiment = new DefaultExperiment(args.default_experiment); - } - if (args.variable_naming_convention !== undefined && args.variable_naming_convention !== null) { - this.variable_naming_convention = args.variable_naming_convention; - } - if (args.model_variables !== undefined && args.model_variables !== null) { - this.model_variables = Thrift.copyList(args.model_variables, [ScalarVariable]); - } - if (args.model_structure !== undefined && args.model_structure !== null) { - this.model_structure = new ModelStructure(args.model_structure); - } - if (args.model_identifier !== undefined && args.model_identifier !== null) { - this.model_identifier = args.model_identifier; - } - if (args.can_get_and_set_fmu_state !== undefined && args.can_get_and_set_fmu_state !== null) { - this.can_get_and_set_fmu_state = args.can_get_and_set_fmu_state; - } - if (args.can_serialize_fmu_state !== undefined && args.can_serialize_fmu_state !== null) { - this.can_serialize_fmu_state = args.can_serialize_fmu_state; - } - if (args.provides_directional_derivative !== undefined && args.provides_directional_derivative !== null) { - this.provides_directional_derivative = args.provides_directional_derivative; - } - if (args.can_handle_variable_communication_step_size !== undefined && args.can_handle_variable_communication_step_size !== null) { - this.can_handle_variable_communication_step_size = args.can_handle_variable_communication_step_size; - } - if (args.can_interpolate_inputs !== undefined && args.can_interpolate_inputs !== null) { - this.can_interpolate_inputs = args.can_interpolate_inputs; - } - if (args.max_output_derivative_order !== undefined && args.max_output_derivative_order !== null) { - this.max_output_derivative_order = args.max_output_derivative_order; - } - } -}; -ModelDescription.prototype = {}; -ModelDescription.prototype.read = function(input) { - input.readStructBegin(); - while (true) { - var ret = input.readFieldBegin(); - var ftype = ret.ftype; - var fid = ret.fid; - if (ftype == Thrift.Type.STOP) { - break; - } - switch (fid) { - case 1: - if (ftype == Thrift.Type.STRING) { - this.guid = input.readString().value; - } else { - input.skip(ftype); - } - break; - case 2: - if (ftype == Thrift.Type.STRING) { - this.fmi_version = input.readString().value; - } else { - input.skip(ftype); - } - break; - case 3: - if (ftype == Thrift.Type.STRING) { - this.modelName = input.readString().value; - } else { - input.skip(ftype); - } - break; - case 4: - if (ftype == Thrift.Type.STRING) { - this.license = input.readString().value; - } else { - input.skip(ftype); - } - break; - case 5: - if (ftype == Thrift.Type.STRING) { - this.copyright = input.readString().value; - } else { - input.skip(ftype); - } - break; - case 6: - if (ftype == Thrift.Type.STRING) { - this.author = input.readString().value; - } else { - input.skip(ftype); - } - break; - case 7: - if (ftype == Thrift.Type.STRING) { - this.version = input.readString().value; - } else { - input.skip(ftype); - } - break; - case 8: - if (ftype == Thrift.Type.STRING) { - this.description = input.readString().value; - } else { - input.skip(ftype); - } - break; - case 9: - if (ftype == Thrift.Type.STRING) { - this.generation_tool = input.readString().value; - } else { - input.skip(ftype); - } - break; - case 10: - if (ftype == Thrift.Type.STRING) { - this.generation_date_and_time = input.readString().value; - } else { - input.skip(ftype); - } - break; - case 11: - if (ftype == Thrift.Type.STRUCT) { - this.default_experiment = new DefaultExperiment(); - this.default_experiment.read(input); - } else { - input.skip(ftype); - } - break; - case 12: - if (ftype == Thrift.Type.STRING) { - this.variable_naming_convention = input.readString().value; - } else { - input.skip(ftype); - } - break; - case 13: - if (ftype == Thrift.Type.LIST) { - this.model_variables = []; - var _rtmp346 = input.readListBegin(); - var _size45 = _rtmp346.size || 0; - for (var _i47 = 0; _i47 < _size45; ++_i47) { - var elem48 = null; - elem48 = new ScalarVariable(); - elem48.read(input); - this.model_variables.push(elem48); - } - input.readListEnd(); - } else { - input.skip(ftype); - } - break; - case 14: - if (ftype == Thrift.Type.STRUCT) { - this.model_structure = new ModelStructure(); - this.model_structure.read(input); - } else { - input.skip(ftype); - } - break; - case 15: - if (ftype == Thrift.Type.STRING) { - this.model_identifier = input.readString().value; - } else { - input.skip(ftype); - } - break; - case 16: - if (ftype == Thrift.Type.BOOL) { - this.can_get_and_set_fmu_state = input.readBool().value; - } else { - input.skip(ftype); - } - break; - case 17: - if (ftype == Thrift.Type.BOOL) { - this.can_serialize_fmu_state = input.readBool().value; - } else { - input.skip(ftype); - } - break; - case 18: - if (ftype == Thrift.Type.BOOL) { - this.provides_directional_derivative = input.readBool().value; - } else { - input.skip(ftype); - } - break; - case 19: - if (ftype == Thrift.Type.BOOL) { - this.can_handle_variable_communication_step_size = input.readBool().value; - } else { - input.skip(ftype); - } - break; - case 20: - if (ftype == Thrift.Type.BOOL) { - this.can_interpolate_inputs = input.readBool().value; - } else { - input.skip(ftype); - } - break; - case 21: - if (ftype == Thrift.Type.I32) { - this.max_output_derivative_order = input.readI32().value; - } else { - input.skip(ftype); - } - break; - default: - input.skip(ftype); - } - input.readFieldEnd(); - } - input.readStructEnd(); - return; -}; - -ModelDescription.prototype.write = function(output) { - output.writeStructBegin('ModelDescription'); - if (this.guid !== null && this.guid !== undefined) { - output.writeFieldBegin('guid', Thrift.Type.STRING, 1); - output.writeString(this.guid); - output.writeFieldEnd(); - } - if (this.fmi_version !== null && this.fmi_version !== undefined) { - output.writeFieldBegin('fmi_version', Thrift.Type.STRING, 2); - output.writeString(this.fmi_version); - output.writeFieldEnd(); - } - if (this.modelName !== null && this.modelName !== undefined) { - output.writeFieldBegin('modelName', Thrift.Type.STRING, 3); - output.writeString(this.modelName); - output.writeFieldEnd(); - } - if (this.license !== null && this.license !== undefined) { - output.writeFieldBegin('license', Thrift.Type.STRING, 4); - output.writeString(this.license); - output.writeFieldEnd(); - } - if (this.copyright !== null && this.copyright !== undefined) { - output.writeFieldBegin('copyright', Thrift.Type.STRING, 5); - output.writeString(this.copyright); - output.writeFieldEnd(); - } - if (this.author !== null && this.author !== undefined) { - output.writeFieldBegin('author', Thrift.Type.STRING, 6); - output.writeString(this.author); - output.writeFieldEnd(); - } - if (this.version !== null && this.version !== undefined) { - output.writeFieldBegin('version', Thrift.Type.STRING, 7); - output.writeString(this.version); - output.writeFieldEnd(); - } - if (this.description !== null && this.description !== undefined) { - output.writeFieldBegin('description', Thrift.Type.STRING, 8); - output.writeString(this.description); - output.writeFieldEnd(); - } - if (this.generation_tool !== null && this.generation_tool !== undefined) { - output.writeFieldBegin('generation_tool', Thrift.Type.STRING, 9); - output.writeString(this.generation_tool); - output.writeFieldEnd(); - } - if (this.generation_date_and_time !== null && this.generation_date_and_time !== undefined) { - output.writeFieldBegin('generation_date_and_time', Thrift.Type.STRING, 10); - output.writeString(this.generation_date_and_time); - output.writeFieldEnd(); - } - if (this.default_experiment !== null && this.default_experiment !== undefined) { - output.writeFieldBegin('default_experiment', Thrift.Type.STRUCT, 11); - this.default_experiment.write(output); - output.writeFieldEnd(); - } - if (this.variable_naming_convention !== null && this.variable_naming_convention !== undefined) { - output.writeFieldBegin('variable_naming_convention', Thrift.Type.STRING, 12); - output.writeString(this.variable_naming_convention); - output.writeFieldEnd(); - } - if (this.model_variables !== null && this.model_variables !== undefined) { - output.writeFieldBegin('model_variables', Thrift.Type.LIST, 13); - output.writeListBegin(Thrift.Type.STRUCT, this.model_variables.length); - for (var iter49 in this.model_variables) { - if (this.model_variables.hasOwnProperty(iter49)) { - iter49 = this.model_variables[iter49]; - iter49.write(output); - } - } - output.writeListEnd(); - output.writeFieldEnd(); - } - if (this.model_structure !== null && this.model_structure !== undefined) { - output.writeFieldBegin('model_structure', Thrift.Type.STRUCT, 14); - this.model_structure.write(output); - output.writeFieldEnd(); - } - if (this.model_identifier !== null && this.model_identifier !== undefined) { - output.writeFieldBegin('model_identifier', Thrift.Type.STRING, 15); - output.writeString(this.model_identifier); - output.writeFieldEnd(); - } - if (this.can_get_and_set_fmu_state !== null && this.can_get_and_set_fmu_state !== undefined) { - output.writeFieldBegin('can_get_and_set_fmu_state', Thrift.Type.BOOL, 16); - output.writeBool(this.can_get_and_set_fmu_state); - output.writeFieldEnd(); - } - if (this.can_serialize_fmu_state !== null && this.can_serialize_fmu_state !== undefined) { - output.writeFieldBegin('can_serialize_fmu_state', Thrift.Type.BOOL, 17); - output.writeBool(this.can_serialize_fmu_state); - output.writeFieldEnd(); - } - if (this.provides_directional_derivative !== null && this.provides_directional_derivative !== undefined) { - output.writeFieldBegin('provides_directional_derivative', Thrift.Type.BOOL, 18); - output.writeBool(this.provides_directional_derivative); - output.writeFieldEnd(); - } - if (this.can_handle_variable_communication_step_size !== null && this.can_handle_variable_communication_step_size !== undefined) { - output.writeFieldBegin('can_handle_variable_communication_step_size', Thrift.Type.BOOL, 19); - output.writeBool(this.can_handle_variable_communication_step_size); - output.writeFieldEnd(); - } - if (this.can_interpolate_inputs !== null && this.can_interpolate_inputs !== undefined) { - output.writeFieldBegin('can_interpolate_inputs', Thrift.Type.BOOL, 20); - output.writeBool(this.can_interpolate_inputs); - output.writeFieldEnd(); - } - if (this.max_output_derivative_order !== null && this.max_output_derivative_order !== undefined) { - output.writeFieldBegin('max_output_derivative_order', Thrift.Type.I32, 21); - output.writeI32(this.max_output_derivative_order); - output.writeFieldEnd(); - } - output.writeFieldStop(); - output.writeStructEnd(); - return; -}; - -NoSuchFmuException = function(args) { - this.message = null; - if (args) { - if (args.message !== undefined && args.message !== null) { - this.message = args.message; - } - } -}; -Thrift.inherits(NoSuchFmuException, Thrift.TException); -NoSuchFmuException.prototype.name = 'NoSuchFmuException'; -NoSuchFmuException.prototype.read = function(input) { - input.readStructBegin(); - while (true) { - var ret = input.readFieldBegin(); - var ftype = ret.ftype; - var fid = ret.fid; - if (ftype == Thrift.Type.STOP) { - break; - } - switch (fid) { - case 1: - if (ftype == Thrift.Type.STRING) { - this.message = input.readString().value; - } else { - input.skip(ftype); - } - break; - case 0: - input.skip(ftype); - break; - default: - input.skip(ftype); - } - input.readFieldEnd(); - } - input.readStructEnd(); - return; -}; - -NoSuchFmuException.prototype.write = function(output) { - output.writeStructBegin('NoSuchFmuException'); - if (this.message !== null && this.message !== undefined) { - output.writeFieldBegin('message', Thrift.Type.STRING, 1); - output.writeString(this.message); - output.writeFieldEnd(); - } - output.writeFieldStop(); - output.writeStructEnd(); - return; -}; - -NoSuchInstanceException = function(args) { - this.message = null; - if (args) { - if (args.message !== undefined && args.message !== null) { - this.message = args.message; - } - } -}; -Thrift.inherits(NoSuchInstanceException, Thrift.TException); -NoSuchInstanceException.prototype.name = 'NoSuchInstanceException'; -NoSuchInstanceException.prototype.read = function(input) { - input.readStructBegin(); - while (true) { - var ret = input.readFieldBegin(); - var ftype = ret.ftype; - var fid = ret.fid; - if (ftype == Thrift.Type.STOP) { - break; - } - switch (fid) { - case 1: - if (ftype == Thrift.Type.STRING) { - this.message = input.readString().value; - } else { - input.skip(ftype); - } - break; - case 0: - input.skip(ftype); - break; - default: - input.skip(ftype); - } - input.readFieldEnd(); - } - input.readStructEnd(); - return; -}; - -NoSuchInstanceException.prototype.write = function(output) { - output.writeStructBegin('NoSuchInstanceException'); - if (this.message !== null && this.message !== undefined) { - output.writeFieldBegin('message', Thrift.Type.STRING, 1); - output.writeString(this.message); - output.writeFieldEnd(); - } - output.writeFieldStop(); - output.writeStructEnd(); - return; -}; - -NoSuchVariableException = function(args) { - this.message = null; - if (args) { - if (args.message !== undefined && args.message !== null) { - this.message = args.message; - } - } -}; -Thrift.inherits(NoSuchVariableException, Thrift.TException); -NoSuchVariableException.prototype.name = 'NoSuchVariableException'; -NoSuchVariableException.prototype.read = function(input) { - input.readStructBegin(); - while (true) { - var ret = input.readFieldBegin(); - var ftype = ret.ftype; - var fid = ret.fid; - if (ftype == Thrift.Type.STOP) { - break; - } - switch (fid) { - case 1: - if (ftype == Thrift.Type.STRING) { - this.message = input.readString().value; - } else { - input.skip(ftype); - } - break; - case 0: - input.skip(ftype); - break; - default: - input.skip(ftype); - } - input.readFieldEnd(); - } - input.readStructEnd(); - return; -}; - -NoSuchVariableException.prototype.write = function(output) { - output.writeStructBegin('NoSuchVariableException'); - if (this.message !== null && this.message !== undefined) { - output.writeFieldBegin('message', Thrift.Type.STRING, 1); - output.writeString(this.message); - output.writeFieldEnd(); - } - output.writeFieldStop(); - output.writeStructEnd(); - return; -}; - -UnsupportedOperationException = function(args) { - this.message = null; - if (args) { - if (args.message !== undefined && args.message !== null) { - this.message = args.message; - } - } -}; -Thrift.inherits(UnsupportedOperationException, Thrift.TException); -UnsupportedOperationException.prototype.name = 'UnsupportedOperationException'; -UnsupportedOperationException.prototype.read = function(input) { - input.readStructBegin(); - while (true) { - var ret = input.readFieldBegin(); - var ftype = ret.ftype; - var fid = ret.fid; - if (ftype == Thrift.Type.STOP) { - break; - } - switch (fid) { - case 1: - if (ftype == Thrift.Type.STRING) { - this.message = input.readString().value; - } else { - input.skip(ftype); - } - break; - case 0: - input.skip(ftype); - break; - default: - input.skip(ftype); - } - input.readFieldEnd(); - } - input.readStructEnd(); - return; -}; - -UnsupportedOperationException.prototype.write = function(output) { - output.writeStructBegin('UnsupportedOperationException'); - if (this.message !== null && this.message !== undefined) { - output.writeFieldBegin('message', Thrift.Type.STRING, 1); - output.writeString(this.message); - output.writeFieldEnd(); - } - output.writeFieldStop(); - output.writeStructEnd(); - return; -}; - -DirectionalDerivativeResult = function(args) { - this.dv_unknown_ref = null; - this.status = null; - if (args) { - if (args.dv_unknown_ref !== undefined && args.dv_unknown_ref !== null) { - this.dv_unknown_ref = Thrift.copyList(args.dv_unknown_ref, [null]); - } - if (args.status !== undefined && args.status !== null) { - this.status = args.status; - } - } -}; -DirectionalDerivativeResult.prototype = {}; -DirectionalDerivativeResult.prototype.read = function(input) { - input.readStructBegin(); - while (true) { - var ret = input.readFieldBegin(); - var ftype = ret.ftype; - var fid = ret.fid; - if (ftype == Thrift.Type.STOP) { - break; - } - switch (fid) { - case 1: - if (ftype == Thrift.Type.LIST) { - this.dv_unknown_ref = []; - var _rtmp351 = input.readListBegin(); - var _size50 = _rtmp351.size || 0; - for (var _i52 = 0; _i52 < _size50; ++_i52) { - var elem53 = null; - elem53 = input.readDouble().value; - this.dv_unknown_ref.push(elem53); - } - input.readListEnd(); - } else { - input.skip(ftype); - } - break; - case 2: - if (ftype == Thrift.Type.I32) { - this.status = input.readI32().value; - } else { - input.skip(ftype); - } - break; - default: - input.skip(ftype); - } - input.readFieldEnd(); - } - input.readStructEnd(); - return; -}; - -DirectionalDerivativeResult.prototype.write = function(output) { - output.writeStructBegin('DirectionalDerivativeResult'); - if (this.dv_unknown_ref !== null && this.dv_unknown_ref !== undefined) { - output.writeFieldBegin('dv_unknown_ref', Thrift.Type.LIST, 1); - output.writeListBegin(Thrift.Type.DOUBLE, this.dv_unknown_ref.length); - for (var iter54 in this.dv_unknown_ref) { - if (this.dv_unknown_ref.hasOwnProperty(iter54)) { - iter54 = this.dv_unknown_ref[iter54]; - output.writeDouble(iter54); - } - } - output.writeListEnd(); - output.writeFieldEnd(); - } - if (this.status !== null && this.status !== undefined) { - output.writeFieldBegin('status', Thrift.Type.I32, 2); - output.writeI32(this.status); - output.writeFieldEnd(); - } - output.writeFieldStop(); - output.writeStructEnd(); - return; -}; - diff --git a/client-demos/browser/thrift/js/thrift.js b/client-demos/browser/thrift/js/thrift.js deleted file mode 100644 index 9418ca37..00000000 --- a/client-demos/browser/thrift/js/thrift.js +++ /dev/null @@ -1,1569 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/*jshint evil:true*/ - -/** - * The Thrift namespace houses the Apache Thrift JavaScript library - * elements providing JavaScript bindings for the Apache Thrift RPC - * system. End users will typically only directly make use of the - * Transport (TXHRTransport/TWebSocketTransport) and Protocol - * (TJSONPRotocol/TBinaryProtocol) constructors. - * - * Object methods beginning with a __ (e.g. __onOpen()) are internal - * and should not be called outside of the object's own methods. - * - * This library creates one global object: Thrift - * Code in this library must never create additional global identifiers, - * all features must be scoped within the Thrift namespace. - * @namespace - * @example - * var transport = new Thrift.Transport('http://localhost:8585'); - * var protocol = new Thrift.Protocol(transport); - * var client = new MyThriftSvcClient(protocol); - * var result = client.MyMethod(); - */ -var Thrift = { - /** - * Thrift JavaScript library version. - * @readonly - * @const {string} Version - * @memberof Thrift - */ - Version: '0.12.0', - - /** - * Thrift IDL type string to Id mapping. - * @readonly - * @property {number} STOP - End of a set of fields. - * @property {number} VOID - No value (only legal for return types). - * @property {number} BOOL - True/False integer. - * @property {number} BYTE - Signed 8 bit integer. - * @property {number} I08 - Signed 8 bit integer. - * @property {number} DOUBLE - 64 bit IEEE 854 floating point. - * @property {number} I16 - Signed 16 bit integer. - * @property {number} I32 - Signed 32 bit integer. - * @property {number} I64 - Signed 64 bit integer. - * @property {number} STRING - Array of bytes representing a string of characters. - * @property {number} UTF7 - Array of bytes representing a string of UTF7 encoded characters. - * @property {number} STRUCT - A multifield type. - * @property {number} MAP - A collection type (map/associative-array/dictionary). - * @property {number} SET - A collection type (unordered and without repeated values). - * @property {number} LIST - A collection type (unordered). - * @property {number} UTF8 - Array of bytes representing a string of UTF8 encoded characters. - * @property {number} UTF16 - Array of bytes representing a string of UTF16 encoded characters. - */ - Type: { - STOP: 0, - VOID: 1, - BOOL: 2, - BYTE: 3, - I08: 3, - DOUBLE: 4, - I16: 6, - I32: 8, - I64: 10, - STRING: 11, - UTF7: 11, - STRUCT: 12, - MAP: 13, - SET: 14, - LIST: 15, - UTF8: 16, - UTF16: 17 - }, - - /** - * Thrift RPC message type string to Id mapping. - * @readonly - * @property {number} CALL - RPC call sent from client to server. - * @property {number} REPLY - RPC call normal response from server to client. - * @property {number} EXCEPTION - RPC call exception response from server to client. - * @property {number} ONEWAY - Oneway RPC call from client to server with no response. - */ - MessageType: { - CALL: 1, - REPLY: 2, - EXCEPTION: 3, - ONEWAY: 4 - }, - - /** - * Utility function returning the count of an object's own properties. - * @param {object} obj - Object to test. - * @returns {number} number of object's own properties - */ - objectLength: function(obj) { - var length = 0; - for (var k in obj) { - if (obj.hasOwnProperty(k)) { - length++; - } - } - return length; - }, - - /** - * Utility function to establish prototype inheritance. - * @see {@link http://javascript.crockford.com/prototypal.html|Prototypal Inheritance} - * @param {function} constructor - Contstructor function to set as derived. - * @param {function} superConstructor - Contstructor function to set as base. - * @param {string} [name] - Type name to set as name property in derived prototype. - */ - inherits: function(constructor, superConstructor, name) { - function F() {} - F.prototype = superConstructor.prototype; - constructor.prototype = new F(); - constructor.prototype.name = name || ''; - } -}; - -/** - * Initializes a Thrift TException instance. - * @constructor - * @augments Error - * @param {string} message - The TException message (distinct from the Error message). - * @classdesc TException is the base class for all Thrift exceptions types. - */ -Thrift.TException = function(message) { - this.message = message; -}; -Thrift.inherits(Thrift.TException, Error, 'TException'); - -/** - * Returns the message set on the exception. - * @readonly - * @returns {string} exception message - */ -Thrift.TException.prototype.getMessage = function() { - return this.message; -}; - -/** - * Thrift Application Exception type string to Id mapping. - * @readonly - * @property {number} UNKNOWN - Unknown/undefined. - * @property {number} UNKNOWN_METHOD - Client attempted to call a method unknown to the server. - * @property {number} INVALID_MESSAGE_TYPE - Client passed an unknown/unsupported MessageType. - * @property {number} WRONG_METHOD_NAME - Unused. - * @property {number} BAD_SEQUENCE_ID - Unused in Thrift RPC, used to flag proprietary sequence number errors. - * @property {number} MISSING_RESULT - Raised by a server processor if a handler fails to supply the required return result. - * @property {number} INTERNAL_ERROR - Something bad happened. - * @property {number} PROTOCOL_ERROR - The protocol layer failed to serialize or deserialize data. - * @property {number} INVALID_TRANSFORM - Unused. - * @property {number} INVALID_PROTOCOL - The protocol (or version) is not supported. - * @property {number} UNSUPPORTED_CLIENT_TYPE - Unused. - */ -Thrift.TApplicationExceptionType = { - UNKNOWN: 0, - UNKNOWN_METHOD: 1, - INVALID_MESSAGE_TYPE: 2, - WRONG_METHOD_NAME: 3, - BAD_SEQUENCE_ID: 4, - MISSING_RESULT: 5, - INTERNAL_ERROR: 6, - PROTOCOL_ERROR: 7, - INVALID_TRANSFORM: 8, - INVALID_PROTOCOL: 9, - UNSUPPORTED_CLIENT_TYPE: 10 -}; - -/** - * Initializes a Thrift TApplicationException instance. - * @constructor - * @augments Thrift.TException - * @param {string} message - The TApplicationException message (distinct from the Error message). - * @param {Thrift.TApplicationExceptionType} [code] - The TApplicationExceptionType code. - * @classdesc TApplicationException is the exception class used to propagate exceptions from an RPC server back to a calling client. -*/ -Thrift.TApplicationException = function(message, code) { - this.message = message; - this.code = typeof code === 'number' ? code : 0; -}; -Thrift.inherits(Thrift.TApplicationException, Thrift.TException, 'TApplicationException'); - -/** - * Read a TApplicationException from the supplied protocol. - * @param {object} input - The input protocol to read from. - */ -Thrift.TApplicationException.prototype.read = function(input) { - while (1) { - var ret = input.readFieldBegin(); - - if (ret.ftype == Thrift.Type.STOP) { - break; - } - - var fid = ret.fid; - - switch (fid) { - case 1: - if (ret.ftype == Thrift.Type.STRING) { - ret = input.readString(); - this.message = ret.value; - } else { - ret = input.skip(ret.ftype); - } - break; - case 2: - if (ret.ftype == Thrift.Type.I32) { - ret = input.readI32(); - this.code = ret.value; - } else { - ret = input.skip(ret.ftype); - } - break; - default: - ret = input.skip(ret.ftype); - break; - } - - input.readFieldEnd(); - } - - input.readStructEnd(); -}; - -/** - * Wite a TApplicationException to the supplied protocol. - * @param {object} output - The output protocol to write to. - */ -Thrift.TApplicationException.prototype.write = function(output) { - output.writeStructBegin('TApplicationException'); - - if (this.message) { - output.writeFieldBegin('message', Thrift.Type.STRING, 1); - output.writeString(this.getMessage()); - output.writeFieldEnd(); - } - - if (this.code) { - output.writeFieldBegin('type', Thrift.Type.I32, 2); - output.writeI32(this.code); - output.writeFieldEnd(); - } - - output.writeFieldStop(); - output.writeStructEnd(); -}; - -/** - * Returns the application exception code set on the exception. - * @readonly - * @returns {Thrift.TApplicationExceptionType} exception code - */ -Thrift.TApplicationException.prototype.getCode = function() { - return this.code; -}; - -Thrift.TProtocolExceptionType = { - UNKNOWN: 0, - INVALID_DATA: 1, - NEGATIVE_SIZE: 2, - SIZE_LIMIT: 3, - BAD_VERSION: 4, - NOT_IMPLEMENTED: 5, - DEPTH_LIMIT: 6 -}; - -Thrift.TProtocolException = function TProtocolException(type, message) { - Error.call(this); - Error.captureStackTrace(this, this.constructor); - this.name = this.constructor.name; - this.type = type; - this.message = message; -}; -Thrift.inherits(Thrift.TProtocolException, Thrift.TException, 'TProtocolException'); - -/** - * Constructor Function for the XHR transport. - * If you do not specify a url then you must handle XHR operations on - * your own. This type can also be constructed using the Transport alias - * for backward compatibility. - * @constructor - * @param {string} [url] - The URL to connect to. - * @classdesc The Apache Thrift Transport layer performs byte level I/O - * between RPC clients and servers. The JavaScript TXHRTransport object - * uses Http[s]/XHR. Target servers must implement the http[s] transport - * (see: node.js example server_http.js). - * @example - * var transport = new Thrift.TXHRTransport("http://localhost:8585"); - */ -Thrift.Transport = Thrift.TXHRTransport = function(url, options) { - this.url = url; - this.wpos = 0; - this.rpos = 0; - this.useCORS = (options && options.useCORS); - this.customHeaders = options ? (options.customHeaders ? options.customHeaders : {}): {}; - this.send_buf = ''; - this.recv_buf = ''; -}; - -Thrift.TXHRTransport.prototype = { - /** - * Gets the browser specific XmlHttpRequest Object. - * @returns {object} the browser XHR interface object - */ - getXmlHttpRequestObject: function() { - try { return new XMLHttpRequest(); } catch (e1) { } - try { return new ActiveXObject('Msxml2.XMLHTTP'); } catch (e2) { } - try { return new ActiveXObject('Microsoft.XMLHTTP'); } catch (e3) { } - - throw "Your browser doesn't support XHR."; - }, - - /** - * Sends the current XRH request if the transport was created with a URL - * and the async parameter is false. If the transport was not created with - * a URL, or the async parameter is True and no callback is provided, or - * the URL is an empty string, the current send buffer is returned. - * @param {object} async - If true the current send buffer is returned. - * @param {object} callback - Optional async completion callback - * @returns {undefined|string} Nothing or the current send buffer. - * @throws {string} If XHR fails. - */ - flush: function(async, callback) { - var self = this; - if ((async && !callback) || this.url === undefined || this.url === '') { - return this.send_buf; - } - - var xreq = this.getXmlHttpRequestObject(); - - if (xreq.overrideMimeType) { - xreq.overrideMimeType('application/vnd.apache.thrift.json; charset=utf-8'); - } - - if (callback) { - //Ignore XHR callbacks until the data arrives, then call the - // client's callback - xreq.onreadystatechange = - (function() { - var clientCallback = callback; - return function() { - if (this.readyState == 4 && this.status == 200) { - self.setRecvBuffer(this.responseText); - clientCallback(); - } - }; - }()); - - // detect net::ERR_CONNECTION_REFUSED and call the callback. - xreq.onerror = - (function() { - var clientCallback = callback; - return function() { - clientCallback(); - }; - }()); - - } - - xreq.open('POST', this.url, !!async); - - // add custom headers - Object.keys(self.customHeaders).forEach(function(prop) { - xreq.setRequestHeader(prop, self.customHeaders[prop]); - }); - - if (xreq.setRequestHeader) { - xreq.setRequestHeader('Accept', 'application/vnd.apache.thrift.json; charset=utf-8'); - xreq.setRequestHeader('Content-Type', 'application/vnd.apache.thrift.json; charset=utf-8'); - } - - xreq.send(this.send_buf); - if (async && callback) { - return; - } - - if (xreq.readyState != 4) { - throw 'encountered an unknown ajax ready state: ' + xreq.readyState; - } - - if (xreq.status != 200) { - throw 'encountered a unknown request status: ' + xreq.status; - } - - this.recv_buf = xreq.responseText; - this.recv_buf_sz = this.recv_buf.length; - this.wpos = this.recv_buf.length; - this.rpos = 0; - }, - - /** - * Creates a jQuery XHR object to be used for a Thrift server call. - * @param {object} client - The Thrift Service client object generated by the IDL compiler. - * @param {object} postData - The message to send to the server. - * @param {function} args - The original call arguments with the success call back at the end. - * @param {function} recv_method - The Thrift Service Client receive method for the call. - * @returns {object} A new jQuery XHR object. - * @throws {string} If the jQuery version is prior to 1.5 or if jQuery is not found. - */ - jqRequest: function(client, postData, args, recv_method) { - if (typeof jQuery === 'undefined' || - typeof jQuery.Deferred === 'undefined') { - throw 'Thrift.js requires jQuery 1.5+ to use asynchronous requests'; - } - - var thriftTransport = this; - - var jqXHR = jQuery.ajax({ - url: this.url, - data: postData, - type: 'POST', - cache: false, - contentType: 'application/vnd.apache.thrift.json; charset=utf-8', - dataType: 'text thrift', - converters: { - 'text thrift' : function(responseData) { - thriftTransport.setRecvBuffer(responseData); - var value = recv_method.call(client); - return value; - } - }, - context: client, - success: jQuery.makeArray(args).pop() - }); - - return jqXHR; - }, - - /** - * Sets the buffer to provide the protocol when deserializing. - * @param {string} buf - The buffer to supply the protocol. - */ - setRecvBuffer: function(buf) { - this.recv_buf = buf; - this.recv_buf_sz = this.recv_buf.length; - this.wpos = this.recv_buf.length; - this.rpos = 0; - }, - - /** - * Returns true if the transport is open, XHR always returns true. - * @readonly - * @returns {boolean} Always True. - */ - isOpen: function() { - return true; - }, - - /** - * Opens the transport connection, with XHR this is a nop. - */ - open: function() {}, - - /** - * Closes the transport connection, with XHR this is a nop. - */ - close: function() {}, - - /** - * Returns the specified number of characters from the response - * buffer. - * @param {number} len - The number of characters to return. - * @returns {string} Characters sent by the server. - */ - read: function(len) { - var avail = this.wpos - this.rpos; - - if (avail === 0) { - return ''; - } - - var give = len; - - if (avail < len) { - give = avail; - } - - var ret = this.read_buf.substr(this.rpos, give); - this.rpos += give; - - //clear buf when complete? - return ret; - }, - - /** - * Returns the entire response buffer. - * @returns {string} Characters sent by the server. - */ - readAll: function() { - return this.recv_buf; - }, - - /** - * Sets the send buffer to buf. - * @param {string} buf - The buffer to send. - */ - write: function(buf) { - this.send_buf = buf; - }, - - /** - * Returns the send buffer. - * @readonly - * @returns {string} The send buffer. - */ - getSendBuffer: function() { - return this.send_buf; - } - -}; - - -/** - * Constructor Function for the WebSocket transport. - * @constructor - * @param {string} [url] - The URL to connect to. - * @classdesc The Apache Thrift Transport layer performs byte level I/O - * between RPC clients and servers. The JavaScript TWebSocketTransport object - * uses the WebSocket protocol. Target servers must implement WebSocket. - * (see: node.js example server_http.js). - * @example - * var transport = new Thrift.TWebSocketTransport("http://localhost:8585"); - */ -Thrift.TWebSocketTransport = function(url) { - this.__reset(url); -}; - -Thrift.TWebSocketTransport.prototype = { - __reset: function(url) { - this.url = url; //Where to connect - this.socket = null; //The web socket - this.callbacks = []; //Pending callbacks - this.send_pending = []; //Buffers/Callback pairs waiting to be sent - this.send_buf = ''; //Outbound data, immutable until sent - this.recv_buf = ''; //Inbound data - this.rb_wpos = 0; //Network write position in receive buffer - this.rb_rpos = 0; //Client read position in receive buffer - }, - - /** - * Sends the current WS request and registers callback. The async - * parameter is ignored (WS flush is always async) and the callback - * function parameter is required. - * @param {object} async - Ignored. - * @param {object} callback - The client completion callback. - * @returns {undefined|string} Nothing (undefined) - */ - flush: function(async, callback) { - var self = this; - if (this.isOpen()) { - //Send data and register a callback to invoke the client callback - this.socket.send(this.send_buf); - this.callbacks.push((function() { - var clientCallback = callback; - return function(msg) { - self.setRecvBuffer(msg); - if (clientCallback) { - clientCallback(); - } - }; - }())); - } else { - //Queue the send to go out __onOpen - this.send_pending.push({ - buf: this.send_buf, - cb: callback - }); - } - }, - - __onOpen: function() { - var self = this; - if (this.send_pending.length > 0) { - //If the user made calls before the connection was fully - //open, send them now - this.send_pending.forEach(function(elem) { - self.socket.send(elem.buf); - self.callbacks.push((function() { - var clientCallback = elem.cb; - return function(msg) { - self.setRecvBuffer(msg); - clientCallback(); - }; - }())); - }); - this.send_pending = []; - } - }, - - __onClose: function(evt) { - this.__reset(this.url); - }, - - __onMessage: function(evt) { - if (this.callbacks.length) { - this.callbacks.shift()(evt.data); - } - }, - - __onError: function(evt) { - console.log('Thrift WebSocket Error: ' + evt.toString()); - this.socket.close(); - }, - - /** - * Sets the buffer to use when receiving server responses. - * @param {string} buf - The buffer to receive server responses. - */ - setRecvBuffer: function(buf) { - this.recv_buf = buf; - this.recv_buf_sz = this.recv_buf.length; - this.wpos = this.recv_buf.length; - this.rpos = 0; - }, - - /** - * Returns true if the transport is open - * @readonly - * @returns {boolean} - */ - isOpen: function() { - return this.socket && this.socket.readyState == this.socket.OPEN; - }, - - /** - * Opens the transport connection - */ - open: function() { - //If OPEN/CONNECTING/CLOSING ignore additional opens - if (this.socket && this.socket.readyState != this.socket.CLOSED) { - return; - } - //If there is no socket or the socket is closed: - this.socket = new WebSocket(this.url); - this.socket.onopen = this.__onOpen.bind(this); - this.socket.onmessage = this.__onMessage.bind(this); - this.socket.onerror = this.__onError.bind(this); - this.socket.onclose = this.__onClose.bind(this); - }, - - /** - * Closes the transport connection - */ - close: function() { - this.socket.close(); - }, - - /** - * Returns the specified number of characters from the response - * buffer. - * @param {number} len - The number of characters to return. - * @returns {string} Characters sent by the server. - */ - read: function(len) { - var avail = this.wpos - this.rpos; - - if (avail === 0) { - return ''; - } - - var give = len; - - if (avail < len) { - give = avail; - } - - var ret = this.read_buf.substr(this.rpos, give); - this.rpos += give; - - //clear buf when complete? - return ret; - }, - - /** - * Returns the entire response buffer. - * @returns {string} Characters sent by the server. - */ - readAll: function() { - return this.recv_buf; - }, - - /** - * Sets the send buffer to buf. - * @param {string} buf - The buffer to send. - */ - write: function(buf) { - this.send_buf = buf; - }, - - /** - * Returns the send buffer. - * @readonly - * @returns {string} The send buffer. - */ - getSendBuffer: function() { - return this.send_buf; - } - -}; - -/** - * Initializes a Thrift JSON protocol instance. - * @constructor - * @param {Thrift.Transport} transport - The transport to serialize to/from. - * @classdesc Apache Thrift Protocols perform serialization which enables cross - * language RPC. The Protocol type is the JavaScript browser implementation - * of the Apache Thrift TJSONProtocol. - * @example - * var protocol = new Thrift.Protocol(transport); - */ -Thrift.TJSONProtocol = Thrift.Protocol = function(transport) { - this.tstack = []; - this.tpos = []; - this.transport = transport; -}; - -/** - * Thrift IDL type Id to string mapping. - * @readonly - * @see {@link Thrift.Type} - */ -Thrift.Protocol.Type = {}; -Thrift.Protocol.Type[Thrift.Type.BOOL] = '"tf"'; -Thrift.Protocol.Type[Thrift.Type.BYTE] = '"i8"'; -Thrift.Protocol.Type[Thrift.Type.I16] = '"i16"'; -Thrift.Protocol.Type[Thrift.Type.I32] = '"i32"'; -Thrift.Protocol.Type[Thrift.Type.I64] = '"i64"'; -Thrift.Protocol.Type[Thrift.Type.DOUBLE] = '"dbl"'; -Thrift.Protocol.Type[Thrift.Type.STRUCT] = '"rec"'; -Thrift.Protocol.Type[Thrift.Type.STRING] = '"str"'; -Thrift.Protocol.Type[Thrift.Type.MAP] = '"map"'; -Thrift.Protocol.Type[Thrift.Type.LIST] = '"lst"'; -Thrift.Protocol.Type[Thrift.Type.SET] = '"set"'; - -/** - * Thrift IDL type string to Id mapping. - * @readonly - * @see {@link Thrift.Type} - */ -Thrift.Protocol.RType = {}; -Thrift.Protocol.RType.tf = Thrift.Type.BOOL; -Thrift.Protocol.RType.i8 = Thrift.Type.BYTE; -Thrift.Protocol.RType.i16 = Thrift.Type.I16; -Thrift.Protocol.RType.i32 = Thrift.Type.I32; -Thrift.Protocol.RType.i64 = Thrift.Type.I64; -Thrift.Protocol.RType.dbl = Thrift.Type.DOUBLE; -Thrift.Protocol.RType.rec = Thrift.Type.STRUCT; -Thrift.Protocol.RType.str = Thrift.Type.STRING; -Thrift.Protocol.RType.map = Thrift.Type.MAP; -Thrift.Protocol.RType.lst = Thrift.Type.LIST; -Thrift.Protocol.RType.set = Thrift.Type.SET; - -/** - * The TJSONProtocol version number. - * @readonly - * @const {number} Version - * @memberof Thrift.Protocol - */ - Thrift.Protocol.Version = 1; - -Thrift.Protocol.prototype = { - /** - * Returns the underlying transport. - * @readonly - * @returns {Thrift.Transport} The underlying transport. - */ - getTransport: function() { - return this.transport; - }, - - /** - * Serializes the beginning of a Thrift RPC message. - * @param {string} name - The service method to call. - * @param {Thrift.MessageType} messageType - The type of method call. - * @param {number} seqid - The sequence number of this call (always 0 in Apache Thrift). - */ - writeMessageBegin: function(name, messageType, seqid) { - this.tstack = []; - this.tpos = []; - - this.tstack.push([Thrift.Protocol.Version, '"' + - name + '"', messageType, seqid]); - }, - - /** - * Serializes the end of a Thrift RPC message. - */ - writeMessageEnd: function() { - var obj = this.tstack.pop(); - - this.wobj = this.tstack.pop(); - this.wobj.push(obj); - - this.wbuf = '[' + this.wobj.join(',') + ']'; - - this.transport.write(this.wbuf); - }, - - - /** - * Serializes the beginning of a struct. - * @param {string} name - The name of the struct. - */ - writeStructBegin: function(name) { - this.tpos.push(this.tstack.length); - this.tstack.push({}); - }, - - /** - * Serializes the end of a struct. - */ - writeStructEnd: function() { - - var p = this.tpos.pop(); - var struct = this.tstack[p]; - var str = '{'; - var first = true; - for (var key in struct) { - if (first) { - first = false; - } else { - str += ','; - } - - str += key + ':' + struct[key]; - } - - str += '}'; - this.tstack[p] = str; - }, - - /** - * Serializes the beginning of a struct field. - * @param {string} name - The name of the field. - * @param {Thrift.Protocol.Type} fieldType - The data type of the field. - * @param {number} fieldId - The field's unique identifier. - */ - writeFieldBegin: function(name, fieldType, fieldId) { - this.tpos.push(this.tstack.length); - this.tstack.push({ 'fieldId': '"' + - fieldId + '"', 'fieldType': Thrift.Protocol.Type[fieldType] - }); - - }, - - /** - * Serializes the end of a field. - */ - writeFieldEnd: function() { - var value = this.tstack.pop(); - var fieldInfo = this.tstack.pop(); - - this.tstack[this.tstack.length - 1][fieldInfo.fieldId] = '{' + - fieldInfo.fieldType + ':' + value + '}'; - this.tpos.pop(); - }, - - /** - * Serializes the end of the set of fields for a struct. - */ - writeFieldStop: function() { - //na - }, - - /** - * Serializes the beginning of a map collection. - * @param {Thrift.Type} keyType - The data type of the key. - * @param {Thrift.Type} valType - The data type of the value. - * @param {number} [size] - The number of elements in the map (ignored). - */ - writeMapBegin: function(keyType, valType, size) { - this.tpos.push(this.tstack.length); - this.tstack.push([Thrift.Protocol.Type[keyType], - Thrift.Protocol.Type[valType], 0]); - }, - - /** - * Serializes the end of a map. - */ - writeMapEnd: function() { - var p = this.tpos.pop(); - - if (p == this.tstack.length) { - return; - } - - if ((this.tstack.length - p - 1) % 2 !== 0) { - this.tstack.push(''); - } - - var size = (this.tstack.length - p - 1) / 2; - - this.tstack[p][this.tstack[p].length - 1] = size; - - var map = '}'; - var first = true; - while (this.tstack.length > p + 1) { - var v = this.tstack.pop(); - var k = this.tstack.pop(); - if (first) { - first = false; - } else { - map = ',' + map; - } - - if (! isNaN(k)) { k = '"' + k + '"'; } //json "keys" need to be strings - map = k + ':' + v + map; - } - map = '{' + map; - - this.tstack[p].push(map); - this.tstack[p] = '[' + this.tstack[p].join(',') + ']'; - }, - - /** - * Serializes the beginning of a list collection. - * @param {Thrift.Type} elemType - The data type of the elements. - * @param {number} size - The number of elements in the list. - */ - writeListBegin: function(elemType, size) { - this.tpos.push(this.tstack.length); - this.tstack.push([Thrift.Protocol.Type[elemType], size]); - }, - - /** - * Serializes the end of a list. - */ - writeListEnd: function() { - var p = this.tpos.pop(); - - while (this.tstack.length > p + 1) { - var tmpVal = this.tstack[p + 1]; - this.tstack.splice(p + 1, 1); - this.tstack[p].push(tmpVal); - } - - this.tstack[p] = '[' + this.tstack[p].join(',') + ']'; - }, - - /** - * Serializes the beginning of a set collection. - * @param {Thrift.Type} elemType - The data type of the elements. - * @param {number} size - The number of elements in the list. - */ - writeSetBegin: function(elemType, size) { - this.tpos.push(this.tstack.length); - this.tstack.push([Thrift.Protocol.Type[elemType], size]); - }, - - /** - * Serializes the end of a set. - */ - writeSetEnd: function() { - var p = this.tpos.pop(); - - while (this.tstack.length > p + 1) { - var tmpVal = this.tstack[p + 1]; - this.tstack.splice(p + 1, 1); - this.tstack[p].push(tmpVal); - } - - this.tstack[p] = '[' + this.tstack[p].join(',') + ']'; - }, - - /** Serializes a boolean */ - writeBool: function(value) { - this.tstack.push(value ? 1 : 0); - }, - - /** Serializes a number */ - writeByte: function(i8) { - this.tstack.push(i8); - }, - - /** Serializes a number */ - writeI16: function(i16) { - this.tstack.push(i16); - }, - - /** Serializes a number */ - writeI32: function(i32) { - this.tstack.push(i32); - }, - - /** Serializes a number */ - writeI64: function(i64) { - this.tstack.push(i64); - }, - - /** Serializes a number */ - writeDouble: function(dbl) { - this.tstack.push(dbl); - }, - - /** Serializes a string */ - writeString: function(str) { - // We do not encode uri components for wire transfer: - if (str === null) { - this.tstack.push(null); - } else { - // concat may be slower than building a byte buffer - var escapedString = ''; - for (var i = 0; i < str.length; i++) { - var ch = str.charAt(i); // a single double quote: " - if (ch === '\"') { - escapedString += '\\\"'; // write out as: \" - } else if (ch === '\\') { // a single backslash - escapedString += '\\\\'; // write out as double backslash - } else if (ch === '\b') { // a single backspace: invisible - escapedString += '\\b'; // write out as: \b" - } else if (ch === '\f') { // a single formfeed: invisible - escapedString += '\\f'; // write out as: \f" - } else if (ch === '\n') { // a single newline: invisible - escapedString += '\\n'; // write out as: \n" - } else if (ch === '\r') { // a single return: invisible - escapedString += '\\r'; // write out as: \r" - } else if (ch === '\t') { // a single tab: invisible - escapedString += '\\t'; // write out as: \t" - } else { - escapedString += ch; // Else it need not be escaped - } - } - this.tstack.push('"' + escapedString + '"'); - } - }, - - /** Serializes a string */ - writeBinary: function(binary) { - var str = ''; - if (typeof binary == 'string') { - str = binary; - } else if (binary instanceof Uint8Array) { - var arr = binary; - for (var i = 0; i < arr.length; ++i) { - str += String.fromCharCode(arr[i]); - } - } else { - throw new TypeError('writeBinary only accepts String or Uint8Array.'); - } - this.tstack.push('"' + btoa(str) + '"'); - }, - - /** - @class - @name AnonReadMessageBeginReturn - @property {string} fname - The name of the service method. - @property {Thrift.MessageType} mtype - The type of message call. - @property {number} rseqid - The sequence number of the message (0 in Thrift RPC). - */ - /** - * Deserializes the beginning of a message. - * @returns {AnonReadMessageBeginReturn} - */ - readMessageBegin: function() { - this.rstack = []; - this.rpos = []; - - if (typeof JSON !== 'undefined' && typeof JSON.parse === 'function') { - this.robj = JSON.parse(this.transport.readAll()); - } else if (typeof jQuery !== 'undefined') { - this.robj = jQuery.parseJSON(this.transport.readAll()); - } else { - this.robj = eval(this.transport.readAll()); - } - - var r = {}; - var version = this.robj.shift(); - - if (version != Thrift.Protocol.Version) { - throw 'Wrong thrift protocol version: ' + version; - } - - r.fname = this.robj.shift(); - r.mtype = this.robj.shift(); - r.rseqid = this.robj.shift(); - - - //get to the main obj - this.rstack.push(this.robj.shift()); - - return r; - }, - - /** Deserializes the end of a message. */ - readMessageEnd: function() { - }, - - /** - * Deserializes the beginning of a struct. - * @param {string} [name] - The name of the struct (ignored) - * @returns {object} - An object with an empty string fname property - */ - readStructBegin: function(name) { - var r = {}; - r.fname = ''; - - //incase this is an array of structs - if (this.rstack[this.rstack.length - 1] instanceof Array) { - this.rstack.push(this.rstack[this.rstack.length - 1].shift()); - } - - return r; - }, - - /** Deserializes the end of a struct. */ - readStructEnd: function() { - if (this.rstack[this.rstack.length - 2] instanceof Array) { - this.rstack.pop(); - } - }, - - /** - @class - @name AnonReadFieldBeginReturn - @property {string} fname - The name of the field (always ''). - @property {Thrift.Type} ftype - The data type of the field. - @property {number} fid - The unique identifier of the field. - */ - /** - * Deserializes the beginning of a field. - * @returns {AnonReadFieldBeginReturn} - */ - readFieldBegin: function() { - var r = {}; - - var fid = -1; - var ftype = Thrift.Type.STOP; - - //get a fieldId - for (var f in (this.rstack[this.rstack.length - 1])) { - if (f === null) { - continue; - } - - fid = parseInt(f, 10); - this.rpos.push(this.rstack.length); - - var field = this.rstack[this.rstack.length - 1][fid]; - - //remove so we don't see it again - delete this.rstack[this.rstack.length - 1][fid]; - - this.rstack.push(field); - - break; - } - - if (fid != -1) { - - //should only be 1 of these but this is the only - //way to match a key - for (var i in (this.rstack[this.rstack.length - 1])) { - if (Thrift.Protocol.RType[i] === null) { - continue; - } - - ftype = Thrift.Protocol.RType[i]; - this.rstack[this.rstack.length - 1] = - this.rstack[this.rstack.length - 1][i]; - } - } - - r.fname = ''; - r.ftype = ftype; - r.fid = fid; - - return r; - }, - - /** Deserializes the end of a field. */ - readFieldEnd: function() { - var pos = this.rpos.pop(); - - //get back to the right place in the stack - while (this.rstack.length > pos) { - this.rstack.pop(); - } - - }, - - /** - @class - @name AnonReadMapBeginReturn - @property {Thrift.Type} ktype - The data type of the key. - @property {Thrift.Type} vtype - The data type of the value. - @property {number} size - The number of elements in the map. - */ - /** - * Deserializes the beginning of a map. - * @returns {AnonReadMapBeginReturn} - */ - readMapBegin: function() { - var map = this.rstack.pop(); - var first = map.shift(); - if (first instanceof Array) { - this.rstack.push(map); - map = first; - first = map.shift(); - } - - var r = {}; - r.ktype = Thrift.Protocol.RType[first]; - r.vtype = Thrift.Protocol.RType[map.shift()]; - r.size = map.shift(); - - - this.rpos.push(this.rstack.length); - this.rstack.push(map.shift()); - - return r; - }, - - /** Deserializes the end of a map. */ - readMapEnd: function() { - this.readFieldEnd(); - }, - - /** - @class - @name AnonReadColBeginReturn - @property {Thrift.Type} etype - The data type of the element. - @property {number} size - The number of elements in the collection. - */ - /** - * Deserializes the beginning of a list. - * @returns {AnonReadColBeginReturn} - */ - readListBegin: function() { - var list = this.rstack[this.rstack.length - 1]; - - var r = {}; - r.etype = Thrift.Protocol.RType[list.shift()]; - r.size = list.shift(); - - this.rpos.push(this.rstack.length); - this.rstack.push(list.shift()); - - return r; - }, - - /** Deserializes the end of a list. */ - readListEnd: function() { - var pos = this.rpos.pop() - 2; - var st = this.rstack; - st.pop(); - if (st instanceof Array && st.length > pos && st[pos].length > 0) { - st.push(st[pos].shift()); - } - }, - - /** - * Deserializes the beginning of a set. - * @returns {AnonReadColBeginReturn} - */ - readSetBegin: function(elemType, size) { - return this.readListBegin(elemType, size); - }, - - /** Deserializes the end of a set. */ - readSetEnd: function() { - return this.readListEnd(); - }, - - /** Returns an object with a value property set to - * False unless the next number in the protocol buffer - * is 1, in which case the value property is True */ - readBool: function() { - var r = this.readI32(); - - if (r !== null && r.value == '1') { - r.value = true; - } else { - r.value = false; - } - - return r; - }, - - /** Returns the an object with a value property set to the - next value found in the protocol buffer */ - readByte: function() { - return this.readI32(); - }, - - /** Returns the an object with a value property set to the - next value found in the protocol buffer */ - readI16: function() { - return this.readI32(); - }, - - /** Returns the an object with a value property set to the - next value found in the protocol buffer */ - readI32: function(f) { - if (f === undefined) { - f = this.rstack[this.rstack.length - 1]; - } - - var r = {}; - - if (f instanceof Array) { - if (f.length === 0) { - r.value = undefined; - } else { - if (!f.isReversed) { - f.reverse(); - f.isReversed = true; - } - r.value = f.pop(); - } - } else if (f instanceof Object) { - for (var i in f) { - if (i === null) { - continue; - } - this.rstack.push(f[i]); - delete f[i]; - - r.value = i; - break; - } - } else { - r.value = f; - this.rstack.pop(); - } - - return r; - }, - - /** Returns the an object with a value property set to the - next value found in the protocol buffer */ - readI64: function() { - return this.readI32(); - }, - - /** Returns the an object with a value property set to the - next value found in the protocol buffer */ - readDouble: function() { - return this.readI32(); - }, - - /** Returns the an object with a value property set to the - next value found in the protocol buffer */ - readString: function() { - var r = this.readI32(); - return r; - }, - - /** Returns the an object with a value property set to the - next value found in the protocol buffer */ - readBinary: function() { - var r = this.readI32(); - r.value = atob(r.value); - return r; - }, - - /** - * Method to arbitrarily skip over data */ - skip: function(type) { - var ret, i; - switch (type) { - case Thrift.Type.STOP: - return null; - - case Thrift.Type.BOOL: - return this.readBool(); - - case Thrift.Type.BYTE: - return this.readByte(); - - case Thrift.Type.I16: - return this.readI16(); - - case Thrift.Type.I32: - return this.readI32(); - - case Thrift.Type.I64: - return this.readI64(); - - case Thrift.Type.DOUBLE: - return this.readDouble(); - - case Thrift.Type.STRING: - return this.readString(); - - case Thrift.Type.STRUCT: - this.readStructBegin(); - while (true) { - ret = this.readFieldBegin(); - if (ret.ftype == Thrift.Type.STOP) { - break; - } - this.skip(ret.ftype); - this.readFieldEnd(); - } - this.readStructEnd(); - return null; - - case Thrift.Type.MAP: - ret = this.readMapBegin(); - for (i = 0; i < ret.size; i++) { - if (i > 0) { - if (this.rstack.length > this.rpos[this.rpos.length - 1] + 1) { - this.rstack.pop(); - } - } - this.skip(ret.ktype); - this.skip(ret.vtype); - } - this.readMapEnd(); - return null; - - case Thrift.Type.SET: - ret = this.readSetBegin(); - for (i = 0; i < ret.size; i++) { - this.skip(ret.etype); - } - this.readSetEnd(); - return null; - - case Thrift.Type.LIST: - ret = this.readListBegin(); - for (i = 0; i < ret.size; i++) { - this.skip(ret.etype); - } - this.readListEnd(); - return null; - - default: - throw new Thrift.TProtocolException(Thrift.TProtocolExceptionType.INVALID_DATA); - } - } -}; - - -/** - * Initializes a MutilplexProtocol Implementation as a Wrapper for Thrift.Protocol - * @constructor - */ -Thrift.MultiplexProtocol = function(srvName, trans, strictRead, strictWrite) { - Thrift.Protocol.call(this, trans, strictRead, strictWrite); - this.serviceName = srvName; -}; -Thrift.inherits(Thrift.MultiplexProtocol, Thrift.Protocol, 'multiplexProtocol'); - -/** Override writeMessageBegin method of prototype*/ -Thrift.MultiplexProtocol.prototype.writeMessageBegin = function(name, type, seqid) { - - if (type === Thrift.MessageType.CALL || type === Thrift.MessageType.ONEWAY) { - Thrift.Protocol.prototype.writeMessageBegin.call(this, this.serviceName + ':' + name, type, seqid); - } else { - Thrift.Protocol.prototype.writeMessageBegin.call(this, name, type, seqid); - } -}; - -Thrift.Multiplexer = function() { - this.seqid = 0; -}; - -/** Instantiates a multiplexed client for a specific service - * @constructor - * @param {String} serviceName - The transport to serialize to/from. - * @param {Thrift.ServiceClient} SCl - The Service Client Class - * @param {Thrift.Transport} transport - Thrift.Transport instance which provides remote host:port - * @example - * var mp = new Thrift.Multiplexer(); - * var transport = new Thrift.Transport("http://localhost:9090/foo.thrift"); - * var protocol = new Thrift.Protocol(transport); - * var client = mp.createClient('AuthService', AuthServiceClient, transport); -*/ -Thrift.Multiplexer.prototype.createClient = function(serviceName, SCl, transport) { - if (SCl.Client) { - SCl = SCl.Client; - } - var self = this; - SCl.prototype.new_seqid = function() { - self.seqid += 1; - return self.seqid; - }; - var client = new SCl(new Thrift.MultiplexProtocol(serviceName, transport)); - - return client; -}; - - - -var copyList, copyMap; - -copyList = function(lst, types) { - - if (!lst) {return lst; } - - var type; - - if (types.shift === undefined) { - type = types; - } - else { - type = types[0]; - } - var Type = type; - - var len = lst.length, result = [], i, val; - for (i = 0; i < len; i++) { - val = lst[i]; - if (type === null) { - result.push(val); - } - else if (type === copyMap || type === copyList) { - result.push(type(val, types.slice(1))); - } - else { - result.push(new Type(val)); - } - } - return result; -}; - -copyMap = function(obj, types) { - - if (!obj) {return obj; } - - var type; - - if (types.shift === undefined) { - type = types; - } - else { - type = types[0]; - } - var Type = type; - - var result = {}, val; - for (var prop in obj) { - if (obj.hasOwnProperty(prop)) { - val = obj[prop]; - if (type === null) { - result[prop] = val; - } - else if (type === copyMap || type === copyList) { - result[prop] = type(val, types.slice(1)); - } - else { - result[prop] = new Type(val); - } - } - } - return result; -}; - -Thrift.copyMap = copyMap; -Thrift.copyList = copyList; diff --git a/client-demos/browser/thrift/serve.bat b/client-demos/browser/thrift/serve.bat deleted file mode 100644 index f4e3ade3..00000000 --- a/client-demos/browser/thrift/serve.bat +++ /dev/null @@ -1 +0,0 @@ -python -m http.server \ No newline at end of file diff --git a/client-demos/browser/thrift/serve.sh b/client-demos/browser/thrift/serve.sh deleted file mode 100755 index 846e5104..00000000 --- a/client-demos/browser/thrift/serve.sh +++ /dev/null @@ -1 +0,0 @@ -python3 -m http.server diff --git a/client-demos/python/thrift-client/__init__.py b/client-demos/python/thrift-client/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/client-demos/python/thrift-client/client/__init__.py b/client-demos/python/thrift-client/client/__init__.py deleted file mode 100644 index ab1a8b8a..00000000 --- a/client-demos/python/thrift-client/client/__init__.py +++ /dev/null @@ -1,129 +0,0 @@ - -from service import FmuService -from service.ttypes import * - -from thrift.transport import TSocket -from thrift.transport import TTransport -from thrift.protocol import TBinaryProtocol - - -class VariableReader: - - def __init__(self, instance_id: int, value_reference: int, client: FmuService.Client): - self.client = client # type: fmu_service.Client - self.instance_id = instance_id # type: str - self.value_reference = [value_reference] # type: [int] - - def read_int(self) -> IntegerRead: - return self.client.read_integer(self.instance_id, self.value_reference) - - def read_real(self) -> RealRead: - return self.client.read_real(self.instance_id, self.value_reference) - - def read_string(self) -> StringRead: - return self.client.read_string(self.instance_id, self.value_reference) - - def read_boolean(self) -> BooleanRead: - return self.client.read_boolean(self.instance_id, self.value_reference) - - -class VariableWriter: - - def __init__(self, instance_id: int, value_reference: int, client: FmuService.Client): - self.client = client # type: fmu_service.Client - self.instance_id = instance_id # type: str - self.value_reference = [value_reference] # type: [int] - - def write_int(self, value: int) -> Status: - return self.client.write_integer(self.instance_id, self.value_reference, [value]) - - def write_real(self, value: float) -> Status: - return self.client.write_real(self.instance_id, self.value_reference, [value]) - - def write_string(self, value: str) -> Status: - return self.client.write_string(self.instance_id, self.value_reference, [value]) - - def write_boolean(self, value: bool) -> Status: - return self.client.write_boolean(self.instance_id, self.value_reference, [value]) - - -class RemoteFmuInstance: - - def __init__(self, remote_fmu, instance_id: str): - self.instance_id = instance_id - self.remote_fmu = remote_fmu - self.client = remote_fmu.client # type: fmu_service.Client - self.model_description = remote_fmu.model_description # type: ModelDescription - self.simulation_time = -1 # type: float - - def setup_experiment(self, start: float = 0.0, stop: float = 0.0, tolerance: float = 0.0) -> Status: - self.simulation_time = start - return self.client.setup_experiment(self.instance_id, start, stop, tolerance) - - def enter_initialization_mode(self) -> Status: - return self.client.enter_initialization_mode(self.instance_id) - - def exit_initialization_mode(self) -> Status: - return self.client.exit_initialization_mode(self.instance_id) - - def step(self, step_size: float) -> Status: - response = self.client.step(self.instance_id, step_size) # type: StepResult - self.simulation_time = response.simulation_time - return response.status - - def reset(self) -> Status: - return self.client.reset(self.instance_id) - - def terminate(self) -> Status: - return self.client.terminate(self.instance_id) - - def freeInstance(self) -> Status: - return self.client.freeInstance(self.instance_id) - - def get_reader(self, identifier) -> VariableReader: - if isinstance(identifier, int): - return VariableReader(self.instance_id, identifier, self.client) - elif isinstance(identifier, str): - value_reference = self.remote_fmu.get_value_reference(identifier) - return VariableReader(self.instance_id, value_reference, self.client) - else: - raise ValueError('not a valid identifier: ' + identifier) - - def get_writer(self, identifier) -> VariableWriter: - if isinstance(identifier, int): - return VariableWriter(self.instance_id, identifier, self.client) - elif isinstance(identifier, str): - value_reference = self.remote_fmu.get_value_reference(identifier) - return VariableWriter(self.instance_id, value_reference, self.client) - else: - raise ValueError('not a valid identifier: ' + identifier) - - -class RemoteFmu: - - def __init__(self, fmu_id: str, host_address: str, port: int): - - self.transport = TSocket.TSocket(host_address, port) - self.transport = TTransport.TFramedTransport(self.transport) - self.protocol = TBinaryProtocol.TBinaryProtocol(self.transport) - - self.client = FmuService.Client(self.protocol) - - self.transport.open() - - self.fmu_id = fmu_id - self.model_description = self.client.get_model_description(fmu_id) # type: ModelDescription - - self.model_variables = dict() - for var in self.model_description.model_variables: # type: [ScalarVariable] - self.model_variables[var.value_reference] = var - - def get_value_reference(self, var_name) -> int: - for key in self.model_variables: - if self.model_variables[key].name == var_name: - return key - return None - - def create_instance(self) -> RemoteFmuInstance: - instance_id = self.client.create_instance(self.fmu_id) - return RemoteFmuInstance(self, instance_id) diff --git a/client-demos/python/thrift-client/generate.bat b/client-demos/python/thrift-client/generate.bat deleted file mode 100644 index 9ac7f5bc..00000000 --- a/client-demos/python/thrift-client/generate.bat +++ /dev/null @@ -1,6 +0,0 @@ -thrift --gen py ../../../rpc-definitions/thrift/service.thrift -rmdir /Q /S service -move gen-py/service service -rmdir /Q /S gen-py -del "constants.py" /Q /S -@echo __all__ = ['ttypes', 'FmuService'] > service/__init__.py diff --git a/client-demos/python/thrift-client/generate.sh b/client-demos/python/thrift-client/generate.sh deleted file mode 100755 index 895626ee..00000000 --- a/client-demos/python/thrift-client/generate.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/env bash -thrift --gen py ../../../rpc-definitions/thrift/service.thrift - -rm -r service -mv gen-py/service service -rm -r gen-py - -rm service/constants.py -rm service/fmu_service-remote -echo "__all__ = ['ttypes', 'fmu_service']" > service/__init__.py \ No newline at end of file diff --git a/client-demos/python/thrift-client/service/FmuService.py b/client-demos/python/thrift-client/service/FmuService.py deleted file mode 100644 index ee5d2405..00000000 --- a/client-demos/python/thrift-client/service/FmuService.py +++ /dev/null @@ -1,4712 +0,0 @@ -# -# Autogenerated by Thrift Compiler (0.12.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 logging -from .ttypes import * -from thrift.Thrift import TProcessor -from thrift.transport import TTransport -all_structs = [] - - -class Iface(object): - def load_from_url(self, url): - """ - Parameters: - - url - - """ - pass - - def load_from_file(self, name, data): - """ - Parameters: - - name - - data - - """ - pass - - def get_model_description(self, fmuId): - """ - Parameters: - - fmuId - - """ - pass - - def create_instance(self, fmuId): - """ - Parameters: - - fmuId - - """ - pass - - def setup_experiment(self, instanceId, start, stop, tolerance): - """ - Parameters: - - instanceId - - start - - stop - - tolerance - - """ - pass - - def enter_initialization_mode(self, instanceId): - """ - Parameters: - - instanceId - - """ - pass - - def exit_initialization_mode(self, instanceId): - """ - Parameters: - - instanceId - - """ - pass - - def step(self, instanceId, stepSize): - """ - Parameters: - - instanceId - - stepSize - - """ - pass - - def reset(self, instanceId): - """ - Parameters: - - instanceId - - """ - pass - - def terminate(self, instanceId): - """ - Parameters: - - instanceId - - """ - pass - - def freeInstance(self, instanceId): - """ - Parameters: - - instanceId - - """ - pass - - def read_integer(self, instanceId, vr): - """ - Parameters: - - instanceId - - vr - - """ - pass - - def read_real(self, instanceId, vr): - """ - Parameters: - - instanceId - - vr - - """ - pass - - def read_string(self, instanceId, vr): - """ - Parameters: - - instanceId - - vr - - """ - pass - - def read_boolean(self, instanceId, vr): - """ - Parameters: - - instanceId - - vr - - """ - pass - - def write_integer(self, instanceId, vr, value): - """ - Parameters: - - instanceId - - vr - - value - - """ - pass - - def write_real(self, instanceId, vr, value): - """ - Parameters: - - instanceId - - vr - - value - - """ - pass - - def write_string(self, instanceId, vr, value): - """ - Parameters: - - instanceId - - vr - - value - - """ - pass - - def write_boolean(self, instanceId, vr, value): - """ - Parameters: - - instanceId - - vr - - value - - """ - pass - - def get_directional_derivative(self, instanceId, vUnknownRef, vKnownRef, dvKnownRef): - """ - Parameters: - - instanceId - - vUnknownRef - - vKnownRef - - dvKnownRef - - """ - pass - - -class Client(Iface): - def __init__(self, iprot, oprot=None): - self._iprot = self._oprot = iprot - if oprot is not None: - self._oprot = oprot - self._seqid = 0 - - def load_from_url(self, url): - """ - Parameters: - - url - - """ - self.send_load_from_url(url) - return self.recv_load_from_url() - - def send_load_from_url(self, url): - self._oprot.writeMessageBegin('load_from_url', TMessageType.CALL, self._seqid) - args = load_from_url_args() - args.url = url - args.write(self._oprot) - self._oprot.writeMessageEnd() - self._oprot.trans.flush() - - def recv_load_from_url(self): - iprot = self._iprot - (fname, mtype, rseqid) = iprot.readMessageBegin() - if mtype == TMessageType.EXCEPTION: - x = TApplicationException() - x.read(iprot) - iprot.readMessageEnd() - raise x - result = load_from_url_result() - result.read(iprot) - iprot.readMessageEnd() - if result.success is not None: - return result.success - raise TApplicationException(TApplicationException.MISSING_RESULT, "load_from_url failed: unknown result") - - def load_from_file(self, name, data): - """ - Parameters: - - name - - data - - """ - self.send_load_from_file(name, data) - return self.recv_load_from_file() - - def send_load_from_file(self, name, data): - self._oprot.writeMessageBegin('load_from_file', TMessageType.CALL, self._seqid) - args = load_from_file_args() - args.name = name - args.data = data - args.write(self._oprot) - self._oprot.writeMessageEnd() - self._oprot.trans.flush() - - def recv_load_from_file(self): - iprot = self._iprot - (fname, mtype, rseqid) = iprot.readMessageBegin() - if mtype == TMessageType.EXCEPTION: - x = TApplicationException() - x.read(iprot) - iprot.readMessageEnd() - raise x - result = load_from_file_result() - result.read(iprot) - iprot.readMessageEnd() - if result.success is not None: - return result.success - raise TApplicationException(TApplicationException.MISSING_RESULT, "load_from_file failed: unknown result") - - def get_model_description(self, fmuId): - """ - Parameters: - - fmuId - - """ - self.send_get_model_description(fmuId) - return self.recv_get_model_description() - - def send_get_model_description(self, fmuId): - self._oprot.writeMessageBegin('get_model_description', TMessageType.CALL, self._seqid) - args = get_model_description_args() - args.fmuId = fmuId - args.write(self._oprot) - self._oprot.writeMessageEnd() - self._oprot.trans.flush() - - def recv_get_model_description(self): - iprot = self._iprot - (fname, mtype, rseqid) = iprot.readMessageBegin() - if mtype == TMessageType.EXCEPTION: - x = TApplicationException() - x.read(iprot) - iprot.readMessageEnd() - raise x - result = get_model_description_result() - result.read(iprot) - iprot.readMessageEnd() - if result.success is not None: - return result.success - if result.ex is not None: - raise result.ex - raise TApplicationException(TApplicationException.MISSING_RESULT, "get_model_description failed: unknown result") - - def create_instance(self, fmuId): - """ - Parameters: - - fmuId - - """ - self.send_create_instance(fmuId) - return self.recv_create_instance() - - def send_create_instance(self, fmuId): - self._oprot.writeMessageBegin('create_instance', TMessageType.CALL, self._seqid) - args = create_instance_args() - args.fmuId = fmuId - args.write(self._oprot) - self._oprot.writeMessageEnd() - self._oprot.trans.flush() - - def recv_create_instance(self): - iprot = self._iprot - (fname, mtype, rseqid) = iprot.readMessageBegin() - if mtype == TMessageType.EXCEPTION: - x = TApplicationException() - x.read(iprot) - iprot.readMessageEnd() - raise x - result = create_instance_result() - result.read(iprot) - iprot.readMessageEnd() - if result.success is not None: - return result.success - if result.ex1 is not None: - raise result.ex1 - if result.ex2 is not None: - raise result.ex2 - raise TApplicationException(TApplicationException.MISSING_RESULT, "create_instance failed: unknown result") - - def setup_experiment(self, instanceId, start, stop, tolerance): - """ - Parameters: - - instanceId - - start - - stop - - tolerance - - """ - self.send_setup_experiment(instanceId, start, stop, tolerance) - return self.recv_setup_experiment() - - def send_setup_experiment(self, instanceId, start, stop, tolerance): - self._oprot.writeMessageBegin('setup_experiment', TMessageType.CALL, self._seqid) - args = setup_experiment_args() - args.instanceId = instanceId - args.start = start - args.stop = stop - args.tolerance = tolerance - args.write(self._oprot) - self._oprot.writeMessageEnd() - self._oprot.trans.flush() - - def recv_setup_experiment(self): - iprot = self._iprot - (fname, mtype, rseqid) = iprot.readMessageBegin() - if mtype == TMessageType.EXCEPTION: - x = TApplicationException() - x.read(iprot) - iprot.readMessageEnd() - raise x - result = setup_experiment_result() - result.read(iprot) - iprot.readMessageEnd() - if result.success is not None: - return result.success - if result.ex is not None: - raise result.ex - raise TApplicationException(TApplicationException.MISSING_RESULT, "setup_experiment failed: unknown result") - - def enter_initialization_mode(self, instanceId): - """ - Parameters: - - instanceId - - """ - self.send_enter_initialization_mode(instanceId) - return self.recv_enter_initialization_mode() - - def send_enter_initialization_mode(self, instanceId): - self._oprot.writeMessageBegin('enter_initialization_mode', TMessageType.CALL, self._seqid) - args = enter_initialization_mode_args() - args.instanceId = instanceId - args.write(self._oprot) - self._oprot.writeMessageEnd() - self._oprot.trans.flush() - - def recv_enter_initialization_mode(self): - iprot = self._iprot - (fname, mtype, rseqid) = iprot.readMessageBegin() - if mtype == TMessageType.EXCEPTION: - x = TApplicationException() - x.read(iprot) - iprot.readMessageEnd() - raise x - result = enter_initialization_mode_result() - result.read(iprot) - iprot.readMessageEnd() - if result.success is not None: - return result.success - if result.ex is not None: - raise result.ex - raise TApplicationException(TApplicationException.MISSING_RESULT, "enter_initialization_mode failed: unknown result") - - def exit_initialization_mode(self, instanceId): - """ - Parameters: - - instanceId - - """ - self.send_exit_initialization_mode(instanceId) - return self.recv_exit_initialization_mode() - - def send_exit_initialization_mode(self, instanceId): - self._oprot.writeMessageBegin('exit_initialization_mode', TMessageType.CALL, self._seqid) - args = exit_initialization_mode_args() - args.instanceId = instanceId - args.write(self._oprot) - self._oprot.writeMessageEnd() - self._oprot.trans.flush() - - def recv_exit_initialization_mode(self): - iprot = self._iprot - (fname, mtype, rseqid) = iprot.readMessageBegin() - if mtype == TMessageType.EXCEPTION: - x = TApplicationException() - x.read(iprot) - iprot.readMessageEnd() - raise x - result = exit_initialization_mode_result() - result.read(iprot) - iprot.readMessageEnd() - if result.success is not None: - return result.success - if result.ex is not None: - raise result.ex - raise TApplicationException(TApplicationException.MISSING_RESULT, "exit_initialization_mode failed: unknown result") - - def step(self, instanceId, stepSize): - """ - Parameters: - - instanceId - - stepSize - - """ - self.send_step(instanceId, stepSize) - return self.recv_step() - - def send_step(self, instanceId, stepSize): - self._oprot.writeMessageBegin('step', TMessageType.CALL, self._seqid) - args = step_args() - args.instanceId = instanceId - args.stepSize = stepSize - args.write(self._oprot) - self._oprot.writeMessageEnd() - self._oprot.trans.flush() - - def recv_step(self): - iprot = self._iprot - (fname, mtype, rseqid) = iprot.readMessageBegin() - if mtype == TMessageType.EXCEPTION: - x = TApplicationException() - x.read(iprot) - iprot.readMessageEnd() - raise x - result = step_result() - result.read(iprot) - iprot.readMessageEnd() - if result.success is not None: - return result.success - if result.ex is not None: - raise result.ex - raise TApplicationException(TApplicationException.MISSING_RESULT, "step failed: unknown result") - - def reset(self, instanceId): - """ - Parameters: - - instanceId - - """ - self.send_reset(instanceId) - return self.recv_reset() - - def send_reset(self, instanceId): - self._oprot.writeMessageBegin('reset', TMessageType.CALL, self._seqid) - args = reset_args() - args.instanceId = instanceId - args.write(self._oprot) - self._oprot.writeMessageEnd() - self._oprot.trans.flush() - - def recv_reset(self): - iprot = self._iprot - (fname, mtype, rseqid) = iprot.readMessageBegin() - if mtype == TMessageType.EXCEPTION: - x = TApplicationException() - x.read(iprot) - iprot.readMessageEnd() - raise x - result = reset_result() - result.read(iprot) - iprot.readMessageEnd() - if result.success is not None: - return result.success - if result.ex is not None: - raise result.ex - raise TApplicationException(TApplicationException.MISSING_RESULT, "reset failed: unknown result") - - def terminate(self, instanceId): - """ - Parameters: - - instanceId - - """ - self.send_terminate(instanceId) - return self.recv_terminate() - - def send_terminate(self, instanceId): - self._oprot.writeMessageBegin('terminate', TMessageType.CALL, self._seqid) - args = terminate_args() - args.instanceId = instanceId - args.write(self._oprot) - self._oprot.writeMessageEnd() - self._oprot.trans.flush() - - def recv_terminate(self): - iprot = self._iprot - (fname, mtype, rseqid) = iprot.readMessageBegin() - if mtype == TMessageType.EXCEPTION: - x = TApplicationException() - x.read(iprot) - iprot.readMessageEnd() - raise x - result = terminate_result() - result.read(iprot) - iprot.readMessageEnd() - if result.success is not None: - return result.success - if result.ex is not None: - raise result.ex - raise TApplicationException(TApplicationException.MISSING_RESULT, "terminate failed: unknown result") - - def freeInstance(self, instanceId): - """ - Parameters: - - instanceId - - """ - self.send_freeInstance(instanceId) - self.recv_freeInstance() - - def send_freeInstance(self, instanceId): - self._oprot.writeMessageBegin('freeInstance', TMessageType.CALL, self._seqid) - args = freeInstance_args() - args.instanceId = instanceId - args.write(self._oprot) - self._oprot.writeMessageEnd() - self._oprot.trans.flush() - - def recv_freeInstance(self): - iprot = self._iprot - (fname, mtype, rseqid) = iprot.readMessageBegin() - if mtype == TMessageType.EXCEPTION: - x = TApplicationException() - x.read(iprot) - iprot.readMessageEnd() - raise x - result = freeInstance_result() - result.read(iprot) - iprot.readMessageEnd() - if result.ex is not None: - raise result.ex - return - - def read_integer(self, instanceId, vr): - """ - Parameters: - - instanceId - - vr - - """ - self.send_read_integer(instanceId, vr) - return self.recv_read_integer() - - def send_read_integer(self, instanceId, vr): - self._oprot.writeMessageBegin('read_integer', TMessageType.CALL, self._seqid) - args = read_integer_args() - args.instanceId = instanceId - args.vr = vr - args.write(self._oprot) - self._oprot.writeMessageEnd() - self._oprot.trans.flush() - - def recv_read_integer(self): - iprot = self._iprot - (fname, mtype, rseqid) = iprot.readMessageBegin() - if mtype == TMessageType.EXCEPTION: - x = TApplicationException() - x.read(iprot) - iprot.readMessageEnd() - raise x - result = read_integer_result() - result.read(iprot) - iprot.readMessageEnd() - if result.success is not None: - return result.success - if result.ex1 is not None: - raise result.ex1 - if result.ex2 is not None: - raise result.ex2 - raise TApplicationException(TApplicationException.MISSING_RESULT, "read_integer failed: unknown result") - - def read_real(self, instanceId, vr): - """ - Parameters: - - instanceId - - vr - - """ - self.send_read_real(instanceId, vr) - return self.recv_read_real() - - def send_read_real(self, instanceId, vr): - self._oprot.writeMessageBegin('read_real', TMessageType.CALL, self._seqid) - args = read_real_args() - args.instanceId = instanceId - args.vr = vr - args.write(self._oprot) - self._oprot.writeMessageEnd() - self._oprot.trans.flush() - - def recv_read_real(self): - iprot = self._iprot - (fname, mtype, rseqid) = iprot.readMessageBegin() - if mtype == TMessageType.EXCEPTION: - x = TApplicationException() - x.read(iprot) - iprot.readMessageEnd() - raise x - result = read_real_result() - result.read(iprot) - iprot.readMessageEnd() - if result.success is not None: - return result.success - if result.ex1 is not None: - raise result.ex1 - if result.ex2 is not None: - raise result.ex2 - raise TApplicationException(TApplicationException.MISSING_RESULT, "read_real failed: unknown result") - - def read_string(self, instanceId, vr): - """ - Parameters: - - instanceId - - vr - - """ - self.send_read_string(instanceId, vr) - return self.recv_read_string() - - def send_read_string(self, instanceId, vr): - self._oprot.writeMessageBegin('read_string', TMessageType.CALL, self._seqid) - args = read_string_args() - args.instanceId = instanceId - args.vr = vr - args.write(self._oprot) - self._oprot.writeMessageEnd() - self._oprot.trans.flush() - - def recv_read_string(self): - iprot = self._iprot - (fname, mtype, rseqid) = iprot.readMessageBegin() - if mtype == TMessageType.EXCEPTION: - x = TApplicationException() - x.read(iprot) - iprot.readMessageEnd() - raise x - result = read_string_result() - result.read(iprot) - iprot.readMessageEnd() - if result.success is not None: - return result.success - if result.ex1 is not None: - raise result.ex1 - if result.ex2 is not None: - raise result.ex2 - raise TApplicationException(TApplicationException.MISSING_RESULT, "read_string failed: unknown result") - - def read_boolean(self, instanceId, vr): - """ - Parameters: - - instanceId - - vr - - """ - self.send_read_boolean(instanceId, vr) - return self.recv_read_boolean() - - def send_read_boolean(self, instanceId, vr): - self._oprot.writeMessageBegin('read_boolean', TMessageType.CALL, self._seqid) - args = read_boolean_args() - args.instanceId = instanceId - args.vr = vr - args.write(self._oprot) - self._oprot.writeMessageEnd() - self._oprot.trans.flush() - - def recv_read_boolean(self): - iprot = self._iprot - (fname, mtype, rseqid) = iprot.readMessageBegin() - if mtype == TMessageType.EXCEPTION: - x = TApplicationException() - x.read(iprot) - iprot.readMessageEnd() - raise x - result = read_boolean_result() - result.read(iprot) - iprot.readMessageEnd() - if result.success is not None: - return result.success - if result.ex1 is not None: - raise result.ex1 - if result.ex2 is not None: - raise result.ex2 - raise TApplicationException(TApplicationException.MISSING_RESULT, "read_boolean failed: unknown result") - - def write_integer(self, instanceId, vr, value): - """ - Parameters: - - instanceId - - vr - - value - - """ - self.send_write_integer(instanceId, vr, value) - return self.recv_write_integer() - - def send_write_integer(self, instanceId, vr, value): - self._oprot.writeMessageBegin('write_integer', TMessageType.CALL, self._seqid) - args = write_integer_args() - args.instanceId = instanceId - args.vr = vr - args.value = value - args.write(self._oprot) - self._oprot.writeMessageEnd() - self._oprot.trans.flush() - - def recv_write_integer(self): - iprot = self._iprot - (fname, mtype, rseqid) = iprot.readMessageBegin() - if mtype == TMessageType.EXCEPTION: - x = TApplicationException() - x.read(iprot) - iprot.readMessageEnd() - raise x - result = write_integer_result() - result.read(iprot) - iprot.readMessageEnd() - if result.success is not None: - return result.success - if result.ex1 is not None: - raise result.ex1 - if result.ex2 is not None: - raise result.ex2 - raise TApplicationException(TApplicationException.MISSING_RESULT, "write_integer failed: unknown result") - - def write_real(self, instanceId, vr, value): - """ - Parameters: - - instanceId - - vr - - value - - """ - self.send_write_real(instanceId, vr, value) - return self.recv_write_real() - - def send_write_real(self, instanceId, vr, value): - self._oprot.writeMessageBegin('write_real', TMessageType.CALL, self._seqid) - args = write_real_args() - args.instanceId = instanceId - args.vr = vr - args.value = value - args.write(self._oprot) - self._oprot.writeMessageEnd() - self._oprot.trans.flush() - - def recv_write_real(self): - iprot = self._iprot - (fname, mtype, rseqid) = iprot.readMessageBegin() - if mtype == TMessageType.EXCEPTION: - x = TApplicationException() - x.read(iprot) - iprot.readMessageEnd() - raise x - result = write_real_result() - result.read(iprot) - iprot.readMessageEnd() - if result.success is not None: - return result.success - if result.ex1 is not None: - raise result.ex1 - if result.ex2 is not None: - raise result.ex2 - raise TApplicationException(TApplicationException.MISSING_RESULT, "write_real failed: unknown result") - - def write_string(self, instanceId, vr, value): - """ - Parameters: - - instanceId - - vr - - value - - """ - self.send_write_string(instanceId, vr, value) - return self.recv_write_string() - - def send_write_string(self, instanceId, vr, value): - self._oprot.writeMessageBegin('write_string', TMessageType.CALL, self._seqid) - args = write_string_args() - args.instanceId = instanceId - args.vr = vr - args.value = value - args.write(self._oprot) - self._oprot.writeMessageEnd() - self._oprot.trans.flush() - - def recv_write_string(self): - iprot = self._iprot - (fname, mtype, rseqid) = iprot.readMessageBegin() - if mtype == TMessageType.EXCEPTION: - x = TApplicationException() - x.read(iprot) - iprot.readMessageEnd() - raise x - result = write_string_result() - result.read(iprot) - iprot.readMessageEnd() - if result.success is not None: - return result.success - if result.ex1 is not None: - raise result.ex1 - if result.ex2 is not None: - raise result.ex2 - raise TApplicationException(TApplicationException.MISSING_RESULT, "write_string failed: unknown result") - - def write_boolean(self, instanceId, vr, value): - """ - Parameters: - - instanceId - - vr - - value - - """ - self.send_write_boolean(instanceId, vr, value) - return self.recv_write_boolean() - - def send_write_boolean(self, instanceId, vr, value): - self._oprot.writeMessageBegin('write_boolean', TMessageType.CALL, self._seqid) - args = write_boolean_args() - args.instanceId = instanceId - args.vr = vr - args.value = value - args.write(self._oprot) - self._oprot.writeMessageEnd() - self._oprot.trans.flush() - - def recv_write_boolean(self): - iprot = self._iprot - (fname, mtype, rseqid) = iprot.readMessageBegin() - if mtype == TMessageType.EXCEPTION: - x = TApplicationException() - x.read(iprot) - iprot.readMessageEnd() - raise x - result = write_boolean_result() - result.read(iprot) - iprot.readMessageEnd() - if result.success is not None: - return result.success - if result.ex1 is not None: - raise result.ex1 - if result.ex2 is not None: - raise result.ex2 - raise TApplicationException(TApplicationException.MISSING_RESULT, "write_boolean failed: unknown result") - - def get_directional_derivative(self, instanceId, vUnknownRef, vKnownRef, dvKnownRef): - """ - Parameters: - - instanceId - - vUnknownRef - - vKnownRef - - dvKnownRef - - """ - self.send_get_directional_derivative(instanceId, vUnknownRef, vKnownRef, dvKnownRef) - return self.recv_get_directional_derivative() - - def send_get_directional_derivative(self, instanceId, vUnknownRef, vKnownRef, dvKnownRef): - self._oprot.writeMessageBegin('get_directional_derivative', TMessageType.CALL, self._seqid) - args = get_directional_derivative_args() - args.instanceId = instanceId - args.vUnknownRef = vUnknownRef - args.vKnownRef = vKnownRef - args.dvKnownRef = dvKnownRef - args.write(self._oprot) - self._oprot.writeMessageEnd() - self._oprot.trans.flush() - - def recv_get_directional_derivative(self): - iprot = self._iprot - (fname, mtype, rseqid) = iprot.readMessageBegin() - if mtype == TMessageType.EXCEPTION: - x = TApplicationException() - x.read(iprot) - iprot.readMessageEnd() - raise x - result = get_directional_derivative_result() - result.read(iprot) - iprot.readMessageEnd() - if result.success is not None: - return result.success - if result.ex1 is not None: - raise result.ex1 - if result.ex2 is not None: - raise result.ex2 - raise TApplicationException(TApplicationException.MISSING_RESULT, "get_directional_derivative failed: unknown result") - - -class Processor(Iface, TProcessor): - def __init__(self, handler): - self._handler = handler - self._processMap = {} - self._processMap["load_from_url"] = Processor.process_load_from_url - self._processMap["load_from_file"] = Processor.process_load_from_file - self._processMap["get_model_description"] = Processor.process_get_model_description - self._processMap["create_instance"] = Processor.process_create_instance - self._processMap["setup_experiment"] = Processor.process_setup_experiment - self._processMap["enter_initialization_mode"] = Processor.process_enter_initialization_mode - self._processMap["exit_initialization_mode"] = Processor.process_exit_initialization_mode - self._processMap["step"] = Processor.process_step - self._processMap["reset"] = Processor.process_reset - self._processMap["terminate"] = Processor.process_terminate - self._processMap["freeInstance"] = Processor.process_freeInstance - self._processMap["read_integer"] = Processor.process_read_integer - self._processMap["read_real"] = Processor.process_read_real - self._processMap["read_string"] = Processor.process_read_string - self._processMap["read_boolean"] = Processor.process_read_boolean - self._processMap["write_integer"] = Processor.process_write_integer - self._processMap["write_real"] = Processor.process_write_real - self._processMap["write_string"] = Processor.process_write_string - self._processMap["write_boolean"] = Processor.process_write_boolean - self._processMap["get_directional_derivative"] = Processor.process_get_directional_derivative - - def process(self, iprot, oprot): - (name, type, seqid) = iprot.readMessageBegin() - 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_load_from_url(self, seqid, iprot, oprot): - args = load_from_url_args() - args.read(iprot) - iprot.readMessageEnd() - result = load_from_url_result() - try: - result.success = self._handler.load_from_url(args.url) - 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("load_from_url", msg_type, seqid) - result.write(oprot) - oprot.writeMessageEnd() - oprot.trans.flush() - - def process_load_from_file(self, seqid, iprot, oprot): - args = load_from_file_args() - args.read(iprot) - iprot.readMessageEnd() - result = load_from_file_result() - try: - result.success = self._handler.load_from_file(args.name, args.data) - 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("load_from_file", msg_type, seqid) - result.write(oprot) - oprot.writeMessageEnd() - oprot.trans.flush() - - def process_get_model_description(self, seqid, iprot, oprot): - args = get_model_description_args() - args.read(iprot) - iprot.readMessageEnd() - result = get_model_description_result() - try: - result.success = self._handler.get_model_description(args.fmuId) - msg_type = TMessageType.REPLY - except TTransport.TTransportException: - raise - except NoSuchFmuException as ex: - msg_type = TMessageType.REPLY - result.ex = ex - 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("get_model_description", msg_type, seqid) - result.write(oprot) - oprot.writeMessageEnd() - oprot.trans.flush() - - def process_create_instance(self, seqid, iprot, oprot): - args = create_instance_args() - args.read(iprot) - iprot.readMessageEnd() - result = create_instance_result() - try: - result.success = self._handler.create_instance(args.fmuId) - msg_type = TMessageType.REPLY - except TTransport.TTransportException: - raise - except UnsupportedOperationException as ex1: - msg_type = TMessageType.REPLY - result.ex1 = ex1 - except NoSuchFmuException as ex2: - msg_type = TMessageType.REPLY - result.ex2 = ex2 - 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("create_instance", msg_type, seqid) - result.write(oprot) - oprot.writeMessageEnd() - oprot.trans.flush() - - def process_setup_experiment(self, seqid, iprot, oprot): - args = setup_experiment_args() - args.read(iprot) - iprot.readMessageEnd() - result = setup_experiment_result() - try: - result.success = self._handler.setup_experiment(args.instanceId, args.start, args.stop, args.tolerance) - msg_type = TMessageType.REPLY - except TTransport.TTransportException: - raise - except NoSuchInstanceException as ex: - msg_type = TMessageType.REPLY - result.ex = ex - 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("setup_experiment", msg_type, seqid) - result.write(oprot) - oprot.writeMessageEnd() - oprot.trans.flush() - - def process_enter_initialization_mode(self, seqid, iprot, oprot): - args = enter_initialization_mode_args() - args.read(iprot) - iprot.readMessageEnd() - result = enter_initialization_mode_result() - try: - result.success = self._handler.enter_initialization_mode(args.instanceId) - msg_type = TMessageType.REPLY - except TTransport.TTransportException: - raise - except NoSuchInstanceException as ex: - msg_type = TMessageType.REPLY - result.ex = ex - 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("enter_initialization_mode", msg_type, seqid) - result.write(oprot) - oprot.writeMessageEnd() - oprot.trans.flush() - - def process_exit_initialization_mode(self, seqid, iprot, oprot): - args = exit_initialization_mode_args() - args.read(iprot) - iprot.readMessageEnd() - result = exit_initialization_mode_result() - try: - result.success = self._handler.exit_initialization_mode(args.instanceId) - msg_type = TMessageType.REPLY - except TTransport.TTransportException: - raise - except NoSuchInstanceException as ex: - msg_type = TMessageType.REPLY - result.ex = ex - 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("exit_initialization_mode", msg_type, seqid) - result.write(oprot) - oprot.writeMessageEnd() - oprot.trans.flush() - - def process_step(self, seqid, iprot, oprot): - args = step_args() - args.read(iprot) - iprot.readMessageEnd() - result = step_result() - try: - result.success = self._handler.step(args.instanceId, args.stepSize) - msg_type = TMessageType.REPLY - except TTransport.TTransportException: - raise - except NoSuchInstanceException as ex: - msg_type = TMessageType.REPLY - result.ex = ex - 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("step", msg_type, seqid) - result.write(oprot) - oprot.writeMessageEnd() - oprot.trans.flush() - - def process_reset(self, seqid, iprot, oprot): - args = reset_args() - args.read(iprot) - iprot.readMessageEnd() - result = reset_result() - try: - result.success = self._handler.reset(args.instanceId) - msg_type = TMessageType.REPLY - except TTransport.TTransportException: - raise - except NoSuchInstanceException as ex: - msg_type = TMessageType.REPLY - result.ex = ex - 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("reset", msg_type, seqid) - result.write(oprot) - oprot.writeMessageEnd() - oprot.trans.flush() - - def process_terminate(self, seqid, iprot, oprot): - args = terminate_args() - args.read(iprot) - iprot.readMessageEnd() - result = terminate_result() - try: - result.success = self._handler.terminate(args.instanceId) - msg_type = TMessageType.REPLY - except TTransport.TTransportException: - raise - except NoSuchInstanceException as ex: - msg_type = TMessageType.REPLY - result.ex = ex - 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("terminate", msg_type, seqid) - result.write(oprot) - oprot.writeMessageEnd() - oprot.trans.flush() - - def process_freeInstance(self, seqid, iprot, oprot): - args = freeInstance_args() - args.read(iprot) - iprot.readMessageEnd() - result = freeInstance_result() - try: - self._handler.freeInstance(args.instanceId) - msg_type = TMessageType.REPLY - except TTransport.TTransportException: - raise - except NoSuchInstanceException as ex: - msg_type = TMessageType.REPLY - result.ex = ex - 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("freeInstance", msg_type, seqid) - result.write(oprot) - oprot.writeMessageEnd() - oprot.trans.flush() - - def process_read_integer(self, seqid, iprot, oprot): - args = read_integer_args() - args.read(iprot) - iprot.readMessageEnd() - result = read_integer_result() - try: - result.success = self._handler.read_integer(args.instanceId, args.vr) - msg_type = TMessageType.REPLY - except TTransport.TTransportException: - raise - except NoSuchInstanceException as ex1: - msg_type = TMessageType.REPLY - result.ex1 = ex1 - except NoSuchVariableException as ex2: - msg_type = TMessageType.REPLY - result.ex2 = ex2 - 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("read_integer", msg_type, seqid) - result.write(oprot) - oprot.writeMessageEnd() - oprot.trans.flush() - - def process_read_real(self, seqid, iprot, oprot): - args = read_real_args() - args.read(iprot) - iprot.readMessageEnd() - result = read_real_result() - try: - result.success = self._handler.read_real(args.instanceId, args.vr) - msg_type = TMessageType.REPLY - except TTransport.TTransportException: - raise - except NoSuchInstanceException as ex1: - msg_type = TMessageType.REPLY - result.ex1 = ex1 - except NoSuchVariableException as ex2: - msg_type = TMessageType.REPLY - result.ex2 = ex2 - 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("read_real", msg_type, seqid) - result.write(oprot) - oprot.writeMessageEnd() - oprot.trans.flush() - - def process_read_string(self, seqid, iprot, oprot): - args = read_string_args() - args.read(iprot) - iprot.readMessageEnd() - result = read_string_result() - try: - result.success = self._handler.read_string(args.instanceId, args.vr) - msg_type = TMessageType.REPLY - except TTransport.TTransportException: - raise - except NoSuchInstanceException as ex1: - msg_type = TMessageType.REPLY - result.ex1 = ex1 - except NoSuchVariableException as ex2: - msg_type = TMessageType.REPLY - result.ex2 = ex2 - 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("read_string", msg_type, seqid) - result.write(oprot) - oprot.writeMessageEnd() - oprot.trans.flush() - - def process_read_boolean(self, seqid, iprot, oprot): - args = read_boolean_args() - args.read(iprot) - iprot.readMessageEnd() - result = read_boolean_result() - try: - result.success = self._handler.read_boolean(args.instanceId, args.vr) - msg_type = TMessageType.REPLY - except TTransport.TTransportException: - raise - except NoSuchInstanceException as ex1: - msg_type = TMessageType.REPLY - result.ex1 = ex1 - except NoSuchVariableException as ex2: - msg_type = TMessageType.REPLY - result.ex2 = ex2 - 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("read_boolean", msg_type, seqid) - result.write(oprot) - oprot.writeMessageEnd() - oprot.trans.flush() - - def process_write_integer(self, seqid, iprot, oprot): - args = write_integer_args() - args.read(iprot) - iprot.readMessageEnd() - result = write_integer_result() - try: - result.success = self._handler.write_integer(args.instanceId, args.vr, args.value) - msg_type = TMessageType.REPLY - except TTransport.TTransportException: - raise - except NoSuchInstanceException as ex1: - msg_type = TMessageType.REPLY - result.ex1 = ex1 - except NoSuchVariableException as ex2: - msg_type = TMessageType.REPLY - result.ex2 = ex2 - 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("write_integer", msg_type, seqid) - result.write(oprot) - oprot.writeMessageEnd() - oprot.trans.flush() - - def process_write_real(self, seqid, iprot, oprot): - args = write_real_args() - args.read(iprot) - iprot.readMessageEnd() - result = write_real_result() - try: - result.success = self._handler.write_real(args.instanceId, args.vr, args.value) - msg_type = TMessageType.REPLY - except TTransport.TTransportException: - raise - except NoSuchInstanceException as ex1: - msg_type = TMessageType.REPLY - result.ex1 = ex1 - except NoSuchVariableException as ex2: - msg_type = TMessageType.REPLY - result.ex2 = ex2 - 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("write_real", msg_type, seqid) - result.write(oprot) - oprot.writeMessageEnd() - oprot.trans.flush() - - def process_write_string(self, seqid, iprot, oprot): - args = write_string_args() - args.read(iprot) - iprot.readMessageEnd() - result = write_string_result() - try: - result.success = self._handler.write_string(args.instanceId, args.vr, args.value) - msg_type = TMessageType.REPLY - except TTransport.TTransportException: - raise - except NoSuchInstanceException as ex1: - msg_type = TMessageType.REPLY - result.ex1 = ex1 - except NoSuchVariableException as ex2: - msg_type = TMessageType.REPLY - result.ex2 = ex2 - 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("write_string", msg_type, seqid) - result.write(oprot) - oprot.writeMessageEnd() - oprot.trans.flush() - - def process_write_boolean(self, seqid, iprot, oprot): - args = write_boolean_args() - args.read(iprot) - iprot.readMessageEnd() - result = write_boolean_result() - try: - result.success = self._handler.write_boolean(args.instanceId, args.vr, args.value) - msg_type = TMessageType.REPLY - except TTransport.TTransportException: - raise - except NoSuchInstanceException as ex1: - msg_type = TMessageType.REPLY - result.ex1 = ex1 - except NoSuchVariableException as ex2: - msg_type = TMessageType.REPLY - result.ex2 = ex2 - 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("write_boolean", msg_type, seqid) - result.write(oprot) - oprot.writeMessageEnd() - oprot.trans.flush() - - def process_get_directional_derivative(self, seqid, iprot, oprot): - args = get_directional_derivative_args() - args.read(iprot) - iprot.readMessageEnd() - result = get_directional_derivative_result() - try: - result.success = self._handler.get_directional_derivative(args.instanceId, args.vUnknownRef, args.vKnownRef, args.dvKnownRef) - msg_type = TMessageType.REPLY - except TTransport.TTransportException: - raise - except NoSuchInstanceException as ex1: - msg_type = TMessageType.REPLY - result.ex1 = ex1 - except UnsupportedOperationException as ex2: - msg_type = TMessageType.REPLY - result.ex2 = ex2 - 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("get_directional_derivative", msg_type, seqid) - result.write(oprot) - oprot.writeMessageEnd() - oprot.trans.flush() - -# HELPER FUNCTIONS AND STRUCTURES - - -class load_from_url_args(object): - """ - Attributes: - - url - - """ - - - def __init__(self, url=None,): - self.url = url - - 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.STRING: - self.url = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() - 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('load_from_url_args') - if self.url is not None: - oprot.writeFieldBegin('url', TType.STRING, 1) - oprot.writeString(self.url.encode('utf-8') if sys.version_info[0] == 2 else self.url) - 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(load_from_url_args) -load_from_url_args.thrift_spec = ( - None, # 0 - (1, TType.STRING, 'url', 'UTF8', None, ), # 1 -) - - -class load_from_url_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.STRING: - self.success = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() - 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('load_from_url_result') - if self.success is not None: - oprot.writeFieldBegin('success', TType.STRING, 0) - oprot.writeString(self.success.encode('utf-8') if sys.version_info[0] == 2 else self.success) - 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(load_from_url_result) -load_from_url_result.thrift_spec = ( - (0, TType.STRING, 'success', 'UTF8', None, ), # 0 -) - - -class load_from_file_args(object): - """ - Attributes: - - name - - data - - """ - - - def __init__(self, name=None, data=None,): - self.name = name - self.data = data - - 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.STRING: - self.name = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() - else: - iprot.skip(ftype) - elif fid == 2: - if ftype == TType.STRING: - self.data = iprot.readBinary() - 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('load_from_file_args') - if self.name is not None: - oprot.writeFieldBegin('name', TType.STRING, 1) - oprot.writeString(self.name.encode('utf-8') if sys.version_info[0] == 2 else self.name) - oprot.writeFieldEnd() - if self.data is not None: - oprot.writeFieldBegin('data', TType.STRING, 2) - oprot.writeBinary(self.data) - 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(load_from_file_args) -load_from_file_args.thrift_spec = ( - None, # 0 - (1, TType.STRING, 'name', 'UTF8', None, ), # 1 - (2, TType.STRING, 'data', 'BINARY', None, ), # 2 -) - - -class load_from_file_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.STRING: - self.success = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() - 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('load_from_file_result') - if self.success is not None: - oprot.writeFieldBegin('success', TType.STRING, 0) - oprot.writeString(self.success.encode('utf-8') if sys.version_info[0] == 2 else self.success) - 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(load_from_file_result) -load_from_file_result.thrift_spec = ( - (0, TType.STRING, 'success', 'UTF8', None, ), # 0 -) - - -class get_model_description_args(object): - """ - Attributes: - - fmuId - - """ - - - def __init__(self, fmuId=None,): - self.fmuId = fmuId - - 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.STRING: - self.fmuId = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() - 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('get_model_description_args') - if self.fmuId is not None: - oprot.writeFieldBegin('fmuId', TType.STRING, 1) - oprot.writeString(self.fmuId.encode('utf-8') if sys.version_info[0] == 2 else self.fmuId) - 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(get_model_description_args) -get_model_description_args.thrift_spec = ( - None, # 0 - (1, TType.STRING, 'fmuId', 'UTF8', None, ), # 1 -) - - -class get_model_description_result(object): - """ - Attributes: - - success - - ex - - """ - - - def __init__(self, success=None, ex=None,): - self.success = success - self.ex = ex - - 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 = ModelDescription() - self.success.read(iprot) - else: - iprot.skip(ftype) - elif fid == 1: - if ftype == TType.STRUCT: - self.ex = NoSuchFmuException() - self.ex.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('get_model_description_result') - if self.success is not None: - oprot.writeFieldBegin('success', TType.STRUCT, 0) - self.success.write(oprot) - oprot.writeFieldEnd() - if self.ex is not None: - oprot.writeFieldBegin('ex', TType.STRUCT, 1) - self.ex.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(get_model_description_result) -get_model_description_result.thrift_spec = ( - (0, TType.STRUCT, 'success', [ModelDescription, None], None, ), # 0 - (1, TType.STRUCT, 'ex', [NoSuchFmuException, None], None, ), # 1 -) - - -class create_instance_args(object): - """ - Attributes: - - fmuId - - """ - - - def __init__(self, fmuId=None,): - self.fmuId = fmuId - - 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.STRING: - self.fmuId = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() - 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('create_instance_args') - if self.fmuId is not None: - oprot.writeFieldBegin('fmuId', TType.STRING, 1) - oprot.writeString(self.fmuId.encode('utf-8') if sys.version_info[0] == 2 else self.fmuId) - 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(create_instance_args) -create_instance_args.thrift_spec = ( - None, # 0 - (1, TType.STRING, 'fmuId', 'UTF8', None, ), # 1 -) - - -class create_instance_result(object): - """ - Attributes: - - success - - ex1 - - ex2 - - """ - - - def __init__(self, success=None, ex1=None, ex2=None,): - self.success = success - self.ex1 = ex1 - self.ex2 = ex2 - - 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.STRING: - self.success = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() - else: - iprot.skip(ftype) - elif fid == 1: - if ftype == TType.STRUCT: - self.ex1 = UnsupportedOperationException() - self.ex1.read(iprot) - else: - iprot.skip(ftype) - elif fid == 2: - if ftype == TType.STRUCT: - self.ex2 = NoSuchFmuException() - self.ex2.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('create_instance_result') - if self.success is not None: - oprot.writeFieldBegin('success', TType.STRING, 0) - oprot.writeString(self.success.encode('utf-8') if sys.version_info[0] == 2 else self.success) - oprot.writeFieldEnd() - if self.ex1 is not None: - oprot.writeFieldBegin('ex1', TType.STRUCT, 1) - self.ex1.write(oprot) - oprot.writeFieldEnd() - if self.ex2 is not None: - oprot.writeFieldBegin('ex2', TType.STRUCT, 2) - self.ex2.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(create_instance_result) -create_instance_result.thrift_spec = ( - (0, TType.STRING, 'success', 'UTF8', None, ), # 0 - (1, TType.STRUCT, 'ex1', [UnsupportedOperationException, None], None, ), # 1 - (2, TType.STRUCT, 'ex2', [NoSuchFmuException, None], None, ), # 2 -) - - -class setup_experiment_args(object): - """ - Attributes: - - instanceId - - start - - stop - - tolerance - - """ - - - def __init__(self, instanceId=None, start=None, stop=None, tolerance=None,): - self.instanceId = instanceId - self.start = start - self.stop = stop - self.tolerance = tolerance - - 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.STRING: - self.instanceId = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() - else: - iprot.skip(ftype) - elif fid == 2: - if ftype == TType.DOUBLE: - self.start = iprot.readDouble() - else: - iprot.skip(ftype) - elif fid == 3: - if ftype == TType.DOUBLE: - self.stop = iprot.readDouble() - else: - iprot.skip(ftype) - elif fid == 4: - if ftype == TType.DOUBLE: - self.tolerance = iprot.readDouble() - 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('setup_experiment_args') - if self.instanceId is not None: - oprot.writeFieldBegin('instanceId', TType.STRING, 1) - oprot.writeString(self.instanceId.encode('utf-8') if sys.version_info[0] == 2 else self.instanceId) - oprot.writeFieldEnd() - if self.start is not None: - oprot.writeFieldBegin('start', TType.DOUBLE, 2) - oprot.writeDouble(self.start) - oprot.writeFieldEnd() - if self.stop is not None: - oprot.writeFieldBegin('stop', TType.DOUBLE, 3) - oprot.writeDouble(self.stop) - oprot.writeFieldEnd() - if self.tolerance is not None: - oprot.writeFieldBegin('tolerance', TType.DOUBLE, 4) - oprot.writeDouble(self.tolerance) - 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(setup_experiment_args) -setup_experiment_args.thrift_spec = ( - None, # 0 - (1, TType.STRING, 'instanceId', 'UTF8', None, ), # 1 - (2, TType.DOUBLE, 'start', None, None, ), # 2 - (3, TType.DOUBLE, 'stop', None, None, ), # 3 - (4, TType.DOUBLE, 'tolerance', None, None, ), # 4 -) - - -class setup_experiment_result(object): - """ - Attributes: - - success - - ex - - """ - - - def __init__(self, success=None, ex=None,): - self.success = success - self.ex = ex - - 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.I32: - self.success = iprot.readI32() - else: - iprot.skip(ftype) - elif fid == 1: - if ftype == TType.STRUCT: - self.ex = NoSuchInstanceException() - self.ex.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('setup_experiment_result') - if self.success is not None: - oprot.writeFieldBegin('success', TType.I32, 0) - oprot.writeI32(self.success) - oprot.writeFieldEnd() - if self.ex is not None: - oprot.writeFieldBegin('ex', TType.STRUCT, 1) - self.ex.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(setup_experiment_result) -setup_experiment_result.thrift_spec = ( - (0, TType.I32, 'success', None, None, ), # 0 - (1, TType.STRUCT, 'ex', [NoSuchInstanceException, None], None, ), # 1 -) - - -class enter_initialization_mode_args(object): - """ - Attributes: - - instanceId - - """ - - - def __init__(self, instanceId=None,): - self.instanceId = instanceId - - 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.STRING: - self.instanceId = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() - 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('enter_initialization_mode_args') - if self.instanceId is not None: - oprot.writeFieldBegin('instanceId', TType.STRING, 1) - oprot.writeString(self.instanceId.encode('utf-8') if sys.version_info[0] == 2 else self.instanceId) - 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(enter_initialization_mode_args) -enter_initialization_mode_args.thrift_spec = ( - None, # 0 - (1, TType.STRING, 'instanceId', 'UTF8', None, ), # 1 -) - - -class enter_initialization_mode_result(object): - """ - Attributes: - - success - - ex - - """ - - - def __init__(self, success=None, ex=None,): - self.success = success - self.ex = ex - - 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.I32: - self.success = iprot.readI32() - else: - iprot.skip(ftype) - elif fid == 1: - if ftype == TType.STRUCT: - self.ex = NoSuchInstanceException() - self.ex.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('enter_initialization_mode_result') - if self.success is not None: - oprot.writeFieldBegin('success', TType.I32, 0) - oprot.writeI32(self.success) - oprot.writeFieldEnd() - if self.ex is not None: - oprot.writeFieldBegin('ex', TType.STRUCT, 1) - self.ex.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(enter_initialization_mode_result) -enter_initialization_mode_result.thrift_spec = ( - (0, TType.I32, 'success', None, None, ), # 0 - (1, TType.STRUCT, 'ex', [NoSuchInstanceException, None], None, ), # 1 -) - - -class exit_initialization_mode_args(object): - """ - Attributes: - - instanceId - - """ - - - def __init__(self, instanceId=None,): - self.instanceId = instanceId - - 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.STRING: - self.instanceId = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() - 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('exit_initialization_mode_args') - if self.instanceId is not None: - oprot.writeFieldBegin('instanceId', TType.STRING, 1) - oprot.writeString(self.instanceId.encode('utf-8') if sys.version_info[0] == 2 else self.instanceId) - 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(exit_initialization_mode_args) -exit_initialization_mode_args.thrift_spec = ( - None, # 0 - (1, TType.STRING, 'instanceId', 'UTF8', None, ), # 1 -) - - -class exit_initialization_mode_result(object): - """ - Attributes: - - success - - ex - - """ - - - def __init__(self, success=None, ex=None,): - self.success = success - self.ex = ex - - 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.I32: - self.success = iprot.readI32() - else: - iprot.skip(ftype) - elif fid == 1: - if ftype == TType.STRUCT: - self.ex = NoSuchInstanceException() - self.ex.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('exit_initialization_mode_result') - if self.success is not None: - oprot.writeFieldBegin('success', TType.I32, 0) - oprot.writeI32(self.success) - oprot.writeFieldEnd() - if self.ex is not None: - oprot.writeFieldBegin('ex', TType.STRUCT, 1) - self.ex.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(exit_initialization_mode_result) -exit_initialization_mode_result.thrift_spec = ( - (0, TType.I32, 'success', None, None, ), # 0 - (1, TType.STRUCT, 'ex', [NoSuchInstanceException, None], None, ), # 1 -) - - -class step_args(object): - """ - Attributes: - - instanceId - - stepSize - - """ - - - def __init__(self, instanceId=None, stepSize=None,): - self.instanceId = instanceId - self.stepSize = stepSize - - 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.STRING: - self.instanceId = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() - else: - iprot.skip(ftype) - elif fid == 2: - if ftype == TType.DOUBLE: - self.stepSize = iprot.readDouble() - 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('step_args') - if self.instanceId is not None: - oprot.writeFieldBegin('instanceId', TType.STRING, 1) - oprot.writeString(self.instanceId.encode('utf-8') if sys.version_info[0] == 2 else self.instanceId) - oprot.writeFieldEnd() - if self.stepSize is not None: - oprot.writeFieldBegin('stepSize', TType.DOUBLE, 2) - oprot.writeDouble(self.stepSize) - 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(step_args) -step_args.thrift_spec = ( - None, # 0 - (1, TType.STRING, 'instanceId', 'UTF8', None, ), # 1 - (2, TType.DOUBLE, 'stepSize', None, None, ), # 2 -) - - -class step_result(object): - """ - Attributes: - - success - - ex - - """ - - - def __init__(self, success=None, ex=None,): - self.success = success - self.ex = ex - - 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 = StepResult() - self.success.read(iprot) - else: - iprot.skip(ftype) - elif fid == 1: - if ftype == TType.STRUCT: - self.ex = NoSuchInstanceException() - self.ex.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('step_result') - if self.success is not None: - oprot.writeFieldBegin('success', TType.STRUCT, 0) - self.success.write(oprot) - oprot.writeFieldEnd() - if self.ex is not None: - oprot.writeFieldBegin('ex', TType.STRUCT, 1) - self.ex.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(step_result) -step_result.thrift_spec = ( - (0, TType.STRUCT, 'success', [StepResult, None], None, ), # 0 - (1, TType.STRUCT, 'ex', [NoSuchInstanceException, None], None, ), # 1 -) - - -class reset_args(object): - """ - Attributes: - - instanceId - - """ - - - def __init__(self, instanceId=None,): - self.instanceId = instanceId - - 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.STRING: - self.instanceId = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() - 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('reset_args') - if self.instanceId is not None: - oprot.writeFieldBegin('instanceId', TType.STRING, 1) - oprot.writeString(self.instanceId.encode('utf-8') if sys.version_info[0] == 2 else self.instanceId) - 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(reset_args) -reset_args.thrift_spec = ( - None, # 0 - (1, TType.STRING, 'instanceId', 'UTF8', None, ), # 1 -) - - -class reset_result(object): - """ - Attributes: - - success - - ex - - """ - - - def __init__(self, success=None, ex=None,): - self.success = success - self.ex = ex - - 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.I32: - self.success = iprot.readI32() - else: - iprot.skip(ftype) - elif fid == 1: - if ftype == TType.STRUCT: - self.ex = NoSuchInstanceException() - self.ex.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('reset_result') - if self.success is not None: - oprot.writeFieldBegin('success', TType.I32, 0) - oprot.writeI32(self.success) - oprot.writeFieldEnd() - if self.ex is not None: - oprot.writeFieldBegin('ex', TType.STRUCT, 1) - self.ex.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(reset_result) -reset_result.thrift_spec = ( - (0, TType.I32, 'success', None, None, ), # 0 - (1, TType.STRUCT, 'ex', [NoSuchInstanceException, None], None, ), # 1 -) - - -class terminate_args(object): - """ - Attributes: - - instanceId - - """ - - - def __init__(self, instanceId=None,): - self.instanceId = instanceId - - 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.STRING: - self.instanceId = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() - 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('terminate_args') - if self.instanceId is not None: - oprot.writeFieldBegin('instanceId', TType.STRING, 1) - oprot.writeString(self.instanceId.encode('utf-8') if sys.version_info[0] == 2 else self.instanceId) - 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(terminate_args) -terminate_args.thrift_spec = ( - None, # 0 - (1, TType.STRING, 'instanceId', 'UTF8', None, ), # 1 -) - - -class terminate_result(object): - """ - Attributes: - - success - - ex - - """ - - - def __init__(self, success=None, ex=None,): - self.success = success - self.ex = ex - - 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.I32: - self.success = iprot.readI32() - else: - iprot.skip(ftype) - elif fid == 1: - if ftype == TType.STRUCT: - self.ex = NoSuchInstanceException() - self.ex.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('terminate_result') - if self.success is not None: - oprot.writeFieldBegin('success', TType.I32, 0) - oprot.writeI32(self.success) - oprot.writeFieldEnd() - if self.ex is not None: - oprot.writeFieldBegin('ex', TType.STRUCT, 1) - self.ex.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(terminate_result) -terminate_result.thrift_spec = ( - (0, TType.I32, 'success', None, None, ), # 0 - (1, TType.STRUCT, 'ex', [NoSuchInstanceException, None], None, ), # 1 -) - - -class freeInstance_args(object): - """ - Attributes: - - instanceId - - """ - - - def __init__(self, instanceId=None,): - self.instanceId = instanceId - - 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.STRING: - self.instanceId = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() - 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('freeInstance_args') - if self.instanceId is not None: - oprot.writeFieldBegin('instanceId', TType.STRING, 1) - oprot.writeString(self.instanceId.encode('utf-8') if sys.version_info[0] == 2 else self.instanceId) - 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(freeInstance_args) -freeInstance_args.thrift_spec = ( - None, # 0 - (1, TType.STRING, 'instanceId', 'UTF8', None, ), # 1 -) - - -class freeInstance_result(object): - """ - Attributes: - - ex - - """ - - - def __init__(self, ex=None,): - self.ex = ex - - 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.ex = NoSuchInstanceException() - self.ex.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('freeInstance_result') - if self.ex is not None: - oprot.writeFieldBegin('ex', TType.STRUCT, 1) - self.ex.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(freeInstance_result) -freeInstance_result.thrift_spec = ( - None, # 0 - (1, TType.STRUCT, 'ex', [NoSuchInstanceException, None], None, ), # 1 -) - - -class read_integer_args(object): - """ - Attributes: - - instanceId - - vr - - """ - - - def __init__(self, instanceId=None, vr=None,): - self.instanceId = instanceId - self.vr = vr - - 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.STRING: - self.instanceId = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() - else: - iprot.skip(ftype) - elif fid == 2: - if ftype == TType.LIST: - self.vr = [] - (_etype80, _size77) = iprot.readListBegin() - for _i81 in range(_size77): - _elem82 = iprot.readI64() - self.vr.append(_elem82) - 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('read_integer_args') - if self.instanceId is not None: - oprot.writeFieldBegin('instanceId', TType.STRING, 1) - oprot.writeString(self.instanceId.encode('utf-8') if sys.version_info[0] == 2 else self.instanceId) - oprot.writeFieldEnd() - if self.vr is not None: - oprot.writeFieldBegin('vr', TType.LIST, 2) - oprot.writeListBegin(TType.I64, len(self.vr)) - for iter83 in self.vr: - oprot.writeI64(iter83) - 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(read_integer_args) -read_integer_args.thrift_spec = ( - None, # 0 - (1, TType.STRING, 'instanceId', 'UTF8', None, ), # 1 - (2, TType.LIST, 'vr', (TType.I64, None, False), None, ), # 2 -) - - -class read_integer_result(object): - """ - Attributes: - - success - - ex1 - - ex2 - - """ - - - def __init__(self, success=None, ex1=None, ex2=None,): - self.success = success - self.ex1 = ex1 - self.ex2 = ex2 - - 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 = IntegerRead() - self.success.read(iprot) - else: - iprot.skip(ftype) - elif fid == 1: - if ftype == TType.STRUCT: - self.ex1 = NoSuchInstanceException() - self.ex1.read(iprot) - else: - iprot.skip(ftype) - elif fid == 2: - if ftype == TType.STRUCT: - self.ex2 = NoSuchVariableException() - self.ex2.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('read_integer_result') - if self.success is not None: - oprot.writeFieldBegin('success', TType.STRUCT, 0) - self.success.write(oprot) - oprot.writeFieldEnd() - if self.ex1 is not None: - oprot.writeFieldBegin('ex1', TType.STRUCT, 1) - self.ex1.write(oprot) - oprot.writeFieldEnd() - if self.ex2 is not None: - oprot.writeFieldBegin('ex2', TType.STRUCT, 2) - self.ex2.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(read_integer_result) -read_integer_result.thrift_spec = ( - (0, TType.STRUCT, 'success', [IntegerRead, None], None, ), # 0 - (1, TType.STRUCT, 'ex1', [NoSuchInstanceException, None], None, ), # 1 - (2, TType.STRUCT, 'ex2', [NoSuchVariableException, None], None, ), # 2 -) - - -class read_real_args(object): - """ - Attributes: - - instanceId - - vr - - """ - - - def __init__(self, instanceId=None, vr=None,): - self.instanceId = instanceId - self.vr = vr - - 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.STRING: - self.instanceId = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() - else: - iprot.skip(ftype) - elif fid == 2: - if ftype == TType.LIST: - self.vr = [] - (_etype87, _size84) = iprot.readListBegin() - for _i88 in range(_size84): - _elem89 = iprot.readI64() - self.vr.append(_elem89) - 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('read_real_args') - if self.instanceId is not None: - oprot.writeFieldBegin('instanceId', TType.STRING, 1) - oprot.writeString(self.instanceId.encode('utf-8') if sys.version_info[0] == 2 else self.instanceId) - oprot.writeFieldEnd() - if self.vr is not None: - oprot.writeFieldBegin('vr', TType.LIST, 2) - oprot.writeListBegin(TType.I64, len(self.vr)) - for iter90 in self.vr: - oprot.writeI64(iter90) - 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(read_real_args) -read_real_args.thrift_spec = ( - None, # 0 - (1, TType.STRING, 'instanceId', 'UTF8', None, ), # 1 - (2, TType.LIST, 'vr', (TType.I64, None, False), None, ), # 2 -) - - -class read_real_result(object): - """ - Attributes: - - success - - ex1 - - ex2 - - """ - - - def __init__(self, success=None, ex1=None, ex2=None,): - self.success = success - self.ex1 = ex1 - self.ex2 = ex2 - - 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 = RealRead() - self.success.read(iprot) - else: - iprot.skip(ftype) - elif fid == 1: - if ftype == TType.STRUCT: - self.ex1 = NoSuchInstanceException() - self.ex1.read(iprot) - else: - iprot.skip(ftype) - elif fid == 2: - if ftype == TType.STRUCT: - self.ex2 = NoSuchVariableException() - self.ex2.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('read_real_result') - if self.success is not None: - oprot.writeFieldBegin('success', TType.STRUCT, 0) - self.success.write(oprot) - oprot.writeFieldEnd() - if self.ex1 is not None: - oprot.writeFieldBegin('ex1', TType.STRUCT, 1) - self.ex1.write(oprot) - oprot.writeFieldEnd() - if self.ex2 is not None: - oprot.writeFieldBegin('ex2', TType.STRUCT, 2) - self.ex2.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(read_real_result) -read_real_result.thrift_spec = ( - (0, TType.STRUCT, 'success', [RealRead, None], None, ), # 0 - (1, TType.STRUCT, 'ex1', [NoSuchInstanceException, None], None, ), # 1 - (2, TType.STRUCT, 'ex2', [NoSuchVariableException, None], None, ), # 2 -) - - -class read_string_args(object): - """ - Attributes: - - instanceId - - vr - - """ - - - def __init__(self, instanceId=None, vr=None,): - self.instanceId = instanceId - self.vr = vr - - 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.STRING: - self.instanceId = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() - else: - iprot.skip(ftype) - elif fid == 2: - if ftype == TType.LIST: - self.vr = [] - (_etype94, _size91) = iprot.readListBegin() - for _i95 in range(_size91): - _elem96 = iprot.readI64() - self.vr.append(_elem96) - 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('read_string_args') - if self.instanceId is not None: - oprot.writeFieldBegin('instanceId', TType.STRING, 1) - oprot.writeString(self.instanceId.encode('utf-8') if sys.version_info[0] == 2 else self.instanceId) - oprot.writeFieldEnd() - if self.vr is not None: - oprot.writeFieldBegin('vr', TType.LIST, 2) - oprot.writeListBegin(TType.I64, len(self.vr)) - for iter97 in self.vr: - oprot.writeI64(iter97) - 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(read_string_args) -read_string_args.thrift_spec = ( - None, # 0 - (1, TType.STRING, 'instanceId', 'UTF8', None, ), # 1 - (2, TType.LIST, 'vr', (TType.I64, None, False), None, ), # 2 -) - - -class read_string_result(object): - """ - Attributes: - - success - - ex1 - - ex2 - - """ - - - def __init__(self, success=None, ex1=None, ex2=None,): - self.success = success - self.ex1 = ex1 - self.ex2 = ex2 - - 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 = StringRead() - self.success.read(iprot) - else: - iprot.skip(ftype) - elif fid == 1: - if ftype == TType.STRUCT: - self.ex1 = NoSuchInstanceException() - self.ex1.read(iprot) - else: - iprot.skip(ftype) - elif fid == 2: - if ftype == TType.STRUCT: - self.ex2 = NoSuchVariableException() - self.ex2.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('read_string_result') - if self.success is not None: - oprot.writeFieldBegin('success', TType.STRUCT, 0) - self.success.write(oprot) - oprot.writeFieldEnd() - if self.ex1 is not None: - oprot.writeFieldBegin('ex1', TType.STRUCT, 1) - self.ex1.write(oprot) - oprot.writeFieldEnd() - if self.ex2 is not None: - oprot.writeFieldBegin('ex2', TType.STRUCT, 2) - self.ex2.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(read_string_result) -read_string_result.thrift_spec = ( - (0, TType.STRUCT, 'success', [StringRead, None], None, ), # 0 - (1, TType.STRUCT, 'ex1', [NoSuchInstanceException, None], None, ), # 1 - (2, TType.STRUCT, 'ex2', [NoSuchVariableException, None], None, ), # 2 -) - - -class read_boolean_args(object): - """ - Attributes: - - instanceId - - vr - - """ - - - def __init__(self, instanceId=None, vr=None,): - self.instanceId = instanceId - self.vr = vr - - 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.STRING: - self.instanceId = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() - else: - iprot.skip(ftype) - elif fid == 2: - if ftype == TType.LIST: - self.vr = [] - (_etype101, _size98) = iprot.readListBegin() - for _i102 in range(_size98): - _elem103 = iprot.readI64() - self.vr.append(_elem103) - 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('read_boolean_args') - if self.instanceId is not None: - oprot.writeFieldBegin('instanceId', TType.STRING, 1) - oprot.writeString(self.instanceId.encode('utf-8') if sys.version_info[0] == 2 else self.instanceId) - oprot.writeFieldEnd() - if self.vr is not None: - oprot.writeFieldBegin('vr', TType.LIST, 2) - oprot.writeListBegin(TType.I64, len(self.vr)) - for iter104 in self.vr: - oprot.writeI64(iter104) - 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(read_boolean_args) -read_boolean_args.thrift_spec = ( - None, # 0 - (1, TType.STRING, 'instanceId', 'UTF8', None, ), # 1 - (2, TType.LIST, 'vr', (TType.I64, None, False), None, ), # 2 -) - - -class read_boolean_result(object): - """ - Attributes: - - success - - ex1 - - ex2 - - """ - - - def __init__(self, success=None, ex1=None, ex2=None,): - self.success = success - self.ex1 = ex1 - self.ex2 = ex2 - - 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 = BooleanRead() - self.success.read(iprot) - else: - iprot.skip(ftype) - elif fid == 1: - if ftype == TType.STRUCT: - self.ex1 = NoSuchInstanceException() - self.ex1.read(iprot) - else: - iprot.skip(ftype) - elif fid == 2: - if ftype == TType.STRUCT: - self.ex2 = NoSuchVariableException() - self.ex2.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('read_boolean_result') - if self.success is not None: - oprot.writeFieldBegin('success', TType.STRUCT, 0) - self.success.write(oprot) - oprot.writeFieldEnd() - if self.ex1 is not None: - oprot.writeFieldBegin('ex1', TType.STRUCT, 1) - self.ex1.write(oprot) - oprot.writeFieldEnd() - if self.ex2 is not None: - oprot.writeFieldBegin('ex2', TType.STRUCT, 2) - self.ex2.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(read_boolean_result) -read_boolean_result.thrift_spec = ( - (0, TType.STRUCT, 'success', [BooleanRead, None], None, ), # 0 - (1, TType.STRUCT, 'ex1', [NoSuchInstanceException, None], None, ), # 1 - (2, TType.STRUCT, 'ex2', [NoSuchVariableException, None], None, ), # 2 -) - - -class write_integer_args(object): - """ - Attributes: - - instanceId - - vr - - value - - """ - - - def __init__(self, instanceId=None, vr=None, value=None,): - self.instanceId = instanceId - self.vr = vr - 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.STRING: - self.instanceId = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() - else: - iprot.skip(ftype) - elif fid == 2: - if ftype == TType.LIST: - self.vr = [] - (_etype108, _size105) = iprot.readListBegin() - for _i109 in range(_size105): - _elem110 = iprot.readI64() - self.vr.append(_elem110) - iprot.readListEnd() - else: - iprot.skip(ftype) - elif fid == 3: - if ftype == TType.LIST: - self.value = [] - (_etype114, _size111) = iprot.readListBegin() - for _i115 in range(_size111): - _elem116 = iprot.readI32() - self.value.append(_elem116) - 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('write_integer_args') - if self.instanceId is not None: - oprot.writeFieldBegin('instanceId', TType.STRING, 1) - oprot.writeString(self.instanceId.encode('utf-8') if sys.version_info[0] == 2 else self.instanceId) - oprot.writeFieldEnd() - if self.vr is not None: - oprot.writeFieldBegin('vr', TType.LIST, 2) - oprot.writeListBegin(TType.I64, len(self.vr)) - for iter117 in self.vr: - oprot.writeI64(iter117) - oprot.writeListEnd() - oprot.writeFieldEnd() - if self.value is not None: - oprot.writeFieldBegin('value', TType.LIST, 3) - oprot.writeListBegin(TType.I32, len(self.value)) - for iter118 in self.value: - oprot.writeI32(iter118) - 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(write_integer_args) -write_integer_args.thrift_spec = ( - None, # 0 - (1, TType.STRING, 'instanceId', 'UTF8', None, ), # 1 - (2, TType.LIST, 'vr', (TType.I64, None, False), None, ), # 2 - (3, TType.LIST, 'value', (TType.I32, None, False), None, ), # 3 -) - - -class write_integer_result(object): - """ - Attributes: - - success - - ex1 - - ex2 - - """ - - - def __init__(self, success=None, ex1=None, ex2=None,): - self.success = success - self.ex1 = ex1 - self.ex2 = ex2 - - 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.I32: - self.success = iprot.readI32() - else: - iprot.skip(ftype) - elif fid == 1: - if ftype == TType.STRUCT: - self.ex1 = NoSuchInstanceException() - self.ex1.read(iprot) - else: - iprot.skip(ftype) - elif fid == 2: - if ftype == TType.STRUCT: - self.ex2 = NoSuchVariableException() - self.ex2.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('write_integer_result') - if self.success is not None: - oprot.writeFieldBegin('success', TType.I32, 0) - oprot.writeI32(self.success) - oprot.writeFieldEnd() - if self.ex1 is not None: - oprot.writeFieldBegin('ex1', TType.STRUCT, 1) - self.ex1.write(oprot) - oprot.writeFieldEnd() - if self.ex2 is not None: - oprot.writeFieldBegin('ex2', TType.STRUCT, 2) - self.ex2.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(write_integer_result) -write_integer_result.thrift_spec = ( - (0, TType.I32, 'success', None, None, ), # 0 - (1, TType.STRUCT, 'ex1', [NoSuchInstanceException, None], None, ), # 1 - (2, TType.STRUCT, 'ex2', [NoSuchVariableException, None], None, ), # 2 -) - - -class write_real_args(object): - """ - Attributes: - - instanceId - - vr - - value - - """ - - - def __init__(self, instanceId=None, vr=None, value=None,): - self.instanceId = instanceId - self.vr = vr - 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.STRING: - self.instanceId = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() - else: - iprot.skip(ftype) - elif fid == 2: - if ftype == TType.LIST: - self.vr = [] - (_etype122, _size119) = iprot.readListBegin() - for _i123 in range(_size119): - _elem124 = iprot.readI64() - self.vr.append(_elem124) - iprot.readListEnd() - else: - iprot.skip(ftype) - elif fid == 3: - if ftype == TType.LIST: - self.value = [] - (_etype128, _size125) = iprot.readListBegin() - for _i129 in range(_size125): - _elem130 = iprot.readDouble() - self.value.append(_elem130) - 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('write_real_args') - if self.instanceId is not None: - oprot.writeFieldBegin('instanceId', TType.STRING, 1) - oprot.writeString(self.instanceId.encode('utf-8') if sys.version_info[0] == 2 else self.instanceId) - oprot.writeFieldEnd() - if self.vr is not None: - oprot.writeFieldBegin('vr', TType.LIST, 2) - oprot.writeListBegin(TType.I64, len(self.vr)) - for iter131 in self.vr: - oprot.writeI64(iter131) - oprot.writeListEnd() - oprot.writeFieldEnd() - if self.value is not None: - oprot.writeFieldBegin('value', TType.LIST, 3) - oprot.writeListBegin(TType.DOUBLE, len(self.value)) - for iter132 in self.value: - oprot.writeDouble(iter132) - 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(write_real_args) -write_real_args.thrift_spec = ( - None, # 0 - (1, TType.STRING, 'instanceId', 'UTF8', None, ), # 1 - (2, TType.LIST, 'vr', (TType.I64, None, False), None, ), # 2 - (3, TType.LIST, 'value', (TType.DOUBLE, None, False), None, ), # 3 -) - - -class write_real_result(object): - """ - Attributes: - - success - - ex1 - - ex2 - - """ - - - def __init__(self, success=None, ex1=None, ex2=None,): - self.success = success - self.ex1 = ex1 - self.ex2 = ex2 - - 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.I32: - self.success = iprot.readI32() - else: - iprot.skip(ftype) - elif fid == 1: - if ftype == TType.STRUCT: - self.ex1 = NoSuchInstanceException() - self.ex1.read(iprot) - else: - iprot.skip(ftype) - elif fid == 2: - if ftype == TType.STRUCT: - self.ex2 = NoSuchVariableException() - self.ex2.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('write_real_result') - if self.success is not None: - oprot.writeFieldBegin('success', TType.I32, 0) - oprot.writeI32(self.success) - oprot.writeFieldEnd() - if self.ex1 is not None: - oprot.writeFieldBegin('ex1', TType.STRUCT, 1) - self.ex1.write(oprot) - oprot.writeFieldEnd() - if self.ex2 is not None: - oprot.writeFieldBegin('ex2', TType.STRUCT, 2) - self.ex2.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(write_real_result) -write_real_result.thrift_spec = ( - (0, TType.I32, 'success', None, None, ), # 0 - (1, TType.STRUCT, 'ex1', [NoSuchInstanceException, None], None, ), # 1 - (2, TType.STRUCT, 'ex2', [NoSuchVariableException, None], None, ), # 2 -) - - -class write_string_args(object): - """ - Attributes: - - instanceId - - vr - - value - - """ - - - def __init__(self, instanceId=None, vr=None, value=None,): - self.instanceId = instanceId - self.vr = vr - 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.STRING: - self.instanceId = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() - else: - iprot.skip(ftype) - elif fid == 2: - if ftype == TType.LIST: - self.vr = [] - (_etype136, _size133) = iprot.readListBegin() - for _i137 in range(_size133): - _elem138 = iprot.readI64() - self.vr.append(_elem138) - iprot.readListEnd() - else: - iprot.skip(ftype) - elif fid == 3: - if ftype == TType.LIST: - self.value = [] - (_etype142, _size139) = iprot.readListBegin() - for _i143 in range(_size139): - _elem144 = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() - self.value.append(_elem144) - 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('write_string_args') - if self.instanceId is not None: - oprot.writeFieldBegin('instanceId', TType.STRING, 1) - oprot.writeString(self.instanceId.encode('utf-8') if sys.version_info[0] == 2 else self.instanceId) - oprot.writeFieldEnd() - if self.vr is not None: - oprot.writeFieldBegin('vr', TType.LIST, 2) - oprot.writeListBegin(TType.I64, len(self.vr)) - for iter145 in self.vr: - oprot.writeI64(iter145) - oprot.writeListEnd() - oprot.writeFieldEnd() - if self.value is not None: - oprot.writeFieldBegin('value', TType.LIST, 3) - oprot.writeListBegin(TType.STRING, len(self.value)) - for iter146 in self.value: - oprot.writeString(iter146.encode('utf-8') if sys.version_info[0] == 2 else iter146) - 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(write_string_args) -write_string_args.thrift_spec = ( - None, # 0 - (1, TType.STRING, 'instanceId', 'UTF8', None, ), # 1 - (2, TType.LIST, 'vr', (TType.I64, None, False), None, ), # 2 - (3, TType.LIST, 'value', (TType.STRING, 'UTF8', False), None, ), # 3 -) - - -class write_string_result(object): - """ - Attributes: - - success - - ex1 - - ex2 - - """ - - - def __init__(self, success=None, ex1=None, ex2=None,): - self.success = success - self.ex1 = ex1 - self.ex2 = ex2 - - 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.I32: - self.success = iprot.readI32() - else: - iprot.skip(ftype) - elif fid == 1: - if ftype == TType.STRUCT: - self.ex1 = NoSuchInstanceException() - self.ex1.read(iprot) - else: - iprot.skip(ftype) - elif fid == 2: - if ftype == TType.STRUCT: - self.ex2 = NoSuchVariableException() - self.ex2.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('write_string_result') - if self.success is not None: - oprot.writeFieldBegin('success', TType.I32, 0) - oprot.writeI32(self.success) - oprot.writeFieldEnd() - if self.ex1 is not None: - oprot.writeFieldBegin('ex1', TType.STRUCT, 1) - self.ex1.write(oprot) - oprot.writeFieldEnd() - if self.ex2 is not None: - oprot.writeFieldBegin('ex2', TType.STRUCT, 2) - self.ex2.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(write_string_result) -write_string_result.thrift_spec = ( - (0, TType.I32, 'success', None, None, ), # 0 - (1, TType.STRUCT, 'ex1', [NoSuchInstanceException, None], None, ), # 1 - (2, TType.STRUCT, 'ex2', [NoSuchVariableException, None], None, ), # 2 -) - - -class write_boolean_args(object): - """ - Attributes: - - instanceId - - vr - - value - - """ - - - def __init__(self, instanceId=None, vr=None, value=None,): - self.instanceId = instanceId - self.vr = vr - 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.STRING: - self.instanceId = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() - else: - iprot.skip(ftype) - elif fid == 2: - if ftype == TType.LIST: - self.vr = [] - (_etype150, _size147) = iprot.readListBegin() - for _i151 in range(_size147): - _elem152 = iprot.readI64() - self.vr.append(_elem152) - iprot.readListEnd() - else: - iprot.skip(ftype) - elif fid == 3: - if ftype == TType.LIST: - self.value = [] - (_etype156, _size153) = iprot.readListBegin() - for _i157 in range(_size153): - _elem158 = iprot.readBool() - self.value.append(_elem158) - 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('write_boolean_args') - if self.instanceId is not None: - oprot.writeFieldBegin('instanceId', TType.STRING, 1) - oprot.writeString(self.instanceId.encode('utf-8') if sys.version_info[0] == 2 else self.instanceId) - oprot.writeFieldEnd() - if self.vr is not None: - oprot.writeFieldBegin('vr', TType.LIST, 2) - oprot.writeListBegin(TType.I64, len(self.vr)) - for iter159 in self.vr: - oprot.writeI64(iter159) - oprot.writeListEnd() - oprot.writeFieldEnd() - if self.value is not None: - oprot.writeFieldBegin('value', TType.LIST, 3) - oprot.writeListBegin(TType.BOOL, len(self.value)) - for iter160 in self.value: - oprot.writeBool(iter160) - 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(write_boolean_args) -write_boolean_args.thrift_spec = ( - None, # 0 - (1, TType.STRING, 'instanceId', 'UTF8', None, ), # 1 - (2, TType.LIST, 'vr', (TType.I64, None, False), None, ), # 2 - (3, TType.LIST, 'value', (TType.BOOL, None, False), None, ), # 3 -) - - -class write_boolean_result(object): - """ - Attributes: - - success - - ex1 - - ex2 - - """ - - - def __init__(self, success=None, ex1=None, ex2=None,): - self.success = success - self.ex1 = ex1 - self.ex2 = ex2 - - 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.I32: - self.success = iprot.readI32() - else: - iprot.skip(ftype) - elif fid == 1: - if ftype == TType.STRUCT: - self.ex1 = NoSuchInstanceException() - self.ex1.read(iprot) - else: - iprot.skip(ftype) - elif fid == 2: - if ftype == TType.STRUCT: - self.ex2 = NoSuchVariableException() - self.ex2.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('write_boolean_result') - if self.success is not None: - oprot.writeFieldBegin('success', TType.I32, 0) - oprot.writeI32(self.success) - oprot.writeFieldEnd() - if self.ex1 is not None: - oprot.writeFieldBegin('ex1', TType.STRUCT, 1) - self.ex1.write(oprot) - oprot.writeFieldEnd() - if self.ex2 is not None: - oprot.writeFieldBegin('ex2', TType.STRUCT, 2) - self.ex2.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(write_boolean_result) -write_boolean_result.thrift_spec = ( - (0, TType.I32, 'success', None, None, ), # 0 - (1, TType.STRUCT, 'ex1', [NoSuchInstanceException, None], None, ), # 1 - (2, TType.STRUCT, 'ex2', [NoSuchVariableException, None], None, ), # 2 -) - - -class get_directional_derivative_args(object): - """ - Attributes: - - instanceId - - vUnknownRef - - vKnownRef - - dvKnownRef - - """ - - - def __init__(self, instanceId=None, vUnknownRef=None, vKnownRef=None, dvKnownRef=None,): - self.instanceId = instanceId - self.vUnknownRef = vUnknownRef - self.vKnownRef = vKnownRef - self.dvKnownRef = dvKnownRef - - 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.STRING: - self.instanceId = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() - else: - iprot.skip(ftype) - elif fid == 2: - if ftype == TType.LIST: - self.vUnknownRef = [] - (_etype164, _size161) = iprot.readListBegin() - for _i165 in range(_size161): - _elem166 = iprot.readI64() - self.vUnknownRef.append(_elem166) - iprot.readListEnd() - else: - iprot.skip(ftype) - elif fid == 3: - if ftype == TType.LIST: - self.vKnownRef = [] - (_etype170, _size167) = iprot.readListBegin() - for _i171 in range(_size167): - _elem172 = iprot.readI64() - self.vKnownRef.append(_elem172) - iprot.readListEnd() - else: - iprot.skip(ftype) - elif fid == 4: - if ftype == TType.LIST: - self.dvKnownRef = [] - (_etype176, _size173) = iprot.readListBegin() - for _i177 in range(_size173): - _elem178 = iprot.readDouble() - self.dvKnownRef.append(_elem178) - 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('get_directional_derivative_args') - if self.instanceId is not None: - oprot.writeFieldBegin('instanceId', TType.STRING, 1) - oprot.writeString(self.instanceId.encode('utf-8') if sys.version_info[0] == 2 else self.instanceId) - oprot.writeFieldEnd() - if self.vUnknownRef is not None: - oprot.writeFieldBegin('vUnknownRef', TType.LIST, 2) - oprot.writeListBegin(TType.I64, len(self.vUnknownRef)) - for iter179 in self.vUnknownRef: - oprot.writeI64(iter179) - oprot.writeListEnd() - oprot.writeFieldEnd() - if self.vKnownRef is not None: - oprot.writeFieldBegin('vKnownRef', TType.LIST, 3) - oprot.writeListBegin(TType.I64, len(self.vKnownRef)) - for iter180 in self.vKnownRef: - oprot.writeI64(iter180) - oprot.writeListEnd() - oprot.writeFieldEnd() - if self.dvKnownRef is not None: - oprot.writeFieldBegin('dvKnownRef', TType.LIST, 4) - oprot.writeListBegin(TType.DOUBLE, len(self.dvKnownRef)) - for iter181 in self.dvKnownRef: - oprot.writeDouble(iter181) - 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(get_directional_derivative_args) -get_directional_derivative_args.thrift_spec = ( - None, # 0 - (1, TType.STRING, 'instanceId', 'UTF8', None, ), # 1 - (2, TType.LIST, 'vUnknownRef', (TType.I64, None, False), None, ), # 2 - (3, TType.LIST, 'vKnownRef', (TType.I64, None, False), None, ), # 3 - (4, TType.LIST, 'dvKnownRef', (TType.DOUBLE, None, False), None, ), # 4 -) - - -class get_directional_derivative_result(object): - """ - Attributes: - - success - - ex1 - - ex2 - - """ - - - def __init__(self, success=None, ex1=None, ex2=None,): - self.success = success - self.ex1 = ex1 - self.ex2 = ex2 - - 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 = DirectionalDerivativeResult() - self.success.read(iprot) - else: - iprot.skip(ftype) - elif fid == 1: - if ftype == TType.STRUCT: - self.ex1 = NoSuchInstanceException() - self.ex1.read(iprot) - else: - iprot.skip(ftype) - elif fid == 2: - if ftype == TType.STRUCT: - self.ex2 = UnsupportedOperationException() - self.ex2.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('get_directional_derivative_result') - if self.success is not None: - oprot.writeFieldBegin('success', TType.STRUCT, 0) - self.success.write(oprot) - oprot.writeFieldEnd() - if self.ex1 is not None: - oprot.writeFieldBegin('ex1', TType.STRUCT, 1) - self.ex1.write(oprot) - oprot.writeFieldEnd() - if self.ex2 is not None: - oprot.writeFieldBegin('ex2', TType.STRUCT, 2) - self.ex2.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(get_directional_derivative_result) -get_directional_derivative_result.thrift_spec = ( - (0, TType.STRUCT, 'success', [DirectionalDerivativeResult, None], None, ), # 0 - (1, TType.STRUCT, 'ex1', [NoSuchInstanceException, None], None, ), # 1 - (2, TType.STRUCT, 'ex2', [UnsupportedOperationException, None], None, ), # 2 -) -fix_spec(all_structs) -del all_structs - diff --git a/client-demos/python/thrift-client/service/__init__.py b/client-demos/python/thrift-client/service/__init__.py deleted file mode 100644 index 69b602af..00000000 --- a/client-demos/python/thrift-client/service/__init__.py +++ /dev/null @@ -1 +0,0 @@ -__all__ = ['ttypes', 'FmuService'] diff --git a/client-demos/python/thrift-client/service/ttypes.py b/client-demos/python/thrift-client/service/ttypes.py deleted file mode 100644 index 8e8338a3..00000000 --- a/client-demos/python/thrift-client/service/ttypes.py +++ /dev/null @@ -1,2083 +0,0 @@ -# -# Autogenerated by Thrift Compiler (0.12.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 - -from thrift.transport import TTransport -all_structs = [] - - -class Status(object): - OK_STATUS = 0 - WARNING_STATUS = 1 - DISCARD_STATUS = 2 - ERROR_STATUS = 3 - FATAL_STATUS = 4 - PENDING_STATUS = 5 - - _VALUES_TO_NAMES = { - 0: "OK_STATUS", - 1: "WARNING_STATUS", - 2: "DISCARD_STATUS", - 3: "ERROR_STATUS", - 4: "FATAL_STATUS", - 5: "PENDING_STATUS", - } - - _NAMES_TO_VALUES = { - "OK_STATUS": 0, - "WARNING_STATUS": 1, - "DISCARD_STATUS": 2, - "ERROR_STATUS": 3, - "FATAL_STATUS": 4, - "PENDING_STATUS": 5, - } - - -class IntegerAttribute(object): - """ - Attributes: - - min - - max - - start - - quantity - - """ - - - def __init__(self, min=None, max=None, start=None, quantity=None,): - self.min = min - self.max = max - self.start = start - self.quantity = quantity - - 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.min = iprot.readI32() - else: - iprot.skip(ftype) - elif fid == 2: - if ftype == TType.I32: - self.max = iprot.readI32() - else: - iprot.skip(ftype) - elif fid == 3: - if ftype == TType.I32: - self.start = iprot.readI32() - else: - iprot.skip(ftype) - elif fid == 4: - if ftype == TType.STRING: - self.quantity = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() - 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('IntegerAttribute') - if self.min is not None: - oprot.writeFieldBegin('min', TType.I32, 1) - oprot.writeI32(self.min) - oprot.writeFieldEnd() - if self.max is not None: - oprot.writeFieldBegin('max', TType.I32, 2) - oprot.writeI32(self.max) - oprot.writeFieldEnd() - if self.start is not None: - oprot.writeFieldBegin('start', TType.I32, 3) - oprot.writeI32(self.start) - oprot.writeFieldEnd() - if self.quantity is not None: - oprot.writeFieldBegin('quantity', TType.STRING, 4) - oprot.writeString(self.quantity.encode('utf-8') if sys.version_info[0] == 2 else self.quantity) - 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 RealAttribute(object): - """ - Attributes: - - min - - max - - start - - quantity - - """ - - - def __init__(self, min=None, max=None, start=None, quantity=None,): - self.min = min - self.max = max - self.start = start - self.quantity = quantity - - 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.min = iprot.readDouble() - else: - iprot.skip(ftype) - elif fid == 2: - if ftype == TType.DOUBLE: - self.max = iprot.readDouble() - else: - iprot.skip(ftype) - elif fid == 3: - if ftype == TType.DOUBLE: - self.start = iprot.readDouble() - else: - iprot.skip(ftype) - elif fid == 4: - if ftype == TType.STRING: - self.quantity = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() - 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('RealAttribute') - if self.min is not None: - oprot.writeFieldBegin('min', TType.DOUBLE, 1) - oprot.writeDouble(self.min) - oprot.writeFieldEnd() - if self.max is not None: - oprot.writeFieldBegin('max', TType.DOUBLE, 2) - oprot.writeDouble(self.max) - oprot.writeFieldEnd() - if self.start is not None: - oprot.writeFieldBegin('start', TType.DOUBLE, 3) - oprot.writeDouble(self.start) - oprot.writeFieldEnd() - if self.quantity is not None: - oprot.writeFieldBegin('quantity', TType.STRING, 4) - oprot.writeString(self.quantity.encode('utf-8') if sys.version_info[0] == 2 else self.quantity) - 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 StringAttribute(object): - """ - Attributes: - - start - - """ - - - def __init__(self, start=None,): - self.start = start - - 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.STRING: - self.start = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() - 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('StringAttribute') - if self.start is not None: - oprot.writeFieldBegin('start', TType.STRING, 1) - oprot.writeString(self.start.encode('utf-8') if sys.version_info[0] == 2 else self.start) - 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 BooleanAttribute(object): - """ - Attributes: - - start - - """ - - - def __init__(self, start=None,): - self.start = start - - 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.start = iprot.readBool() - 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('BooleanAttribute') - if self.start is not None: - oprot.writeFieldBegin('start', TType.BOOL, 1) - oprot.writeBool(self.start) - 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 EnumerationAttribute(object): - """ - Attributes: - - min - - max - - start - - quantity - - """ - - - def __init__(self, min=None, max=None, start=None, quantity=None,): - self.min = min - self.max = max - self.start = start - self.quantity = quantity - - 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.min = iprot.readI32() - else: - iprot.skip(ftype) - elif fid == 2: - if ftype == TType.I32: - self.max = iprot.readI32() - else: - iprot.skip(ftype) - elif fid == 3: - if ftype == TType.I32: - self.start = iprot.readI32() - else: - iprot.skip(ftype) - elif fid == 4: - if ftype == TType.STRING: - self.quantity = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() - 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('EnumerationAttribute') - if self.min is not None: - oprot.writeFieldBegin('min', TType.I32, 1) - oprot.writeI32(self.min) - oprot.writeFieldEnd() - if self.max is not None: - oprot.writeFieldBegin('max', TType.I32, 2) - oprot.writeI32(self.max) - oprot.writeFieldEnd() - if self.start is not None: - oprot.writeFieldBegin('start', TType.I32, 3) - oprot.writeI32(self.start) - oprot.writeFieldEnd() - if self.quantity is not None: - oprot.writeFieldBegin('quantity', TType.STRING, 4) - oprot.writeString(self.quantity.encode('utf-8') if sys.version_info[0] == 2 else self.quantity) - 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 ScalarVariableAttribute(object): - """ - Attributes: - - integer_attribute - - real_attribute - - string_attribute - - boolean_attribute - - enumeration_attribute - - """ - - - def __init__(self, integer_attribute=None, real_attribute=None, string_attribute=None, boolean_attribute=None, enumeration_attribute=None,): - self.integer_attribute = integer_attribute - self.real_attribute = real_attribute - self.string_attribute = string_attribute - self.boolean_attribute = boolean_attribute - self.enumeration_attribute = enumeration_attribute - - 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.integer_attribute = IntegerAttribute() - self.integer_attribute.read(iprot) - else: - iprot.skip(ftype) - elif fid == 2: - if ftype == TType.STRUCT: - self.real_attribute = RealAttribute() - self.real_attribute.read(iprot) - else: - iprot.skip(ftype) - elif fid == 3: - if ftype == TType.STRUCT: - self.string_attribute = StringAttribute() - self.string_attribute.read(iprot) - else: - iprot.skip(ftype) - elif fid == 4: - if ftype == TType.STRUCT: - self.boolean_attribute = BooleanAttribute() - self.boolean_attribute.read(iprot) - else: - iprot.skip(ftype) - elif fid == 5: - if ftype == TType.STRUCT: - self.enumeration_attribute = EnumerationAttribute() - self.enumeration_attribute.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('ScalarVariableAttribute') - if self.integer_attribute is not None: - oprot.writeFieldBegin('integer_attribute', TType.STRUCT, 1) - self.integer_attribute.write(oprot) - oprot.writeFieldEnd() - if self.real_attribute is not None: - oprot.writeFieldBegin('real_attribute', TType.STRUCT, 2) - self.real_attribute.write(oprot) - oprot.writeFieldEnd() - if self.string_attribute is not None: - oprot.writeFieldBegin('string_attribute', TType.STRUCT, 3) - self.string_attribute.write(oprot) - oprot.writeFieldEnd() - if self.boolean_attribute is not None: - oprot.writeFieldBegin('boolean_attribute', TType.STRUCT, 4) - self.boolean_attribute.write(oprot) - oprot.writeFieldEnd() - if self.enumeration_attribute is not None: - oprot.writeFieldBegin('enumeration_attribute', TType.STRUCT, 5) - self.enumeration_attribute.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 ScalarVariable(object): - """ - Attributes: - - name - - value_reference - - description - - initial - - causality - - variability - - attribute - - """ - - - def __init__(self, name=None, value_reference=None, description=None, initial=None, causality=None, variability=None, attribute=None,): - self.name = name - self.value_reference = value_reference - self.description = description - self.initial = initial - self.causality = causality - self.variability = variability - self.attribute = attribute - - 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.STRING: - self.name = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() - else: - iprot.skip(ftype) - elif fid == 2: - if ftype == TType.I64: - self.value_reference = iprot.readI64() - else: - iprot.skip(ftype) - elif fid == 3: - if ftype == TType.STRING: - self.description = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() - else: - iprot.skip(ftype) - elif fid == 4: - if ftype == TType.STRING: - self.initial = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() - else: - iprot.skip(ftype) - elif fid == 5: - if ftype == TType.STRING: - self.causality = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() - else: - iprot.skip(ftype) - elif fid == 6: - if ftype == TType.STRING: - self.variability = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() - else: - iprot.skip(ftype) - elif fid == 7: - if ftype == TType.STRUCT: - self.attribute = ScalarVariableAttribute() - self.attribute.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('ScalarVariable') - if self.name is not None: - oprot.writeFieldBegin('name', TType.STRING, 1) - oprot.writeString(self.name.encode('utf-8') if sys.version_info[0] == 2 else self.name) - oprot.writeFieldEnd() - if self.value_reference is not None: - oprot.writeFieldBegin('value_reference', TType.I64, 2) - oprot.writeI64(self.value_reference) - 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.initial is not None: - oprot.writeFieldBegin('initial', TType.STRING, 4) - oprot.writeString(self.initial.encode('utf-8') if sys.version_info[0] == 2 else self.initial) - oprot.writeFieldEnd() - if self.causality is not None: - oprot.writeFieldBegin('causality', TType.STRING, 5) - oprot.writeString(self.causality.encode('utf-8') if sys.version_info[0] == 2 else self.causality) - oprot.writeFieldEnd() - if self.variability is not None: - oprot.writeFieldBegin('variability', TType.STRING, 6) - oprot.writeString(self.variability.encode('utf-8') if sys.version_info[0] == 2 else self.variability) - oprot.writeFieldEnd() - if self.attribute is not None: - oprot.writeFieldBegin('attribute', TType.STRUCT, 7) - self.attribute.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 Unknown(object): - """ - Attributes: - - index - - dependencies - - dependencies_kind - - """ - - - def __init__(self, index=None, dependencies=None, dependencies_kind=None,): - self.index = index - self.dependencies = dependencies - self.dependencies_kind = dependencies_kind - - 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.index = iprot.readI32() - else: - iprot.skip(ftype) - elif fid == 2: - if ftype == TType.LIST: - self.dependencies = [] - (_etype3, _size0) = iprot.readListBegin() - for _i4 in range(_size0): - _elem5 = iprot.readI32() - self.dependencies.append(_elem5) - iprot.readListEnd() - else: - iprot.skip(ftype) - elif fid == 3: - if ftype == TType.LIST: - self.dependencies_kind = [] - (_etype9, _size6) = iprot.readListBegin() - for _i10 in range(_size6): - _elem11 = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() - self.dependencies_kind.append(_elem11) - 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('Unknown') - if self.index is not None: - oprot.writeFieldBegin('index', TType.I32, 1) - oprot.writeI32(self.index) - oprot.writeFieldEnd() - if self.dependencies is not None: - oprot.writeFieldBegin('dependencies', TType.LIST, 2) - oprot.writeListBegin(TType.I32, len(self.dependencies)) - for iter12 in self.dependencies: - oprot.writeI32(iter12) - oprot.writeListEnd() - oprot.writeFieldEnd() - if self.dependencies_kind is not None: - oprot.writeFieldBegin('dependencies_kind', TType.LIST, 3) - oprot.writeListBegin(TType.STRING, len(self.dependencies_kind)) - for iter13 in self.dependencies_kind: - oprot.writeString(iter13.encode('utf-8') if sys.version_info[0] == 2 else iter13) - 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 ModelStructure(object): - """ - Attributes: - - outputs - - derivatives - - initial_unknowns - - """ - - - def __init__(self, outputs=None, derivatives=None, initial_unknowns=None,): - self.outputs = outputs - self.derivatives = derivatives - self.initial_unknowns = initial_unknowns - - 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.LIST: - self.outputs = [] - (_etype17, _size14) = iprot.readListBegin() - for _i18 in range(_size14): - _elem19 = Unknown() - _elem19.read(iprot) - self.outputs.append(_elem19) - iprot.readListEnd() - else: - iprot.skip(ftype) - elif fid == 2: - if ftype == TType.LIST: - self.derivatives = [] - (_etype23, _size20) = iprot.readListBegin() - for _i24 in range(_size20): - _elem25 = Unknown() - _elem25.read(iprot) - self.derivatives.append(_elem25) - iprot.readListEnd() - else: - iprot.skip(ftype) - elif fid == 3: - if ftype == TType.LIST: - self.initial_unknowns = [] - (_etype29, _size26) = iprot.readListBegin() - for _i30 in range(_size26): - _elem31 = Unknown() - _elem31.read(iprot) - self.initial_unknowns.append(_elem31) - 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('ModelStructure') - if self.outputs is not None: - oprot.writeFieldBegin('outputs', TType.LIST, 1) - oprot.writeListBegin(TType.STRUCT, len(self.outputs)) - for iter32 in self.outputs: - iter32.write(oprot) - oprot.writeListEnd() - oprot.writeFieldEnd() - if self.derivatives is not None: - oprot.writeFieldBegin('derivatives', TType.LIST, 2) - oprot.writeListBegin(TType.STRUCT, len(self.derivatives)) - for iter33 in self.derivatives: - iter33.write(oprot) - oprot.writeListEnd() - oprot.writeFieldEnd() - if self.initial_unknowns is not None: - oprot.writeFieldBegin('initial_unknowns', TType.LIST, 3) - oprot.writeListBegin(TType.STRUCT, len(self.initial_unknowns)) - for iter34 in self.initial_unknowns: - iter34.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 DefaultExperiment(object): - """ - Attributes: - - startTime - - stopTime - - tolerance - - stepSize - - """ - - - def __init__(self, startTime=None, stopTime=None, tolerance=None, stepSize=None,): - self.startTime = startTime - self.stopTime = stopTime - self.tolerance = tolerance - self.stepSize = stepSize - - 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.startTime = iprot.readDouble() - else: - iprot.skip(ftype) - elif fid == 2: - if ftype == TType.DOUBLE: - self.stopTime = iprot.readDouble() - else: - iprot.skip(ftype) - elif fid == 3: - if ftype == TType.DOUBLE: - self.tolerance = iprot.readDouble() - else: - iprot.skip(ftype) - elif fid == 4: - if ftype == TType.DOUBLE: - self.stepSize = iprot.readDouble() - 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('DefaultExperiment') - if self.startTime is not None: - oprot.writeFieldBegin('startTime', TType.DOUBLE, 1) - oprot.writeDouble(self.startTime) - oprot.writeFieldEnd() - if self.stopTime is not None: - oprot.writeFieldBegin('stopTime', TType.DOUBLE, 2) - oprot.writeDouble(self.stopTime) - oprot.writeFieldEnd() - if self.tolerance is not None: - oprot.writeFieldBegin('tolerance', TType.DOUBLE, 3) - oprot.writeDouble(self.tolerance) - oprot.writeFieldEnd() - if self.stepSize is not None: - oprot.writeFieldBegin('stepSize', TType.DOUBLE, 4) - oprot.writeDouble(self.stepSize) - 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 StepResult(object): - """ - Attributes: - - status - - simulation_time - - """ - - - def __init__(self, status=None, simulation_time=None,): - self.status = status - self.simulation_time = simulation_time - - 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.status = iprot.readI32() - else: - iprot.skip(ftype) - elif fid == 2: - if ftype == TType.DOUBLE: - self.simulation_time = iprot.readDouble() - 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('StepResult') - if self.status is not None: - oprot.writeFieldBegin('status', TType.I32, 1) - oprot.writeI32(self.status) - oprot.writeFieldEnd() - if self.simulation_time is not None: - oprot.writeFieldBegin('simulation_time', TType.DOUBLE, 2) - oprot.writeDouble(self.simulation_time) - 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 IntegerRead(object): - """ - Attributes: - - value - - status - - """ - - - def __init__(self, value=None, status=None,): - self.value = value - self.status = status - - 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.LIST: - self.value = [] - (_etype38, _size35) = iprot.readListBegin() - for _i39 in range(_size35): - _elem40 = iprot.readI32() - self.value.append(_elem40) - iprot.readListEnd() - else: - iprot.skip(ftype) - elif fid == 2: - if ftype == TType.I32: - self.status = iprot.readI32() - 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('IntegerRead') - if self.value is not None: - oprot.writeFieldBegin('value', TType.LIST, 1) - oprot.writeListBegin(TType.I32, len(self.value)) - for iter41 in self.value: - oprot.writeI32(iter41) - oprot.writeListEnd() - oprot.writeFieldEnd() - if self.status is not None: - oprot.writeFieldBegin('status', TType.I32, 2) - oprot.writeI32(self.status) - 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 RealRead(object): - """ - Attributes: - - value - - status - - """ - - - def __init__(self, value=None, status=None,): - self.value = value - self.status = status - - 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.LIST: - self.value = [] - (_etype45, _size42) = iprot.readListBegin() - for _i46 in range(_size42): - _elem47 = iprot.readDouble() - self.value.append(_elem47) - iprot.readListEnd() - else: - iprot.skip(ftype) - elif fid == 2: - if ftype == TType.I32: - self.status = iprot.readI32() - 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('RealRead') - if self.value is not None: - oprot.writeFieldBegin('value', TType.LIST, 1) - oprot.writeListBegin(TType.DOUBLE, len(self.value)) - for iter48 in self.value: - oprot.writeDouble(iter48) - oprot.writeListEnd() - oprot.writeFieldEnd() - if self.status is not None: - oprot.writeFieldBegin('status', TType.I32, 2) - oprot.writeI32(self.status) - 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 StringRead(object): - """ - Attributes: - - value - - status - - """ - - - def __init__(self, value=None, status=None,): - self.value = value - self.status = status - - 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.LIST: - self.value = [] - (_etype52, _size49) = iprot.readListBegin() - for _i53 in range(_size49): - _elem54 = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() - self.value.append(_elem54) - iprot.readListEnd() - else: - iprot.skip(ftype) - elif fid == 2: - if ftype == TType.I32: - self.status = iprot.readI32() - 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('StringRead') - if self.value is not None: - oprot.writeFieldBegin('value', TType.LIST, 1) - oprot.writeListBegin(TType.STRING, len(self.value)) - for iter55 in self.value: - oprot.writeString(iter55.encode('utf-8') if sys.version_info[0] == 2 else iter55) - oprot.writeListEnd() - oprot.writeFieldEnd() - if self.status is not None: - oprot.writeFieldBegin('status', TType.I32, 2) - oprot.writeI32(self.status) - 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 BooleanRead(object): - """ - Attributes: - - value - - status - - """ - - - def __init__(self, value=None, status=None,): - self.value = value - self.status = status - - 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.LIST: - self.value = [] - (_etype59, _size56) = iprot.readListBegin() - for _i60 in range(_size56): - _elem61 = iprot.readBool() - self.value.append(_elem61) - iprot.readListEnd() - else: - iprot.skip(ftype) - elif fid == 2: - if ftype == TType.I32: - self.status = iprot.readI32() - 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('BooleanRead') - if self.value is not None: - oprot.writeFieldBegin('value', TType.LIST, 1) - oprot.writeListBegin(TType.BOOL, len(self.value)) - for iter62 in self.value: - oprot.writeBool(iter62) - oprot.writeListEnd() - oprot.writeFieldEnd() - if self.status is not None: - oprot.writeFieldBegin('status', TType.I32, 2) - oprot.writeI32(self.status) - 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 ModelDescription(object): - """ - Attributes: - - guid - - fmi_version - - modelName - - license - - copyright - - author - - version - - description - - generation_tool - - generation_date_and_time - - default_experiment - - variable_naming_convention - - model_variables - - model_structure - - model_identifier - - can_get_and_set_fmu_state - - can_serialize_fmu_state - - provides_directional_derivative - - can_handle_variable_communication_step_size - - can_interpolate_inputs - - max_output_derivative_order - - """ - - - def __init__(self, guid=None, fmi_version=None, modelName=None, license=None, copyright=None, author=None, version=None, description=None, generation_tool=None, generation_date_and_time=None, default_experiment=None, variable_naming_convention=None, model_variables=None, model_structure=None, model_identifier=None, can_get_and_set_fmu_state=None, can_serialize_fmu_state=None, provides_directional_derivative=None, can_handle_variable_communication_step_size=None, can_interpolate_inputs=None, max_output_derivative_order=None,): - self.guid = guid - self.fmi_version = fmi_version - self.modelName = modelName - self.license = license - self.copyright = copyright - self.author = author - self.version = version - self.description = description - self.generation_tool = generation_tool - self.generation_date_and_time = generation_date_and_time - self.default_experiment = default_experiment - self.variable_naming_convention = variable_naming_convention - self.model_variables = model_variables - self.model_structure = model_structure - self.model_identifier = model_identifier - self.can_get_and_set_fmu_state = can_get_and_set_fmu_state - self.can_serialize_fmu_state = can_serialize_fmu_state - self.provides_directional_derivative = provides_directional_derivative - self.can_handle_variable_communication_step_size = can_handle_variable_communication_step_size - self.can_interpolate_inputs = can_interpolate_inputs - self.max_output_derivative_order = max_output_derivative_order - - 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.STRING: - self.guid = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() - else: - iprot.skip(ftype) - elif fid == 2: - if ftype == TType.STRING: - self.fmi_version = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() - else: - iprot.skip(ftype) - elif fid == 3: - if ftype == TType.STRING: - self.modelName = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() - else: - iprot.skip(ftype) - elif fid == 4: - if ftype == TType.STRING: - self.license = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() - else: - iprot.skip(ftype) - elif fid == 5: - if ftype == TType.STRING: - self.copyright = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() - else: - iprot.skip(ftype) - elif fid == 6: - if ftype == TType.STRING: - self.author = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() - else: - iprot.skip(ftype) - elif fid == 7: - if ftype == TType.STRING: - self.version = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() - else: - iprot.skip(ftype) - elif fid == 8: - if ftype == TType.STRING: - self.description = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() - else: - iprot.skip(ftype) - elif fid == 9: - if ftype == TType.STRING: - self.generation_tool = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() - else: - iprot.skip(ftype) - elif fid == 10: - if ftype == TType.STRING: - self.generation_date_and_time = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() - else: - iprot.skip(ftype) - elif fid == 11: - if ftype == TType.STRUCT: - self.default_experiment = DefaultExperiment() - self.default_experiment.read(iprot) - else: - iprot.skip(ftype) - elif fid == 12: - if ftype == TType.STRING: - self.variable_naming_convention = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() - else: - iprot.skip(ftype) - elif fid == 13: - if ftype == TType.LIST: - self.model_variables = [] - (_etype66, _size63) = iprot.readListBegin() - for _i67 in range(_size63): - _elem68 = ScalarVariable() - _elem68.read(iprot) - self.model_variables.append(_elem68) - iprot.readListEnd() - else: - iprot.skip(ftype) - elif fid == 14: - if ftype == TType.STRUCT: - self.model_structure = ModelStructure() - self.model_structure.read(iprot) - else: - iprot.skip(ftype) - elif fid == 15: - if ftype == TType.STRING: - self.model_identifier = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() - else: - iprot.skip(ftype) - elif fid == 16: - if ftype == TType.BOOL: - self.can_get_and_set_fmu_state = iprot.readBool() - else: - iprot.skip(ftype) - elif fid == 17: - if ftype == TType.BOOL: - self.can_serialize_fmu_state = iprot.readBool() - else: - iprot.skip(ftype) - elif fid == 18: - if ftype == TType.BOOL: - self.provides_directional_derivative = iprot.readBool() - else: - iprot.skip(ftype) - elif fid == 19: - if ftype == TType.BOOL: - self.can_handle_variable_communication_step_size = iprot.readBool() - else: - iprot.skip(ftype) - elif fid == 20: - if ftype == TType.BOOL: - self.can_interpolate_inputs = iprot.readBool() - else: - iprot.skip(ftype) - elif fid == 21: - if ftype == TType.I32: - self.max_output_derivative_order = iprot.readI32() - 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('ModelDescription') - if self.guid is not None: - oprot.writeFieldBegin('guid', TType.STRING, 1) - oprot.writeString(self.guid.encode('utf-8') if sys.version_info[0] == 2 else self.guid) - oprot.writeFieldEnd() - if self.fmi_version is not None: - oprot.writeFieldBegin('fmi_version', TType.STRING, 2) - oprot.writeString(self.fmi_version.encode('utf-8') if sys.version_info[0] == 2 else self.fmi_version) - oprot.writeFieldEnd() - if self.modelName is not None: - oprot.writeFieldBegin('modelName', TType.STRING, 3) - oprot.writeString(self.modelName.encode('utf-8') if sys.version_info[0] == 2 else self.modelName) - oprot.writeFieldEnd() - if self.license is not None: - oprot.writeFieldBegin('license', TType.STRING, 4) - oprot.writeString(self.license.encode('utf-8') if sys.version_info[0] == 2 else self.license) - oprot.writeFieldEnd() - if self.copyright is not None: - oprot.writeFieldBegin('copyright', TType.STRING, 5) - oprot.writeString(self.copyright.encode('utf-8') if sys.version_info[0] == 2 else self.copyright) - oprot.writeFieldEnd() - if self.author is not None: - oprot.writeFieldBegin('author', TType.STRING, 6) - oprot.writeString(self.author.encode('utf-8') if sys.version_info[0] == 2 else self.author) - oprot.writeFieldEnd() - if self.version is not None: - oprot.writeFieldBegin('version', TType.STRING, 7) - oprot.writeString(self.version.encode('utf-8') if sys.version_info[0] == 2 else self.version) - oprot.writeFieldEnd() - if self.description is not None: - oprot.writeFieldBegin('description', TType.STRING, 8) - oprot.writeString(self.description.encode('utf-8') if sys.version_info[0] == 2 else self.description) - oprot.writeFieldEnd() - if self.generation_tool is not None: - oprot.writeFieldBegin('generation_tool', TType.STRING, 9) - oprot.writeString(self.generation_tool.encode('utf-8') if sys.version_info[0] == 2 else self.generation_tool) - oprot.writeFieldEnd() - if self.generation_date_and_time is not None: - oprot.writeFieldBegin('generation_date_and_time', TType.STRING, 10) - oprot.writeString(self.generation_date_and_time.encode('utf-8') if sys.version_info[0] == 2 else self.generation_date_and_time) - oprot.writeFieldEnd() - if self.default_experiment is not None: - oprot.writeFieldBegin('default_experiment', TType.STRUCT, 11) - self.default_experiment.write(oprot) - oprot.writeFieldEnd() - if self.variable_naming_convention is not None: - oprot.writeFieldBegin('variable_naming_convention', TType.STRING, 12) - oprot.writeString(self.variable_naming_convention.encode('utf-8') if sys.version_info[0] == 2 else self.variable_naming_convention) - oprot.writeFieldEnd() - if self.model_variables is not None: - oprot.writeFieldBegin('model_variables', TType.LIST, 13) - oprot.writeListBegin(TType.STRUCT, len(self.model_variables)) - for iter69 in self.model_variables: - iter69.write(oprot) - oprot.writeListEnd() - oprot.writeFieldEnd() - if self.model_structure is not None: - oprot.writeFieldBegin('model_structure', TType.STRUCT, 14) - self.model_structure.write(oprot) - oprot.writeFieldEnd() - if self.model_identifier is not None: - oprot.writeFieldBegin('model_identifier', TType.STRING, 15) - oprot.writeString(self.model_identifier.encode('utf-8') if sys.version_info[0] == 2 else self.model_identifier) - oprot.writeFieldEnd() - if self.can_get_and_set_fmu_state is not None: - oprot.writeFieldBegin('can_get_and_set_fmu_state', TType.BOOL, 16) - oprot.writeBool(self.can_get_and_set_fmu_state) - oprot.writeFieldEnd() - if self.can_serialize_fmu_state is not None: - oprot.writeFieldBegin('can_serialize_fmu_state', TType.BOOL, 17) - oprot.writeBool(self.can_serialize_fmu_state) - oprot.writeFieldEnd() - if self.provides_directional_derivative is not None: - oprot.writeFieldBegin('provides_directional_derivative', TType.BOOL, 18) - oprot.writeBool(self.provides_directional_derivative) - oprot.writeFieldEnd() - if self.can_handle_variable_communication_step_size is not None: - oprot.writeFieldBegin('can_handle_variable_communication_step_size', TType.BOOL, 19) - oprot.writeBool(self.can_handle_variable_communication_step_size) - oprot.writeFieldEnd() - if self.can_interpolate_inputs is not None: - oprot.writeFieldBegin('can_interpolate_inputs', TType.BOOL, 20) - oprot.writeBool(self.can_interpolate_inputs) - oprot.writeFieldEnd() - if self.max_output_derivative_order is not None: - oprot.writeFieldBegin('max_output_derivative_order', TType.I32, 21) - oprot.writeI32(self.max_output_derivative_order) - 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 NoSuchFmuException(TException): - """ - Attributes: - - message - - """ - - - def __init__(self, message=None,): - self.message = message - - 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.STRING: - self.message = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() - 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('NoSuchFmuException') - if self.message is not None: - oprot.writeFieldBegin('message', TType.STRING, 1) - oprot.writeString(self.message.encode('utf-8') if sys.version_info[0] == 2 else self.message) - oprot.writeFieldEnd() - oprot.writeFieldStop() - oprot.writeStructEnd() - - def validate(self): - return - - def __str__(self): - return repr(self) - - 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 NoSuchInstanceException(TException): - """ - Attributes: - - message - - """ - - - def __init__(self, message=None,): - self.message = message - - 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.STRING: - self.message = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() - 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('NoSuchInstanceException') - if self.message is not None: - oprot.writeFieldBegin('message', TType.STRING, 1) - oprot.writeString(self.message.encode('utf-8') if sys.version_info[0] == 2 else self.message) - oprot.writeFieldEnd() - oprot.writeFieldStop() - oprot.writeStructEnd() - - def validate(self): - return - - def __str__(self): - return repr(self) - - 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 NoSuchVariableException(TException): - """ - Attributes: - - message - - """ - - - def __init__(self, message=None,): - self.message = message - - 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.STRING: - self.message = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() - 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('NoSuchVariableException') - if self.message is not None: - oprot.writeFieldBegin('message', TType.STRING, 1) - oprot.writeString(self.message.encode('utf-8') if sys.version_info[0] == 2 else self.message) - oprot.writeFieldEnd() - oprot.writeFieldStop() - oprot.writeStructEnd() - - def validate(self): - return - - def __str__(self): - return repr(self) - - 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 UnsupportedOperationException(TException): - """ - Attributes: - - message - - """ - - - def __init__(self, message=None,): - self.message = message - - 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.STRING: - self.message = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() - 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('UnsupportedOperationException') - if self.message is not None: - oprot.writeFieldBegin('message', TType.STRING, 1) - oprot.writeString(self.message.encode('utf-8') if sys.version_info[0] == 2 else self.message) - oprot.writeFieldEnd() - oprot.writeFieldStop() - oprot.writeStructEnd() - - def validate(self): - return - - def __str__(self): - return repr(self) - - 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 DirectionalDerivativeResult(object): - """ - Attributes: - - dv_unknown_ref - - status - - """ - - - def __init__(self, dv_unknown_ref=None, status=None,): - self.dv_unknown_ref = dv_unknown_ref - self.status = status - - 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.LIST: - self.dv_unknown_ref = [] - (_etype73, _size70) = iprot.readListBegin() - for _i74 in range(_size70): - _elem75 = iprot.readDouble() - self.dv_unknown_ref.append(_elem75) - iprot.readListEnd() - else: - iprot.skip(ftype) - elif fid == 2: - if ftype == TType.I32: - self.status = iprot.readI32() - 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('DirectionalDerivativeResult') - if self.dv_unknown_ref is not None: - oprot.writeFieldBegin('dv_unknown_ref', TType.LIST, 1) - oprot.writeListBegin(TType.DOUBLE, len(self.dv_unknown_ref)) - for iter76 in self.dv_unknown_ref: - oprot.writeDouble(iter76) - oprot.writeListEnd() - oprot.writeFieldEnd() - if self.status is not None: - oprot.writeFieldBegin('status', TType.I32, 2) - oprot.writeI32(self.status) - 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(IntegerAttribute) -IntegerAttribute.thrift_spec = ( - None, # 0 - (1, TType.I32, 'min', None, None, ), # 1 - (2, TType.I32, 'max', None, None, ), # 2 - (3, TType.I32, 'start', None, None, ), # 3 - (4, TType.STRING, 'quantity', 'UTF8', None, ), # 4 -) -all_structs.append(RealAttribute) -RealAttribute.thrift_spec = ( - None, # 0 - (1, TType.DOUBLE, 'min', None, None, ), # 1 - (2, TType.DOUBLE, 'max', None, None, ), # 2 - (3, TType.DOUBLE, 'start', None, None, ), # 3 - (4, TType.STRING, 'quantity', 'UTF8', None, ), # 4 -) -all_structs.append(StringAttribute) -StringAttribute.thrift_spec = ( - None, # 0 - (1, TType.STRING, 'start', 'UTF8', None, ), # 1 -) -all_structs.append(BooleanAttribute) -BooleanAttribute.thrift_spec = ( - None, # 0 - (1, TType.BOOL, 'start', None, None, ), # 1 -) -all_structs.append(EnumerationAttribute) -EnumerationAttribute.thrift_spec = ( - None, # 0 - (1, TType.I32, 'min', None, None, ), # 1 - (2, TType.I32, 'max', None, None, ), # 2 - (3, TType.I32, 'start', None, None, ), # 3 - (4, TType.STRING, 'quantity', 'UTF8', None, ), # 4 -) -all_structs.append(ScalarVariableAttribute) -ScalarVariableAttribute.thrift_spec = ( - None, # 0 - (1, TType.STRUCT, 'integer_attribute', [IntegerAttribute, None], None, ), # 1 - (2, TType.STRUCT, 'real_attribute', [RealAttribute, None], None, ), # 2 - (3, TType.STRUCT, 'string_attribute', [StringAttribute, None], None, ), # 3 - (4, TType.STRUCT, 'boolean_attribute', [BooleanAttribute, None], None, ), # 4 - (5, TType.STRUCT, 'enumeration_attribute', [EnumerationAttribute, None], None, ), # 5 -) -all_structs.append(ScalarVariable) -ScalarVariable.thrift_spec = ( - None, # 0 - (1, TType.STRING, 'name', 'UTF8', None, ), # 1 - (2, TType.I64, 'value_reference', None, None, ), # 2 - (3, TType.STRING, 'description', 'UTF8', None, ), # 3 - (4, TType.STRING, 'initial', 'UTF8', None, ), # 4 - (5, TType.STRING, 'causality', 'UTF8', None, ), # 5 - (6, TType.STRING, 'variability', 'UTF8', None, ), # 6 - (7, TType.STRUCT, 'attribute', [ScalarVariableAttribute, None], None, ), # 7 -) -all_structs.append(Unknown) -Unknown.thrift_spec = ( - None, # 0 - (1, TType.I32, 'index', None, None, ), # 1 - (2, TType.LIST, 'dependencies', (TType.I32, None, False), None, ), # 2 - (3, TType.LIST, 'dependencies_kind', (TType.STRING, 'UTF8', False), None, ), # 3 -) -all_structs.append(ModelStructure) -ModelStructure.thrift_spec = ( - None, # 0 - (1, TType.LIST, 'outputs', (TType.STRUCT, [Unknown, None], False), None, ), # 1 - (2, TType.LIST, 'derivatives', (TType.STRUCT, [Unknown, None], False), None, ), # 2 - (3, TType.LIST, 'initial_unknowns', (TType.STRUCT, [Unknown, None], False), None, ), # 3 -) -all_structs.append(DefaultExperiment) -DefaultExperiment.thrift_spec = ( - None, # 0 - (1, TType.DOUBLE, 'startTime', None, None, ), # 1 - (2, TType.DOUBLE, 'stopTime', None, None, ), # 2 - (3, TType.DOUBLE, 'tolerance', None, None, ), # 3 - (4, TType.DOUBLE, 'stepSize', None, None, ), # 4 -) -all_structs.append(StepResult) -StepResult.thrift_spec = ( - None, # 0 - (1, TType.I32, 'status', None, None, ), # 1 - (2, TType.DOUBLE, 'simulation_time', None, None, ), # 2 -) -all_structs.append(IntegerRead) -IntegerRead.thrift_spec = ( - None, # 0 - (1, TType.LIST, 'value', (TType.I32, None, False), None, ), # 1 - (2, TType.I32, 'status', None, None, ), # 2 -) -all_structs.append(RealRead) -RealRead.thrift_spec = ( - None, # 0 - (1, TType.LIST, 'value', (TType.DOUBLE, None, False), None, ), # 1 - (2, TType.I32, 'status', None, None, ), # 2 -) -all_structs.append(StringRead) -StringRead.thrift_spec = ( - None, # 0 - (1, TType.LIST, 'value', (TType.STRING, 'UTF8', False), None, ), # 1 - (2, TType.I32, 'status', None, None, ), # 2 -) -all_structs.append(BooleanRead) -BooleanRead.thrift_spec = ( - None, # 0 - (1, TType.LIST, 'value', (TType.BOOL, None, False), None, ), # 1 - (2, TType.I32, 'status', None, None, ), # 2 -) -all_structs.append(ModelDescription) -ModelDescription.thrift_spec = ( - None, # 0 - (1, TType.STRING, 'guid', 'UTF8', None, ), # 1 - (2, TType.STRING, 'fmi_version', 'UTF8', None, ), # 2 - (3, TType.STRING, 'modelName', 'UTF8', None, ), # 3 - (4, TType.STRING, 'license', 'UTF8', None, ), # 4 - (5, TType.STRING, 'copyright', 'UTF8', None, ), # 5 - (6, TType.STRING, 'author', 'UTF8', None, ), # 6 - (7, TType.STRING, 'version', 'UTF8', None, ), # 7 - (8, TType.STRING, 'description', 'UTF8', None, ), # 8 - (9, TType.STRING, 'generation_tool', 'UTF8', None, ), # 9 - (10, TType.STRING, 'generation_date_and_time', 'UTF8', None, ), # 10 - (11, TType.STRUCT, 'default_experiment', [DefaultExperiment, None], None, ), # 11 - (12, TType.STRING, 'variable_naming_convention', 'UTF8', None, ), # 12 - (13, TType.LIST, 'model_variables', (TType.STRUCT, [ScalarVariable, None], False), None, ), # 13 - (14, TType.STRUCT, 'model_structure', [ModelStructure, None], None, ), # 14 - (15, TType.STRING, 'model_identifier', 'UTF8', None, ), # 15 - (16, TType.BOOL, 'can_get_and_set_fmu_state', None, None, ), # 16 - (17, TType.BOOL, 'can_serialize_fmu_state', None, None, ), # 17 - (18, TType.BOOL, 'provides_directional_derivative', None, None, ), # 18 - (19, TType.BOOL, 'can_handle_variable_communication_step_size', None, None, ), # 19 - (20, TType.BOOL, 'can_interpolate_inputs', None, None, ), # 20 - (21, TType.I32, 'max_output_derivative_order', None, None, ), # 21 -) -all_structs.append(NoSuchFmuException) -NoSuchFmuException.thrift_spec = ( - None, # 0 - (1, TType.STRING, 'message', 'UTF8', None, ), # 1 -) -all_structs.append(NoSuchInstanceException) -NoSuchInstanceException.thrift_spec = ( - None, # 0 - (1, TType.STRING, 'message', 'UTF8', None, ), # 1 -) -all_structs.append(NoSuchVariableException) -NoSuchVariableException.thrift_spec = ( - None, # 0 - (1, TType.STRING, 'message', 'UTF8', None, ), # 1 -) -all_structs.append(UnsupportedOperationException) -UnsupportedOperationException.thrift_spec = ( - None, # 0 - (1, TType.STRING, 'message', 'UTF8', None, ), # 1 -) -all_structs.append(DirectionalDerivativeResult) -DirectionalDerivativeResult.thrift_spec = ( - None, # 0 - (1, TType.LIST, 'dv_unknown_ref', (TType.DOUBLE, None, False), None, ), # 1 - (2, TType.I32, 'status', None, None, ), # 2 -) -fix_spec(all_structs) -del all_structs diff --git a/client-demos/python/thrift-client/test/test.py b/client-demos/python/thrift-client/test/test.py deleted file mode 100644 index ea0d36b6..00000000 --- a/client-demos/python/thrift-client/test/test.py +++ /dev/null @@ -1,36 +0,0 @@ -import time -from service.ttypes import * -from client import RemoteFmu - -if __name__ == '__main__': - - client = RemoteFmu("{06c2700b-b39c-4895-9151-304ddde28443}", "localhost", 9090) - - stop = 0.1 - step_size = 1E-4 - - slave = client.create_instance() - - variable_name = 'Temperature_Room' - reader = slave.get_reader(variable_name) - - slave.setup_experiment() - slave.enter_initialization_mode() - slave.exit_initialization_mode() - - start = time.time() - - while slave.simulation_time < (stop - step_size): - status = slave.step(step_size) - if status != 0: - print("Error: t={}, FMU returned status {}".format(slave.simulation_time, status)) - break - print("t={}, {}={}".format(slave.simulation_time, variable_name, reader.read_real().value[0])) - - end = time.time() - - print("Elapsed={}s".format(end - start)) - - status = slave.terminate() - print("FMU '{}' terminated with status: {}".format(client.model_description.modelName, Status._VALUES_TO_NAMES[status])) - slave.freeInstance() diff --git a/test/start_proxy.sh b/test/start_proxy.sh deleted file mode 100755 index 014fae52..00000000 --- a/test/start_proxy.sh +++ /dev/null @@ -1,2 +0,0 @@ -cd .. -./gradlew :fmu-proxy-server:run --args="-tcp 9090 -http 9091 test/fmus/2.0/cs/20sim/4.6.4.8004/ControlledTemperature/ControlledTemperature.fmu"