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 //
FWItemSingleAccessor.h
edm::ObjectWithDict::address
void * address() const
Definition: ObjectWithDict.cc:27
FWItemSingleAccessor::FWItemSingleAccessor
FWItemSingleAccessor(const TClass *)
Definition: FWItemSingleAccessor.cc:32
edm::ObjectWithDict
Definition: ObjectWithDict.h:17
cms::cuda::assert
assert(be >=bs)
TypeWithDict.h
FWItemSingleAccessor::modelType
const TClass * modelType() const override
Definition: FWItemSingleAccessor.cc:82
FWItemSingleAccessor::size
unsigned int size() const override
Definition: FWItemSingleAccessor.cc:80
ObjectWithDict.h
FWItemSingleAccessor::isCollection
bool isCollection() const override
Definition: FWItemSingleAccessor.cc:86
FWItemSingleAccessor::m_type
const TClass * m_type
Definition: FWItemSingleAccessor.h:52
FWItemSingleAccessor::m_data
const void * m_data
Definition: FWItemSingleAccessor.h:53
FWItemSingleAccessor::setData
void setData(const edm::ObjectWithDict &) override
override if id of an object should be different than the index
Definition: FWItemSingleAccessor.cc:56
FWItemSingleAccessor::data
const void * data() const override
Definition: FWItemSingleAccessor.cc:78
FWItemSingleAccessor::reset
void reset() override
Definition: FWItemSingleAccessor.cc:66
FWItemSingleAccessor::~FWItemSingleAccessor
~FWItemSingleAccessor() override
Definition: FWItemSingleAccessor.cc:39
FWItemSingleAccessor::type
const TClass * type() const override
Definition: FWItemSingleAccessor.cc:84
FWItemSingleAccessor::modelData
const void * modelData(int iIndex) const override
Definition: FWItemSingleAccessor.cc:71