IncrementPreSerializationCountersRecursively() public method

public IncrementPreSerializationCountersRecursively ( ) : void
return void
Ejemplo n.º 1
0
 public virtual void IncrementPreSerializationCountersRecursively()
 {
     ++m_nGM1CounterPreSerialization;
     if (m_cbroot_1 != null)
     {
         m_cbroot_1.IncrementPreSerializationCountersRecursively();
     }
     if (m_cbroot_2 != null)
     {
         m_cbroot_2.IncrementPreSerializationCountersRecursively();
     }
     if (m_cbrootb1 != null)
     {
         m_cbrootb1.IncrementPreSerializationCountersRecursively();
     }
     if (m_cbrootb2 != null)
     {
         m_cbrootb2.IncrementPreSerializationCountersRecursively();
     }
     if (m_cbrootc1 != null)
     {
         m_cbrootc1.IncrementPreSerializationCountersRecursively();
     }
     if (m_cbrootc2 != null)
     {
         m_cbrootc2.IncrementPreSerializationCountersRecursively();
     }
 }
Ejemplo n.º 2
0
  public virtual bool M10_TwoRefsToOneObj()
  {
 	Console.WriteLine( "** "+ s_strTFAbbrev +" method: TwoRefsToOneObj()" );
 	Int32 nCntErrorsOrig = iCountErrors;
 	BinaryFormatter pmlformt2;
 	String strPreSerial;
 	String strPostDeserial;
 	ArrayList arlistPreSerial = new ArrayList();
 	ArrayList arlistPostDeserial = new ArrayList();
 	IEnumerator enumer2;
 	IEnumerator enumer3;
 	MemoryStream memstm3 = new MemoryStream( 16 );
 	Int32 nEqualPreSer = -2;
 	Int32 nEqualPostDeser = -3;
 	Int32[] nArrCountsPreSer = new Int32[98];
 	Int32[] nArrCountsPostDeser = new Int32[98];
 	Int32 nCurrSlot2 = -2;
 	Int32 nW = -3;
 	Object objDeserialized;
 	Co1011_root cbrootPreSer;
 	Co1011_root cbrootb1;
 	Co1011_root cbrootc1;
 	Co1011_root cbrootPostDeser;
   try
   {
   do
   {
 	o_strLoc="Loc_1010bik";
 	cbrootPreSer = new Co1011_root();
 	cbrootb1 = new Co1011_root();
 	cbrootc1 = new Co1011_root();
 	cbrootPreSer.m_cbrootb1 = cbrootb1;
 	cbrootPreSer.m_cbrootc1 = cbrootc1;
 	cbrootb1.m_cbrootc1 = cbrootc1;
 	o_strLoc="Loc_1020bik"; if(DBGLEV>=2){Console.WriteLine(o_strLoc);}
 	cbrootPreSer.IncrementPreSerializationCountersRecursively();
 	o_strLoc="Loc_1030bik"; if(DBGLEV>=2){Console.WriteLine(o_strLoc);}
 	arlistPreSerial.Add( (Object)cbrootPreSer );
 	arlistPreSerial.Add( (Object)cbrootPreSer.m_cbrootb1 );
 	arlistPreSerial.Add( (Object)cbrootPreSer.m_cbrootc1 );
 	arlistPreSerial.Add( (Object)cbrootPreSer.m_cbrootb1.m_cbrootc1 );
 	o_strLoc="Loc_1040bik"; if(DBGLEV>=2){Console.WriteLine(o_strLoc);}
 	strPreSerial = cbrootPreSer.GM1SerizalizeToStringRecursively( true );
 	o_strLoc="Loc_1050bik"; if(DBGLEV>=2){Console.WriteLine(o_strLoc);}
 	pmlformt2 = new BinaryFormatter();
 	o_strLoc="Loc_1060bik"; if(DBGLEV>=2){Console.WriteLine(o_strLoc);}
 	pmlformt2.Serialize  
 			(
 			 memstm3
 			,cbrootPreSer
 			,(
 				  null
 			 )
 			);
 	o_strLoc="Loc_1070bik"; if(DBGLEV>=2){Console.WriteLine(o_strLoc);}
 	memstm3.Position = 0;  
 	objDeserialized = pmlformt2.Deserialize(memstm3);  
 	cbrootPostDeser = ( Co1011_root )objDeserialized;
 	o_strLoc="Loc_1080bik"; if(DBGLEV>=2){Console.WriteLine(o_strLoc);}
 	o_strLoc="Loc_1090bik"; if(DBGLEV>=2){Console.WriteLine(o_strLoc);}
 	cbrootPostDeser.IncrementPostDeserializationCountersRecursively();
 	o_strLoc="Loc_1100bik"; if(DBGLEV>=2){Console.WriteLine(o_strLoc);}
 	arlistPostDeserial.Add( (Object)cbrootPostDeser );
 	arlistPostDeserial.Add( (Object)cbrootPostDeser.m_cbrootb1 );
 	arlistPostDeserial.Add( (Object)cbrootPostDeser.m_cbrootc1 );
 	arlistPostDeserial.Add( (Object)cbrootPostDeser.m_cbrootb1.m_cbrootc1 );
 	o_strLoc="Loc_1110bik"; if(DBGLEV>=2){Console.WriteLine(o_strLoc);}
 	strPostDeserial = cbrootPostDeser.GM1SerizalizeToStringRecursively( true );
 	o_strLoc="Loc_1120bik"; if(DBGLEV>=2){Console.WriteLine(o_strLoc);}
 	o_strBaseLoc = o_strLoc + "_"; o_nBaseLocCount=0;
 	nEqualPreSer = 0;
 	enumer2 = arlistPreSerial.GetEnumerator();
 	while ( enumer2.MoveNext() == true )
 	{
 		o_strLoc=o_strBaseLoc+((o_nBaseLocCount++).ToString());
 		enumer3 = arlistPreSerial.GetEnumerator();
 		while ( enumer3.MoveNext() == true )
 		{
 			o_strLoc=o_strBaseLoc+((o_nBaseLocCount++).ToString());
 			if ( enumer2.Current == enumer3.Current )  
 			{
 				++nEqualPreSer;
 			}
 		}
 	}
 	o_strLoc="Loc_1130bik"; if(DBGLEV>=2){Console.WriteLine(o_strLoc);}
 	o_strBaseLoc = o_strLoc + "_"; o_nBaseLocCount=0;
 	nEqualPostDeser = 0;
 	enumer2 = arlistPostDeserial.GetEnumerator();
 	while ( enumer2.MoveNext() == true )
 	{
 		o_strLoc=o_strBaseLoc+((o_nBaseLocCount++).ToString());
 		enumer3 = arlistPostDeserial.GetEnumerator();
 		while ( enumer3.MoveNext() == true )
 		{
 			o_strLoc=o_strBaseLoc+((o_nBaseLocCount++).ToString());
 			if ( enumer2.Current == enumer3.Current )  
 			{
 				++nEqualPostDeser;
 			}
 		}
 	}
 	o_strLoc="Loc_1140bik"; if(DBGLEV>=2){Console.WriteLine(o_strLoc);}
 	++iCountTestcases;
 	if ( nEqualPreSer != nEqualPostDeser )  
 	{
 		++iCountErrors;
 		Console.WriteLine( "Error_1012zeg ("+ s_strTFAbbrev +")!  nEqualPreSer="+ nEqualPreSer +" ,nEqualPostDeser="+ nEqualPostDeser );
 	}
 	o_strLoc="Loc_1150bik"; if(DBGLEV>=2){Console.WriteLine(o_strLoc);}
 	++iCountTestcases;
 	if ( strPreSerial.Equals( strPostDeserial ) != true )  
 	{
 		++iCountErrors;
 		Console.WriteLine();
 		Console.WriteLine( "Error_1033wsx ("+ s_strTFAbbrev +")!" );
 		Console.WriteLine( "   strPreSerial   ="+ strPreSerial );
 		Console.WriteLine( "   strPostDeserial="+ strPostDeserial );
 		Console.WriteLine();
 	}
 	o_strLoc="Loc_1160bik"; if(DBGLEV>=2){Console.WriteLine(o_strLoc);}
 	nArrCountsPreSer = new Int32[98];
 	nCurrSlot2 = 0;
 	cbrootPostDeser.PopulateArrayWithPreSerCountersRecursively( nArrCountsPreSer ,nCurrSlot2 );
 	o_strLoc="Loc_1161bik"; if(DBGLEV>=2){Console.WriteLine(o_strLoc);}
 	nArrCountsPostDeser = new Int32[98];
 	nW = nCurrSlot2;
 	nCurrSlot2 = 0;
 	cbrootPostDeser.PopulateArrayWithPostDeserCountersRecursively( nArrCountsPostDeser ,nCurrSlot2 );
 	++iCountTestcases;
 	if ( nW != nCurrSlot2 )
 	{
 		Console.WriteLine( "Error_1068bik ("+ s_strTFAbbrev +")!  Slots_PreSer="+ nW +" ,Slots_PostDeser="+ nCurrSlot2 );
 	}
 	o_strLoc="Loc_1170bik"; if(DBGLEV>=2){Console.WriteLine(o_strLoc);}
 	o_strBaseLoc = o_strLoc + "_"; o_nBaseLocCount=0;
 	for (
 	       int qd=0
 	      ;    qd<nArrCountsPreSer.Length
 	       &&  qd<nArrCountsPostDeser.Length
 	       &&  qd<nCurrSlot2
 	       &&  nW == nCurrSlot2
 	      ;qd++
 	    )
 	{
 		o_strLoc=o_strBaseLoc+((qd).ToString());
 		++iCountTestcases;
 		if ( nArrCountsPreSer[qd] != nArrCountsPostDeser[qd] )
 		{
 			Console.WriteLine( "Error_1571bik ("+ s_strTFAbbrev +")!  qd="+ qd +" ,nArrCountsPreSer[qd]="+ nArrCountsPreSer[qd] +" ,nArrCountsPostDeser[qd]="+ nArrCountsPostDeser[qd] );
 		}
 	}
   } while ( false );
   }
   catch( Exception exc_general )
   {
 	++iCountErrors;
 	Console.WriteLine( "Error Err_8888bik ("+ s_strTFAbbrev +")!  Unexpected exception thrown sometime after o_strLoc=="+ o_strLoc +" ,exc_general=="+ exc_general );
   }
 	if ( ( iCountErrors - nCntErrorsOrig ) == 0 )
 	{
 		return true;
 	}
 	else
 	{
 		return false;
 	}
  }
