2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
18 * @author Bartlomiej Grzelewski (b.grzelewski@samsung.com)
19 * @author Tomasz Swierczek (t.swierczek@samsung.com)
21 * @brief This file contais definictions of specific AutoPtr class.
35 struct UniversalFree {};
37 // Template Specialization
38 #define DECLARE_DELETER(type, function) \
40 struct UniversalFree <type> { \
41 void universal_free(type *ptr){ \
56 AutoPtr(const AutoPtr<T> &second)
58 m_data = second.m_data;
62 AutoPtr & operator=(const AutoPtr &second)
64 if (this != &second) {
65 UniversalFree<T> deleter;
66 deleter.universal_free(m_data);
67 m_data = second.m_data;
74 * overloaded -> operator, so smart ptr could act as ordinary ptr
83 UniversalFree<T> deleter;
84 deleter.universal_free(m_data);
88 * get internal pointer