Xalan-C++ API Documentation

The Xalan C++ XSLT Processor Version 1.10

XalanMemMgrHelper.hpp
Go to the documentation of this file.
1 /*
2  * Copyright 1999-2004 The Apache Software 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 #if !defined(XALANMEMMGRHELPER_HEADER_GUARD_1357924680)
17 #define XALANMEMMGRHELPER_HEADER_GUARD_1357924680
18 
19 
20 
21 // Base include file. Must be first.
23 
24 
25 
27 
28 
29 
30 
31 XALAN_CPP_NAMESPACE_BEGIN
32 
33 template <class Type>
34 inline Type*
35 cloneObjWithMemMgr(const Type& other, MemoryManagerType& theManager)
36 {
37 
38  XalanMemMgrAutoPtr<Type, false> theGuard( theManager , (Type*)theManager.allocate(sizeof(Type)));
39 
40  Type* theResult = theGuard.get();
41 
42  new (theResult) Type(other, theManager);
43 
44  theGuard.release();
45 
46  return theResult;
47 }
48 
49 
50 
51 template <class Type>
52 inline Type*
53 cloneObj(const Type& other, MemoryManagerType& theManager)
54 {
55 
56  XalanMemMgrAutoPtr<Type, false> theGuard( theManager , (Type*)theManager.allocate(sizeof(Type)));
57 
58  Type* theResult = theGuard.get();
59 
60  new (theResult) Type(other);
61 
62  theGuard.release();
63 
64  return theResult;
65 }
66 
67 
68 
69 template <class Type>
71 {
72 public:
73  Type*
75  {
76 
77  XalanMemMgrAutoPtr<Type, false> theGuard( theManager , (Type*)theManager.allocate(sizeof(Type)));
78 
79  Type* theResult = theGuard.get();
80 
81  new (theResult) Type(theManager);
82 
83  theGuard.release();
84 
85  return theResult;
86  }
87 };
88 
89 template <class Type>
90 inline void
91 destroyObjWithMemMgr(const Type* ptr, MemoryManagerType& theManager)
92 {
93  if (ptr != 0)
94  {
95  Type* const nonConstPointer =
96 #if defined(XALAN_OLD_STYLE_CASTS)
97  (const Type*)ptr;
98 #else
99  const_cast<Type*>(ptr);
100 #endif
101  nonConstPointer->~Type();
102 
103  theManager.deallocate(nonConstPointer);
104  }
105 }
106 
107 
108 
109 XALAN_CPP_NAMESPACE_END
110 
111 
112 
113 #endif // if !defined(XALANMEMMGRHELPER_HEADER_GUARD_1357924680)

Interpreting class diagrams

Doxygen and GraphViz are used to generate this API documentation from the Xalan-C header files.

dot

Xalan-C++ XSLT Processor Version 1.10
Copyright © 1999-2004 The Apache Software Foundation. All Rights Reserved.

Apache Logo