30 #ifndef PTLIB_OBJECT_H
31 #define PTLIB_OBJECT_H
37 #include <ptlib_config.h>
40 #include "msos/ptlib/platform.h"
42 #include "unix/ptlib/platform.h"
79 #if !defined __GNUC__ || __GNUC__ >= 5
80 #define P_MAX_INDEX ::std::numeric_limits<PINDEX>::max()
81 #elif P_PINDEX_IS_SIZE_T
88 #define PASSERTINDEX(idx) PAssert((idx) >= 0, PInvalidArrayIndex)
90 #define PASSERTINDEX(idx)
97 #if __cplusplus < 201103L
98 template <
typename T>
class PAutoPtr :
public std::auto_ptr<T>
107 template <
typename T>
class PAutoPtr :
public std::unique_ptr<T>
111 explicit PAutoPtr(T * p) : std::unique_ptr<T>(p) { }
112 void transfer(
PAutoPtr & other) { std::unique_ptr<T>::operator=(std::move(other)); }
119 #define P_REMOVE_VIRTUAL_INTERNAL_BASE(fn) __inline virtual struct ptlib_virtual_function_changed_or_removed ****** fn { return 0; }
121 #if defined(_MSC_VER)
124 #define P_REMOVE_VIRTUAL_INTERNAL(type, fn, body) P_REMOVE_VIRTUAL_INTERNAL_BASE(fn)
125 #elif _MSC_VER < 1400
126 #define P_DEPRECATED __declspec(deprecated)
127 #define P_REMOVE_VIRTUAL_INTERNAL(type, fn, body) __inline virtual __declspec(deprecated) type fn body
129 #define P_DEPRECATED __declspec(deprecated)
130 #define P_REMOVE_VIRTUAL_INTERNAL(type, fn, body) __inline virtual __declspec(deprecated("Virtual function signature changed or function deprecated")) type fn body
132 #elif defined(__GNUC__)
135 #define P_REMOVE_VIRTUAL_INTERNAL(type, fn, body) P_REMOVE_VIRTUAL_INTERNAL_BASE(fn)
137 #define P_DEPRECATED __attribute__((deprecated))
138 #define P_REMOVE_VIRTUAL_INTERNAL(type, fn, body) __attribute__((warn_unused_result)) __attribute__((deprecated)) P_REMOVE_VIRTUAL_INTERNAL_BASE(fn)
142 #define P_REMOVE_VIRTUAL_INTERNAL(type, fn, body) P_REMOVE_VIRTUAL_INTERNAL_BASE(fn)
145 #define P_REMOVE_VIRTUAL_VOID(fn) P_REMOVE_VIRTUAL_INTERNAL(void, fn, {})
146 #define P_REMOVE_VIRTUAL(type, fn, ret) P_REMOVE_VIRTUAL_INTERNAL(type, fn, { return ret; })
150 #define P_PUSH_MSVC_WARNINGS(warnings) __pragma(warning(push)) __pragma(warning(disable:warnings))
151 #define P_POP_MSVC_WARNINGS() __pragma(warning(pop))
153 #define P_PUSH_MSVC_WARNINGS(warnings)
154 #define P_POP_MSVC_WARNINGS()
156 #define P_DISABLE_MSVC_WARNINGS(warnings, statement) P_PUSH_MSVC_WARNINGS(warnings) statement P_POP_MSVC_WARNINGS()
159 #define PIGNORE_RETURN(t,e) (void)(e)
161 #define PIGNORE_RETURN(t,e) do { t unused __attribute__((unused)) = (e); } while(0)
183 #ifndef P_USE_INLINES
185 #define P_USE_INLINES 0
187 #define P_USE_INLINES 0
192 #define PINLINE __inline
203 #define PARG_COUNT(...) PARG_COUNT_PART2(PARG_COUNT_PART1(__VA_ARGS__))
204 #define PARG_COUNT_PART1(...) unused, __VA_ARGS__
205 #define PARG_COUNT_PART2(...) PARG_COUNT_PART3(PARG_COUNT_PART4(__VA_ARGS__,39,38,37,36,35,34,33,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0))
206 #define PARG_COUNT_PART3(x) x
207 #define PARG_COUNT_PART4(_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,N,...) N
209 #define PARG_COUNT(...) PARG_COUNT_INTERNAL(0,##__VA_ARGS__,40,39,38,37,36,35,34,33,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0)
210 #define PARG_COUNT_INTERNAL(_0,_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,N,...) N
214 #define P_STRINGISE(v) P_STRINGISE_PART2(v)
215 #define P_STRINGIZE(v) P_STRINGISE_PART2(v)
216 #define P_STRINGISE_PART2(v) #v
229 #define P_DECLARE_ENUM_EX(name, countName, firstName, firstValue, ...) \
230 enum name { firstName = firstValue, Begin##name = firstName, __VA_ARGS__, End##name, countName = End##name-Begin##name }; \
231 friend __inline name operator++(name & e ) { PAssert(e < End##name, PInvalidParameter); return e = (name)(e+1); } \
232 friend __inline name operator++(name & e, int) { PAssert(e < End##name, PInvalidParameter); name o=e; e = (name)(e+1); return o; } \
233 friend __inline name operator--(name & e ) { PAssert(e >= Begin##name, PInvalidParameter); return e = (name)(e-1); } \
234 friend __inline name operator--(name & e, int) { PAssert(e >= Begin##name, PInvalidParameter); name o=e; e = (name)(e-1); return o; } \
235 static __inline name name##FromInt(int v) { return (name)(v < Begin##name ? Begin##name : v >= End##name ? (End##name-1) : v); }
248 #define P_DECLARE_ENUM(name, first, ...) P_DECLARE_ENUM_EX(name, Num##name, first, 0, __VA_ARGS__)
250 extern void PPrintEnum(std::ostream & strm,
int e,
int begin,
int end,
char const *
const * names);
251 extern int PReadEnum(std::istream & strm,
int begin,
int end,
char const *
const * names,
bool matchCase =
true);
252 extern int PParseEnum(
const char * str,
int begin,
int end,
char const *
const * names,
bool matchCase =
true);
254 #define P_ENUM_NAMES_PART1(narg, args)P_ENUM_NAMES_PART2(narg, args)
255 #define P_ENUM_NAMES_PART2(narg, args) P_ENUM_NAMES_ARG_##narg args
256 #define P_ENUM_NAMES_ARG_1(_1 )#_1
257 #define P_ENUM_NAMES_ARG_2(_1,_2 )#_1,#_2
258 #define P_ENUM_NAMES_ARG_3(_1,_2,_3 )#_1,#_2,#_3
259 #define P_ENUM_NAMES_ARG_4(_1,_2,_3,_4 )#_1,#_2,#_3,#_4
260 #define P_ENUM_NAMES_ARG_5(_1,_2,_3,_4,_5 )#_1,#_2,#_3,#_4,#_5
261 #define P_ENUM_NAMES_ARG_6(_1,_2,_3,_4,_5,_6 )#_1,#_2,#_3,#_4,#_5,#_6
262 #define P_ENUM_NAMES_ARG_7(_1,_2,_3,_4,_5,_6,_7 )#_1,#_2,#_3,#_4,#_5,#_6,#_7
263 #define P_ENUM_NAMES_ARG_8(_1,_2,_3,_4,_5,_6,_7,_8 )#_1,#_2,#_3,#_4,#_5,#_6,#_7,#_8
264 #define P_ENUM_NAMES_ARG_9(_1,_2,_3,_4,_5,_6,_7,_8,_9 )#_1,#_2,#_3,#_4,#_5,#_6,#_7,#_8,#_9
265 #define P_ENUM_NAMES_ARG_10(_1,_2,_3,_4,_5,_6,_7,_8,_9,_10 )#_1,#_2,#_3,#_4,#_5,#_6,#_7,#_8,#_9,#_10
266 #define P_ENUM_NAMES_ARG_11(_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11 )#_1,#_2,#_3,#_4,#_5,#_6,#_7,#_8,#_9,#_10,#_11
267 #define P_ENUM_NAMES_ARG_12(_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12 )#_1,#_2,#_3,#_4,#_5,#_6,#_7,#_8,#_9,#_10,#_11,#_12
268 #define P_ENUM_NAMES_ARG_13(_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13 )#_1,#_2,#_3,#_4,#_5,#_6,#_7,#_8,#_9,#_10,#_11,#_12,#_13
269 #define P_ENUM_NAMES_ARG_14(_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14 )#_1,#_2,#_3,#_4,#_5,#_6,#_7,#_8,#_9,#_10,#_11,#_12,#_13,#_14
270 #define P_ENUM_NAMES_ARG_15(_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15 )#_1,#_2,#_3,#_4,#_5,#_6,#_7,#_8,#_9,#_10,#_11,#_12,#_13,#_14,#_15
271 #define P_ENUM_NAMES_ARG_16(_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16 )#_1,#_2,#_3,#_4,#_5,#_6,#_7,#_8,#_9,#_10,#_11,#_12,#_13,#_14,#_15,#_16
272 #define P_ENUM_NAMES_ARG_17(_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16,_17 )#_1,#_2,#_3,#_4,#_5,#_6,#_7,#_8,#_9,#_10,#_11,#_12,#_13,#_14,#_15,#_16,#_17
273 #define P_ENUM_NAMES_ARG_18(_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16,_17,_18 )#_1,#_2,#_3,#_4,#_5,#_6,#_7,#_8,#_9,#_10,#_11,#_12,#_13,#_14,#_15,#_16,#_17,#_18
274 #define P_ENUM_NAMES_ARG_19(_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16,_17,_18,_19 )#_1,#_2,#_3,#_4,#_5,#_6,#_7,#_8,#_9,#_10,#_11,#_12,#_13,#_14,#_15,#_16,#_17,#_18,#_19
275 #define P_ENUM_NAMES_ARG_20(_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16,_17,_18,_19,_20 )#_1,#_2,#_3,#_4,#_5,#_6,#_7,#_8,#_9,#_10,#_11,#_12,#_13,#_14,#_15,#_16,#_17,#_18,#_19,#_20
276 #define P_ENUM_NAMES_ARG_21(_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16,_17,_18,_19,_20,_21 )#_1,#_2,#_3,#_4,#_5,#_6,#_7,#_8,#_9,#_10,#_11,#_12,#_13,#_14,#_15,#_16,#_17,#_18,#_19,#_20,#_21
277 #define P_ENUM_NAMES_ARG_22(_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16,_17,_18,_19,_20,_21,_22 )#_1,#_2,#_3,#_4,#_5,#_6,#_7,#_8,#_9,#_10,#_11,#_12,#_13,#_14,#_15,#_16,#_17,#_18,#_19,#_20,#_21,#_22
278 #define P_ENUM_NAMES_ARG_23(_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16,_17,_18,_19,_20,_21,_22,_23 )#_1,#_2,#_3,#_4,#_5,#_6,#_7,#_8,#_9,#_10,#_11,#_12,#_13,#_14,#_15,#_16,#_17,#_18,#_19,#_20,#_21,#_22,#_23
279 #define P_ENUM_NAMES_ARG_24(_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16,_17,_18,_19,_20,_21,_22,_23,_24 )#_1,#_2,#_3,#_4,#_5,#_6,#_7,#_8,#_9,#_10,#_11,#_12,#_13,#_14,#_15,#_16,#_17,#_18,#_19,#_20,#_21,#_22,#_23,#_24
280 #define P_ENUM_NAMES_ARG_25(_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 )#_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
281 #define P_ENUM_NAMES_ARG_26(_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 )#_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
282 #define P_ENUM_NAMES_ARG_27(_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 )#_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
283 #define P_ENUM_NAMES_ARG_28(_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 )#_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
284 #define P_ENUM_NAMES_ARG_29(_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 )#_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
285 #define P_ENUM_NAMES_ARG_30(_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 )#_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
286 #define P_ENUM_NAMES_ARG_31(_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 )#_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
287 #define P_ENUM_NAMES_ARG_32(_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 )#_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
288 #define P_ENUM_NAMES_ARG_33(_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 )#_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
289 #define P_ENUM_NAMES_ARG_34(_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 )#_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
290 #define P_ENUM_NAMES_ARG_35(_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 )#_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
291 #define P_ENUM_NAMES_ARG_36(_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 )#_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
292 #define P_ENUM_NAMES_ARG_37(_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 )#_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
293 #define P_ENUM_NAMES_ARG_38(_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 )#_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
294 #define P_ENUM_NAMES_ARG_39(_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 )#_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
295 #define P_ENUM_NAMES_ARG_40(_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)#_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
303 #define P_DECLARE_ENUM_NAMES(name, ...) \
304 struct PEnumNames_##name { \
305 static char const * const * Names() { static char const * const Strings[] = { __VA_ARGS__ }; return Strings; } \
307 friend __inline std::ostream & operator<<(std::ostream & strm, name e) \
308 { PPrintEnum(strm, e, Begin##name, End##name, PEnumNames_##name::Names()); return strm; } \
309 friend __inline std::istream & operator>>(std::istream & strm, name & e) \
310 { e = (name)PReadEnum(strm, Begin##name, End##name, PEnumNames_##name::Names()); return strm; } \
311 static __inline const char * name##ToString(name e) { return e >= Begin##name && e < End##name ? PAssertNULL(PEnumNames_##name::Names()[e-Begin##name]) : ""; } \
312 static __inline name name##FromString(const char * str, bool matchCase = true) { return (name)PParseEnum(str, Begin##name, End##name, PEnumNames_##name::Names(), matchCase); }
318 #define P_DECLARE_STREAMABLE_ENUM_EX(name, countName, firstName, firstValue, ...) \
319 P_DECLARE_ENUM_EX(name, countName, firstName, firstValue, __VA_ARGS__) \
320 P_DECLARE_ENUM_NAMES(name, #firstName, P_ENUM_NAMES_PART1(PARG_COUNT(__VA_ARGS__), (__VA_ARGS__)))
326 #define P_DECLARE_STREAMABLE_ENUM(name, first, ...) P_DECLARE_STREAMABLE_ENUM_EX(name, Num##name, first, 0, __VA_ARGS__)
340 : m_file(NULL), m_line(0), m_extra(extra) { }
342 : m_file(file), m_line(line), m_extra(extra) { }
345 void PrintOn(ostream & strm,
const char * prefix = NULL)
const;
350 #define P_DEBUG_LOCATION PDebugLocation(__FILE__, __LINE__)
353 #ifndef P_USE_ASSERTS
354 #define P_USE_ASSERTS 1
359 #define PAssert(b, m) (b)
360 #define PAssert2(b, c, m) (b)
361 #define PAssertOS(b) (b)
362 #define PAssertNULL(p) (p)
363 #define PAssertAlways(m) {}
364 #define PAssertAlways2(c, m) {}
366 #else // P_USE_ASSERTS
386 #define __CLASS__ NULL
400 #define PAssert(b, msg) ((b)?true:PAssertFunc(PDebugLocation(__FILE__,__LINE__,__CLASS__),(msg)))
409 #define PAssert2(b, cls, msg) ((b)?true:PAssertFunc(PDebugLocation(__FILE__,__LINE__,(cls)),(msg)))
417 #define PAssertOS(b) ((b)?true:PAssertFunc(PDebugLocation(__FILE__,__LINE__,__CLASS__),POperatingSystemError))
428 #define PAssertNULL(ptr) (((ptr)!=NULL)?(ptr): \
429 (PAssertFunc(PDebugLocation(__FILE__,__LINE__, __CLASS__), PNullPointerReference),(ptr)))
437 #define PAssertAlways(msg) PAssertFunc(PDebugLocation(__FILE__,__LINE__,__CLASS__),(msg))
445 #define PAssertAlways2(cls, msg) PAssertFunc(PDebugLocation(__FILE__,__LINE__,(cls)),(msg))
447 #endif // P_USE_ASSERTS
475 #define PError (PGetErrorStream())
512 DateAndTime = 0x0002,
516 FileAndLine = 0x0020,
517 ThreadAddress = 0x0040,
518 AppendToFile = 0x0080,
520 RotateDaily = 0x0200,
521 RotateHourly = 0x0400,
522 RotateMinutely = 0x0800,
523 RotateLogMask = RotateDaily + RotateHourly + RotateMinutely,
525 ObjectInstance = 0x1000,
526 ContextIdentifier = 0x2000,
528 SystemLogStream = 0x8000,
531 HasFilePermissions = 0x8000000,
532 FilePermissionMask = 0x7ff0000,
534 FilePermissionShift = 16
538 #define PTRACE_ARGLIST_OPT_HELP \
539 "use +X or -X to add/remove option where X is one of:\r" \
540 " block PTrace::Block constructs in output\r" \
541 " time time since program start\r" \
542 " date date and time\r" \
543 " gmt Date/time is in UTC\r" \
544 " thread thread name and identifier\r" \
545 " level log level\r" \
546 " source source file name and line number\r" \
547 " object PObject pointer\r" \
548 " context context identifier\r" \
549 " single single line output\r" \
550 " daily rotate output file daily\r" \
551 " hour rotate output file hourly\r" \
552 " minute rotate output file every minute\r" \
553 " append append to output file, otherwise overwrites\r" \
554 " <perm> file permission similar to unix chmod, but starts\r" \
555 " with +/- and only has one combination at a time,\r" \
556 " e.g. +uw is user write, +or is other read, etc"
558 #define PTRACE_ARG_TRACE "trace"
559 #define PTRACE_ARG_LEVEL "trace-level"
560 #define PTRACE_ARG_OUTPUT "output"
561 #define PTRACE_ARG_ROLLOVER "trace-rollover"
562 #define PTRACE_ARG_OPTION "trace-option"
564 #define PTRACE_ARGLIST_EXT(t,l,o,r,O) \
565 t "-" PTRACE_ARG_TRACE ". Trace enable (use multiple times for more detail).\n" \
566 l "-" PTRACE_ARG_LEVEL ": Specify trace detail level.\n" \
567 o "-" PTRACE_ARG_OUTPUT ": Specify filename for trace output\rMay be special value such as \"stderr\" dependent on platform.\n" \
568 r "-" PTRACE_ARG_ROLLOVER ": Specify trace file rollover file name pattern.\n" \
569 O "-" PTRACE_ARG_OPTION ": Specify trace option(s),\r" PTRACE_ARGLIST_OPT_HELP "\n"
571 #define PTRACE_ARGLIST PTRACE_ARGLIST_EXT("t","","o","","")
573 #define PTRACE_INITIALISE(...) PTrace::Initialise(__VA_ARGS__)
578 static void Initialise(
584 Timestamp | Thread | Blocks,
623 static void Initialise(
625 const char * filename = NULL,
626 unsigned options = Timestamp | Thread | Blocks,
627 const char * rolloverPattern = NULL
633 const char * filename,
634 const char * rolloverPattern,
635 unsigned options = Timestamp | Thread | Blocks
636 ) { Initialise(level, filename, options, rolloverPattern); }
640 static void SetFilename(
641 const char * filename
648 static const char * GetFilename();
653 static void SetMaxLength(
660 static PINDEX GetMaxLength();
683 static void SetOptionsByName(
689 static std::string GetOptionsByName();
697 static void SetOptions(
709 static void ClearOptions(
718 static unsigned GetOptions();
725 static void SetLevel(
734 static unsigned GetLevel();
748 static void SetStream(
754 static ostream * GetStream();
757 static int GetTimeZone();
761 static ostream & PrintInfo(
781 static ostream & Begin(
783 const char * fileName,
785 const PObject * instance = NULL,
786 const char * module = NULL
791 const char * fileName,
795 const char * defModule
796 ) {
return Begin(level, fileName, lineNum, instance, module != NULL ? module : defModule); }
800 const char * fileName,
805 ) {
return Begin(level, fileName, lineNum, instance != NULL ? instance : defInstance, module); }
824 static ostream & End(
837 const char * fileName,
839 const char * traceName
877 unsigned interval = 60000,
878 unsigned highLevel = 6,
879 unsigned maxShown = 1
884 bool CanTrace(int64_t now = 0);
885 operator unsigned()
const {
return m_currentLevel; }
908 template <
unsigned lowLevel,
909 unsigned interval = 60000,
910 unsigned highLevel = 6,
911 unsigned maxShown = 1
919 static void WalkStack(
921 PThreadIdentifier
id = PNullThreadIdentifier,
922 PUniqueThreadIdentifier uid = 0,
923 bool noSymbols =
false
929 static unsigned GetNextContextIdentifier();
935 #define PTRACE_PARAM(...) __VA_ARGS__
943 #define PTRACE_BLOCK(name) PTrace::Block __trace_block_instance(__FILE__, __LINE__, name)
948 #define PTRACE_LINE() \
949 (PTrace::CanTrace(1)) ? (void)(PTrace::Begin(1, __FILE__, __LINE__) << __FILE__ << '(' << __LINE__ << ')' << PTrace::End) : (void)0
953 #define PTRACE_INTERNAL(level, condition, args, ...) \
954 (PTrace::CanTrace(level) condition) ? ((PTrace::Begin(level, __FILE__, __LINE__, __VA_ARGS__) << args << PTrace::End), true) : false
956 #define PTRACE_NO_CONDITION
959 #define PTRACE_PART1(narg, args) PTRACE_PART2(narg, args)
960 #define PTRACE_PART2(narg, args) PTRACE_ARG_##narg args
962 #define PTRACE_ARG_4(level, object, module, args) \
963 PTRACE_INTERNAL(level, PTRACE_NO_CONDITION, args, object, module)
965 #define PTRACE_ARG_3(level, objectOrModule, args) \
966 PTRACE_INTERNAL(level, PTRACE_NO_CONDITION, args, objectOrModule, PTraceObjectInstance(objectOrModule), PTraceModule())
968 #define PTRACE_ARG_2(level, args) \
969 PTRACE_INTERNAL(level, PTRACE_NO_CONDITION, args, PTraceObjectInstance(), PTraceModule())
972 #define PTRACE_IF_PART1(narg, args) PTRACE_IF_PART2(narg, args)
973 #define PTRACE_IF_PART2(narg, args) PTRACE_IF_ARG_##narg args
975 #define PTRACE_IF_ARG_5(level, condition, object, module, args) \
976 PTRACE_INTERNAL(level, && (condition), args, object, module)
978 #define PTRACE_IF_ARG_4(level, condition, objectOrModule, args) \
979 PTRACE_INTERNAL(level, && (condition), args, objectOrModule, PTraceObjectInstance(objectOrModule), PTraceModule())
981 #define PTRACE_IF_ARG_3(level, condition, args) \
982 PTRACE_INTERNAL(level, && (condition), args, PTraceObjectInstance(), PTraceModule())
985 #define PTRACE_BEGIN_PART1(narg, args) PTRACE_BEGIN_PART2(narg, args)
986 #define PTRACE_BEGIN_PART2(narg, args) PTRACE_BEGIN_ARG_##narg args
988 #define PTRACE_BEGIN_ARG_3(level, object, module) \
989 PTrace::Begin(level, __FILE__, __LINE__, object, module)
991 #define PTRACE_BEGIN_ARG_2(level, objectOrModule) \
992 PTrace::Begin(level, __FILE__, __LINE__, objectOrModule, PTraceObjectInstance(objectOrModule), PTraceModule())
994 #define PTRACE_BEGIN_ARG_1(level) \
995 PTrace::Begin(level, __FILE__, __LINE__, PTraceObjectInstance(), PTraceModule())
999 #define PTRACE2(level, object, args) \
1000 PTRACE_INTERNAL(level, PTRACE_NO_CONDITION, args, object, PTraceModule())
1001 #define PTRACE_IF2(level, condition, object, args) \
1002 PTRACE_INTERNAL(level, && (condition), args, object, PTraceModule())
1039 #define PTRACE(...) PTRACE_PART1(PARG_COUNT(__VA_ARGS__), (__VA_ARGS__))
1053 #define PTRACE_IF(...) PTRACE_IF_PART1(PARG_COUNT(__VA_ARGS__), (__VA_ARGS__))
1063 #define PTRACE_ONCE(level, ...) \
1065 static PAtomicBoolean firstTrace(true); \
1066 PTRACE_IF((level), firstTrace.TestAndSet(false), __VA_ARGS__); \
1078 #define PTRACE_BEGIN(...) PTRACE_BEGIN_PART1(PARG_COUNT(__VA_ARGS__), (__VA_ARGS__))
1082 #define PTRACE_THROTTLE(var, ...) PTrace::Throttle<__VA_ARGS__> var
1083 #define PTRACE_THROTTLE_STATIC(var, ...) static PTrace::Throttle<__VA_ARGS__> var
1098 #define PTRACE_CONTEXT_ID_NEW() SetTraceContextIdentifier(PTrace::GetNextContextIdentifier())
1099 #define PTRACE_CONTEXT_ID_SET(to, from) PObject::CopyTraceContextIdentifier(to, from)
1100 #define PTRACE_CONTEXT_ID_FROM(obj) SetTraceContextIdentifier(obj)
1101 #define PTRACE_CONTEXT_ID_TO(obj) CopyTraceContextIdentifier(obj)
1106 class PThread * m_currentThread;
1107 unsigned m_savedContextIdentifier;
1114 #define PTRACE_CONTEXT_ID_PUSH_THREAD(obj) PTraceSaveContextIdentifier ptraceSavedContextIdentifier(obj)
1116 #endif // PTRACING==2
1119 #define P_DECLARE_TRACED_ENUM P_DECLARE_STREAMABLE_ENUM
1120 #define P_DECLARE_TRACED_ENUM_EX P_DECLARE_STREAMABLE_ENUM_EX
1124 #ifndef PTRACE_ARGLIST_EXT
1125 #define PTRACE_ARGLIST_EXT(...) ""
1128 #ifndef PTRACE_ARGLIST
1129 #define PTRACE_ARGLIST ""
1132 #ifndef PTRACE_INITIALISE
1133 #define PTRACE_INITIALISE(...)
1136 #ifndef PTRACE_PARAM
1137 #define PTRACE_PARAM(...)
1140 #ifndef PTRACE_BLOCK
1141 #define PTRACE_BLOCK(n)
1145 #define PTRACE_LINE()
1153 #define PTRACE_IF(...)
1156 #ifndef PTRACE_BEGIN
1157 #define PTRACE_BEGIN(...)
1160 #ifndef PTRACE_THROTTLE
1161 #define PTRACE_THROTTLE(...)
1165 #define PTRACE2(level, obj, arg)
1169 #define PTRACE_IF2(level, cond, obj, args)
1172 #ifndef PTRACE_CONTEXT_ID_NEW
1173 #define PTRACE_CONTEXT_ID_NEW()
1176 #ifndef PTRACE_CONTEXT_ID_SET
1177 #define PTRACE_CONTEXT_ID_SET(to, from)
1180 #ifndef PTRACE_CONTEXT_ID_FROM
1181 #define PTRACE_CONTEXT_ID_FROM(obj)
1184 #ifndef PTRACE_CONTEXT_ID_TO
1185 #define PTRACE_CONTEXT_ID_TO(obj)
1188 #ifndef PTRACE_CONTEXT_ID_PUSH_THREAD
1189 #define PTRACE_CONTEXT_ID_PUSH_THREAD(obj)
1192 #ifndef P_DECLARE_TRACED_ENUM
1193 #define P_DECLARE_TRACED_ENUM P_DECLARE_ENUM
1196 #ifndef P_DECLARE_TRACED_ENUM_EX
1197 #define P_DECLARE_TRACED_ENUM_EX P_DECLARE_ENUM_EX
1205 template <
typename ValueType,
typename AccumType = ValueType>
1223 if (value < m_minimum)
1225 if (value > m_maximum)
1227 m_accumulator += value;
1233 m_minimum = numeric_limits<ValueType>::max();
1241 ValueType
GetAverage()
const {
return m_count > 0 ? (ValueType)(m_accumulator/m_count) : 0; }
1256 #if defined( __GNUC__) && !defined(__clang__)
1257 #define PPROFILE_EXCLUDE(func) func __attribute__((no_instrument_function))
1259 #define PPROFILE_EXCLUDE(func) func
1261 #define __PRETTY_FUNCTION__ __FUNCSIG__
1263 #define __PRETTY_FUNCTION__ __FUNCTION__
1270 namespace PProfiling
1274 #if defined(P_HAS_RDTSC)
1276 #elif defined(__i386__) || defined(__x86_64__)
1278 __asm__ __volatile__ (
"rdtsc" :
"=a"(l),
"=d"(h));
1279 return ((uint64_t)h<<32)|l;
1280 #elif defined(_WIN32)
1282 QueryPerformanceCounter(&li);
1284 #elif defined(CLOCK_MONOTONIC)
1286 clock_gettime(CLOCK_MONOTONIC, &ts);
1287 return ts.tv_sec*1000000000ULL+ts.tv_nsec;
1290 gettimeofday(&tv, NULL);
1291 return tv.tv_sec*1000000ULL+tv.tv_usec;
1311 , m_minimum(std::numeric_limits<uint64_t>::max())
1316 typedef std::map<std::string, Function> FunctionMap;
1321 PThreadIdentifier m_threadId;
1322 PUniqueThreadIdentifier m_uniqueId;
1327 FunctionMap m_functions;
1330 PThreadIdentifier threadId = PNullThreadIdentifier,
1331 PUniqueThreadIdentifier uniqueId = 0,
1332 const char * name =
"",
1334 float systemCPU = 0,
1337 , m_threadId(threadId)
1338 , m_uniqueId(uniqueId)
1339 , m_realTime(realTime)
1340 , m_systemCPU(systemCPU)
1341 , m_userCPU(userCPU)
1346 typedef std::map<PUniqueThreadIdentifier, Thread> ThreadByID;
1347 typedef std::multimap<float, Thread, std::greater<double> > ThreadByUsage;
1351 uint64_t m_durationCycles;
1352 unsigned m_functionCount;
1353 ThreadByID m_threadByID;
1354 ThreadByUsage m_threadByUsage;
1357 : m_durationCycles(0)
1358 , m_functionCount(0)
1362 void ToText(ostream & strm)
const;
1363 void ToHTML(ostream & strm)
const;
1366 void Analyse(Analysis & analysis);
1367 void Analyse(ostream & strm,
bool html);
1370 void Enable(
bool enab)
1380 void Dump(ostream & strm)
1411 #define PPROFILE_BLOCK(name) ::PProfiling::Block p_profile_block_instance(PDebugLocation(__FILE,__LINE__, name))
1412 #define PPROFILE_FUNCTION() PPROFILE_BLOCK(__PRETTY_FUNCTION__)
1414 #define PPROFILE_PRE_SYSTEM() ::PProfiling::PreSystem()
1415 #define PPROFILE_POST_SYSTEM() ::PProfiling::PostSystem()
1416 #define PPROFILE_SYSTEM(...) PPROFILE_PRE_SYSTEM(); __VA_ARGS__; PPROFILE_POST_SYSTEM()
1418 #define PPROFILE_BLOCK(...)
1419 #define PPROFILE_FUNCTION()
1420 #define PPROFILE_PRE_SYSTEM()
1421 #define PPROFILE_POST_SYSTEM()
1422 #define PPROFILE_SYSTEM(...) __VA_ARGS__
1433 struct Implementation;
1445 unsigned thresholdTime,
1446 unsigned throttleTime = 10000,
1447 unsigned throttledLogLevel = 2,
1448 unsigned unthrottledLogLevel = 6,
1449 unsigned thresholdPercent = 5,
1450 unsigned maxHistory = 0
1458 void SetThrottleTime(
unsigned throttleTime);
1461 void SetThrottledLogLevel(
unsigned throttledLogLevel);
1464 void SetUnthrottledLogLevel(
unsigned unthrottledLogLevel);
1467 void SetThresholdPercent(
unsigned thresholdPercent);
1470 void SetMaxHistory(
unsigned maxHistory);
1473 void EndMeasurement(
1474 const void * context,
1505 , m_context(context)
1513 m_scope.EndMeasurement(m_context, m_object, NULL, m_startCycle);
1518 #define PPROFILE_TIMESCOPE(name, context, ...) \
1519 static ::PProfiling::TimeScope p_profile_timescope_static_instance##name(PDebugLocation(__FILE__, __LINE__, #name), __VA_ARGS__); \
1520 ::PProfiling::TimeScope::Measure p_profile_timescope_instance##name(p_profile_timescope_static_instance##name, context)
1522 #define PPROFILE_TIMESCOPE(...)
1534 static std::map<std::string, unsigned> Get();
1549 #if PMEMORY_CHECK || (defined(_MSC_VER) && defined(_DEBUG))
1551 #define PMEMORY_HEAP 1
1574 static void * Allocate(
1578 const char * className
1587 static void * Allocate(
1601 static void * Reallocate(
1613 static void Deallocate(
1615 const char * className
1634 static Validation Validate(
1636 const char * className,
1645 ostream * error = NULL
1653 static PBoolean SetIgnoreAllocations(
1660 static void DumpStatistics();
1664 static void DumpStatistics(ostream & strm );
1673 typedef _CrtMemState
State;
1680 static void GetState(
1691 static void DumpObjectsSince(
1700 static void DumpObjectsSince(
1710 static void SetAllocationBreakpoint(
1719 void * InternalAllocate(
1723 const char * className,
1726 void * InternalReallocate(
1732 void InternalDeallocate(
1734 const char * className
1738 const char * className,
1741 bool InternalValidateHeap(ostream * error);
1742 void InternalDumpStatistics(ostream & strm);
1743 void InternalDumpObjectsSince(DWORD objectNumber, ostream & strm);
1755 sizeof(
const char *) +
1756 sizeof(
const char *) +
1761 sizeof(PThreadIdentifier)
1774 char m_guard[NumGuardBytes];
1776 static char GuardBytes[NumGuardBytes];
1809 CRITICAL_SECTION m_mutex;
1810 #elif defined(P_PTHREADS)
1811 pthread_mutex_t m_mutex;
1812 #elif defined(P_VXWORKS)
1818 static void CreateInstance();
1819 #define P_CLIENT_BLOCK (_CLIENT_BLOCK|(0x61<<16)) // This identifies a PObject derived class
1820 _CrtMemState initialState;
1822 #endif // PMEMORY_CHECK
1845 #define malloc(s) PMemoryHeap::Allocate(s, __FILE__, __LINE__, NULL)
1853 #define calloc(n,s) PMemoryHeap::Allocate(n, s, __FILE__, __LINE__)
1861 #define realloc(p,s) PMemoryHeap::Reallocate(p, s, __FILE__, __LINE__)
1870 #define free(p) PMemoryHeap::Deallocate(p, NULL)
1879 #define cfree(p) PMemoryHeap::Deallocate(p, NULL)
1896 #define PNEW new (__FILE__, __LINE__)
1898 #if !defined(_MSC_VER) || _MSC_VER<1200
1899 #define PSPECIAL_DELETE_FUNCTION
1901 #define PSPECIAL_DELETE_FUNCTION \
1902 void operator delete(void * ptr, const char *, int) \
1903 { PMemoryHeap::Deallocate(ptr, Class()); } \
1904 void operator delete[](void * ptr, const char *, int) \
1905 { PMemoryHeap::Deallocate(ptr, Class()); }
1908 #define PNEW_AND_DELETE_FUNCTIONS(align) \
1909 void * operator new(size_t nSize, const char * file, int line) \
1910 { return PMemoryHeap::Allocate(nSize, file, line, Class()); } \
1911 void * operator new(size_t nSize) \
1912 { return PMemoryHeap::Allocate(nSize, NULL, 0, Class()); } \
1913 void operator delete(void * ptr) \
1914 { PMemoryHeap::Deallocate(ptr, Class()); } \
1915 void * operator new(size_t, void * placement) \
1916 { return placement; } \
1917 void operator delete(void *, void *) \
1919 void * operator new[](size_t nSize, const char * file, int line) \
1920 { return PMemoryHeap::Allocate(nSize, file, line, Class()); } \
1921 void * operator new[](size_t nSize) \
1922 { return PMemoryHeap::Allocate(nSize, NULL, 0, Class()); } \
1923 void operator delete[](void * ptr) \
1924 { PMemoryHeap::Deallocate(ptr, Class()); } \
1925 PSPECIAL_DELETE_FUNCTION
1928 inline void *
operator new(
size_t nSize,
const char * file,
int line)
1931 inline void *
operator new[](
size_t nSize,
const char * file,
int line)
1936 void * operator new(
size_t nSize);
1937 void * operator new[](
size_t nSize);
1940 void operator delete(
void * ptr);
1941 void operator delete[](
void * ptr);
1943 #if defined(_MSC_VER) && _MSC_VER>=1200
1944 inline void operator delete(
void * ptr,
const char *, int)
1947 inline void operator delete[](
void * ptr,
const char *, int)
1958 PBoolean previousIgnoreAllocations;
1961 #define PMEMORY_IGNORE_ALLOCATIONS_FOR_SCOPE PMemoryHeapIgnoreAllocationsForScope instance_PMemoryHeapIgnoreAllocationsForScope
1971 #define PMEMORY_ALLOCATION_BREAKPOINT(point) PMemoryAllocationBreakpoint PMemoryAllocationBreakpointInstance(point)
1974 #else // PMEMORY_CHECK || (defined(_MSC_VER) && defined(_DEBUG))
1976 #define PMEMORY_HEAP 0
1981 #define PNEW_AND_DELETE_FUNCTIONS(align)
1983 #define PNEW_AND_DELETE_FUNCTIONS_ALIGNED(align) \
1984 void * operator new(size_t nSize) \
1985 { return _aligned_malloc(nSize, align); } \
1986 void operator delete(void * ptr) \
1987 { _aligned_free(ptr); } \
1988 void * operator new(size_t, void * placement) \
1989 { return placement; } \
1990 void operator delete(void *, void *) \
1992 void * operator new[](size_t nSize) \
1993 { return _aligned_malloc(nSize, align); } \
1994 void operator delete[](void * ptr) \
1995 { _aligned_free(ptr); }
1997 #define PNEW_AND_DELETE_FUNCTIONS64 PNEW_AND_DELETE_FUNCTIONS_ALIGNED(64)
1998 #define PNEW_AND_DELETE_FUNCTIONS32 PNEW_AND_DELETE_FUNCTIONS_ALIGNED(32)
1999 #define PNEW_AND_DELETE_FUNCTIONS16 PNEW_AND_DELETE_FUNCTIONS_ALIGNED(16)
2000 #define PNEW_AND_DELETE_FUNCTIONS8 PNEW_AND_DELETE_FUNCTIONS_ALIGNED(8)
2001 #define PNEW_AND_DELETE_FUNCTIONS4 PNEW_AND_DELETE_FUNCTIONS_ALIGNED(4)
2002 #define PNEW_AND_DELETE_FUNCTIONS2 PNEW_AND_DELETE_FUNCTIONS_ALIGNED(2)
2003 #define PNEW_AND_DELETE_FUNCTIONS0
2004 #define PNEW_AND_DELETE_FUNCTIONS(align) PNEW_AND_DELETE_FUNCTIONS##align
2007 #define runtime_malloc(s) malloc(s)
2008 #define runtime_free(p) free(p)
2010 #define PMEMORY_IGNORE_ALLOCATIONS_FOR_SCOPE
2011 #define PMEMORY_ALLOCATION_BREAKPOINT(point)
2013 #endif // PMEMORY_CHECK || (defined(_MSC_VER) && defined(_DEBUG))
2044 template <
class Type,
typename GuardType =
unsigned, Type * (*Creator)() = PSingletonCreatorDefault<Type> >
2052 static auto_ptr<Type> s_pointer;
2053 static GuardType s_guard(0);
2054 if (s_guard++ != 0) {
2056 while ((m_instance = s_pointer.get()) == NULL)
2064 s_pointer.reset(Creator());
2065 m_instance = s_pointer.get();
2070 Type & operator* ()
const {
return *m_instance; }
2075 template <
class Type, Type * (*Creator)() = PSingletonCreatorDefault<Type> >
2086 #include <ext/mt_allocator.h>
2092 template <
bool _Thread>
2093 struct PMemoryPool :
public __gnu_cxx::__pool<_Thread>
2096 : __gnu_cxx::__pool<_Thread>()
2100 PMemoryPool(
const __gnu_cxx::__pool_base::_Tune& t)
2101 : __gnu_cxx::__pool<_Thread>(t)
2106 #if P_GNU_ALLOCATOR==1
2109 template <
class Type>
2110 struct PCommonPool :
public __gnu_cxx::__common_pool_policy<PMemoryPool, true>
2114 template <
class Type>
2115 struct PFixedPoolAllocator :
public PSingleton<__gnu_cxx::__mt_alloc<Type, PCommonPool<Type> > >
2119 #include <ext/bitmap_allocator.h>
2120 template <
class Type>
2121 struct PFixedPoolAllocator :
public PSingleton<__gnu_cxx::bitmap_allocator<Type> >
2126 #define PDECLARE_POOL_ALLOCATOR(cls) \
2127 void * cls::operator new(size_t) { return PFixedPoolAllocator<cls>()->allocate(1); } \
2128 void * cls::operator new(size_t, const char *, int) { return PFixedPoolAllocator<cls>()->allocate(1); } \
2129 void cls::operator delete(void * ptr) { PFixedPoolAllocator<cls>()->deallocate((cls *)ptr, 1); } \
2130 void cls::operator delete(void * ptr, const char *, int) { PFixedPoolAllocator<cls>()->deallocate((cls *)ptr, 1); }
2134 #define PDECLARE_POOL_ALLOCATOR(cls) \
2135 virtual ~cls() { } \
2136 __inline static const char * Class() { return typeid(cls).name(); } \
2137 PNEW_AND_DELETE_FUNCTIONS(0)
2139 #define PDEFINE_POOL_ALLOCATOR(cls)
2144 #define PCLASSINFO_ALIGNED(cls, par, align) \
2146 typedef cls P_thisClass; \
2147 __inline static const char * Class() { return typeid(cls).name(); } \
2148 __inline bool IsClass(const char * name) const { return strcmp(name, Class()) == 0; } \
2149 virtual PObject::Comparison CompareObjectMemoryDirect(const PObject & obj) const \
2150 { return PObject::InternalCompareObjectMemoryDirect(this, dynamic_cast<const cls *>(&obj), sizeof(cls)); } \
2151 PNEW_AND_DELETE_FUNCTIONS(align)
2164 #define PCLASSINFO(cls, par) PCLASSINFO_ALIGNED(cls, (par), 0)
2167 #define PCLASSINFO_WITH_CLONE(cls, par) \
2168 PCLASSINFO(cls, par) \
2169 virtual PObject * Clone() const { return new cls(*this); }
2172 #define PIsDescendant(ptr, cls) (dynamic_cast<const cls *>(ptr) != NULL)
2173 #define PRemoveConst(cls, ptr) (const_cast<cls*>(ptr))
2176 template<
class BaseClass>
inline BaseClass *
PAssertCast(BaseClass * obj,
const char * file,
int line)
2178 #define PDownCast(cls, ptr) PAssertCast<cls>(dynamic_cast<cls*>(ptr),__FILE__,__LINE__)
2180 #define PDownCast(cls, ptr) (dynamic_cast<cls*>(ptr))
2192 #define PDECLARE_CLASS(cls, par) class cls : public par { PCLASSINFO(cls, par)
2193 #ifdef DOC_PLUS_PLUS
2194 } Match previous opening brace in doc++
2221 #endif // PTRACING==2
2239 __inline
const char *
GetClass()
const {
return typeid(
const_cast<PObject &
>(*this)).name(); }
2240 __inline
bool IsClass(
const char * name)
const {
return strcmp(name,
Class()) == 0; }
2390 ) { obj.
PrintOn(strm);
return strm; }
2400 ) { obj.
ReadFrom(strm);
return strm; }
2421 template <
class CLS>
2425 CLS * obj =
dynamic_cast<CLS *
>(clone);
2455 #define PANSI_CHAR 1
2456 #define PLITTLE_ENDIAN 2
2457 #define PBIG_ENDIAN 3
2460 template <
typename type>
2467 __inline
operator type()
const {
return data; }
2476 template <
typename type>
2483 __inline
operator type()
const {
return ReverseBytes(data); }
2491 __inline
static int8_t ReverseBytes(
const int8_t src) {
return src; }
2492 __inline
static uint8_t ReverseBytes(
const uint8_t src) {
return src; }
2493 __inline
static int16_t ReverseBytes(
const int16_t src) {
return _byteswap_ushort(src); }
2494 __inline
static uint16_t ReverseBytes(
const uint16_t src) {
return _byteswap_ushort(src); }
2495 __inline
static int32_t ReverseBytes(
const int32_t src) {
return _byteswap_ulong(src); }
2496 __inline
static uint32_t ReverseBytes(
const uint32_t src) {
return _byteswap_ulong(src); }
2497 __inline
static int64_t ReverseBytes(
const int64_t src) {
return _byteswap_uint64(src); }
2498 __inline
static uint64_t ReverseBytes(
const uint64_t src) {
return _byteswap_uint64(src); }
2499 __inline
static float ReverseBytes(
const float src) { uint32_t dst = ReverseBytes(*(uint32_t *)&src);
return *(
float *)&dst; }
2500 __inline
static double ReverseBytes(
const double src) { uint64_t dst = ReverseBytes(*(uint64_t *)&src);
return *(
double *)&dst; }
2502 __inline
static int8_t ReverseBytes(
const int8_t src) {
return src; }
2503 __inline
static uint8_t ReverseBytes(
const uint8_t src) {
return src; }
2504 __inline
static int16_t ReverseBytes(
const int16_t src) {
return __bswap_16(src); }
2505 __inline
static uint16_t ReverseBytes(
const uint16_t src) {
return __bswap_16(src); }
2506 __inline
static int32_t ReverseBytes(
const int32_t src) {
return __bswap_32(src); }
2507 __inline
static uint32_t ReverseBytes(
const uint32_t src) {
return __bswap_32(src); }
2508 __inline
static int64_t ReverseBytes(
const int64_t src) {
return __bswap_64(src); }
2509 __inline
static uint64_t ReverseBytes(
const uint64_t src) {
return __bswap_64(src); }
2510 __inline
static float ReverseBytes(
const float src) { uint32_t dst = ReverseBytes(*(uint32_t *)&src);
return *(
float *)&dst; }
2511 __inline
static double ReverseBytes(
const double src) { uint64_t dst = ReverseBytes(*(uint64_t *)&src);
return *(
double *)&dst; }
2513 static __inline type ReverseBytes(
const type & src)
2516 size_t s =
sizeof(type)-1;
2517 for (
size_t d = 0; d <
sizeof(type); ++d,--s)
2518 ((BYTE *)&dst)[d] = ((
const BYTE *)&src)[s];
2525 #define PCHAR8 PANSI_CHAR
2528 #if PCHAR8==PANSI_CHAR
2536 #if PBYTE_ORDER==PLITTLE_ENDIAN
2538 #elif PBYTE_ORDER==PBIG_ENDIAN
2542 #if PBYTE_ORDER==PLITTLE_ENDIAN
2544 #elif PBYTE_ORDER==PBIG_ENDIAN
2548 #if PBYTE_ORDER==PLITTLE_ENDIAN
2550 #elif PBYTE_ORDER==PBIG_ENDIAN
2554 #if PBYTE_ORDER==PLITTLE_ENDIAN
2556 #elif PBYTE_ORDER==PBIG_ENDIAN
2560 #if PBYTE_ORDER==PLITTLE_ENDIAN
2562 #elif PBYTE_ORDER==PBIG_ENDIAN
2566 #if PBYTE_ORDER==PLITTLE_ENDIAN
2568 #elif PBYTE_ORDER==PBIG_ENDIAN
2572 #if PBYTE_ORDER==PLITTLE_ENDIAN
2574 #elif PBYTE_ORDER==PBIG_ENDIAN
2578 #if PBYTE_ORDER==PLITTLE_ENDIAN
2580 #elif PBYTE_ORDER==PBIG_ENDIAN
2584 #if PBYTE_ORDER==PLITTLE_ENDIAN
2586 #elif PBYTE_ORDER==PBIG_ENDIAN
2590 #if PBYTE_ORDER==PLITTLE_ENDIAN
2592 #elif PBYTE_ORDER==PBIG_ENDIAN
2596 #if PBYTE_ORDER==PLITTLE_ENDIAN
2598 #elif PBYTE_ORDER==PBIG_ENDIAN
2602 #if PBYTE_ORDER==PLITTLE_ENDIAN
2604 #elif PBYTE_ORDER==PBIG_ENDIAN
2608 #if PBYTE_ORDER==PLITTLE_ENDIAN
2610 #elif PBYTE_ORDER==PBIG_ENDIAN
2614 #if PBYTE_ORDER==PLITTLE_ENDIAN
2616 #elif PBYTE_ORDER==PBIG_ENDIAN
2620 #if PBYTE_ORDER==PLITTLE_ENDIAN
2622 #elif PBYTE_ORDER==PBIG_ENDIAN
2626 #if PBYTE_ORDER==PLITTLE_ENDIAN
2628 #elif PBYTE_ORDER==PBIG_ENDIAN
2632 #ifndef NO_LONG_DOUBLE // stupid OSX compiler
2633 #if PBYTE_ORDER==PLITTLE_ENDIAN
2635 #elif PBYTE_ORDER==PBIG_ENDIAN
2639 #if PBYTE_ORDER==PLITTLE_ENDIAN
2641 #elif PBYTE_ORDER==PBIG_ENDIAN
2648 #if defined(_MSC_VER)
2649 #define P_ALIGN_FIELD(fieldType,fieldName,alignment) fieldType __declspec(align(alignment)) fieldName
2650 #elif defined(__GNUC__)
2651 #define P_ALIGN_FIELD(fieldType,fieldName,alignment) fieldType fieldName __attribute__ ((aligned(alignment)))
2663 #define PARRAYSIZE(array) ((PINDEX)(sizeof(array)/sizeof(array[0])))
2669 #define PMIN(v1, v2) std::min(v1, v2)
2675 #define PMAX(v1, v2) std::max(v1, v2)
2681 #define PABS(v) std::abs(v)
2684 #endif // PTLIB_OBJECT_H
Options
Options for trace output.
Definition: object.h:506
Memory heap checking class.
Definition: object.h:1559
Information about a source file location.
Definition: object.h:333
__inline std::ostream & operator<<(std::ostream &strm, const PHashTableList &hash)
Definition: dict.h:180
uint64_t const m_startCycle
Definition: object.h:1492
static void Deallocate(void *ptr, const char *className)
Free a memory block.
Definition: object.h:1783
alloc_t m_firstRealObject
Definition: object.h:1792
__inline void CopyTraceContextIdentifier(PObject *obj) const
Definition: object.h:2216
AccumType m_accumulator
Definition: object.h:1211
atomic< unsigned > m_hiddenCount
Definition: object.h:902
__inline PIntReversedOrder & operator=(const PIntReversedOrder &value)
Definition: object.h:2482
Class to encapsulate tracing functions.
Definition: object.h:502
static Validation Validate(const void *ptr, const char *className, ostream *error)
Validate the memory pointer.
const char * name
Definition: object.h:851
Definition: object.h:2253
CLS * CloneAs() const
As for Clone() but converts to specified type.
Definition: object.h:2422
static __inline const PObject * PTraceObjectInstance(const PObject *obj)
Definition: object.h:2244
virtual Comparison CompareObjectMemoryDirect(const PObject &obj) const
Determine the byte wise comparison of two objects.
__inline friend ostream & operator<<(ostream &s, const PIntSameOrder &v)
Definition: object.h:2468
This class defines an arbitrary time interval to millisecond accuracy.
Definition: timeint.h:51
Throttle()
Definition: object.h:914
__inline void SetTraceContextIdentifier(unsigned id)
Definition: object.h:2212
#define PTRACE_ARG_LEVEL
Definition: object.h:559
__inline const char * GetClass() const
Definition: object.h:2239
Definition: object.h:2477
static void * Allocate(size_t nSize, const char *file, int line, const char *className)
Allocate a memory block.
Number of standard assert message.
Definition: object.h:383
char m_freeFillChar
Definition: object.h:1796
__inline PIntSameOrder & operator=(type value)
Definition: object.h:2465
Block & operator=(const Block &)
Definition: object.h:847
Header * m_listTail
Definition: object.h:1788
__inline void SetTraceContextIdentifier(const PObject &obj)
Definition: object.h:2213
Class used by PPROFILE_TIMESCOPE() macro to do the measurement of time between construction and destr...
Definition: object.h:1486
const char * m_extra
Definition: object.h:337
PIntSameOrder< int8_t > PInt8
Definition: object.h:2532
ValueType m_maximum
Definition: object.h:1210
PMemoryHeapIgnoreAllocationsForScope()
Definition: object.h:1955
__inline void CopyTraceContextIdentifier(PObject &obj) const
Definition: object.h:2215
atomic< unsigned > m_currentLevel
Definition: object.h:899
PDebugLocation(const char *extra=NULL)
Definition: object.h:339
alloc_t m_peakObjects
Definition: object.h:1801
unsigned m_interval
Definition: object.h:895
unsigned m_traceContextIdentifier
Definition: object.h:2206
void transfer(PAutoPtr &other)
Definition: object.h:104
static PBoolean SetIgnoreAllocations(PBoolean ignore)
Ignore/Monitor allocations.
Flags
Definition: object.h:1745
__inline friend ostream & operator<<(ostream &s, const PIntReversedOrder &value)
Definition: object.h:2484
__inline PIntSameOrder & operator=(const PIntSameOrder &value)
Definition: object.h:2466
__inline friend istream & operator>>(istream &s, PIntReversedOrder &value)
Definition: object.h:2485
static ostream & Begin(unsigned level, const char *fileName, int lineNum, const char *module, const PObject *instance, const char *defModule)
Definition: object.h:789
__inline unsigned GetTraceContextIdentifier() const
Get PTRACE context identifier.
Definition: object.h:2211
HighWaterMark()
Definition: object.h:1540
Comparison
Result of the comparison operation performed by the Compare() function.
Definition: object.h:2251
Type * m_instance
Definition: object.h:2048
int PParseEnum(const char *str, int begin, int end, char const *const *names, bool matchCase=true)
PStandardAssertMessage
Standard assert messages for the PAssert macro.
Definition: object.h:369
static __inline void CopyTraceContextIdentifier(PObject &to, const PObject &from)
Definition: object.h:2217
atomic< unsigned > m_repeatCount
Definition: object.h:901
A new or malloc failed.
Definition: object.h:371
__inline friend istream & operator>>(istream &s, PIntSameOrder &v)
Definition: object.h:2469
Type * operator->() const
Definition: object.h:2069
Template class for integral types (incluing PTimeInterval) for calcualting minimum, maximum and average.
Definition: object.h:1206
A Pop() was made of a stack with no elements.
Definition: object.h:376
ostream & PGetErrorStream()
Get the stream being used for error output.
Class to reduce noise level for some logging.
Definition: object.h:872
Definition: object.h:2254
ValueType GetAverage() const
Definition: object.h:1241
Template class to reduce noise level for some logging.
Definition: object.h:912
std::string m_name
Definition: object.h:1527
static HighWaterMarkData & GetHighWaterMarkData()
Definition: object.h:1539
char m_allocFillChar
Definition: object.h:1795
size_t m_peakMemoryUsage
Definition: object.h:1799
bool operator!=(const PObject &obj) const
Compare the two objects.
Definition: object.h:2318
void runtime_free(void *ptr)
Free memory allocated by run time library.
Definition: object.h:1836
atomic< unsigned > m_highWaterMark
Definition: object.h:1529
#define P_POP_MSVC_WARNINGS()
Definition: object.h:154
__inline unsigned GetCurrentLevel() const
Definition: object.h:891
uint8_t m_flags
Definition: object.h:1793
unsigned alloc_t
Definition: object.h:1666
PIntSameOrder< int8_t > PChar8
Definition: object.h:2529
alloc_t allocationNumber
Definition: object.h:1670
Definition: object.h:2076
TimeScope & m_scope
Definition: object.h:1489
BaseClass * PAssertCast(BaseClass *obj, const char *file, int line)
Definition: object.h:2176
virtual void ReadFrom(istream &strm)
Input the contents of the object from the stream.
An index into an array was negative.
Definition: object.h:374
void Reset()
Definition: object.h:1231
A reference was made through a NULL pointer.
Definition: object.h:372
virtual ~PObject()
Definition: object.h:2235
__inline PIntReversedOrder()
Definition: object.h:2478
Definition: object.h:1103
PAutoPtr(T *p)
Definition: object.h:102
Operation attempted when channel not open.
Definition: object.h:380
static __inline void CopyTraceContextIdentifier(PObject &to, const PObject *from)
Definition: object.h:2218
__inline void SetTraceContextIdentifier(const PObject *obj)
Definition: object.h:2214
Definition: object.h:2461
PObject()
Constructor for PObject, made protected so cannot ever create one on its own.
Definition: object.h:2227
__inline const PObject * PTraceObjectInstance()
Definition: object.h:1086
void * runtime_malloc(size_t bytes)
Allocate memory for the run time library.
Definition: object.h:1830
Definition: object.h:1621
Access through invalid window.
Definition: object.h:382
Definition: object.h:1953
Definition: object.h:1963
Template class for a simple singleton object.
Definition: object.h:2045
static void SetAllocationBreakpoint(alloc_t point)
Set break point allocation number.
alloc_t m_allocationRequest
Definition: object.h:1790
Definition: object.h:1623
const PObject *const m_object
Definition: object.h:1491
Definition: object.h:1624
#define PTRACE_ARG_ROLLOVER
Definition: object.h:561
#define free(p)
Override of system call for memory check system.
Definition: object.h:1870
~HighWaterMark()
Definition: object.h:1541
__inline PIntReversedOrder(const PIntReversedOrder &value)
Definition: object.h:2480
virtual PINDEX HashFunction() const
This function yields a hash value required by the PDictionary class.
Measure(TimeScope &scope, const PObject *object)
Definition: object.h:1495
ValueType GetMaximum() const
Definition: object.h:1240
int PReadEnum(std::istream &strm, int begin, int end, char const *const *names, bool matchCase=true)
friend ostream & operator<<(ostream &strm, const PObject &obj)
Global function for using the standard << operator on objects descended from PObject.
Definition: object.h:2387
PAutoPtr()
Definition: object.h:101
__inline PIntSameOrder(type value)
Definition: object.h:2463
Header * m_listHead
Definition: object.h:1787
bool operator==(const PObject &obj) const
Compare the two objects.
Definition: object.h:2309
bool PBoolean
Definition: object.h:174
bool operator<(const PObject &obj) const
Compare the two objects.
Definition: object.h:2327
unsigned m_highLevel
Definition: object.h:897
#define PPROFILE_EXCLUDE(func)
Definition: object.h:1259
__inline PIntReversedOrder & operator=(type value)
Definition: object.h:2481
void PrintOn(ostream &strm, const char *prefix=NULL) const
__inline const char * PTraceModule()
Definition: object.h:1088
intptr_t P_INT_PTR
Definition: object.h:2646
#define P_MAX_INDEX
Definition: object.h:80
__inline unsigned GetLowLevel() const
Definition: object.h:889
void PPrintEnum(std::ostream &strm, int e, int begin, int end, char const *const *names)
This class, along with the PPROFILE_TIMESCOPE() macro, allows the measurement of the time used by a s...
Definition: object.h:1430
ValueType m_minimum
Definition: object.h:1209
#define P_PUSH_MSVC_WARNINGS(warnings)
Definition: object.h:153
PDebugLocation(const char *file, unsigned line, const char *extra=NULL)
Definition: object.h:341
friend ostream & operator<<(ostream &strm, const PMinMaxAvg &mma)
Definition: object.h:1244
static unsigned MaxStackWalk
Definition: object.h:926
static __inline const char * Class()
Definition: object.h:2238
Feature is not supported.
Definition: object.h:381
This class allows the parsing of a set of program arguments.
Definition: args.h:41
const char * m_file
Definition: object.h:335
virtual Comparison Compare(const PObject &obj) const
Compare the two objects and return their relative rank.
bool operator<=(const PObject &obj) const
Compare the two objects.
Definition: object.h:2345
size_t m_currentMemoryUsage
Definition: object.h:1798
bool operator>=(const PObject &obj) const
Compare the two objects.
Definition: object.h:2354
static __inline const PObject * PTraceObjectInstance(const char *)
Definition: object.h:2243
Definition: object.h:1782
__inline const PObject * PTraceObjectInstance() const
Definition: object.h:2242
std::string m_units
Definition: object.h:1213
unsigned m_lowLevel
Definition: object.h:896
This class defines a thread of execution in the system.
Definition: thread.h:66
Measure(TimeScope &scope, const void *context)
Definition: object.h:1503
ValueType GetMinimum() const
Definition: object.h:1239
const char * file
Definition: object.h:849
unsigned m_count
Definition: object.h:1212
An invalid cast to descendant is required.
Definition: object.h:373
static __inline void CopyTraceContextIdentifier(PObject *to, const PObject &from)
Definition: object.h:2219
#define malloc(s)
Override of system call for memory check system.
Definition: object.h:1845
static ostream & Begin(unsigned level, const char *fileName, int lineNum, const PObject *instance, const PObject *defInstance, const char *module)
Definition: object.h:798
~Measure()
Definition: object.h:1511
static Comparison Compare2(T v1, T v2)
Compare two types, returning Comparison type.
Definition: object.h:2258
__inline unsigned GetHighLevel() const
Definition: object.h:890
static void Initialise(unsigned level, const char *filename, const char *rolloverPattern, unsigned options=Timestamp|Thread|Blocks)
Definition: object.h:631
friend istream & operator>>(istream &strm, PObject &obj)
Global function for using the standard >> operator on objects descended from PObject.
Definition: object.h:2397
alloc_t m_totalObjects
Definition: object.h:1802
Error was returned by Operating System.
Definition: object.h:379
~PMemoryHeapIgnoreAllocationsForScope()
Definition: object.h:1956
__inline PIntSameOrder(const PIntSameOrder &value)
Definition: object.h:2464
Invalid parameter was passed to a function.
Definition: object.h:378
Implementation *const m_implementation
Definition: object.h:1433
Funtion is not implemented.
Definition: object.h:377
bool PAssertFunc(const PDebugLocation &location, PStandardAssertMessage msg)
void Accumulate(const ValueType &value)
Definition: object.h:1221
#define PTRACE_ARG_TRACE
Definition: object.h:558
const void *const m_context
Definition: object.h:1490
ostream * m_leakDumpStream
Definition: object.h:1804
Type * PSingletonCreatorDefault()
Definition: object.h:2020
PIntSameOrder< uint8_t > PUInt8
Definition: object.h:2534
void PSetErrorStream(ostream *strm)
Set the stream to be used for error output.
Definition: object.h:1525
A NULL array element object was accessed.
Definition: object.h:375
__inline PIntSameOrder()
Definition: object.h:2462
virtual PObject * Clone() const
Create a copy of the class on the heap.
#define PTRACE_ARG_OPTION
Definition: object.h:562
__inline PIntReversedOrder(type value)
Definition: object.h:2479
__inline bool IsClass(const char *name) const
Definition: object.h:2240
PAutoPtr(PAutoPtr &other)
Definition: object.h:103
#define PTRACE_ARG_OUTPUT
Definition: object.h:560
Definition: object.h:1537
unsigned m_maxShown
Definition: object.h:898
Class to trace Execution blocks.
Definition: object.h:833
bool operator>(const PObject &obj) const
Compare the two objects.
Definition: object.h:2336
unsigned m_line
Definition: object.h:336
alloc_t m_allocationBreakpoint
Definition: object.h:1791
__inline uint64_t GetCycles()
Definition: object.h:1272
Definition: object.h:2252
PMemoryAllocationBreakpoint(DWORD point)
Definition: object.h:1965
static bool CanTrace(const ThrottleBase &throttle)
Definition: object.h:917
static __inline void CopyTraceContextIdentifier(PObject *to, const PObject *from)
Definition: object.h:2220
PMinMaxAvg(const char *units="")
Definition: object.h:1215
Definition: object.h:1622
atomic< int64_t > m_nextLog
Definition: object.h:900
Ultimate parent class for all objects in the class library.
Definition: object.h:2204
A logic error occurred.
Definition: object.h:370
PSingleton()
Definition: object.h:2050
__inline unsigned GetHiddenCount() const
Definition: object.h:892
unsigned GetCount() const
Definition: object.h:1242
virtual void PrintOn(ostream &strm) const
Output the contents of the object to the stream.
alloc_t m_currentObjects
Definition: object.h:1800
Definition: object.h:1669
static Comparison InternalCompareObjectMemoryDirect(const PObject *obj1, const PObject *obj2, PINDEX size)
Internal function caled from CompareObjectMemoryDirect()
Validation
Validation result.
Definition: object.h:1620
void PrintOn(ostream &strm) const
atomic< unsigned > m_totalCount
Definition: object.h:1528
int line
Definition: object.h:850