CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros 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 // $Id: FWItemRandomAccessor.cc,v 1.6 2013/02/10 22:12:04 wmtan Exp $
14 //
15 
16 // system include files
17 #include <assert.h>
18 #include "TClass.h"
19 
20 // user include files
22 
23 // forward declarations
24 
25 FWItemRandomAccessorBase::FWItemRandomAccessorBase(const TClass *type, const type_info &modelTypeName)
26 :m_type(type),
27  m_modelType(TClass::GetClass(modelTypeName)),
28  m_data(0)
29 {
30 }
31 
32 // FWItemRandomAccessor::FWItemRandomAccessor(const FWItemRandomAccessor& rhs)
33 // {
34 // // do actual copying here;
35 // }
36 
38 {
39 }
40 
41 //
42 // assignment operators
43 //
44 // const FWItemRandomAccessor& FWItemRandomAccessor::operator=(const FWItemRandomAccessor& rhs)
45 // {
46 // //An exception safe implementation is
47 // FWItemRandomAccessor temp(rhs);
48 // swap(rhs);
49 //
50 // return *this;
51 // }
52 
53 //
54 // member functions
55 //
56 void
58 {
59  if (product.address() == 0)
60  {
61  reset();
62  return;
63  }
64 
65  m_data = product.address();
66  assert(0!=m_data);
67 }
68 
69 void
71 {
72  m_data = 0;
73 }
74 
75 //
76 // const member functions
77 //
78 const void*
80 {
81  return m_data;
82 }
83 
84 void*
86 {
87  return m_data;
88 }
89 
90 const TClass*
92 {
93  return m_type;
94 }
95 
96 const TClass*
98 {
99  assert(m_modelType);
100  return m_modelType;
101 }
102 
103 bool
105 {
106  return true;
107 }
108 //
109 // static member functions
110 //
type
Definition: HCALResponse.h:21
const TClass * type() const
void * address() const
const void * data() const
FWItemRandomAccessorBase(const TClass *type, const type_info &modelTypeName)
void setData(const edm::ObjectWithDict &)
override if id of an object should be different than the index
const TClass * modelType() const