Go to the documentation of this file.00001 #include <iostream>
00002 #include <typeinfo>
00003 #include "EventFilter/CSCRawToDigi/src/bitset_append.h"
00004
00005
00009 template <class T>
00010 bool cscPackerCompare(const T & t1, const T & t2)
00011 {
00012 bool result = true;
00013 if(t1 != t2) {
00014 std::cerr << "Mismatch:\n"<< t1 << "\n" << t2 << std::endl;
00015 result = false;
00016 }
00017 return result;
00018 }
00019
00020
00021 template <class T>
00022 T cscPackAndUnpack(T & t)
00023 {
00024 boost::dynamic_bitset<> firstPack = t.pack();
00025 unsigned char data[10000];
00026 bitset_utilities::bitsetToChar(firstPack, data);
00027 return T((unsigned short int *)data);
00028 }
00029
00030
00031
00032 template <class T>
00033 bool cscClassPackerCompare(T & t)
00034 {
00035 boost::dynamic_bitset<> firstPack = t.pack();
00036 unsigned char data[1000];
00037 bitset_utilities::bitsetToChar(firstPack, data);
00038 T newObject((unsigned short int *)data);
00039 boost::dynamic_bitset<> secondPack = newObject.pack();
00040 if(firstPack != secondPack)
00041 {
00042 std::cerr << "Mismatch in " << typeid(t).name() << "\n";
00043 bitset_utilities::printWords(firstPack);
00044 bitset_utilities::printWords(secondPack);
00045 return false;
00046 }
00047 return true;
00048 }
00049