CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
RefToBase Class Reference

#include <DataFormats/Common/interface/RefToBase.h>

Detailed Description

Description: Interface to a reference to an item based on the base class of the item

Usage: Using an edm:RefToBase<T> allows one to hold references to items in different containers within the edm::Event where those objects are only related by a base class, T.

edm::Ref<Foo> foo(...);
std::vector<edm::RefToBase<Bar> > bars;
bars.push_back(edm::RefToBase<Bar>(foo));

Cast to concrete type can be done via the castTo<REF> function template. This function throws an exception if the type passed as REF does not match the concrete reference type.