CMS 3D CMS Logo

FWItemRandomAccessor.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: Core
4 // Class : FWItemRandomAccessor
5 //
6 // Implementation:
7 // A generic helper class which can be used to create
8 // a specialized FWItemAccessorBase plugin for
9 // all the classes that expose a std::vector like interface.
10 //
11 // Original Author: Giulio Eulisse
12 // Created: Thu Feb 18 15:19:44 EDT 2008
13 //
14 
15 // system include files
16 #include <cassert>
17 #include "TClass.h"
18 
19 // user include files
21 
22 // forward declarations
23 
24 FWItemRandomAccessorBase::FWItemRandomAccessorBase(const TClass* type, const std::type_info& modelTypeName)
25  : m_type(type), m_modelType(TClass::GetClass(modelTypeName)), m_data(nullptr) {}
26 
27 // FWItemRandomAccessor::FWItemRandomAccessor(const FWItemRandomAccessor& rhs)
28 // {
29 // // do actual copying here;
30 // }
31 
33 
34 //
35 // assignment operators
36 //
37 // const FWItemRandomAccessor& FWItemRandomAccessor::operator=(const FWItemRandomAccessor& rhs)
38 // {
39 // //An exception safe implementation is
40 // FWItemRandomAccessor temp(rhs);
41 // swap(rhs);
42 //
43 // return *this;
44 // }
45 
46 //
47 // member functions
48 //
50  if (product.address() == nullptr) {
51  reset();
52  return;
53  }
54 
55  m_data = product.address();
56  assert(nullptr != m_data);
57 }
58 
60 
61 //
62 // const member functions
63 //
64 const void* FWItemRandomAccessorBase::data() const { return m_data; }
65 
67 
68 const TClass* FWItemRandomAccessorBase::type() const { return m_type; }
69 
70 const TClass* FWItemRandomAccessorBase::modelType() const {
72  return m_modelType;
73 }
74 
75 bool FWItemRandomAccessorBase::isCollection() const { return true; }
76 //
77 // static member functions
78 //
FWItemRandomAccessorBase::~FWItemRandomAccessorBase
~FWItemRandomAccessorBase() override
Definition: FWItemRandomAccessor.cc:32
FWItemRandomAccessorBase::m_data
void * m_data
Definition: FWItemRandomAccessor.h:46
edm::ObjectWithDict::address
void * address() const
Definition: ObjectWithDict.cc:27
edm::ObjectWithDict
Definition: ObjectWithDict.h:17
FWItemRandomAccessorBase::isCollection
bool isCollection() const override
Definition: FWItemRandomAccessor.cc:75
cms::cuda::assert
assert(be >=bs)
FWItemRandomAccessorBase::data
const void * data() const override
Definition: FWItemRandomAccessor.cc:64
FWItemRandomAccessorBase::getDataPtr
void * getDataPtr() const
Definition: FWItemRandomAccessor.cc:66
type
type
Definition: SiPixelVCal_PayloadInspector.cc:37
FWItemRandomAccessorBase::modelType
const TClass * modelType() const override
Definition: FWItemRandomAccessor.cc:70
FWItemRandomAccessor.h
FWItemRandomAccessorBase::type
const TClass * type() const override
Definition: FWItemRandomAccessor.cc:68
FWItemRandomAccessorBase::reset
void reset() override
Definition: FWItemRandomAccessor.cc:59
FWItemRandomAccessorBase::FWItemRandomAccessorBase
FWItemRandomAccessorBase(const TClass *type, const std::type_info &modelTypeName)
Definition: FWItemRandomAccessor.cc:24
FWItemRandomAccessorBase::m_type
const TClass * m_type
Definition: FWItemRandomAccessor.h:44
FWItemRandomAccessorBase::setData
void setData(const edm::ObjectWithDict &) override
override if id of an object should be different than the index
Definition: FWItemRandomAccessor.cc:49
FWItemRandomAccessorBase::m_modelType
const TClass * m_modelType
Definition: FWItemRandomAccessor.h:45