CMS 3D CMS Logo

CMSSW_4_4_3_patch1/src/DataFormats/Common/src/CacheStreamers.cc

Go to the documentation of this file.
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 #if 0    
00032     TClass *cl = gROOT->GetClass("edm::BoolCache");
00033     if (cl->GetStreamer() == 0) {
00034       cl->AdoptStreamer(new BoolCacheStreamer());
00035     /*} else {
00036       std::cout <<"ERROR: no edm::BoolCache found"<<std::endl;*/
00037     }
00038 
00039     cl = gROOT->GetClass("edm::ConstPtrCache");
00040     if (cl->GetStreamer() == 0) {
00041       cl->AdoptStreamer(new ConstPtrCacheStreamer());
00042     /*} else {
00043       std::cout <<"ERROR: no edm::ConstPtrCache found"<<std::endl;*/
00044     }
00045 #endif    
00046   }
00047 }