proxy.h
Go to the documentation of this file.
1 /*
2  * Copyright 2006-2008 The FLWOR Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef ZORBA_INTERNAL_PROXY_H
18 #define ZORBA_INTERNAL_PROXY_H
19 
20 namespace zorba {
21 namespace internal {
22 namespace ztd {
23 
24 ///////////////////////////////////////////////////////////////////////////////
25 
26 /**
27  * \internal
28  * A %proxy<T> is-a \c T that also contains a T* -- a pointer to the original.
29  */
30 template<class OriginalType>
31 class proxy : public OriginalType {
32 public:
33  proxy( OriginalType *p ) : original_( p ) { }
34 
35  OriginalType* original() const {
36  return original_;
37  }
38 private:
39  OriginalType *original_;
40 };
41 
42 ///////////////////////////////////////////////////////////////////////////////
43 
44 } // namespace ztd
45 } // namespace internal
46 } // namespace zorba
47 #endif /* ZORBA_INTERNAL_PROXY_H */
48 /* vim:set et sw=2 ts=2: */
OriginalType * original() const
Definition: proxy.h:35
proxy(OriginalType *p)
Definition: proxy.h:33