Ejemplo n.º 3
0
    public virtual bool M10_TwoRefsToOneObj()
    {
        Console.WriteLine("** " + s_strTFAbbrev + " method: TwoRefsToOneObj()");
        Int32           nCntErrorsOrig = iCountErrors;
        BinaryFormatter pmlformt2;
        String          strPreSerial;
        String          strPostDeserial;
        ArrayList       arlistPreSerial    = new ArrayList();
        ArrayList       arlistPostDeserial = new ArrayList();
        IEnumerator     enumer2;
        IEnumerator     enumer3;
        MemoryStream    memstm3         = new MemoryStream(16);
        Int32           nEqualPreSer    = -2;
        Int32           nEqualPostDeser = -3;

        Int32[]     nArrCountsPreSer    = new Int32[98];
        Int32[]     nArrCountsPostDeser = new Int32[98];
        Int32       nCurrSlot2          = -2;
        Int32       nW = -3;
        Object      objDeserialized;
        Co1011_root cbrootPreSer;
        Co1011_root cbrootb1;
        Co1011_root cbrootc1;
        Co1011_root cbrootPostDeser;

        try
        {
            do
            {
                o_strLoc                = "Loc_1010bik";
                cbrootPreSer            = new Co1011_root();
                cbrootb1                = new Co1011_root();
                cbrootc1                = new Co1011_root();
                cbrootPreSer.m_cbrootb1 = cbrootb1;
                cbrootPreSer.m_cbrootc1 = cbrootc1;
                cbrootb1.m_cbrootc1     = cbrootc1;
                o_strLoc                = "Loc_1020bik"; if (DBGLEV >= 2)
                {
                    Console.WriteLine(o_strLoc);
                }
                cbrootPreSer.IncrementPreSerializationCountersRecursively();
                o_strLoc = "Loc_1030bik"; if (DBGLEV >= 2)
                {
                    Console.WriteLine(o_strLoc);
                }
                arlistPreSerial.Add((Object)cbrootPreSer);
                arlistPreSerial.Add((Object)cbrootPreSer.m_cbrootb1);
                arlistPreSerial.Add((Object)cbrootPreSer.m_cbrootc1);
                arlistPreSerial.Add((Object)cbrootPreSer.m_cbrootb1.m_cbrootc1);
                o_strLoc = "Loc_1040bik"; if (DBGLEV >= 2)
                {
                    Console.WriteLine(o_strLoc);
                }
                strPreSerial = cbrootPreSer.GM1SerizalizeToStringRecursively(true);
                o_strLoc     = "Loc_1050bik"; if (DBGLEV >= 2)
                {
                    Console.WriteLine(o_strLoc);
                }
                pmlformt2 = new BinaryFormatter();
                o_strLoc  = "Loc_1060bik"; if (DBGLEV >= 2)
                {
                    Console.WriteLine(o_strLoc);
                }
                pmlformt2.Serialize
                (
                    memstm3
                    , cbrootPreSer
                    , (
                        null
                        )
                );
                o_strLoc = "Loc_1070bik"; if (DBGLEV >= 2)
                {
                    Console.WriteLine(o_strLoc);
                }
                memstm3.Position = 0;
                objDeserialized  = pmlformt2.Deserialize(memstm3);
                cbrootPostDeser  = ( Co1011_root )objDeserialized;
                o_strLoc         = "Loc_1080bik"; if (DBGLEV >= 2)
                {
                    Console.WriteLine(o_strLoc);
                }
                o_strLoc = "Loc_1090bik"; if (DBGLEV >= 2)
                {
                    Console.WriteLine(o_strLoc);
                }
                cbrootPostDeser.IncrementPostDeserializationCountersRecursively();
                o_strLoc = "Loc_1100bik"; if (DBGLEV >= 2)
                {
                    Console.WriteLine(o_strLoc);
                }
                arlistPostDeserial.Add((Object)cbrootPostDeser);
                arlistPostDeserial.Add((Object)cbrootPostDeser.m_cbrootb1);
                arlistPostDeserial.Add((Object)cbrootPostDeser.m_cbrootc1);
                arlistPostDeserial.Add((Object)cbrootPostDeser.m_cbrootb1.m_cbrootc1);
                o_strLoc = "Loc_1110bik"; if (DBGLEV >= 2)
                {
                    Console.WriteLine(o_strLoc);
                }
                strPostDeserial = cbrootPostDeser.GM1SerizalizeToStringRecursively(true);
                o_strLoc        = "Loc_1120bik"; if (DBGLEV >= 2)
                {
                    Console.WriteLine(o_strLoc);
                }
                o_strBaseLoc = o_strLoc + "_"; o_nBaseLocCount = 0;
                nEqualPreSer = 0;
                enumer2      = arlistPreSerial.GetEnumerator();
                while (enumer2.MoveNext() == true)
                {
                    o_strLoc = o_strBaseLoc + ((o_nBaseLocCount++).ToString());
                    enumer3  = arlistPreSerial.GetEnumerator();
                    while (enumer3.MoveNext() == true)
                    {
                        o_strLoc = o_strBaseLoc + ((o_nBaseLocCount++).ToString());
                        if (enumer2.Current == enumer3.Current)
                        {
                            ++nEqualPreSer;
                        }
                    }
                }
                o_strLoc = "Loc_1130bik"; if (DBGLEV >= 2)
                {
                    Console.WriteLine(o_strLoc);
                }
                o_strBaseLoc    = o_strLoc + "_"; o_nBaseLocCount = 0;
                nEqualPostDeser = 0;
                enumer2         = arlistPostDeserial.GetEnumerator();
                while (enumer2.MoveNext() == true)
                {
                    o_strLoc = o_strBaseLoc + ((o_nBaseLocCount++).ToString());
                    enumer3  = arlistPostDeserial.GetEnumerator();
                    while (enumer3.MoveNext() == true)
                    {
                        o_strLoc = o_strBaseLoc + ((o_nBaseLocCount++).ToString());
                        if (enumer2.Current == enumer3.Current)
                        {
                            ++nEqualPostDeser;
                        }
                    }
                }
                o_strLoc = "Loc_1140bik"; if (DBGLEV >= 2)
                {
                    Console.WriteLine(o_strLoc);
                }
                ++iCountTestcases;
                if (nEqualPreSer != nEqualPostDeser)
                {
                    ++iCountErrors;
                    Console.WriteLine("Error_1012zeg (" + s_strTFAbbrev + ")!  nEqualPreSer=" + nEqualPreSer + " ,nEqualPostDeser=" + nEqualPostDeser);
                }
                o_strLoc = "Loc_1150bik"; if (DBGLEV >= 2)
                {
                    Console.WriteLine(o_strLoc);
                }
                ++iCountTestcases;
                if (strPreSerial.Equals(strPostDeserial) != true)
                {
                    ++iCountErrors;
                    Console.WriteLine();
                    Console.WriteLine("Error_1033wsx (" + s_strTFAbbrev + ")!");
                    Console.WriteLine("   strPreSerial   =" + strPreSerial);
                    Console.WriteLine("   strPostDeserial=" + strPostDeserial);
                    Console.WriteLine();
                }
                o_strLoc = "Loc_1160bik"; if (DBGLEV >= 2)
                {
                    Console.WriteLine(o_strLoc);
                }
                nArrCountsPreSer = new Int32[98];
                nCurrSlot2       = 0;
                cbrootPostDeser.PopulateArrayWithPreSerCountersRecursively(nArrCountsPreSer, nCurrSlot2);
                o_strLoc = "Loc_1161bik"; if (DBGLEV >= 2)
                {
                    Console.WriteLine(o_strLoc);
                }
                nArrCountsPostDeser = new Int32[98];
                nW         = nCurrSlot2;
                nCurrSlot2 = 0;
                cbrootPostDeser.PopulateArrayWithPostDeserCountersRecursively(nArrCountsPostDeser, nCurrSlot2);
                ++iCountTestcases;
                if (nW != nCurrSlot2)
                {
                    Console.WriteLine("Error_1068bik (" + s_strTFAbbrev + ")!  Slots_PreSer=" + nW + " ,Slots_PostDeser=" + nCurrSlot2);
                }
                o_strLoc = "Loc_1170bik"; if (DBGLEV >= 2)
                {
                    Console.WriteLine(o_strLoc);
                }
                o_strBaseLoc = o_strLoc + "_"; o_nBaseLocCount = 0;
                for (
                    int qd = 0
                    ; qd < nArrCountsPreSer.Length &&
                    qd < nArrCountsPostDeser.Length &&
                    qd < nCurrSlot2 &&
                    nW == nCurrSlot2
                    ; qd++
                    )
                {
                    o_strLoc = o_strBaseLoc + ((qd).ToString());
                    ++iCountTestcases;
                    if (nArrCountsPreSer[qd] != nArrCountsPostDeser[qd])
                    {
                        Console.WriteLine("Error_1571bik (" + s_strTFAbbrev + ")!  qd=" + qd + " ,nArrCountsPreSer[qd]=" + nArrCountsPreSer[qd] + " ,nArrCountsPostDeser[qd]=" + nArrCountsPostDeser[qd]);
                    }
                }
            } while (false);
        }
        catch (Exception exc_general)
        {
            ++iCountErrors;
            Console.WriteLine("Error Err_8888bik (" + s_strTFAbbrev + ")!  Unexpected exception thrown sometime after o_strLoc==" + o_strLoc + " ,exc_general==" + exc_general);
        }
        if ((iCountErrors - nCntErrorsOrig) == 0)
        {
            return(true);
        }
        else
        {
            return(false);
        }
    }