2
0
mirror of https://github.com/esiur/esiur-dotnet.git synced 2026-06-13 14:38:43 +00:00
Files
esiur-dotnet/Tests/RPC/Client/Model/Thrift/Variant.cs
T
2026-06-08 16:15:57 +03:00

583 lines
16 KiB
C#

/**
* <auto-generated>
* Autogenerated by Thrift Compiler (0.19.0)
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* </auto-generated>
*/
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
using Thrift;
using Thrift.Collections;
using Thrift.Protocol;
using Thrift.Protocol.Entities;
using Thrift.Protocol.Utilities;
using Thrift.Transport;
using Thrift.Transport.Client;
using Thrift.Transport.Server;
using Thrift.Processor;
#pragma warning disable IDE0079 // remove unnecessary pragmas
#pragma warning disable IDE0017 // object init can be simplified
#pragma warning disable IDE0028 // collection init can be simplified
#pragma warning disable IDE1006 // parts of the code use IDL spelling
#pragma warning disable CA1822 // empty DeepCopy() methods still non-static
#pragma warning disable IDE0083 // pattern matching "that is not SomeType" requires net5.0 but we still support earlier versions
namespace Echo.ThriftModel
{
public partial class Variant : TBase
{
private global::Echo.ThriftModel.Kind _tag;
private bool _boolVal;
private long _i64Val;
private long _u64Val;
private double _f64Val;
private string _strVal;
private byte[] _bytesVal;
private long _dtVal;
private byte[] _guidVal;
/// <summary>
///
/// <seealso cref="global::Echo.ThriftModel.Kind"/>
/// </summary>
public global::Echo.ThriftModel.Kind Tag
{
get
{
return _tag;
}
set
{
__isset.@tag = true;
this._tag = value;
}
}
public bool BoolVal
{
get
{
return _boolVal;
}
set
{
__isset.boolVal = true;
this._boolVal = value;
}
}
public long I64Val
{
get
{
return _i64Val;
}
set
{
__isset.i64Val = true;
this._i64Val = value;
}
}
public long U64Val
{
get
{
return _u64Val;
}
set
{
__isset.u64Val = true;
this._u64Val = value;
}
}
public double F64Val
{
get
{
return _f64Val;
}
set
{
__isset.f64Val = true;
this._f64Val = value;
}
}
public string StrVal
{
get
{
return _strVal;
}
set
{
__isset.strVal = true;
this._strVal = value;
}
}
public byte[] BytesVal
{
get
{
return _bytesVal;
}
set
{
__isset.bytesVal = true;
this._bytesVal = value;
}
}
public long DtVal
{
get
{
return _dtVal;
}
set
{
__isset.dtVal = true;
this._dtVal = value;
}
}
public byte[] GuidVal
{
get
{
return _guidVal;
}
set
{
__isset.guidVal = true;
this._guidVal = value;
}
}
public Isset __isset;
public struct Isset
{
public bool @tag;
public bool boolVal;
public bool i64Val;
public bool u64Val;
public bool f64Val;
public bool strVal;
public bool bytesVal;
public bool dtVal;
public bool guidVal;
}
public Variant()
{
}
public Variant DeepCopy()
{
var tmp0 = new Variant();
if(__isset.@tag)
{
tmp0.Tag = this.Tag;
}
tmp0.__isset.@tag = this.__isset.@tag;
if(__isset.boolVal)
{
tmp0.BoolVal = this.BoolVal;
}
tmp0.__isset.boolVal = this.__isset.boolVal;
if(__isset.i64Val)
{
tmp0.I64Val = this.I64Val;
}
tmp0.__isset.i64Val = this.__isset.i64Val;
if(__isset.u64Val)
{
tmp0.U64Val = this.U64Val;
}
tmp0.__isset.u64Val = this.__isset.u64Val;
if(__isset.f64Val)
{
tmp0.F64Val = this.F64Val;
}
tmp0.__isset.f64Val = this.__isset.f64Val;
if((StrVal != null) && __isset.strVal)
{
tmp0.StrVal = this.StrVal;
}
tmp0.__isset.strVal = this.__isset.strVal;
if((BytesVal != null) && __isset.bytesVal)
{
tmp0.BytesVal = this.BytesVal.ToArray();
}
tmp0.__isset.bytesVal = this.__isset.bytesVal;
if(__isset.dtVal)
{
tmp0.DtVal = this.DtVal;
}
tmp0.__isset.dtVal = this.__isset.dtVal;
if((GuidVal != null) && __isset.guidVal)
{
tmp0.GuidVal = this.GuidVal.ToArray();
}
tmp0.__isset.guidVal = this.__isset.guidVal;
return tmp0;
}
public async global::System.Threading.Tasks.Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken)
{
iprot.IncrementRecursionDepth();
try
{
TField field;
await iprot.ReadStructBeginAsync(cancellationToken);
while (true)
{
field = await iprot.ReadFieldBeginAsync(cancellationToken);
if (field.Type == TType.Stop)
{
break;
}
switch (field.ID)
{
case 1:
if (field.Type == TType.I32)
{
Tag = (global::Echo.ThriftModel.Kind)await iprot.ReadI32Async(cancellationToken);
}
else
{
await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
}
break;
case 2:
if (field.Type == TType.Bool)
{
BoolVal = await iprot.ReadBoolAsync(cancellationToken);
}
else
{
await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
}
break;
case 3:
if (field.Type == TType.I64)
{
I64Val = await iprot.ReadI64Async(cancellationToken);
}
else
{
await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
}
break;
case 4:
if (field.Type == TType.I64)
{
U64Val = await iprot.ReadI64Async(cancellationToken);
}
else
{
await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
}
break;
case 5:
if (field.Type == TType.Double)
{
F64Val = await iprot.ReadDoubleAsync(cancellationToken);
}
else
{
await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
}
break;
case 6:
if (field.Type == TType.String)
{
StrVal = await iprot.ReadStringAsync(cancellationToken);
}
else
{
await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
}
break;
case 7:
if (field.Type == TType.String)
{
BytesVal = await iprot.ReadBinaryAsync(cancellationToken);
}
else
{
await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
}
break;
case 8:
if (field.Type == TType.I64)
{
DtVal = await iprot.ReadI64Async(cancellationToken);
}
else
{
await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
}
break;
case 9:
if (field.Type == TType.String)
{
GuidVal = await iprot.ReadBinaryAsync(cancellationToken);
}
else
{
await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
}
break;
default:
await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
break;
}
await iprot.ReadFieldEndAsync(cancellationToken);
}
await iprot.ReadStructEndAsync(cancellationToken);
}
finally
{
iprot.DecrementRecursionDepth();
}
}
public async global::System.Threading.Tasks.Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken)
{
oprot.IncrementRecursionDepth();
try
{
var tmp1 = new TStruct("Variant");
await oprot.WriteStructBeginAsync(tmp1, cancellationToken);
var tmp2 = new TField();
if(__isset.@tag)
{
tmp2.Name = "tag";
tmp2.Type = TType.I32;
tmp2.ID = 1;
await oprot.WriteFieldBeginAsync(tmp2, cancellationToken);
await oprot.WriteI32Async((int)Tag, cancellationToken);
await oprot.WriteFieldEndAsync(cancellationToken);
}
if(__isset.boolVal)
{
tmp2.Name = "boolVal";
tmp2.Type = TType.Bool;
tmp2.ID = 2;
await oprot.WriteFieldBeginAsync(tmp2, cancellationToken);
await oprot.WriteBoolAsync(BoolVal, cancellationToken);
await oprot.WriteFieldEndAsync(cancellationToken);
}
if(__isset.i64Val)
{
tmp2.Name = "i64Val";
tmp2.Type = TType.I64;
tmp2.ID = 3;
await oprot.WriteFieldBeginAsync(tmp2, cancellationToken);
await oprot.WriteI64Async(I64Val, cancellationToken);
await oprot.WriteFieldEndAsync(cancellationToken);
}
if(__isset.u64Val)
{
tmp2.Name = "u64Val";
tmp2.Type = TType.I64;
tmp2.ID = 4;
await oprot.WriteFieldBeginAsync(tmp2, cancellationToken);
await oprot.WriteI64Async(U64Val, cancellationToken);
await oprot.WriteFieldEndAsync(cancellationToken);
}
if(__isset.f64Val)
{
tmp2.Name = "f64Val";
tmp2.Type = TType.Double;
tmp2.ID = 5;
await oprot.WriteFieldBeginAsync(tmp2, cancellationToken);
await oprot.WriteDoubleAsync(F64Val, cancellationToken);
await oprot.WriteFieldEndAsync(cancellationToken);
}
if((StrVal != null) && __isset.strVal)
{
tmp2.Name = "strVal";
tmp2.Type = TType.String;
tmp2.ID = 6;
await oprot.WriteFieldBeginAsync(tmp2, cancellationToken);
await oprot.WriteStringAsync(StrVal, cancellationToken);
await oprot.WriteFieldEndAsync(cancellationToken);
}
if((BytesVal != null) && __isset.bytesVal)
{
tmp2.Name = "bytesVal";
tmp2.Type = TType.String;
tmp2.ID = 7;
await oprot.WriteFieldBeginAsync(tmp2, cancellationToken);
await oprot.WriteBinaryAsync(BytesVal, cancellationToken);
await oprot.WriteFieldEndAsync(cancellationToken);
}
if(__isset.dtVal)
{
tmp2.Name = "dtVal";
tmp2.Type = TType.I64;
tmp2.ID = 8;
await oprot.WriteFieldBeginAsync(tmp2, cancellationToken);
await oprot.WriteI64Async(DtVal, cancellationToken);
await oprot.WriteFieldEndAsync(cancellationToken);
}
if((GuidVal != null) && __isset.guidVal)
{
tmp2.Name = "guidVal";
tmp2.Type = TType.String;
tmp2.ID = 9;
await oprot.WriteFieldBeginAsync(tmp2, cancellationToken);
await oprot.WriteBinaryAsync(GuidVal, cancellationToken);
await oprot.WriteFieldEndAsync(cancellationToken);
}
await oprot.WriteFieldStopAsync(cancellationToken);
await oprot.WriteStructEndAsync(cancellationToken);
}
finally
{
oprot.DecrementRecursionDepth();
}
}
public override bool Equals(object that)
{
if (!(that is Variant other)) return false;
if (ReferenceEquals(this, other)) return true;
return ((__isset.@tag == other.__isset.@tag) && ((!__isset.@tag) || (global::System.Object.Equals(Tag, other.Tag))))
&& ((__isset.boolVal == other.__isset.boolVal) && ((!__isset.boolVal) || (global::System.Object.Equals(BoolVal, other.BoolVal))))
&& ((__isset.i64Val == other.__isset.i64Val) && ((!__isset.i64Val) || (global::System.Object.Equals(I64Val, other.I64Val))))
&& ((__isset.u64Val == other.__isset.u64Val) && ((!__isset.u64Val) || (global::System.Object.Equals(U64Val, other.U64Val))))
&& ((__isset.f64Val == other.__isset.f64Val) && ((!__isset.f64Val) || (global::System.Object.Equals(F64Val, other.F64Val))))
&& ((__isset.strVal == other.__isset.strVal) && ((!__isset.strVal) || (global::System.Object.Equals(StrVal, other.StrVal))))
&& ((__isset.bytesVal == other.__isset.bytesVal) && ((!__isset.bytesVal) || (TCollections.Equals(BytesVal, other.BytesVal))))
&& ((__isset.dtVal == other.__isset.dtVal) && ((!__isset.dtVal) || (global::System.Object.Equals(DtVal, other.DtVal))))
&& ((__isset.guidVal == other.__isset.guidVal) && ((!__isset.guidVal) || (TCollections.Equals(GuidVal, other.GuidVal))));
}
public override int GetHashCode() {
int hashcode = 157;
unchecked {
if(__isset.@tag)
{
hashcode = (hashcode * 397) + Tag.GetHashCode();
}
if(__isset.boolVal)
{
hashcode = (hashcode * 397) + BoolVal.GetHashCode();
}
if(__isset.i64Val)
{
hashcode = (hashcode * 397) + I64Val.GetHashCode();
}
if(__isset.u64Val)
{
hashcode = (hashcode * 397) + U64Val.GetHashCode();
}
if(__isset.f64Val)
{
hashcode = (hashcode * 397) + F64Val.GetHashCode();
}
if((StrVal != null) && __isset.strVal)
{
hashcode = (hashcode * 397) + StrVal.GetHashCode();
}
if((BytesVal != null) && __isset.bytesVal)
{
hashcode = (hashcode * 397) + BytesVal.GetHashCode();
}
if(__isset.dtVal)
{
hashcode = (hashcode * 397) + DtVal.GetHashCode();
}
if((GuidVal != null) && __isset.guidVal)
{
hashcode = (hashcode * 397) + GuidVal.GetHashCode();
}
}
return hashcode;
}
public override string ToString()
{
var tmp3 = new StringBuilder("Variant(");
int tmp4 = 0;
if(__isset.@tag)
{
if(0 < tmp4++) { tmp3.Append(", "); }
tmp3.Append("Tag: ");
Tag.ToString(tmp3);
}
if(__isset.boolVal)
{
if(0 < tmp4++) { tmp3.Append(", "); }
tmp3.Append("BoolVal: ");
BoolVal.ToString(tmp3);
}
if(__isset.i64Val)
{
if(0 < tmp4++) { tmp3.Append(", "); }
tmp3.Append("I64Val: ");
I64Val.ToString(tmp3);
}
if(__isset.u64Val)
{
if(0 < tmp4++) { tmp3.Append(", "); }
tmp3.Append("U64Val: ");
U64Val.ToString(tmp3);
}
if(__isset.f64Val)
{
if(0 < tmp4++) { tmp3.Append(", "); }
tmp3.Append("F64Val: ");
F64Val.ToString(tmp3);
}
if((StrVal != null) && __isset.strVal)
{
if(0 < tmp4++) { tmp3.Append(", "); }
tmp3.Append("StrVal: ");
StrVal.ToString(tmp3);
}
if((BytesVal != null) && __isset.bytesVal)
{
if(0 < tmp4++) { tmp3.Append(", "); }
tmp3.Append("BytesVal: ");
BytesVal.ToString(tmp3);
}
if(__isset.dtVal)
{
if(0 < tmp4++) { tmp3.Append(", "); }
tmp3.Append("DtVal: ");
DtVal.ToString(tmp3);
}
if((GuidVal != null) && __isset.guidVal)
{
if(0 < tmp4++) { tmp3.Append(", "); }
tmp3.Append("GuidVal: ");
GuidVal.ToString(tmp3);
}
tmp3.Append(')');
return tmp3.ToString();
}
}
}