CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Classes | Public Member Functions | Private Member Functions | Private Attributes
fwlite::RecordWriter Class Reference

#include <RecordWriter.h>

Classes

struct  DataBuffer
 

Public Member Functions

void fill (const edm::ESRecordAuxiliary &)
 
 RecordWriter (const char *iName, TFile *iFile)
 
void update (const void *iData, const std::type_info &iType, const char *iLabel)
 
void write ()
 
virtual ~RecordWriter ()
 

Private Member Functions

const RecordWriteroperator= (const RecordWriter &)
 
 RecordWriter (const RecordWriter &)
 

Private Attributes

edm::ESRecordAuxiliary aux_
 
TBranch * auxBranch_
 
std::map< std::pair
< edm::TypeIDBase, std::string >
, DataBuffer
idToBuffer_
 
edm::ESRecordAuxiliarypAux_
 
TTree * tree_
 

Detailed Description

Definition at line 33 of file RecordWriter.h.

Constructor & Destructor Documentation

RecordWriter::RecordWriter ( const char *  iName,
TFile *  iFile 
)

Definition at line 38 of file RecordWriter.cc.

References auxBranch_, fwlite::format_type_to_mangled(), pAux_, and tree_.

38  :
39 pAux_(&aux_)
40 {
41  tree_ = new TTree(fwlite::format_type_to_mangled(iName).c_str(),"Holds data for an EventSetup Record");
42  tree_->SetDirectory(iFile);
43 
44  auxBranch_ = tree_->Branch("ESRecordAuxiliary","edm::ESRecordAuxiliary",&pAux_);
45 }
edm::ESRecordAuxiliary aux_
Definition: RecordWriter.h:64
std::string format_type_to_mangled(const std::string &)
given a C++ class name returned a mangled name
edm::ESRecordAuxiliary * pAux_
Definition: RecordWriter.h:65
RecordWriter::~RecordWriter ( )
virtual

Definition at line 52 of file RecordWriter.cc.

53 {
54 }
fwlite::RecordWriter::RecordWriter ( const RecordWriter )
private

Member Function Documentation

void RecordWriter::fill ( const edm::ESRecordAuxiliary iValue)

Definition at line 112 of file RecordWriter.cc.

References aux_, Exception, idToBuffer_, python.multivaluedict::map(), and tree_.

113 {
114  for(std::map<std::pair<edm::TypeIDBase,std::string>, DataBuffer>::iterator it=idToBuffer_.begin(),itEnd=idToBuffer_.end();
115  it!=itEnd;++it) {
116  if(0==it->second.pBuffer_) {
117  throw cms::Exception("MissingESData")<<"The EventSetup data "<<it->first.first.name()<<" '"<<it->first.second<<"' was not supplied";
118  }
119  }
120 
121  aux_ = iValue;
122  tree_->Fill();
123  for(std::map<std::pair<edm::TypeIDBase,std::string>, DataBuffer>::iterator it=idToBuffer_.begin(),itEnd=idToBuffer_.end();
124  it!=itEnd;++it) {
125  it->second.pBuffer_=0;
126  }
127 }
edm::ESRecordAuxiliary aux_
Definition: RecordWriter.h:64
std::map< std::pair< edm::TypeIDBase, std::string >, DataBuffer > idToBuffer_
Definition: RecordWriter.h:67
const RecordWriter& fwlite::RecordWriter::operator= ( const RecordWriter )
private
void RecordWriter::update ( const void *  iData,
const std::type_info &  iType,
const char *  iLabel 
)

Definition at line 72 of file RecordWriter.cc.

References assert(), fwlite::RecordWriter::DataBuffer::branch_, className(), edm::ObjectWithDict::dynamicType(), fwlite::format_type_to_mangled(), idToBuffer_, diffTwoXMLs::label, edm::TypeWithDict::name(), python.connectstrParser::o, fwlite::RecordWriter::DataBuffer::pBuffer_, AlCaHLTBitMon_QueryRunRegistry::string, lumiQTWidget::t, tree_, and fwlite::RecordWriter::DataBuffer::trueType_.

