15 #ifndef DTOOLBASE_CC_H 16 #define DTOOLBASE_CC_H 25 #define __PDT_STDBOOL_H_ 35 #define TYPENAME typename 37 #define NOEXCEPT noexcept 42 #define EXPORT_TEMPLATE_CLASS(expcl, exptp, classname) 48 #define PUBLISHED __published 50 typedef int streamsize;
51 typedef int ios_openmode;
52 typedef int ios_fmtflags;
53 typedef int ios_iostate;
54 typedef int ios_seekdir;
71 #include "fakestringstream.h" 85 #define TYPENAME typename 92 typedef unsigned short wchar_t;
97 typedef basic_string<wchar_t> wstring;
100 #ifndef HAVE_STREAMSIZE 102 typedef int streamsize;
105 #ifndef HAVE_IOS_TYPEDEFS 106 typedef int ios_openmode;
107 typedef int ios_fmtflags;
108 typedef int ios_iostate;
110 typedef ios::seek_dir ios_seekdir;
112 typedef ios::openmode ios_openmode;
113 typedef ios::fmtflags ios_fmtflags;
114 typedef ios::iostate ios_iostate;
115 typedef ios::seekdir ios_seekdir;
118 #if defined(WIN32_VC) && defined(FORCE_INLINING) 122 #define INLINE __forceinline 124 #define INLINE inline 128 #if defined(__has_extension) // Clang magic. 129 # if __has_extension(cxx_constexpr) 130 # define CONSTEXPR constexpr 132 # define CONSTEXPR INLINE 134 # if __has_extension(cxx_noexcept) 135 # define NOEXCEPT noexcept 139 # if __has_extension(cxx_rvalue_references) && (__cplusplus >= 201103L) 140 # define USE_MOVE_SEMANTICS 141 # define MOVE(x) move(x) 145 # if __has_extension(cxx_override_control) && (__cplusplus >= 201103L) 147 # define OVERRIDE override 152 #elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7)) && (__cplusplus >= 201103L) 155 # define CONSTEXPR constexpr 156 # define NOEXCEPT noexcept 157 # define USE_MOVE_SEMANTICS 159 # define OVERRIDE override 160 # define MOVE(x) move(x) 161 #elif defined(_MSC_VER) && _MSC_VER >= 1600 163 # define CONSTEXPR INLINE 164 # define NOEXCEPT throw() 165 # define USE_MOVE_SEMANTICS 168 # define MOVE(x) move(x) 170 # define CONSTEXPR INLINE 177 #if defined(WIN32_VC) && !defined(LINK_ALL_STATIC) && defined(EXPORT_TEMPLATES) 182 #define EXPORT_TEMPLATE_CLASS(expcl, exptp, classname) \ 183 exptp template class expcl classname; 185 #define EXPORT_TEMPLATE_CLASS(expcl, exptp, classname) 192 #define PUBLISHED public 206 EXPCL_DTOOL
void init_memory_hook();
210 #ifndef USE_MEMORY_NOWRAPPERS 211 #define PANDA_MALLOC_SINGLE(size) (memory_hook->heap_alloc_single(size)) 212 #define PANDA_FREE_SINGLE(ptr) memory_hook->heap_free_single(ptr) 213 #define PANDA_MALLOC_ARRAY(size) (memory_hook->heap_alloc_array(size)) 214 #define PANDA_REALLOC_ARRAY(ptr, size) (memory_hook->heap_realloc_array(ptr, size)) 215 #define PANDA_FREE_ARRAY(ptr) memory_hook->heap_free_array(ptr) 217 #define PANDA_MALLOC_SINGLE(size) ::malloc(size) 218 #define PANDA_FREE_SINGLE(ptr) ::free(ptr) 219 #define PANDA_MALLOC_ARRAY(size) ::malloc(size) 220 #define PANDA_REALLOC_ARRAY(ptr, size) ::realloc(ptr, size) 221 #define PANDA_FREE_ARRAY(ptr) ::free(ptr) 222 #endif // USE_MEMORY_NOWRAPPERS 224 #if defined(HAVE_THREADS) && defined(SIMPLE_THREADS) 227 extern EXPCL_DTOOL void (*global_thread_yield)();
228 extern EXPCL_DTOOL void (*global_thread_consider_yield)();
230 INLINE
void thread_yield() {
231 (*global_thread_yield)();
233 INLINE
void thread_consider_yield() {
234 (*global_thread_consider_yield)();
239 INLINE
void thread_yield() {
241 INLINE
void thread_consider_yield() {
244 #endif // HAVE_THREADS && SIMPLE_THREADS 246 #if defined(USE_TAU) && defined(WIN32) 248 extern EXPCL_DTOOL
bool __tau_shutdown;
249 class EXPCL_DTOOL TauProfile {
251 TauProfile(
void *&tautimer,
char *name,
char *type,
int group,
char *group_name) {
252 Tau_profile_c_timer(&tautimer, name, type, group, group_name);
253 _tautimer = tautimer;
254 TAU_PROFILE_START(_tautimer);
257 if (!__tau_shutdown) {
258 TAU_PROFILE_STOP(_tautimer);
267 #define TAU_PROFILE(name, type, group) \ 268 static void *__tautimer; \ 269 TauProfile __taupr(__tautimer, name, type, group, #group) 271 #undef TAU_PROFILE_EXIT 272 #define TAU_PROFILE_EXIT(msg) \ 273 __tau_shutdown = true; \ 278 #endif // __cplusplus
A base class for all things that want to be reference-counted.
This class provides a wrapper around the various possible malloc schemes Panda might employ...