summaryrefslogtreecommitdiff
path: root/ace/Copy_Disabled.h
blob: 583bc6830620dac2087a784d8d06172e1dd086f5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
// -*- 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/ACE_export.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_COPY_DISABLED_H */