CTR Pia  4.11.3
Game Communication Engine
common_RootObject.h
1 /*---------------------------------------------------------------------------*
2  Project: Pia
3  File: common_RootObject.h
4 
5  Copyright Nintendo. All rights reserved.
6 
7  These coded instructions, statements, and computer programs contain
8  proprietary information of Nintendo of America Inc. and/or Nintendo
9  Company Ltd., and are protected by Federal copyright law. They may
10  not be disclosed to third parties or copied or duplicated in any form,
11  in whole or in part, without the prior written consent of Nintendo.
12  *---------------------------------------------------------------------------*/
13 
14 
15 #pragma once
16 
17 #include <pia/definitions.h>
18 
19 #define NN_PIA_USE_ROOTOBJECT_NEW 1
20 
21 #if NN_PIA_USE_ROOTOBJECT_NEW
22 #include <new>
23 #endif // end of NN_PIA_USE_ROOTOBJECT_NEW
24 
25 
26 namespace nn
27 {
28 namespace pia
29 {
30 namespace common
31 {
32 
33 
34 /*!
35 @brief This is the common base class used inside the Pia library.
36 
37 @date 2012-04-23 Removed an unneeded destructor.
38 @date 2012-04-23 Initial version.
39 */
41 {
42 public:
43 /*!
44 @brief Instantiates the object.
45 */
46  RootObject(void)
47  {
48  }
49 
50 
51 #if NN_PIA_USE_ROOTOBJECT_NEW
52 /*!
53 @cond PRIVATE
54 @brief Plain <tt>new</tt>.
55 */
56  static void* operator new(std::size_t size) throw();
57  //! @endcond
58 
59 
60 /*!
61 @cond PRIVATE
62 @brief Non-throwing <tt>new</tt>.
63 */
64  static void* operator new(std::size_t size, std::nothrow_t) throw();
65  //! @endcond
66 
67 
68 /*!
69 @cond PRIVATE
70 @brief Placement <tt>new</tt>.
71 */
72  static void* operator new(std::size_t, void* p) throw()
73  {
74  return p;
75  }
76  //! @endcond
77 
78 
79 /*!
80 @cond PRIVATE
81 @brief Plain <tt>new</tt>.
82 */
83  static void* operator new[](std::size_t size) throw();
84  //! @endcond
85 
86 
87 /*!
88 @cond PRIVATE
89 @brief Non-throwing <tt>new</tt> (array version).
90 */
91  static void* operator new[](std::size_t size, std::nothrow_t) throw();
92  //! @endcond
93 
94 
95 /*!
96 @cond PRIVATE
97 @brief Placement <tt>new</tt> (array version).
98 */
99  static void* operator new[](std::size_t, void* p) throw()
100  {
101  return p;
102  }
103  //! @endcond
104 
105 
106 /*!
107 @cond PRIVATE
108 @brief Delete operator.
109 */
110  static void operator delete(void* p);
111  //! @endcond
112 
113 
114 /*!
115 @cond PRIVATE
116 @brief Delete operator (array version).
117 */
118  static void operator delete[](void* p);
119 //! @endcond
120 
121 
122 #if NN_PIA_WIN || NN_PIA_NIN_WIN
123 
124  // On Win platform, a <tt>delete</tt> that corresponds to <tt>new</tt> is required.
125 
126 /*!
127 @cond PRIVATE
128 @brief Delete operator for non-throwing <tt>new</tt>.
129 */
130  static void operator delete(void* p, std::nothrow_t) throw();
131  //! @endcond
132 
133 /*!
134 @cond PRIVATE
135 @brief Delete operator for placement <tt>new</tt>.
136 */
137  static void operator delete(void* p, void*) throw();
138  //! @endcond
139 
140 /*!
141 @cond PRIVATE
142 @brief Delete operator for non-throwing <tt>new</tt> (array version).
143 */
144  static void operator delete[](void* p, std::nothrow_t) throw();
145  //! @endcond
146 
147 /*!
148 @cond PRIVATE
149 @brief Delete operator for placement <tt>new</tt> (array version).
150 */
151  static void operator delete[](void* p, void*) throw();
152 //! @endcond
153 
154 #endif
155 
156 #endif // end of NN_PIA_USE_ROOTOBJECT_NEW
157 };
158 }
159 }
160 } // end of namespace nn::pia::common
RootObject(void)
Instantiates the object.
Definition: common_RootObject.h:46
Definition: assert.h:115
This is the common base class used inside the Pia library.
Definition: common_RootObject.h:40