CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
DataProxy.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: Framework
4 // Class : DataProxy
5 //
6 // Implementation:
7 // <Notes on implementation>
8 //
9 // Author: Chris Jones
10 // Created: Thu Mar 31 12:49:19 EST 2005
11 //
12 
13 // system include files
14 
15 // user include files
20 
21 
22 //
23 // constants, enums and typedefs
24 //
25 namespace edm {
26  namespace eventsetup {
27 //
28 // static data member definitions
29 //
30 static
33 {
34  static ComponentDescription s_desc;
35  return &s_desc;
36 }
37 //
38 // constructors and destructor
39 //
41  cache_(0),
42  cacheIsValid_(false),
43  nonTransientAccessRequested_(false),
44  description_(dummyDescription())
45 {
46 }
47 
48 // DataProxy::DataProxy(const DataProxy& rhs)
49 // {
50 // // do actual copying here;
51 // }
52 
54 {
55 }
56 
57 //
58 // assignment operators
59 //
60 // const DataProxy& DataProxy::operator=(const DataProxy& rhs)
61 // {
62 // //An exception safe implementation is
63 // DataProxy temp(rhs);
64 // swap(rhs);
65 //
66 // return *this;
67 // }
68 
69 //
70 // member functions
71 //
72 void
73 DataProxy::setCacheIsValidAndAccessType(bool iTransientAccessOnly) const {
74  cacheIsValid_ = true;
75  if(!iTransientAccessOnly) {
77  }
78 }
79 
81  cacheIsValid_ = false;
83  cache_ = 0;
84 }
85 
86 void
91  }
92 }
93 
94 void
97 }
98 //
99 // const member functions
100 //
101 namespace {
102  void throwMakeException(const EventSetupRecord& iRecord,
103  const DataKey& iKey) {
104  throw MakeDataException(iRecord.key(),iKey);
105  }
106 }
107 
108 
109 const void*
110 DataProxy::get(const EventSetupRecord& iRecord, const DataKey& iKey, bool iTransiently) const
111 {
112  if(!cacheIsValid()) {
113  cache_ = const_cast<DataProxy*>(this)->getImpl(iRecord, iKey);
114  setCacheIsValidAndAccessType(iTransiently);
115  }
116  if(0 == cache_) {
117  throwMakeException(iRecord, iKey);
118  }
119  return cache_;
120 }
121 
122 void DataProxy::doGet(const EventSetupRecord& iRecord, const DataKey& iKey, bool iTransiently) const {
123  get(iRecord, iKey, iTransiently);
124 }
125 
126 
127 //
128 // static member functions
129 //
130  }
131 }
void setCacheIsValidAndAccessType(bool iTransientAccessOnly) const
Definition: DataProxy.cc:73
bool cacheIsValid() const
Definition: DataProxy.h:40
virtual EventSetupRecordKey key() const =0
virtual const void * getImpl(const EventSetupRecord &, const DataKey &iKey)=0
void doGet(const EventSetupRecord &iRecord, const DataKey &iKey, bool iTransiently) const
Definition: DataProxy.cc:122
virtual void invalidateTransientCache()
Definition: DataProxy.cc:95
const void * get(const EventSetupRecord &, const DataKey &iKey, bool iTransiently) const
Definition: DataProxy.cc:110
static const ComponentDescription * dummyDescription()
Definition: DataProxy.cc:32
virtual void invalidateCache()=0