CMS 3D CMS Logo

FWItemSingleAccessor.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: Core
4 // Class : FWItemSingleAccessor
5 //
6 // Implementation:
7 // <Notes on implementation>
8 //
9 // Original Author: Chris Jones
10 // Created: Sat Oct 18 11:36:44 EDT 2008
11 //
12 
13 // system include files
14 #include <cassert>
17 
18 // user include files
20 
21 //
22 // constants, enums and typedefs
23 //
24 
25 //
26 // static data member definitions
27 //
28 
29 //
30 // constructors and destructor
31 //
32 FWItemSingleAccessor::FWItemSingleAccessor(const TClass* iClass) : m_type(iClass), m_data(nullptr) {}
33 
34 // FWItemSingleAccessor::FWItemSingleAccessor(const FWItemSingleAccessor& rhs)
35 // {
36 // // do actual copying here;
37 // }
38 
40 
41 //
42 // assignment operators
43 //
44 // const FWItemSingleAccessor& FWItemSingleAccessor::operator=(const FWItemSingleAccessor& rhs)
45 // {
46 // //An exception safe implementation is
47 // FWItemSingleAccessor temp(rhs);
48 // swap(rhs);
49 //
50 // return *this;
51 // }
52 
53 //
54 // member functions
55 //
57  if (product.address() == nullptr) {
58  reset();
59  return;
60  }
61 
62  m_data = product.address();
63  assert(nullptr != m_data);
64 }
65 
66 void FWItemSingleAccessor::reset() { m_data = nullptr; }
67 
68 //
69 // const member functions
70 //
71 const void* FWItemSingleAccessor::modelData(int iIndex) const {
72  if (0 == iIndex) {
73  return m_data;
74  }
75  return nullptr;
76 }
77 
78 const void* FWItemSingleAccessor::data() const { return m_data; }
79 
80 unsigned int FWItemSingleAccessor::size() const { return nullptr == m_data ? 0 : 1; }
81 
82 const TClass* FWItemSingleAccessor::modelType() const { return m_type; }
83 
84 const TClass* FWItemSingleAccessor::type() const { return m_type; }
85 
86 bool FWItemSingleAccessor::isCollection() const { return false; }
87 
88 //
89 // static member functions
90 //
void * address() const
#define nullptr
const TClass * type() const override
void setData(const edm::ObjectWithDict &) override
override if id of an object should be different than the index
unsigned int size() const override
const void * modelData(int iIndex) const override
bool isCollection() const override
const void * data() const override
FWItemSingleAccessor(const TClass *)
const TClass * modelType() const override