1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef INCLUDED_BRIDGES_SOURCE_CPP_UNO_SHARED_GUARDEDARRAY_HXX
25 #define INCLUDED_BRIDGES_SOURCE_CPP_UNO_SHARED_GUARDEDARRAY_HXX
26 
27 namespace bridges { namespace cpp_uno { namespace shared {
28 
29 template< typename T > class GuardedArray {
30 public:
GuardedArray(T * thePointer)31     explicit GuardedArray(T * thePointer): pointer(thePointer) {}
32 
~GuardedArray()33     ~GuardedArray() { delete[] pointer; }
34 
get() const35     T * get() const { return pointer; }
36 
release()37     T * release() { T * p = pointer; pointer = 0; return p; }
38 
39 private:
40     GuardedArray(GuardedArray &); // not implemented
41     void operator =(GuardedArray); // not implemented
42 
43     T * pointer;
44 };
45 
46 } } }
47 
48 #endif
49