Referenced by progressbar.ProgressBar::__next__(), MatrixUtil.Matrix::__setitem__(), MatrixUtil.Steps::__setitem__(), Vispa.Gui.VispaWidget.VispaWidget::autosize(), Vispa.Views.LineDecayView.LineDecayContainer::createObject(), Vispa.Views.LineDecayView.LineDecayContainer::deselectAllObjects(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::deselectAllWidgets(), Vispa.Gui.VispaWidget.VispaWidget::enableAutosizing(), progressbar.ProgressBar::finish(), Vispa.Gui.MenuWidget.MenuWidget::leaveEvent(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::mouseMoveEvent(), Vispa.Gui.MenuWidget.MenuWidget::mouseMoveEvent(), Vispa.Views.LineDecayView.LineDecayContainer::mouseMoveEvent(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::mouseReleaseEvent(), Vispa.Views.LineDecayView.LineDecayContainer::objectMoved(), MatrixUtil.Steps::overwrite(), Vispa.Views.LineDecayView.LineDecayContainer::removeObject(), Vispa.Gui.ConnectableWidget.ConnectableWidget::removePorts(), Vispa.Gui.FindDialog.FindDialog::reset(), Vispa.Gui.PortConnection.PointToPointConnection::select(), Vispa.Gui.VispaWidget.VispaWidget::select(), Vispa.Views.LineDecayView.LineDecayContainer::select(), Vispa.Gui.VispaWidget.VispaWidget::setText(), Vispa.Gui.VispaWidget.VispaWidget::setTitle(), Vispa.Gui.ZoomableWidget.ZoomableWidget::setZoom(), Vispa.Views.LineDecayView.LineDecayContainer::setZoom(), and Vispa.Gui.PortConnection.PointToPointConnection::updateConnection().

73 {
74  const char* label = iLabel;
75  if(0==iLabel) {
76  label = "";
77  }
78  std::map<std::pair<edm::TypeIDBase,std::string>, DataBuffer>::iterator itFound = idToBuffer_.find(std::make_pair(edm::TypeIDBase(iType),
79  std::string(iLabel)));
80  if(itFound == idToBuffer_.end()) {
81  //first request
82  DataBuffer buffer;
83  buffer.pBuffer_=iData;
84  edm::TypeWithDict t(iType);
85  assert(bool(t));
86 
87  std::string className = t.name();
88 
89  //now find actual type
90  edm::ObjectWithDict o(t,const_cast<void*>(iData));
91  edm::TypeWithDict trueType(o.dynamicType());
92  buffer.trueType_ = edm::TypeIDBase(trueType.typeInfo());
93  std::string trueClassName = trueType.name();
94 
95  buffer.branch_ = tree_->Branch((fwlite::format_type_to_mangled(className)+"__"+label).c_str(),
96  trueClassName.c_str(),
97  &buffer.pBuffer_);
98  idToBuffer_.insert(std::make_pair(std::make_pair(edm::TypeIDBase(iType),std::string(iLabel)),buffer));
99  itFound = idToBuffer_.find(std::make_pair(edm::TypeIDBase(iType),
100  std::string(iLabel)));
101  }
102  edm::TypeWithDict t(iType);
103  edm::ObjectWithDict o(t,const_cast<void*>(iData));
104  edm::TypeWithDict trueType(o.dynamicType());
105  assert(edm::TypeIDBase(trueType.typeInfo())==itFound->second.trueType_);
106  itFound->second.branch_->SetAddress(&(itFound->second.pBuffer_));
107  itFound->second.pBuffer_ = iData;
108 }
assert(m_qm.get())
std::string format_type_to_mangled(const std::string &)
given a C++ class name returned a mangled name
std::map< std::pair< edm::TypeIDBase, std::string >, DataBuffer > idToBuffer_
Definition: RecordWriter.h:67
std::string className(const T &t)
Definition: ClassName.h:30
void RecordWriter::write ( )

Definition at line 130 of file RecordWriter.cc.

References tree_.

131 {
132  tree_->Write();
133 }

Member Data Documentation

edm::ESRecordAuxiliary fwlite::RecordWriter::aux_
private

Definition at line 64 of file RecordWriter.h.

Referenced by fill().

TBranch* fwlite::RecordWriter::auxBranch_
private

Definition at line 66 of file RecordWriter.h.

Referenced by RecordWriter().

std::map<std::pair<edm::TypeIDBase,std::string>, DataBuffer> fwlite::RecordWriter::idToBuffer_
private

Definition at line 67 of file RecordWriter.h.

Referenced by fill(), and update().

edm::ESRecordAuxiliary* fwlite::RecordWriter::pAux_
private

Definition at line 65 of file RecordWriter.h.

Referenced by RecordWriter().

TTree* fwlite::RecordWriter::tree_
private

Definition at line 63 of file RecordWriter.h.

Referenced by fill(), RecordWriter(), update(), and write().