Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:50:52

0001 #include <iostream>
0002 
0003 #include "CondFormats/Calibration/interface/BlobComplex.h"
0004 
0005 void BlobComplexData::fill(unsigned int &serial) {
0006   a = ++serial;
0007   b = ++serial;
0008   for (unsigned int i = 0; i < 10; i++)
0009     values.push_back(++serial);
0010 }
0011 
0012 void BlobComplexData::print() const {
0013   std::cout << "        a = " << a << std::endl;
0014   std::cout << "        b = " << b << std::endl;
0015   for (std::vector<unsigned int>::const_iterator iter = values.begin(); iter != values.end(); iter++)
0016     std::cout << "        value[" << (iter - values.begin()) << "] = " << *iter << std::endl;
0017 }
0018 
0019 bool BlobComplexData::operator==(const BlobComplexData &rhs) const {
0020   if (a != rhs.a)
0021     return false;
0022   if (b != rhs.b)
0023     return false;
0024   if (values.size() != rhs.values.size())
0025     return false;
0026   std::vector<unsigned int>::const_iterator iter1 = values.begin();
0027   std::vector<unsigned int>::const_iterator iter2 = rhs.values.begin();
0028   while (iter1 != values.end())
0029     if (*iter1++ != *iter2++)
0030       return false;
0031   return true;
0032 }
0033 
0034 void BlobComplexContent::fill(unsigned int &serial) {
0035   data1.first.fill(serial);
0036   data1.second = ++serial;
0037   data2.first.fill(serial);
0038   data2.second = ++serial;
0039   data3.first.fill(serial);
0040   data3.second = ++serial;
0041 }
0042 
0043 static void printBlobComplexContentData(const BlobComplexContent::Data &data) {
0044   std::cout << "      first = " << std::endl;
0045   data.first.print();
0046   std::cout << "      second = " << data.second << std::endl;
0047 }
0048 
0049 void BlobComplexContent::print() const {
0050   std::cout << "    data1 = " << std::endl;
0051   printBlobComplexContentData(data1);
0052   std::cout << "    data2 = " << std::endl;
0053   printBlobComplexContentData(data2);
0054   std::cout << "    data3 = " << std::endl;
0055   printBlobComplexContentData(data3);
0056 }
0057 
0058 bool BlobComplexContent::operator==(const BlobComplexContent &rhs) const {
0059   if (data1.first != rhs.data1.first || data1.second != rhs.data1.second)
0060     return false;
0061   if (data2.first != rhs.data2.first || data2.second != rhs.data2.second)
0062     return false;
0063   if (data3.first != rhs.data3.first || data3.second != rhs.data3.second)
0064     return false;
0065   return true;
0066 }
0067 
0068 void BlobComplexObjects::fill(unsigned int &serial) {
0069   a = ++serial;
0070   b = ++serial;
0071   for (unsigned int i = 0; i < 3; i++) {
0072     content.push_back(BlobComplexContent());
0073     content.back().fill(serial);
0074   }
0075 }
0076 
0077 void BlobComplexObjects::print() const {
0078   std::cout << "  a = " << a << std::endl;
0079   std::cout << "  b = " << b << std::endl;
0080   for (std::vector<BlobComplexContent>::const_iterator iter = content.begin(); iter != content.end(); iter++) {
0081     std::cout << "  content[" << (iter - content.begin()) << "] =" << std::endl;
0082     iter->print();
0083   }
0084 }
0085 
0086 bool BlobComplexObjects::operator==(const BlobComplexObjects &rhs) const {
0087   if (a != rhs.a)
0088     return false;
0089   if (b != rhs.b)
0090     return false;
0091   if (content.size() != rhs.content.size())
0092     return false;
0093   std::vector<BlobComplexContent>::const_iterator iter1 = content.begin();
0094   std::vector<BlobComplexContent>::const_iterator iter2 = rhs.content.begin();
0095   while (iter1 != content.end())
0096     if (*iter1++ != *iter2++)
0097       return false;
0098   return true;
0099 }
0100 
0101 void BlobComplex::fill(unsigned int &serial) {
0102   for (unsigned int i = 0; i < 3; i++) {
0103     objects.push_back(BlobComplexObjects());
0104     objects.back().fill(serial);
0105   }
0106 }
0107 
0108 void BlobComplex::print() const {
0109   for (std::vector<BlobComplexObjects>::const_iterator iter = objects.begin(); iter != objects.end(); iter++) {
0110     std::cout << "objects[" << (iter - objects.begin()) << "] =" << std::endl;
0111     iter->print();
0112   }
0113 }
0114 
0115 bool BlobComplex::operator==(const BlobComplex &rhs) const {
0116   if (objects.size() != rhs.objects.size())
0117     return false;
0118   std::vector<BlobComplexObjects>::const_iterator iter1 = objects.begin();
0119   std::vector<BlobComplexObjects>::const_iterator iter2 = rhs.objects.begin();
0120   while (iter1 != objects.end())
0121     if (*iter1++ != *iter2++)
0122       return false;
0123   return true;
0124 }