00001 /** 00002 Licensed to the Apache Software Foundation (ASF) under one 00003 or more contributor license agreements. See the NOTICE file 00004 distributed with this work for additional information 00005 regarding copyright ownership. The ASF licenses this file 00006 to you under the Apache License, Version 2.0 (the 00007 "License"); you may not use this file except in compliance 00008 with the License. You may obtain a copy of the License at 00009 00010 http://www.apache.org/licenses/LICENSE-2.0 00011 00012 Unless required by applicable law or agreed to in writing, software 00013 distributed under the License is distributed on an "AS IS" BASIS, 00014 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00015 See the License for the specific language governing permissions and 00016 limitations under the License. 00017 */ 00018 00019 /** 00020 * @file noncopyable.h 00021 * @brief A base class used to prevent dervied classes from being copyable, this effectively 00022 * eliminates the copy constructor and assignment operator. 00023 */ 00024 00025 #pragma once 00026 #ifndef ATSCPPAPI_NONCOPYABLE_H_ 00027 #define ATSCPPAPI_NONCOPYABLE_H_ 00028 00029 namespace atscppapi { 00030 00031 /** 00032 * @brief noncopyable is a base class that will prevent derived classes from being copied. 00033 * 00034 * @private Prevent Doxygen from showing this class in the inheritance diagrams. 00035 * 00036 * To use noncopyable you only need to inherit from this class and you're derived class 00037 * will become uncopyable 00038 * 00039 * \code 00040 * class myClass : uncopyable { 00041 * public: 00042 * int test_; 00043 * } 00044 * 00045 * // The following will fail: 00046 * myClass a; 00047 * myClass b(a); // fails 00048 * myClass c = a; // fails 00049 * \endcode 00050 */ 00051 class noncopyable 00052 { 00053 protected: 00054 noncopyable() {} 00055 ~noncopyable() {} 00056 private: 00057 noncopyable(const noncopyable&); 00058 const noncopyable& operator=(const noncopyable&); 00059 }; 00060 00061 } /* atscppapi */ 00062 00063 00064 #endif /* ATSCPPAPI_NONCOPYABLE_H_ */