diff options
-rw-r--r-- | ChangeLog | 24 | ||||
-rw-r--r-- | ChangeLogs/ChangeLog-02a | 24 | ||||
-rw-r--r-- | ChangeLogs/ChangeLog-03a | 24 | ||||
-rw-r--r-- | ace/Copy_Disabled.cpp | 21 | ||||
-rw-r--r-- | ace/Copy_Disabled.h | 55 | ||||
-rw-r--r-- | ace/Makefile | 3 | ||||
-rw-r--r-- | ace/Makefile.am | 2 | ||||
-rw-r--r-- | ace/Makefile.bor | 1 | ||||
-rw-r--r-- | ace/ace_dll.dsp | 22 | ||||
-rw-r--r-- | ace/ace_lib.dsp | 16 |
10 files changed, 180 insertions, 12 deletions
diff --git a/ChangeLog b/ChangeLog index 6af42088b70..efeefe932e7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,27 @@ +Mon Mar 04 11:20:45 2002 Carlos O'Ryan <coryan@uci.edu> + + * ace/Copy_Disabled.h: + * ace/Copy_Disabled.cpp: + Add new helper class to disable copy constructors and assignment + operators. I simply got sick of writing this repetitive code: + + // private & undefined + Foo (const Foo &); + Foo &operator= (const Foo&); + + The new class makes life *much* easier, simply say: + + class Foo : private ACE_Copy_Disabled + + Isn't that cool? + + * ace/Makefile: + * ace/Makefile.am: + * ace/Makefile.bor: + * ace/ace_dll.dsp: + * ace/ace_lib.dsp: + Add new file to the project files and Makefiles. + Mon Mar 4 07:36:12 2002 Johnny Willemsen <jwillemsen@remedy.nl> * tests/Token_Strategy_Test.cpp: diff --git a/ChangeLogs/ChangeLog-02a b/ChangeLogs/ChangeLog-02a index 6af42088b70..efeefe932e7 100644 --- a/ChangeLogs/ChangeLog-02a +++ b/ChangeLogs/ChangeLog-02a @@ -1,3 +1,27 @@ +Mon Mar 04 11:20:45 2002 Carlos O'Ryan <coryan@uci.edu> + + * ace/Copy_Disabled.h: + * ace/Copy_Disabled.cpp: + Add new helper class to disable copy constructors and assignment + operators. I simply got sick of writing this repetitive code: + + // private & undefined + Foo (const Foo &); + Foo &operator= (const Foo&); + + The new class makes life *much* easier, simply say: + + class Foo : private ACE_Copy_Disabled + + Isn't that cool? + + * ace/Makefile: + * ace/Makefile.am: + * ace/Makefile.bor: + * ace/ace_dll.dsp: + * ace/ace_lib.dsp: + Add new file to the project files and Makefiles. + Mon Mar 4 07:36:12 2002 Johnny Willemsen <jwillemsen@remedy.nl> * tests/Token_Strategy_Test.cpp: diff --git a/ChangeLogs/ChangeLog-03a b/ChangeLogs/ChangeLog-03a index 6af42088b70..efeefe932e7 100644 --- a/ChangeLogs/ChangeLog-03a +++ b/ChangeLogs/ChangeLog-03a @@ -1,3 +1,27 @@ +Mon Mar 04 11:20:45 2002 Carlos O'Ryan <coryan@uci.edu> + + * ace/Copy_Disabled.h: + * ace/Copy_Disabled.cpp: + Add new helper class to disable copy constructors and assignment + operators. I simply got sick of writing this repetitive code: + + // private & undefined + Foo (const Foo &); + Foo &operator= (const Foo&); + + The new class makes life *much* easier, simply say: + + class Foo : private ACE_Copy_Disabled + + Isn't that cool? + + * ace/Makefile: + * ace/Makefile.am: + * ace/Makefile.bor: + * ace/ace_dll.dsp: + * ace/ace_lib.dsp: + Add new file to the project files and Makefiles. + Mon Mar 4 07:36:12 2002 Johnny Willemsen <jwillemsen@remedy.nl> * tests/Token_Strategy_Test.cpp: diff --git a/ace/Copy_Disabled.cpp b/ace/Copy_Disabled.cpp new file mode 100644 index 00000000000..26c3d36834e --- /dev/null +++ b/ace/Copy_Disabled.cpp @@ -0,0 +1,21 @@ +/* -*- C++ -*- */ +/** + * @file Copy_Disabled.cpp + * + * $Id$ + * + * @author Carlos O'Ryan <coryan@uci.edu> + */ + +#include "ace/Copy_Disabled.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +ACE_RCSID(ace, Copy_Disabled, "$Id$") + +ACE_Copy_Disabled::ACE_Copy_Disabled (void) +{ +} + diff --git a/ace/Copy_Disabled.h b/ace/Copy_Disabled.h new file mode 100644 index 00000000000..5c315ba3ece --- /dev/null +++ b/ace/Copy_Disabled.h @@ -0,0 +1,55 @@ +/* -*- C++ -*- */ +/** + * @file Copy_Disabled.h + * + * $Id$ + * + * @author Carlos O'Ryan <coryan@uci.edu> + */ + +#ifndef ACE_COPY_DISABLED_H +#define ACE_COPY_DISABLED_H +#include "ace/pre.h" + +#include "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +/** + * @class ACE_Copy_Disabled + * + * @brief Helper class to disable copy construction and assignment + * + * Classes used to control OS and other resources are not "canonical", + * i.e. they have their copy constructor and assignment operators + * disabled. + * This is often done by making the copy constructor and assignment + * operators private, effectively disallowing copying by clients of + * the class (including derived classes). If the copy constructor and + * assingment operators are left unimplemented then the class itself + * cannot make any copies of its instances, because it would result in + * link errors. + * + * To use this class simply use private inheritance: + * + * class Foo : private ACE_Copy_Disabled + * { + * // code here + * }; + * + */ +class ACE_Export ACE_Copy_Disabled +{ +public: + /// Default constructor + ACE_Copy_Disabled (void); + +private: + ACE_Copy_Disabled (const ACE_Copy_Disabled &); + ACE_Copy_Disabled &operator= (const ACE_Copy_Disabled &); +}; + +#include "ace/post.h" +#endif /* ACE_FUNCTOR_H */ diff --git a/ace/Makefile b/ace/Makefile index 2eaf2e5610e..95a80f1d590 100644 --- a/ace/Makefile +++ b/ace/Makefile @@ -23,7 +23,8 @@ OS_FILES = \ OS_Log_Msg_Attributes \ Thread_Hook \ Sched_Params \ - Handle_Set + Handle_Set \ + Copy_Disabled UTILS_FILES = \ ACE \ Active_Map_Manager \ diff --git a/ace/Makefile.am b/ace/Makefile.am index 2f45abac6d5..ebeb17c0090 100644 --- a/ace/Makefile.am +++ b/ace/Makefile.am @@ -166,6 +166,7 @@ libACE_Utils_la_SOURCES = \ Configuration.cpp \ Configuration_Import_Export.cpp \ Containers.cpp \ + Copy_Disabled.cpp \ Dirent.cpp \ Dirent_Selector.cpp \ Dynamic.cpp \ @@ -555,6 +556,7 @@ HEADER_FILES = \ Connector.h \ Containers.h \ Containers_T.h \ + Copy_Disabled.h \ DEV.h \ DEV_Addr.h \ DEV_Connector.h \ diff --git a/ace/Makefile.bor b/ace/Makefile.bor index 7ff5a1e28ce..f71f63b849d 100644 --- a/ace/Makefile.bor +++ b/ace/Makefile.bor @@ -42,6 +42,7 @@ OBJFILES = \ $(OBJDIR)\Configuration_Import_Export.obj \ $(OBJDIR)\Connection_Recycling_Strategy.obj \ $(OBJDIR)\Containers.obj \ + $(OBJDIR)\Copy_Disabled.obj \ $(OBJDIR)\Date_Time.obj \ $(OBJDIR)\DEV.obj \ $(OBJDIR)\DEV_Addr.obj \ diff --git a/ace/ace_dll.dsp b/ace/ace_dll.dsp index 6a3fd01e911..785f18ddd77 100644 --- a/ace/ace_dll.dsp +++ b/ace/ace_dll.dsp @@ -7,21 +7,21 @@ CFG=ACE DLL - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
-!MESSAGE
+!MESSAGE
!MESSAGE NMAKE /f "ace_dll.mak".
-!MESSAGE
+!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
+!MESSAGE
!MESSAGE NMAKE /f "ace_dll.mak" CFG="ACE DLL - Win32 Debug"
-!MESSAGE
+!MESSAGE
!MESSAGE Possible choices for configuration are:
-!MESSAGE
+!MESSAGE
!MESSAGE "ACE DLL - Win32 MFC Release" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE "ACE DLL - Win32 MFC Debug" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE "ACE DLL - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE "ACE DLL - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
+!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
@@ -149,7 +149,7 @@ LINK32=link.exe # ADD LINK32 advapi32.lib user32.lib /nologo /subsystem:windows /dll /pdb:".\aced.pdb" /debug /machine:I386 /out:"..\bin\aced.dll"
# SUBTRACT LINK32 /pdb:none
-!ENDIF
+!ENDIF
# Begin Target
@@ -262,6 +262,10 @@ SOURCE=.\Containers.cpp # End Source File
# Begin Source File
+SOURCE=.\Copy_Disabled.cpp
+# End Source File
+# Begin Source File
+
SOURCE=.\Date_Time.cpp
# End Source File
# Begin Source File
@@ -1246,6 +1250,10 @@ SOURCE=.\Containers_T.h # End Source File
# Begin Source File
+SOURCE=.\Copy_Disabled.h
+# End Source File
+# Begin Source File
+
SOURCE=.\Date_Time.h
# End Source File
# Begin Source File
diff --git a/ace/ace_lib.dsp b/ace/ace_lib.dsp index 6b378b52099..55e4dcb5a4f 100644 --- a/ace/ace_lib.dsp +++ b/ace/ace_lib.dsp @@ -42,8 +42,8 @@ RSC=rc.exe # PROP Output_Dir ""
# PROP Intermediate_Dir ".\LIB\Release"
# PROP Target_Dir ""
-MTL=midl.exe
LINK32=link.exe -lib
+MTL=midl.exe
# ADD BASE CPP /nologo /MD /W3 /GX /O1 /I "../" /D ACE_HAS_DLL=0 /D "ACE_NO_INLINE" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /FD /c
# SUBTRACT BASE CPP /YX
# ADD CPP /nologo /MT /W3 /GX /O1 /I "../" /I "../PACE" /D ACE_OS_HAS_DLL=0 /D ACE_HAS_DLL=0 /D "ACE_NO_INLINE" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /FD /c
@@ -69,8 +69,8 @@ LIB32=link.exe -lib # PROP Output_Dir ""
# PROP Intermediate_Dir ".\LIB\Debug"
# PROP Target_Dir ""
-MTL=midl.exe
LINK32=link.exe -lib
+MTL=midl.exe
# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /Gy /I "../" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D ACE_HAS_DLL=0 /FD /c
# SUBTRACT BASE CPP /YX
# ADD CPP /nologo /MTd /W3 /GX /Z7 /Od /Gy /I "../" /I "../PACE" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D ACE_HAS_DLL=0 /D ACE_OS_HAS_DLL=0 /FD /c
@@ -96,8 +96,8 @@ LIB32=link.exe -lib # PROP Output_Dir ""
# PROP Intermediate_Dir ".\LIB\Release"
# PROP Target_Dir ""
-MTL=midl.exe
LINK32=link.exe -lib
+MTL=midl.exe
# ADD BASE CPP /nologo /G5 /MT /W3 /GX /O1 /I "../" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D ACE_HAS_DLL=0 /D "ACE_NO_INLINE" /YX /FD /c
# ADD CPP /nologo /MD /W3 /GX /Zi /O1 /I "../" /I "../PACE" /D "_WINDOWS" /D "NDEBUG" /D "ACE_AS_STATIC_LIBS" /D "WIN32" /FD /c
# SUBTRACT CPP /YX
@@ -122,8 +122,8 @@ LIB32=link.exe -lib # PROP Output_Dir ""
# PROP Intermediate_Dir ".\LIB\Debug"
# PROP Target_Dir ""
-MTL=midl.exe
LINK32=link.exe -lib
+MTL=midl.exe
# ADD BASE CPP /nologo /G5 /MTd /W3 /Gm /GX /Zi /Od /Gy /I "../" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D ACE_HAS_DLL=0 /D "ACE_NO_INLINE" /YX /FD /c
# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /Gy /I "../" /I "../PACE" /D "_WINDOWS" /D "_DEBUG" /D "ACE_AS_STATIC_LIBS" /D "WIN32" /FD /c
# SUBTRACT CPP /YX
@@ -249,6 +249,10 @@ SOURCE=.\Containers.cpp # End Source File
# Begin Source File
+SOURCE=.\Copy_Disabled.cpp
+# End Source File
+# Begin Source File
+
SOURCE=.\Date_Time.cpp
# End Source File
# Begin Source File
@@ -1241,6 +1245,10 @@ SOURCE=.\Containers_T.h # End Source File
# Begin Source File
+SOURCE=.\Copy_Disabled.h
+# End Source File
+# Begin Source File
+
SOURCE=.\Date_Time.h
# End Source File
# Begin Source File
|