Go to the documentation of this file.00001 #include "CondCore/RegressionTest/interface/TestPayloadClass.h"
00002
00003 TestPayloadClass::TestPayloadClass(int payloadID) :
00004 primitives(payloadID),
00005 dataStructs(payloadID),
00006 inheritances(payloadID)
00007 {}
00008 TestPayloadClass::TestPayloadClass() {}
00009
00010 bool TestPayloadClass::DataToFile(std::string fname)
00011 {
00012 std::ofstream myfile;
00013 myfile.open (fname.c_str());
00014 myfile << "TestPayloadClass : "<<std::endl;
00015 myfile << "primitives.testInt : "<<std::endl;
00016 myfile<<primitives.testInt<<std::endl;
00017 myfile << "primitives.testLongInt : "<<std::endl;
00018 myfile <<primitives.testLongInt<<std::endl;
00019 myfile << "primitives.testDouble : "<<std::endl;
00020 myfile <<primitives.testDouble<<std::endl;
00021
00022
00023
00024
00025
00026
00027
00028 myfile << "primitives.testTypedef : "<<std::endl;
00029 myfile <<primitives.testTypedef<<std::endl;
00030 myfile << "primitives.testString : "<<std::endl;
00031 myfile <<primitives.testString<<std::endl;
00032 myfile << "dataStructs.testStringVector : "<<std::endl;
00033 for(int i=0; i<VSIZE; i++)
00034 {
00035 myfile << "dataStructs.testStringVector["<<i<<"] :"<<std::endl;
00036 myfile <<dataStructs.testStringVector[i]<<std::endl;
00037 }
00038 myfile << "dataStructs.testIntVector : "<<std::endl;
00039 for(int i=0; i<SVSIZE; i++)
00040 {
00041 myfile << "dataStructs.testIntVector["<<i<<"] :"<<std::endl;
00042 myfile <<dataStructs.testIntVector[i]<<std::endl;
00043 }
00044 myfile << "inheritances.testData : "<<std::endl;
00045 myfile << "inheritances.testData.commonInt : "<<std::endl;
00046 myfile <<inheritances.testData.commonInt<<std::endl;
00047 myfile << "inheritances.testData.commonIntVector2d : "<<std::endl;
00048 for(int i=0; i<VSIZE; i++)
00049 for(int j =0; j<VSIZE; j++)
00050 {
00051 myfile << "inheritances.testdata.commonIntVector2d["<<i<<"]["<<j<<"] : "<<std::endl;
00052 myfile <<inheritances.testData.commonIntVector2d[i][j]<<std::endl;
00053 }
00054 myfile << "inheritances.testInheritance : "<<std::endl;
00055 myfile << "inheritances.testInheritance.commonInt : "<<std::endl;
00056 myfile <<inheritances.testInheritance.commonInt<<std::endl;
00057 myfile << "testInheritance.commonIntVector2d : "<<std::endl;
00058 for(int i=0; i<VSIZE; i++)
00059 for(int j =0; j<VSIZE; j++)
00060 {
00061 myfile << "inheritances.testInheritance.commonIntVector2d["<<i<<"]["<<j<<"] : "<<std::endl;
00062 myfile <<inheritances.testInheritance.commonIntVector2d[i][j]<<std::endl;
00063 }
00064 myfile << "inheritances.testInheritance.dataStringVector : "<<std::endl;
00065 for(int i=0; i<VSIZE; i++)
00066 {
00067 myfile << "inheritances.testInheritance.dataStringVector["<<i<<"] :"<<std::endl;
00068 myfile <<inheritances.testInheritance.dataStringVector[i]<<std::endl;
00069 }
00070 myfile << "dataStructs.testTripletMap : "<<std::endl;
00071 for (std::map<std::string, std::vector<DataStructs::Color> >::iterator it = dataStructs.testTripletMap.begin(); it != dataStructs.testTripletMap.end(); ++it)
00072 for(unsigned int i=0; i<(*it).second.size(); i++)
00073 {
00074 myfile << "dataStructs.testTripletMap["<<(*it).first<<"] :"<<std::endl;
00075 myfile <<(*it).second[i].r<<std::endl;
00076 myfile <<(*it).second[i].g<<std::endl;
00077 myfile <<(*it).second[i].b<<std::endl;
00078 }
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088 myfile << "dataStructs.testStringList : "<<std::endl;
00089 for (std::list<std::string>::iterator it = dataStructs.testStringList.begin(); it != dataStructs.testStringList.end(); ++it)
00090 {
00091 myfile <<*it<<std::endl;
00092 }
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107 myfile<<"dataStructs.testPair :"<<std::endl;
00108 myfile<<dataStructs.testPair.first<<" "<<dataStructs.testPair.second<<std::endl;
00109
00110
00111
00112
00113
00114 myfile.close();
00115 return true;
00116 }
00117 bool TestPayloadClass::operator ==(const TestPayloadClass& ref) const
00118 {
00119 if(primitives != ref.primitives)
00120 {
00121 return false;
00122 }
00123 if(dataStructs != ref.dataStructs)
00124 {
00125 return false;
00126 }
00127 if(inheritances != ref.inheritances)
00128 {
00129 return false;
00130 }
00131 return true;
00132 }
00133
00134 bool TestPayloadClass::operator !=(const TestPayloadClass& ref) const
00135 {
00136 return !operator==(ref);
00137 }