CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_5/src/CondFormats/Calibration/src/BlobComplex.cc

Go to the documentation of this file.
00001 #include <iostream>
00002 
00003 #include "CondFormats/Calibration/interface/BlobComplex.h"
00004 
00005 void BlobComplexData::fill(unsigned int &serial)
00006 {
00007   a = ++serial;
00008   b = ++serial;
00009   for(unsigned int i = 0; i < 10; i++)
00010     values.push_back(++serial);
00011 }
00012 
00013 void BlobComplexData::print() const
00014 {
00015   std::cout << "        a = " << a << std::endl;
00016   std::cout << "        b = " << b << std::endl;
00017   for(std::vector<unsigned int>::const_iterator iter = values.begin();
00018       iter != values.end(); iter++)
00019     std::cout << "        value[" << (iter - values.begin()) << "] = "
00020               << *iter << std::endl;
00021 }
00022 
00023 bool BlobComplexData::operator == (const BlobComplexData &rhs) const
00024 {
00025   if (a != rhs.a) return false;
00026   if (b != rhs.b) return false;
00027   if (values.size() != rhs.values.size()) return false;
00028   std::vector<unsigned int>::const_iterator iter1 = values.begin();
00029   std::vector<unsigned int>::const_iterator iter2 = rhs.values.begin();
00030   while(iter1 != values.end())
00031     if (*iter1++ != *iter2++) return false;
00032   return true;
00033 }
00034 
00035 void BlobComplexContent::fill(unsigned int &serial)
00036 {
00037   data1.first.fill(serial);
00038   data1.second = ++serial;
00039   data2.first.fill(serial);
00040   data2.second = ++serial;
00041   data3.first.fill(serial);
00042   data3.second = ++serial;
00043 }
00044 
00045 static void printBlobComplexContentData(const BlobComplexContent::Data &data)
00046 {
00047   std::cout << "      first = " << std::endl;
00048   data.first.print();
00049   std::cout << "      second = " << data.second << std::endl;
00050 }
00051 
00052 void BlobComplexContent::print() const
00053 {
00054   std::cout << "    data1 = " << std::endl;
00055   printBlobComplexContentData(data1);
00056   std::cout << "    data2 = " << std::endl;
00057   printBlobComplexContentData(data2);
00058   std::cout << "    data3 = " << std::endl;
00059   printBlobComplexContentData(data3);
00060 }
00061 
00062 bool BlobComplexContent::operator == (const BlobComplexContent &rhs) const
00063 {
00064   if (data1.first != rhs.data1.first ||
00065       data1.second != rhs.data1.second) return false;
00066   if (data2.first != rhs.data2.first ||
00067       data2.second != rhs.data2.second) return false;
00068   if (data3.first != rhs.data3.first ||
00069       data3.second != rhs.data3.second) return false;
00070   return true;
00071 }
00072 
00073 void BlobComplexObjects::fill(unsigned int &serial)
00074 {
00075   a = ++serial;
00076   b = ++serial;
00077   for(unsigned int i = 0; i < 3; i++) {
00078     content.push_back(BlobComplexContent());
00079     content.back().fill(serial);
00080   }
00081 }
00082 
00083 void BlobComplexObjects::print() const
00084 {
00085   std::cout << "  a = " << a << std::endl;
00086   std::cout << "  b = " << b << std::endl;
00087   for(std::vector<BlobComplexContent>::const_iterator iter = content.begin();
00088       iter != content.end(); iter++) {
00089     std::cout << "  content[" << (iter - content.begin()) << "] =" << std::endl;
00090     iter->print();
00091   }
00092 }
00093 
00094 bool BlobComplexObjects::operator == (const BlobComplexObjects &rhs) const
00095 {
00096   if (a != rhs.a) return false;
00097   if (b != rhs.b) return false;
00098   if (content.size() != rhs.content.size()) return false;
00099   std::vector<BlobComplexContent>::const_iterator iter1 = content.begin();
00100   std::vector<BlobComplexContent>::const_iterator iter2 = rhs.content.begin();
00101   while(iter1 != content.end())
00102     if (*iter1++ != *iter2++) return false;
00103   return true;
00104 }
00105 
00106 void BlobComplex::fill(unsigned int &serial)
00107 {
00108   for(unsigned int i = 0; i < 3; i++) {
00109     objects.push_back(BlobComplexObjects());
00110     objects.back().fill(serial);
00111   }
00112 }
00113 
00114 void BlobComplex::print() const
00115 {
00116   for(std::vector<BlobComplexObjects>::const_iterator iter = objects.begin();
00117       iter != objects.end(); iter++) {
00118     std::cout << "objects[" << (iter - objects.begin()) << "] =" << std::endl;
00119     iter->print();
00120   }
00121 }
00122 
00123 bool BlobComplex::operator == (const BlobComplex &rhs) const
00124 {
00125   if (objects.size() != rhs.objects.size()) return false;
00126   std::vector<BlobComplexObjects>::const_iterator iter1 = objects.begin();
00127   std::vector<BlobComplexObjects>::const_iterator iter2 = rhs.objects.begin();
00128   while(iter1 != objects.end())
00129     if (*iter1++ != *iter2++) return false;
00130   return true;
00131 }