CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_3/src/CondCore/RegressionTest/src/Inheritances.cc

Go to the documentation of this file.
00001 #include "CondCore/RegressionTest/interface/Inheritances.h"
00002 
00003 TestData::TestData (int payloadID): commonInt(payloadID), commonIntVector2d() 
00004 {
00005         for(int i =0; i<VSIZE; i++) 
00006         {
00007                 commonIntVector2d.push_back ( std::vector<int>() );
00008                 for(int j=0; j<VSIZE; j++) 
00009                 {
00010                         commonIntVector2d[i].push_back(payloadID); 
00011                 }
00012         }
00013 }
00014 TestData::TestData () {}
00015 bool TestData::operator ==(const TestData& ref) const
00016 {
00017         if(commonInt != ref.commonInt)
00018         {
00019                 std::cout<<commonInt<<std::endl;
00020                 return false;
00021         } 
00022         for(int i=0; i<VSIZE; i++)
00023                 for(int j=0; j<VSIZE; j++)
00024                 {
00025                         if(commonIntVector2d[i] != ref.commonIntVector2d[i])
00026                         {       
00027                                 return false;
00028                         }
00029                 }
00030         return true;
00031 }
00032 bool TestData::operator !=(const TestData& ref) const
00033 {
00034         return !operator==(ref);
00035 }
00036 
00037 
00038 
00039 TestInheritance::TestInheritance (int payloadID):
00040 TestData(),
00041 dataStringVector()
00042 {
00043         commonInt = payloadID;
00044         for(int i =0; i<VSIZE; i++)
00045         {
00046                 commonIntVector2d.push_back ( std::vector<int>() );
00047                 for(int j=0; j<VSIZE; j++)
00048                 {
00049                         commonIntVector2d[i].push_back(payloadID); 
00050                 }
00051         }
00052         for(int i=0; i<VSIZE; i++)
00053         {
00054                 std::stringstream st;
00055                 st << payloadID;
00056                 dataStringVector.push_back(st.str());
00057         }
00058 }
00059 TestInheritance::TestInheritance () {}
00060 bool TestInheritance::operator ==(const TestInheritance& ref) const
00061 {
00062         if(commonInt != ref.commonInt)
00063         {
00064                 return false;
00065         }
00066         for(int i=0; i<VSIZE; i++)
00067                 for(int j=0; j<VSIZE; j++)
00068                 {
00069                         if(commonIntVector2d[i][j] != ref.commonIntVector2d[i][j])
00070                         {
00071                                 return false;
00072                         }
00073                 }
00074         for(int i=0; i<VSIZE; i++)
00075         {
00076                 if(dataStringVector[i].compare(ref.dataStringVector[i]) != 0)
00077                 {
00078                         return false;
00079                 }
00080         }
00081         return true;
00082 }
00083 bool TestInheritance::operator !=(const TestInheritance& ref) const
00084 {
00085         return !operator==(ref);
00086 }
00087 
00088 Inheritances::Inheritances(int payloadID) :
00089         testData(payloadID),
00090         testInheritance(payloadID)
00091 {}
00092 Inheritances::Inheritances() {}
00093 
00094 bool Inheritances::operator ==(const Inheritances& ref) const
00095 {
00096         if(testData != ref.testData)
00097         {
00098                 return false;
00099         }
00100         if(testInheritance != ref.testInheritance)
00101         {
00102                 return false;
00103         }
00104         return true;
00105 }
00106 
00107 bool Inheritances::operator !=(const Inheritances& ref) const
00108 {
00109         return !operator==(ref);
00110 }