1 /*
2 * \brief Non-copyable objects design pattern.
3 * \author Stefan Kalkowski
4 * \date 2012-02-16
5 */
6
7 /*
8 * Copyright (C) 2012-2013 Genode Labs GmbH
9 *
10 * This file is part of the Genode OS framework, which is distributed
11 * under the terms of the GNU General Public License version 2.
12 */
13
14 #ifndef _INCLUDE__UTIL__NONCOPYABLE_H_
15 #define _INCLUDE__UTIL__NONCOPYABLE_H_
16
17 namespace Genode { class Noncopyable; }
18
19
20 /**
21 * Classes of objects not allowed to be copied, should inherit from this one.
22 *
23 * This class declares a private copy-constructor and assignment-operator.
24 * It`s sufficient to inherit private from this class, and let the compiler
25 * detect any copy violations.
26 */
27 class Genode::Noncopyable
28 {
29 private:
30
31 /**
32 * Constructor
33 */
34 Noncopyable(const Noncopyable&);
35
36 const Noncopyable& operator=(const Noncopyable&);
37
38 protected:
39
40 /**
41 * Constructor
42 *
43 * \noapi
44 */
45 Noncopyable() {}
46
47 /**
48 * Destructor
49 *
50 * \noapi
51 */
52 ~Noncopyable() {}
53 };
54
55 #endif /* _INCLUDE__UTIL__NONCOPYABLE_H_ */