00001 #include "DataFormats/Common/interface/CacheStreamers.h" 00002 #include "DataFormats/Common/interface/ConstPtrCache.h" 00003 #include "DataFormats/Common/interface/BoolCache.h" 00004 #include "TROOT.h" 00005 class TBuffer; 00006 00007 namespace edm { 00008 void 00009 BoolCacheStreamer::operator()(TBuffer &R__b, void *objp) { 00010 if (R__b.IsReading()) { 00011 cl_->ReadBuffer(R__b, objp); 00012 BoolCache* obj = static_cast<BoolCache *>(objp); 00013 *obj = false; 00014 } else { 00015 cl_->WriteBuffer(R__b, objp); 00016 } 00017 } 00018 00019 void 00020 ConstPtrCacheStreamer::operator()(TBuffer &R__b, void *objp) { 00021 if (R__b.IsReading()) { 00022 cl_->ReadBuffer(R__b, objp); 00023 ConstPtrCache* obj = static_cast<ConstPtrCache *>(objp); 00024 obj->ptr_=0; 00025 } else { 00026 cl_->WriteBuffer(R__b, objp); 00027 } 00028 } 00029 00030 void setCacheStreamers() { 00031 TClass *cl = gROOT->GetClass("edm::BoolCache"); 00032 if (cl->GetStreamer() == 0) { 00033 cl->AdoptStreamer(new BoolCacheStreamer()); 00034 /*} else { 00035 std::cout <<"ERROR: no edm::BoolCache found"<<std::endl;*/ 00036 } 00037 00038 cl = gROOT->GetClass("edm::ConstPtrCache"); 00039 if (cl->GetStreamer() == 0) { 00040 cl->AdoptStreamer(new ConstPtrCacheStreamer()); 00041 /*} else { 00042 std::cout <<"ERROR: no edm::ConstPtrCache found"<<std::endl;*/ 00043 } 00044 00045 } 00046 00047 }