public void Write(TProtocol oprot)
 {
     oprot.IncrementRecursionDepth();
     try
     {
         TStruct struc = new TStruct("TDDIRiskParameterUnion");
         oprot.WriteStructBegin(struc);
         TField field = new TField();
         if (RiskParameter != null && __isset.RiskParameter)
         {
             field.Name = "RiskParameter";
             field.Type = TType.Struct;
             field.ID   = 1;
             oprot.WriteFieldBegin(field);
             RiskParameter.Write(oprot);
             oprot.WriteFieldEnd();
         }
         if (Situation != null && __isset.Situation)
         {
             field.Name = "Situation";
             field.Type = TType.Struct;
             field.ID   = 2;
             oprot.WriteFieldBegin(field);
             Situation.Write(oprot);
             oprot.WriteFieldEnd();
         }
         if (Accident != null && __isset.Accident)
         {
             field.Name = "Accident";
             field.Type = TType.Struct;
             field.ID   = 3;
             oprot.WriteFieldBegin(field);
             Accident.Write(oprot);
             oprot.WriteFieldEnd();
         }
         if (OperationMeasure != null && __isset.OperationMeasure)
         {
             field.Name = "OperationMeasure";
             field.Type = TType.Struct;
             field.ID   = 4;
             oprot.WriteFieldBegin(field);
             OperationMeasure.Write(oprot);
             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();
   }
 }