CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Static Private Member Functions
pat::UserData Class Referenceabstract

Base class for data that users can add to pat objects. More...

#include "DataFormats/PatCandidates/interface/UserData.h"

Inheritance diagram for pat::UserData:
pat::UserHolder< T >

Public Member Functions

const void * bareData () const
 
virtual UserDataclone () const =0
 Necessary for deep copy in OwnVector. More...
 
template<typename T >
const Tget () const
 Extract data in a typesafe way. <T> must be the concrete type of the data. More...
 
virtual const std::type_info & typeId () const =0
 Concrete type of stored data. More...
 
virtual const std::string & typeName () const =0
 Human readable name of the concrete type of stored data. More...
 
 UserData ()
 
virtual ~UserData ()
 

Static Public Member Functions

template<typename T >
std::unique_ptr< pat::UserDatamake (const T &value, bool transientOnly)
 
template<typename T >
static std::unique_ptr< UserDatamake (const T &value, bool transientOnly=false)
 

Protected Member Functions

virtual const void * data_ () const =0
 Get out the data (can't template non virtual functions) More...
 

Static Protected Member Functions

static std::string typeNameFor (std::type_info const &iInfo)
 

Static Private Member Functions

static void checkDictionaries (const std::type_info &type)
 

Detailed Description

Base class for data that users can add to pat objects.

Author
Sal Rappoccio
Version
$Id: UserData.h,v 1.01

Definition at line 23 of file UserData.h.

Constructor & Destructor Documentation

◆ UserData()

pat::UserData::UserData ( )
inline

Definition at line 25 of file UserData.h.

25 {}

◆ ~UserData()

virtual pat::UserData::~UserData ( )
inlinevirtual

Definition at line 26 of file UserData.h.

26 {}

Member Function Documentation

◆ bareData()

const void* pat::UserData::bareData ( ) const
inline

Get the data as a void *, for CINT usage. COMPLETELY UNSUPPORTED, USE ONLY FOR DEBUGGING

Definition at line 50 of file UserData.h.

50 { return data_(); }

References data_().

◆ checkDictionaries()

void pat::UserData::checkDictionaries ( const std::type_info &  type)
staticprivate

Definition at line 7 of file UserData.cc.

7  {
8  if (!edm::hasDictionary(type)) {
9  int status = 0;
10  char* demangled = abi::__cxa_demangle(type.name(), nullptr, nullptr, &status);
11  std::string typeName(status == 0 ? demangled : type.name());
12  if ((demangled != nullptr) && (status == 0))
13  free(demangled);
15  << " No REFLEX data dictionary found for the following class:\n\t" << typeName
16  << "\n Most likely the dictionary was never generated,\n"
17  << " but it may be that it was generated in the wrong package.\n"
18  << " Please add (or move) the specification\n"
19  << "\t<class name=\"" << typeName << "\" />\n"
20  << " to the appropriate classes_def.xml file.\n"
21  << " If the class is a template instance, you may need\n"
22  << " to define a dummy variable of this type in classes.h.\n"
23  << " Also, if this class has any transient members,\n"
24  << " you need to specify them in classes_def.xml.\n";
25  } // check for dictionary
26 }

References symbols::demangled, edm::errors::DictionaryNotFound, Exception, edm::hasDictionary(), mps_update::status, AlCaHLTBitMon_QueryRunRegistry::string, and typeName().

Referenced by make().

◆ clone()

virtual UserData* pat::UserData::clone ( ) const
pure virtual

Necessary for deep copy in OwnVector.

Implemented in pat::UserHolder< T >.

◆ data_()

virtual const void* pat::UserData::data_ ( ) const
protectedpure virtual

Get out the data (can't template non virtual functions)

Implemented in pat::UserHolder< T >.

Referenced by bareData(), and get().

◆ get()

template<typename T >
const T* pat::UserData::get ( ) const
inline

◆ make() [1/2]

template<typename T >
std::unique_ptr<pat::UserData> pat::UserData::make ( const T value,
bool  transientOnly 
)
static

Definition at line 90 of file UserData.h.

90  {
91  if (!transientOnly) {
92  checkDictionaries(typeid(T));
94  }
95  return std::unique_ptr<UserData>(new pat::UserHolder<T>(value));
96 }

References checkDictionaries().

◆ make() [2/2]

template<typename T >
static std::unique_ptr<UserData> pat::UserData::make ( const T value,
bool  transientOnly = false 
)
static

Make a UserData pointer from some value, wrapping it appropriately. It will check for dictionaries, unless 'transientOnly' is true

Referenced by pat::MatcherUsingTracks::produce(), and VersionedIdProducer< PhysicsObjectPtr, SelectorType >::produce().

◆ typeId()

virtual const std::type_info& pat::UserData::typeId ( ) const
pure virtual

Concrete type of stored data.

Implemented in pat::UserHolder< T >.

Referenced by get().

◆ typeName()

virtual const std::string& pat::UserData::typeName ( ) const
pure virtual

Human readable name of the concrete type of stored data.

Implemented in pat::UserHolder< T >.

Referenced by checkDictionaries().

◆ typeNameFor()

std::string pat::UserData::typeNameFor ( std::type_info const &  iInfo)
staticprotected

Definition at line 28 of file UserData.cc.

28  {
29  int status = 0;
30  const char* demangled = abi::__cxa_demangle(iType.name(), nullptr, nullptr, &status);
31  return std::string(status == 0 ? demangled : "[UNKNOWN]");
32 }

References symbols::demangled, mps_update::status, and AlCaHLTBitMon_QueryRunRegistry::string.

pat::UserData::typeId
virtual const std::type_info & typeId() const =0
Concrete type of stored data.
pat::UserData::checkDictionaries
static void checkDictionaries(const std::type_info &type)
Definition: UserData.cc:7
mps_update.status
status
Definition: mps_update.py:68
pat::UserData::typeName
virtual const std::string & typeName() const =0
Human readable name of the concrete type of stored data.
edm::errors::DictionaryNotFound
Definition: EDMException.h:34
type
type
Definition: SiPixelVCal_PayloadInspector.cc:39
symbols.demangled
demangled
Definition: symbols.py:70
value
Definition: value.py:1
edm::hasDictionary
bool hasDictionary(std::type_info const &)
Definition: TypeWithDict.cc:809
pat::UserData::data_
virtual const void * data_() const =0
Get out the data (can't template non virtual functions)
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
T
long double T
Definition: Basic3DVectorLD.h:48
Exception
Definition: hltDiff.cc:245
pat::UserHolder
Definition: UserData.h:67