CMS 3D CMS Logo

FWItemTVirtualCollectionProxyAccessor.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: Core
4 // Class : FWItemTVirtualCollectionProxyAccessor
5 //
6 // Implementation:
7 // <Notes on implementation>
8 //
9 // Original Author: Chris Jones
10 // Created: Sat Oct 18 08:43:47 EDT 2008
11 //
12 
13 // system include files
14 #include <cassert>
17 #include "TVirtualCollectionProxy.h"
18 
19 // user include files
21 
22 //
23 // constants, enums and typedefs
24 //
25 
26 //
27 // static data member definitions
28 //
29 
30 //
31 // constructors and destructor
32 //
34  const TClass* iType, std::shared_ptr<TVirtualCollectionProxy> iProxy, size_t iOffset)
35  : m_type(iType), m_colProxy(iProxy), m_data(nullptr), m_offset(iOffset) {}
36 
37 // FWItemTVirtualCollectionProxyAccessor::FWItemTVirtualCollectionProxyAccessor(const FWItemTVirtualCollectionProxyAccessor& rhs)
38 // {
39 // // do actual copying here;
40 // }
41 
43 
44 //
45 // assignment operators
46 //
47 // const FWItemTVirtualCollectionProxyAccessor& FWItemTVirtualCollectionProxyAccessor::operator=(const FWItemTVirtualCollectionProxyAccessor& rhs)
48 // {
49 // //An exception safe implementation is
50 // FWItemTVirtualCollectionProxyAccessor temp(rhs);
51 // swap(rhs);
52 //
53 // return *this;
54 // }
55 
56 //
57 // member functions
58 //
60  if (product.address() == nullptr) {
61  reset();
62  return;
63  }
64 
65  m_data = product.address();
66  assert(nullptr != m_data);
67  m_colProxy->PushProxy(static_cast<char*>(const_cast<void*>(m_data)) + m_offset);
68 }
69 
71  if (nullptr != m_data) {
72  m_data = nullptr;
73  m_colProxy->PopProxy();
74  }
75 }
76 
77 //
78 // const member functions
79 //
80 const void* FWItemTVirtualCollectionProxyAccessor::modelData(int iIndex) const {
81  if (nullptr == m_data) {
82  return m_data;
83  }
84  return m_colProxy->At(iIndex);
85 }
86 
87 const void* FWItemTVirtualCollectionProxyAccessor::data() const { return m_data; }
88 
90  if (m_data == nullptr) {
91  return 0;
92  }
93  return m_colProxy->Size();
94 }
95 
96 const TClass* FWItemTVirtualCollectionProxyAccessor::modelType() const { return m_colProxy->GetValueClass(); }
97 
98 const TClass* FWItemTVirtualCollectionProxyAccessor::type() const { return m_type; }
99 
101 
102 //
103 // static member functions
104 //
FWItemTVirtualCollectionProxyAccessor::type
const TClass * type() const override
Definition: FWItemTVirtualCollectionProxyAccessor.cc:98
FWItemTVirtualCollectionProxyAccessor::size
unsigned int size() const override
Definition: FWItemTVirtualCollectionProxyAccessor.cc:89
edm::ObjectWithDict::address
void * address() const
Definition: ObjectWithDict.cc:27
FWItemTVirtualCollectionProxyAccessor.h
edm::ObjectWithDict
Definition: ObjectWithDict.h:17
FWItemTVirtualCollectionProxyAccessor::m_offset
size_t m_offset
Definition: FWItemTVirtualCollectionProxyAccessor.h:62
cms::cuda::assert
assert(be >=bs)
TypeWithDict.h
FWItemTVirtualCollectionProxyAccessor::m_type
const TClass * m_type
Definition: FWItemTVirtualCollectionProxyAccessor.h:59
FWItemTVirtualCollectionProxyAccessor::isCollection
bool isCollection() const override
Definition: FWItemTVirtualCollectionProxyAccessor.cc:100
ObjectWithDict.h
FWItemTVirtualCollectionProxyAccessor::m_colProxy
std::shared_ptr< TVirtualCollectionProxy > m_colProxy
Definition: FWItemTVirtualCollectionProxyAccessor.h:60
FWItemTVirtualCollectionProxyAccessor::setData
void setData(const edm::ObjectWithDict &) override
override if id of an object should be different than the index
Definition: FWItemTVirtualCollectionProxyAccessor.cc:59
FWItemTVirtualCollectionProxyAccessor::data
const void * data() const override
Definition: FWItemTVirtualCollectionProxyAccessor.cc:87
FWItemTVirtualCollectionProxyAccessor::~FWItemTVirtualCollectionProxyAccessor
~FWItemTVirtualCollectionProxyAccessor() override
Definition: FWItemTVirtualCollectionProxyAccessor.cc:42
FWItemTVirtualCollectionProxyAccessor::FWItemTVirtualCollectionProxyAccessor
FWItemTVirtualCollectionProxyAccessor(const TClass *iType, std::shared_ptr< TVirtualCollectionProxy > iProxy, size_t iOffset=0)
Definition: FWItemTVirtualCollectionProxyAccessor.cc:33
FWItemTVirtualCollectionProxyAccessor::reset
void reset() override
Definition: FWItemTVirtualCollectionProxyAccessor.cc:70
FWItemTVirtualCollectionProxyAccessor::modelType
const TClass * modelType() const override
Definition: FWItemTVirtualCollectionProxyAccessor.cc:96
FWItemTVirtualCollectionProxyAccessor::modelData
const void * modelData(int iIndex) const override
Definition: FWItemTVirtualCollectionProxyAccessor.cc:80
FWItemTVirtualCollectionProxyAccessor::m_data
const void * m_data
Definition: FWItemTVirtualCollectionProxyAccessor.h:61