CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 //
std::shared_ptr< TVirtualCollectionProxy > m_colProxy
void * address() const
assert(be >=bs)
const void * modelData(int iIndex) const override
void setData(const edm::ObjectWithDict &) override
override if id of an object should be different than the index
FWItemTVirtualCollectionProxyAccessor(const TClass *iType, std::shared_ptr< TVirtualCollectionProxy > iProxy, size_t iOffset=0)