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 <assert.h>
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),
26  m_modelType(TClass::GetClass(modelTypeName)),
27  m_data(0)
28 {
29 }
30 
31 // FWItemRandomAccessor::FWItemRandomAccessor(const FWItemRandomAccessor& rhs)
32 // {
33 // // do actual copying here;
34 // }
35 
37 {
38 }
39 
40 //
41 // assignment operators
42 //
43 // const FWItemRandomAccessor& FWItemRandomAccessor::operator=(const FWItemRandomAccessor& rhs)
44 // {
45 // //An exception safe implementation is
46 // FWItemRandomAccessor temp(rhs);
47 // swap(rhs);
48 //
49 // return *this;
50 // }
51 
52 //
53 // member functions
54 //
55 void
57 {
58  if (product.address() == 0)
59  {
60  reset();
61  return;
62  }
63 
64  m_data = product.address();
65  assert(0!=m_data);
66 }
67 
68 void
70 {
71  m_data = 0;
72 }
73 
74 //
75 // const member functions
76 //
77 const void*
79 {
80  return m_data;
81 }
82 
83 void*
85 {
86  return m_data;
87 }
88 
89 const TClass*
91 {
92  return m_type;
93 }
94 
95 const TClass*
97 {
98  assert(m_modelType);
99  return m_modelType;
100 }
101 
102 bool
104 {
105  return true;
106 }
107 //
108 // static member functions
109 //
type
Definition: HCALResponse.h:21
const TClass * type() const
void * address() const
const void * data() const
FWItemRandomAccessorBase(const TClass *type, const std::type_info &modelTypeName)
void setData(const edm::ObjectWithDict &)
override if id of an object should be different than the index
const TClass * modelType() const