1 /*---------------------------------------------------------------------------* 2 Project: Horizon 3 File: util_NonCopyable.h 4 5 Copyright (C) 2009-2011 Nintendo. All rights reserved. 6 7 These coded instructions, statements, and computer programs contain 8 proprietary information of Nintendo of America Inc. and/or Nintendo 9 Company Ltd., and are protected by Federal copyright law. They may 10 not be disclosed to third parties or copied or duplicated in any form, 11 in whole or in part, without the prior written consent of Nintendo. 12 13 $Rev: 27772 $ 14 *---------------------------------------------------------------------------*/ 15 16 #ifdef __cplusplus 17 18 #ifndef NN_UTIL_UTIL_NONCOPYABLE_H_ 19 #define NN_UTIL_UTIL_NONCOPYABLE_H_ 20 21 namespace nn { namespace util { 22 23 /* ======================================================================= 24 Dummy for Reference Use 25 ======================================================================== */ 26 #ifdef NN_BUILD_DOCUMENT 27 28 //--------------------------------------------------------------------------- 29 //! :category Utility class template. 30 //! 31 //! @tparam T Derived class type that inherits from this class. 32 //! 33 //! @brief Class template for creating objects that cannot be copied. 34 //! 35 //! class A : To suppress copy operations, such as object copy constructors and substitutions, for Class A, define it as <tt>private nn::util::NonCopyable< A ></tt>. 36 //! 37 //--------------------------------------------------------------------------- 38 template <typename T> 39 class NonCopyable {}; 40 41 42 43 /* ======================================================================= 44 Definition Entity 45 ======================================================================== */ 46 #else 47 namespace ADLFireWall 48 { 49 template <typename T> 50 class NonCopyable 51 { 52 protected: 53 NonCopyable () {} 54 ~NonCopyable () {} 55 56 private: 57 // Copy constructor and assignment operator are made private. 58 NonCopyable (const NonCopyable &); 59 NonCopyable & operator = (const NonCopyable &); 60 }; 61 } 62 #endif 63 64 65 using ADLFireWall::NonCopyable; 66 67 }} 68 69 70 #endif /* NN_UTIL_NONCOPYABLE_H_ */ 71 72 #endif // __cplusplus 73