OLD | NEW |
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ | 1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
2 /* | 2 /* |
3 * Copyright (c) 2015 Lawrence Livermore National Laboratory | 3 * Copyright (c) 2015 Lawrence Livermore National Laboratory |
4 * | 4 * |
5 * This program is free software; you can redistribute it and/or modify | 5 * This program is free software; you can redistribute it and/or modify |
6 * it under the terms of the GNU General Public License version 2 as | 6 * it under the terms of the GNU General Public License version 2 as |
7 * published by the Free Software Foundation; | 7 * published by the Free Software Foundation; |
8 * | 8 * |
9 * This program is distributed in the hope that it will be useful, | 9 * This program is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 * GNU General Public License for more details. | 12 * GNU General Public License for more details. |
13 * | 13 * |
14 * You should have received a copy of the GNU General Public License | 14 * You should have received a copy of the GNU General Public License |
15 * along with this program; if not, write to the Free Software | 15 * along with this program; if not, write to the Free Software |
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
17 * | 17 * |
18 * Author: Peter D. Barnes, Jr. <pdbarnes@llnl.gov> | 18 * Author: Peter D. Barnes, Jr. <pdbarnes@llnl.gov> |
19 */ | 19 */ |
20 | 20 |
21 #ifndef NS3_NON_COPYABLE_H | 21 #ifndef NS3_NON_COPYABLE_H |
22 #define NS3_NON_COPYABLE_H | 22 #define NS3_NON_COPYABLE_H |
23 | 23 |
| 24 #include "ns3/ns3-module.h" |
| 25 #define NS3_MODULE NS3_CORE_MODULE |
| 26 #include "ns3/ns3-export.h" |
| 27 |
24 /** | 28 /** |
25 * \file | 29 * \file |
26 * \ingroup access | 30 * \ingroup access |
27 * ns3::NonCopyable declaration. | 31 * ns3::NonCopyable declaration. |
28 */ | 32 */ |
29 | 33 |
30 /** | 34 /** |
31 * \ingroup core | 35 * \ingroup core |
32 * \defgroup access NonCopyable and Singleton | 36 * \defgroup access NonCopyable and Singleton |
33 * Helpers to make classes non-copyable or singleton. | 37 * Helpers to make classes non-copyable or singleton. |
(...skipping 10 matching lines...) Expand all Loading... |
44 * class ExampleNC : private NonCopyable { ... }; | 48 * class ExampleNC : private NonCopyable { ... }; |
45 * \endcode | 49 * \endcode |
46 * | 50 * |
47 * This class prevents each instance of a derived class from being copied. | 51 * This class prevents each instance of a derived class from being copied. |
48 * If you want only a single global instance of the derived class, | 52 * If you want only a single global instance of the derived class, |
49 * see Singleton. | 53 * see Singleton. |
50 * | 54 * |
51 * \internal | 55 * \internal |
52 * This is based on `boost::noncopyable`. | 56 * This is based on `boost::noncopyable`. |
53 */ | 57 */ |
54 class NonCopyable | 58 class NS3_EXPORT NonCopyable |
55 { | 59 { |
56 protected: | 60 protected: |
57 /** Constructor. */ | 61 /** Constructor. */ |
58 NonCopyable () {} | 62 NonCopyable () {} |
59 /** Destructor. */ | 63 /** Destructor. */ |
60 ~NonCopyable () {} | 64 ~NonCopyable () {} |
61 | 65 |
62 private: | 66 private: |
63 /** Copy constructor. Private, so not copyable. */ | 67 /** Copy constructor. Private, so not copyable. */ |
64 NonCopyable (const NonCopyable &); | 68 NonCopyable (const NonCopyable &); |
65 /** | 69 /** |
66 * Assignment. Private, so not copyable. | 70 * Assignment. Private, so not copyable. |
67 * \param [in] other The dummy argument | 71 * \param [in] other The dummy argument |
68 * \return The unmodified copy. | 72 * \return The unmodified copy. |
69 */ | 73 */ |
70 NonCopyable & operator = (const NonCopyable &other); | 74 NonCopyable & operator = (const NonCopyable &other); |
71 };· | 75 };· |
72 | 76 |
73 } // namespace ns3· | 77 } // namespace ns3· |
74 | 78 |
75 #endif /* NS3_NON_COPYABLE_H */ | 79 #endif /* NS3_NON_COPYABLE_H */ |
OLD | NEW |