00001 // -*- C++ -*- 00002 00003 //=========================================================================== 00004 /** 00005 * @file Copy_Disabled.h 00006 * 00007 * $Id: Copy_Disabled.h 74005 2006-08-14 11:30:00Z johnnyw $ 00008 * 00009 * @author Carlos O'Ryan <coryan@uci.edu> 00010 */ 00011 //=========================================================================== 00012 00013 #ifndef ACE_COPY_DISABLED_H 00014 #define ACE_COPY_DISABLED_H 00015 00016 #include /**/ "ace/pre.h" 00017 00018 #include /**/ "ace/ACE_export.h" 00019 00020 #if !defined (ACE_LACKS_PRAGMA_ONCE) 00021 # pragma once 00022 #endif /* ACE_LACKS_PRAGMA_ONCE */ 00023 00024 ACE_BEGIN_VERSIONED_NAMESPACE_DECL 00025 00026 /** 00027 * @class ACE_Copy_Disabled 00028 * 00029 * @brief Helper class to disable copy construction and assignment 00030 * 00031 * Classes used to control OS and other resources are not "canonical", 00032 * i.e. they have their copy constructor and assignment operators 00033 * disabled. 00034 * This is often done by making the copy constructor and assignment 00035 * operators private, effectively disallowing copying by clients of 00036 * the class (including derived classes). If the copy constructor and 00037 * assingment operators are left unimplemented then the class itself 00038 * cannot make any copies of its instances, because it would result in 00039 * link errors. 00040 * 00041 * To use this class simply use private inheritance: 00042 * 00043 * class Foo : private ACE_Copy_Disabled 00044 * { 00045 * // code here 00046 * }; 00047 * 00048 */ 00049 class ACE_Export ACE_Copy_Disabled 00050 { 00051 public: 00052 00053 /// Default constructor 00054 ACE_Copy_Disabled (void); 00055 00056 private: 00057 ACE_Copy_Disabled (const ACE_Copy_Disabled &); 00058 ACE_Copy_Disabled &operator= (const ACE_Copy_Disabled &); 00059 }; 00060 00061 ACE_END_VERSIONED_NAMESPACE_DECL 00062 00063 #include /**/ "ace/post.h" 00064 00065 #endif /* ACE_COPY_DISABLED_H */