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.6 2012/06/26 22:09:35 wmtan 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 Reflex::Object& product)
64 {
65  if (product.Address() == 0)
66  {
67  reset();
68  return;
69  }
70 
71  if(product.TypeOf().IsTypedef())
72  m_data = Reflex::Object(product.TypeOf().ToType(), product.Address()).Address();
73  else
74  m_data = product.Address();
75  assert(0!=m_data);
76 }
77 
78 void
80 {
81  m_data = 0;
82 }
83 
84 //
85 // const member functions
86 //
87 const void*
89 {
90  if(0==iIndex) {
91  return m_data;
92  }
93  return 0;
94 }
95 
96 const void*
98 {
99  return m_data;
100 }
101 
102 unsigned int
104 {
105  return 0 == m_data ? 0 : 1;
106 }
107 
108 const TClass*
110 {
111  return m_type;
112 }
113 
114 const TClass*
116 {
117  return m_type;
118 }
119 
120 bool
122 {
123  return false;
124 }
125 
126 //
127 // static member functions
128 //
void setData(const Reflex::Object &)
override if id of an object should be different than the index
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