CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 //
void * address() const
const void * data() const override
assert(be >=bs)
bool isCollection() const override
const TClass * type() const override
FWItemRandomAccessorBase(const TClass *type, const std::type_info &modelTypeName)
const TClass * modelType() const override
void setData(const edm::ObjectWithDict &) override
override if id of an object should be different than the index