CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 // $Id: FWItemSingleAccessor.cc,v 1.4 2009/01/23 21:35:43 amraktad Exp $
12 //
13 
14 // system include files
15 #include <assert.h>
16 #include "Reflex/Object.h"
17 
18 // user include files
20 
21 
22 //
23 // constants, enums and typedefs
24 //
25 
26 //
27 // static data member definitions
28 //
29 
30 //
31 // constructors and destructor
32 //
34  m_type(iClass), m_data(0)
35 {
36 }
37 
38 // FWItemSingleAccessor::FWItemSingleAccessor(const FWItemSingleAccessor& rhs)
39 // {
40 // // do actual copying here;
41 // }
42 
44 {
45 }
46 
47 //
48 // assignment operators
49 //
50 // const FWItemSingleAccessor& FWItemSingleAccessor::operator=(const FWItemSingleAccessor& rhs)
51 // {
52 // //An exception safe implementation is
53 // FWItemSingleAccessor temp(rhs);
54 // swap(rhs);
55 //
56 // return *this;
57 // }
58 
59 //
60 // member functions
61 //
62 void
63 FWItemSingleAccessor::setData(const ROOT::Reflex::Object& product)
64 {
65  if (product.Address() == 0)
66  {
67  reset();
68  return;
69  }
70 
71  using ROOT::Reflex::Object;
72 
73  if(product.TypeOf().IsTypedef())
74  m_data = Object(product.TypeOf().ToType(), product.Address()).Address();
75  else
76  m_data = product.Address();
77  assert(0!=m_data);
78 }
79 
80 void
82 {
83  m_data = 0;
84 }
85 
86 //
87 // const member functions
88 //
89 const void*
91 {
92  if(0==iIndex) {
93  return m_data;
94  }
95  return 0;
96 }
97 
98 const void*
100 {
101  return m_data;
102 }
103 
104 unsigned int
106 {
107  return 0 == m_data ? 0 : 1;
108 }
109 
110 const TClass*
112 {
113  return m_type;
114 }
115 
116 const TClass*
118 {
119  return m_type;
120 }
121 
122 bool
124 {
125  return false;
126 }
127 
128 //
129 // static member functions
130 //
void setData(const ROOT::Reflex::Object &)
const void * data() const
FWItemSingleAccessor(const TClass *)
unsigned int size() const
const TClass * type() const
const void * modelData(int iIndex) const
const TClass * modelType() const