public void Write(TProtocol oprot)
 {
     oprot.IncrementRecursionDepth();
     try
     {
         TStruct struc = new TStruct("TDDIHazard");
         oprot.WriteStructBegin(struc);
         TField field = new TField();
         if (__isset.Id)
         {
             field.Name = "Id";
             field.Type = TType.I64;
             field.ID   = 1;
             oprot.WriteFieldBegin(field);
             oprot.WriteI64(Id);
             oprot.WriteFieldEnd();
         }
         if (Name != null && __isset.Name)
         {
             field.Name = "Name";
             field.Type = TType.String;
             field.ID   = 2;
             oprot.WriteFieldBegin(field);
             oprot.WriteString(Name);
             oprot.WriteFieldEnd();
         }
         if (Description != null && __isset.Description)
         {
             field.Name = "Description";
             field.Type = TType.String;
             field.ID   = 3;
             oprot.WriteFieldBegin(field);
             oprot.WriteString(Description);
             oprot.WriteFieldEnd();
         }
         if (KeyValueMaps != null && __isset.KeyValueMaps)
         {
             field.Name = "KeyValueMaps";
             field.Type = TType.List;
             field.ID   = 4;
             oprot.WriteFieldBegin(field);
             {
                 oprot.WriteListBegin(new TList(TType.Struct, KeyValueMaps.Count));
                 foreach (TDDIKeyValueMap _iter553 in KeyValueMaps)
                 {
                     _iter553.Write(oprot);
                 }
                 oprot.WriteListEnd();
             }
             oprot.WriteFieldEnd();
         }
         if (Condition != null && __isset.Condition)
         {
             field.Name = "Condition";
             field.Type = TType.String;
             field.ID   = 5;
             oprot.WriteFieldBegin(field);
             oprot.WriteString(Condition);
             oprot.WriteFieldEnd();
         }
         if (HazardType != null && __isset.HazardType)
         {
             field.Name = "HazardType";
             field.Type = TType.Struct;
             field.ID   = 6;
             oprot.WriteFieldBegin(field);
             HazardType.Write(oprot);
             oprot.WriteFieldEnd();
         }
         if (Measures != null && __isset.Measures)
         {
             field.Name = "Measures";
             field.Type = TType.List;
             field.ID   = 7;
             oprot.WriteFieldBegin(field);
             {
                 oprot.WriteListBegin(new TList(TType.Struct, Measures.Count));
                 foreach (TDDIAbstractMeasureRef _iter554 in Measures)
                 {
                     _iter554.Write(oprot);
                 }
                 oprot.WriteListEnd();
             }
             oprot.WriteFieldEnd();
         }
         if (Failures != null && __isset.Failures)
         {
             field.Name = "Failures";
             field.Type = TType.List;
             field.ID   = 8;
             oprot.WriteFieldBegin(field);
             {
                 oprot.WriteListBegin(new TList(TType.Struct, Failures.Count));
                 foreach (TDDIAbstractFailureRef _iter555 in Failures)
                 {
                     _iter555.Write(oprot);
                 }
                 oprot.WriteListEnd();
             }
             oprot.WriteFieldEnd();
         }
         oprot.WriteFieldStop();
         oprot.WriteStructEnd();
     }
     finally
     {
         oprot.DecrementRecursionDepth();
     }
 }
 public void Write(TProtocol oprot) {
   oprot.IncrementRecursionDepth();
   try
   {
     TStruct struc = new TStruct("TDDIHARAArtifactUnion");
     oprot.WriteStructBegin(struc);
     TField field = new TField();
     if (HARAPackage != null && __isset.HARAPackage) {
       field.Name = "HARAPackage";
       field.Type = TType.Struct;
       field.ID = 1;
       oprot.WriteFieldBegin(field);
       HARAPackage.Write(oprot);
       oprot.WriteFieldEnd();
     }
     if (HazardTypeSystem != null && __isset.HazardTypeSystem) {
       field.Name = "HazardTypeSystem";
       field.Type = TType.Struct;
       field.ID = 2;
       oprot.WriteFieldBegin(field);
       HazardTypeSystem.Write(oprot);
       oprot.WriteFieldEnd();
     }
     if (RiskParameter != null && __isset.RiskParameter) {
       field.Name = "RiskParameter";
       field.Type = TType.Struct;
       field.ID = 3;
       oprot.WriteFieldBegin(field);
       RiskParameter.Write(oprot);
       oprot.WriteFieldEnd();
     }
     if (RiskAssessment != null && __isset.RiskAssessment) {
       field.Name = "RiskAssessment";
       field.Type = TType.Struct;
       field.ID = 4;
       oprot.WriteFieldBegin(field);
       RiskAssessment.Write(oprot);
       oprot.WriteFieldEnd();
     }
     if (HazardType != null && __isset.HazardType) {
       field.Name = "HazardType";
       field.Type = TType.Struct;
       field.ID = 5;
       oprot.WriteFieldBegin(field);
       HazardType.Write(oprot);
       oprot.WriteFieldEnd();
     }
     if (MalFunction != null && __isset.MalFunction) {
       field.Name = "MalFunction";
       field.Type = TType.Struct;
       field.ID = 6;
       oprot.WriteFieldBegin(field);
       MalFunction.Write(oprot);
       oprot.WriteFieldEnd();
     }
     if (Hazard != null && __isset.Hazard) {
       field.Name = "Hazard";
       field.Type = TType.Struct;
       field.ID = 7;
       oprot.WriteFieldBegin(field);
       Hazard.Write(oprot);
       oprot.WriteFieldEnd();
     }
     oprot.WriteFieldStop();
     oprot.WriteStructEnd();
   }
   finally
   {
     oprot.DecrementRecursionDepth();
   }
 }
 public void Write(TProtocol oprot)
 {
     oprot.IncrementRecursionDepth();
     try
     {
         TStruct struc = new TStruct("TDDIHazard");
         oprot.WriteStructBegin(struc);
         TField field = new TField();
         if (__isset.Id)
         {
             field.Name = "Id";
             field.Type = TType.I64;
             field.ID   = 1;
             oprot.WriteFieldBegin(field);
             oprot.WriteI64(Id);
             oprot.WriteFieldEnd();
         }
         if (Name != null && __isset.Name)
         {
             field.Name = "Name";
             field.Type = TType.String;
             field.ID   = 2;
             oprot.WriteFieldBegin(field);
             oprot.WriteString(Name);
             oprot.WriteFieldEnd();
         }
         if (Description != null && __isset.Description)
         {
             field.Name = "Description";
             field.Type = TType.String;
             field.ID   = 3;
             oprot.WriteFieldBegin(field);
             oprot.WriteString(Description);
             oprot.WriteFieldEnd();
         }
         if (__isset.IsCitation)
         {
             field.Name = "IsCitation";
             field.Type = TType.Bool;
             field.ID   = 4;
             oprot.WriteFieldBegin(field);
             oprot.WriteBool(IsCitation);
             oprot.WriteFieldEnd();
         }
         if (__isset.IsAbstract)
         {
             field.Name = "IsAbstract";
             field.Type = TType.Bool;
             field.ID   = 5;
             oprot.WriteFieldBegin(field);
             oprot.WriteBool(IsAbstract);
             oprot.WriteFieldEnd();
         }
         if (KeyValueMaps != null && __isset.KeyValueMaps)
         {
             field.Name = "KeyValueMaps";
             field.Type = TType.List;
             field.ID   = 6;
             oprot.WriteFieldBegin(field);
             {
                 oprot.WriteListBegin(new TList(TType.Struct, KeyValueMaps.Count));
                 foreach (TDDIKeyValueMapRef _iter690 in KeyValueMaps)
                 {
                     _iter690.Write(oprot);
                 }
                 oprot.WriteListEnd();
             }
             oprot.WriteFieldEnd();
         }
         if (CitedElement != null && __isset.CitedElement)
         {
             field.Name = "CitedElement";
             field.Type = TType.Struct;
             field.ID   = 7;
             oprot.WriteFieldBegin(field);
             CitedElement.Write(oprot);
             oprot.WriteFieldEnd();
         }
         if (Condition != null && __isset.Condition)
         {
             field.Name = "Condition";
             field.Type = TType.String;
             field.ID   = 8;
             oprot.WriteFieldBegin(field);
             oprot.WriteString(Condition);
             oprot.WriteFieldEnd();
         }
         if (HazardType != null && __isset.HazardType)
         {
             field.Name = "HazardType";
             field.Type = TType.Struct;
             field.ID   = 9;
             oprot.WriteFieldBegin(field);
             HazardType.Write(oprot);
             oprot.WriteFieldEnd();
         }
         if (Measures != null && __isset.Measures)
         {
             field.Name = "Measures";
             field.Type = TType.List;
             field.ID   = 10;
             oprot.WriteFieldBegin(field);
             {
                 oprot.WriteListBegin(new TList(TType.Struct, Measures.Count));
                 foreach (TDDIAbstractMeasureRef _iter691 in Measures)
                 {
                     _iter691.Write(oprot);
                 }
                 oprot.WriteListEnd();
             }
             oprot.WriteFieldEnd();
         }
         if (OutputFailure != null && __isset.OutputFailure)
         {
             field.Name = "OutputFailure";
             field.Type = TType.Struct;
             field.ID   = 11;
             oprot.WriteFieldBegin(field);
             OutputFailure.Write(oprot);
             oprot.WriteFieldEnd();
         }
         oprot.WriteFieldStop();
         oprot.WriteStructEnd();
     }
     finally
     {
         oprot.DecrementRecursionDepth();
     }
 }