PTLib  Version 2.14.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
object.h File Reference
#include "unix/ptlib/platform.h"
#include <stdio.h>
#include <stdarg.h>
#include <stdlib.h>
#include <limits.h>
#include <string.h>
#include <ctype.h>
#include <errno.h>
#include <string>
#include <iomanip>
#include <iostream>
#include <sstream>
#include <vector>
#include <list>
#include <map>
#include <algorithm>
#include <typeinfo>
Include dependency graph for object.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  PTrace
 Class to encapsulate tracing functions. More...
 
class  PTrace::Block
 Class to trace Execution blocks. More...
 
class  PTraceSaveContextIdentifier
 
class  PMemoryHeap
 Memory heap checking class. More...
 
struct  PMemoryHeap::State
 
class  PMemoryHeap::Wrapper
 
struct  PMemoryHeap::Header
 
class  PMemoryHeapIgnoreAllocationsForScope
 
class  PMemoryAllocationBreakpoint
 
class  PSingleton< Type, GuardType >
 Template class for a simple singleton object. More...
 
struct  PVariablePoolAllocator< Type, Pool >
 
struct  PFixedPoolAllocator< Type >
 
class  PObject
 Ultimate parent class for all objects in the class library. More...
 
struct  PIntSameOrder< type >
 
struct  PIntReversedOrder< type >
 

Macros

#define P_REMOVE_VIRTUAL_INTERNAL_BASE(fn)   __inline virtual struct ptlib_virtual_function_changed_or_removed ****** fn { return 0; }
 
#define P_DEPRECATED
 
#define P_REMOVE_VIRTUAL_INTERNAL(type, fn, body)   P_REMOVE_VIRTUAL_INTERNAL_BASE(fn)
 
#define P_REMOVE_VIRTUAL_VOID(fn)   P_REMOVE_VIRTUAL_INTERNAL(void, fn, {})
 
#define P_REMOVE_VIRTUAL(type, fn, ret)   P_REMOVE_VIRTUAL_INTERNAL(type, fn, { return ret; })
 
#define P_PUSH_MSVC_WARNINGS(warnings)
 
#define P_POP_MSVC_WARNINGS()
 
#define P_DISABLE_MSVC_WARNINGS(warnings, statement)   P_PUSH_MSVC_WARNINGS(warnings) statement P_POP_MSVC_WARNINGS()
 
#define FALSE   0
 
#define TRUE   1
 
#define PTrue   true
 
#define PFalse   false
 
#define P_USE_INLINES   0
 
#define PINLINE
 
#define PARG_COUNT(...)   PARG_COUNT_PART1(PARG_COUNT_PART2(__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))
 Count the number of arguments passed in macro. More...
 
#define PARG_COUNT_PART1(arg)   arg
 
#define PARG_COUNT_PART2(_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
 
#define P_STRINGISE(v)   P_STRINGISE_PART2(v)
 Turn the argument into a string. More...
 
#define P_STRINGIZE(v)   P_STRINGISE_PART2(v)
 
#define P_STRINGISE_PART2(v)   #v
 
#define P_DECLARE_ENUM_EX(name, countName, firstName, firstValue,...)
 This declares a standard enumeration (enum) of symbols with ++ and – operators. More...
 
#define P_DECLARE_ENUM(name, first,...)   P_DECLARE_ENUM_EX(name, Num##name, first, 0, __VA_ARGS__)
 This declares a standard enumeration (enum) of symbols with ++ and – operators. More...
 
#define P_ENUM_NAMES_PART1(narg, args)   P_ENUM_NAMES_PART2(narg, args)
 
#define P_ENUM_NAMES_PART2(narg, args)   P_ENUM_NAMES_ARG_##narg args
 
#define P_ENUM_NAMES_ARG_1(_1)   #_1
 
#define P_ENUM_NAMES_ARG_2(_1, _2)   #_1,#_2
 
#define P_ENUM_NAMES_ARG_3(_1, _2, _3)   #_1,#_2,#_3
 
#define P_ENUM_NAMES_ARG_4(_1, _2, _3, _4)   #_1,#_2,#_3,#_4
 
#define P_ENUM_NAMES_ARG_5(_1, _2, _3, _4, _5)   #_1,#_2,#_3,#_4,#_5
 
#define P_ENUM_NAMES_ARG_6(_1, _2, _3, _4, _5, _6)   #_1,#_2,#_3,#_4,#_5,#_6
 
#define P_ENUM_NAMES_ARG_7(_1, _2, _3, _4, _5, _6, _7)   #_1,#_2,#_3,#_4,#_5,#_6,#_7
 
#define P_ENUM_NAMES_ARG_8(_1, _2, _3, _4, _5, _6, _7, _8)   #_1,#_2,#_3,#_4,#_5,#_6,#_7,#_8
 
#define P_ENUM_NAMES_ARG_9(_1, _2, _3, _4, _5, _6, _7, _8, _9)   #_1,#_2,#_3,#_4,#_5,#_6,#_7,#_8,#_9
 
#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
 
#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
 
#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
 
#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
 
#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
 
#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
 
#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
 
#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
 
#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
 
#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
 
#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
 
#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
 
#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
 
#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
 
#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
 
#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
 
#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
 
#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
 
#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
 
#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
 
#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
 
#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
 
#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
 
#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
 
#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
 
#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
 
#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
 
#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
 
#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
 
#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
 
#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
 
#define P_DECLARE_ENUM_NAMES(name,...)
 This declares the functions and string table for the text names of an enum. More...
 
#define P_DECLARE_STREAMABLE_ENUM_EX(name, countName, firstName, firstValue,...)
 This declares a standard enumeration using P_DECLARE_ENUM_EX() and adds the text names so can be streamed using operator<< or operator>>. More...
 
#define P_DECLARE_STREAMABLE_ENUM(name, first,...)   P_DECLARE_STREAMABLE_ENUM_EX(name, Num##name, first, 0, __VA_ARGS__)
 This declares a standard enumeration using P_DECLARE_ENUM() and adds the text names so can be streamed using operator<< or operator>>. More...
 
#define P_USE_ASSERTS   1
 
#define __CLASS__   NULL
 
#define PAssert(b, msg)   ((b)?true:PAssertFunc(__FILE__,__LINE__,__CLASS__,(msg)))
 This macro is used to assert that a condition must be true. More...
 
#define PAssert2(b, cls, msg)   ((b)?true:PAssertFunc(__FILE__,__LINE__,(cls),(msg)))
 This macro is used to assert that a condition must be true. More...
 
#define PAssertOS(b)   ((b)?true:PAssertFunc(__FILE__,__LINE__,__CLASS__,POperatingSystemError))
 This macro is used to assert that an operating system call succeeds. More...
 
#define PAssertNULL(ptr)
 This macro is used to assert that a pointer must be non-null. More...
 
#define PAssertAlways(msg)   PAssertFunc(__FILE__,__LINE__,__CLASS__,(msg))
 This macro is used to assert immediately. More...
 
#define PAssertAlways2(cls, msg)   PAssertFunc(__FILE__,__LINE__,(cls),(msg))
 This macro is used to assert immediately. More...
 
#define PError   (PGetErrorStream())
 This macro is used to access the platform specific error output stream. More...
 
#define PTRACING   2
 
#define PTRACE_ARGLIST_OPT_HELP
 
#define PTRACE_ARG_TRACE   "trace"
 
#define PTRACE_ARG_LEVEL   "trace-level"
 
#define PTRACE_ARG_OUTPUT   "output"
 
#define PTRACE_ARG_ROLLOVER   "trace-rollover"
 
#define PTRACE_ARG_OPTION   "trace-option"
 
#define PTRACE_ARGLIST_EXT(t, l, o, r, O)
 
#define PTRACE_ARGLIST   PTRACE_ARGLIST_EXT("t","","o","","")
 
#define PTRACE_INITIALISE(...)   PTrace::Initialise(__VA_ARGS__)
 
#define PTRACE_PARAM(...)   __VA_ARGS__
 
#define PTRACE_BLOCK(name)   PTrace::Block __trace_block_instance(__FILE__, __LINE__, name)
 Trace an execution block. More...
 
#define PTRACE_LINE()
 Trace the execution of a line. More...
 
#define PTRACE_INTERNAL(level, condition, args,...)
 
#define PTRACE_NO_CONDITION
 
#define PTRACE_PART1(narg, args)   PTRACE_PART2(narg, args)
 
#define PTRACE_PART2(narg, args)   PTRACE_ARG_##narg args
 
#define PTRACE_ARG_4(level, object, module, args)   PTRACE_INTERNAL(level, PTRACE_NO_CONDITION, args, object, module)
 
#define PTRACE_ARG_3(level, objectOrModule, args)   PTRACE_INTERNAL(level, PTRACE_NO_CONDITION, args, objectOrModule, PTraceObjectInstance(objectOrModule), PTraceModule())
 
#define PTRACE_ARG_2(level, args)   PTRACE_INTERNAL(level, PTRACE_NO_CONDITION, args, PTraceObjectInstance(), PTraceModule())
 
#define PTRACE_IF_PART1(narg, args)   PTRACE_IF_PART2(narg, args)
 
#define PTRACE_IF_PART2(narg, args)   PTRACE_IF_ARG_##narg args
 
#define PTRACE_IF_ARG_5(level, condition, object, module, args)   PTRACE_INTERNAL(level, && (condition), args, object, module)
 
#define PTRACE_IF_ARG_4(level, condition, objectOrModule, args)   PTRACE_INTERNAL(level, && (condition), args, objectOrModule, PTraceObjectInstance(objectOrModule), PTraceModule())
 
#define PTRACE_IF_ARG_3(level, condition, args)   PTRACE_INTERNAL(level, && (condition), args, PTraceObjectInstance(), PTraceModule())
 
#define PTRACE_BEGIN_PART1(narg, args)   PTRACE_BEGIN_PART2(narg, args)
 
#define PTRACE_BEGIN_PART2(narg, args)   PTRACE_BEGIN_ARG_##narg args
 
#define PTRACE_BEGIN_ARG_3(level, object, module)   PTrace::Begin(level, __FILE__, __LINE__, object, module)
 
#define PTRACE_BEGIN_ARG_2(level, objectOrModule)   PTrace::Begin(level, __FILE__, __LINE__, objectOrModule, PTraceObjectInstance(objectOrModule), PTraceModule())
 
#define PTRACE_BEGIN_ARG_1(level)   PTrace::Begin(level, __FILE__, __LINE__, PTraceObjectInstance(), PTraceModule())
 
#define PTRACE2(level, object, args)   PTRACE_INTERNAL(level, PTRACE_NO_CONDITION, args, object, PTraceModule())
 
#define PTRACE_IF2(level, condition, object, args)   PTRACE_INTERNAL(level, && (condition), args, object, PTraceModule())
 
#define PTRACE(...)   PTRACE_PART1(PARG_COUNT(__VA_ARGS__), (__VA_ARGS__))
 Output trace. More...
 
#define PTRACE_IF(...)   PTRACE_IF_PART1(PARG_COUNT(__VA_ARGS__), (__VA_ARGS__))
 Output trace on condition. More...
 
#define PTRACE_BEGIN(...)   PTRACE_BEGIN_PART1(PARG_COUNT(__VA_ARGS__), (__VA_ARGS__))
 Begin output trace. More...
 
#define PTRACE_CONTEXT_ID_NEW()   SetTraceContextIdentifier(PTrace::GetNextContextIdentifier())
 Propagate PTRACE context identifier in an object from another. More...
 
#define PTRACE_CONTEXT_ID_SET(to, from)   (to).SetTraceContextIdentifier(from)
 
#define PTRACE_CONTEXT_ID_FROM(obj)   SetTraceContextIdentifier(obj)
 
#define PTRACE_CONTEXT_ID_TO(obj)   GetTraceContextIdentifier(obj)
 
#define PTRACE_CONTEXT_ID_PUSH_THREAD(obj)   PTraceSaveContextIdentifier praceSavedContextIdentifier(obj)
 
#define P_DECLARE_TRACED_ENUM   P_DECLARE_STREAMABLE_ENUM
 
#define P_DECLARE_TRACED_ENUM_EX   P_DECLARE_STREAMABLE_ENUM_EX
 
#define PMEMORY_HEAP   1
 
#define malloc(s)   PMemoryHeap::Allocate(s, __FILE__, __LINE__, NULL)
 Override of system call for memory check system. More...
 
#define calloc(n, s)   PMemoryHeap::Allocate(n, s, __FILE__, __LINE__)
 Override of system call for memory check system. More...
 
#define realloc(p, s)   PMemoryHeap::Reallocate(p, s, __FILE__, __LINE__)
 Override of system call for memory check system. More...
 
#define free(p)   PMemoryHeap::Deallocate(p, NULL)
 Override of system call for memory check system. More...
 
#define cfree(p)   PMemoryHeap::Deallocate(p, NULL)
 Override of system call for memory check system. More...
 
#define PNEW   new (__FILE__, __LINE__)
 Macro for overriding system default new operator. More...
 
#define PSPECIAL_DELETE_FUNCTION
 
#define PNEW_AND_DELETE_FUNCTIONS
 
#define PMEMORY_IGNORE_ALLOCATIONS_FOR_SCOPE   PMemoryHeapIgnoreAllocationsForScope instance_PMemoryHeapIgnoreAllocationsForScope
 
#define PMEMORY_ALLOCATION_BREAKPOINT(point)   PMemoryAllocationBreakpoint PMemoryAllocationBreakpointInstance(point)
 
#define PDECLARE_POOL_ALLOCATOR()
 
#define PDEFINE_POOL_ALLOCATOR(cls)
 
#define PCLASSINFO(cls, par)
 Declare all the standard PTLib class information. More...
 
#define PCLASSINFO_WITH_CLONE(cls, par)
 Declare all the standard PTLib class information, plus Clone(). More...
 
#define PIsDescendant(ptr, cls)   (dynamic_cast<const cls *>(ptr) != NULL)
 
#define PIsDescendantStr(ptr, str)   ((ptr)->InternalIsDescendant(str))
 
#define PRemoveConst(cls, ptr)   (const_cast<cls*>(ptr))
 
#define PDownCast(cls, ptr)   PAssertCast<cls>(dynamic_cast<cls*>(ptr),__FILE__,__LINE__)
 
#define PDECLARE_CLASS(cls, par)   class cls : public par { PCLASSINFO(cls, par)
 Declare a class with PWLib class information. More...
 
#define PANSI_CHAR   1
 
#define PLITTLE_ENDIAN   2
 
#define PBIG_ENDIAN   3
 
#define PCHAR8   PANSI_CHAR
 
#define PARRAYSIZE(array)   ((PINDEX)(sizeof(array)/sizeof(array[0])))
 
#define PMIN(v1, v2)   std::min(v1, v2)
 
#define PMAX(v1, v2)   std::max(v1, v2)
 
#define PABS(v)   std::abs(v)
 

Typedefs

typedef bool PBoolean
 
typedef PIntSameOrder< char > PChar8
 
typedef PIntSameOrder< char > PInt8
 
typedef PIntSameOrder
< unsigned char > 
PUInt8
 
typedef intptr_t P_INT_PTR
 

Enumerations

enum  PStandardAssertMessage {
  PLogicError, POutOfMemory, PNullPointerReference, PInvalidCast,
  PInvalidArrayIndex, PInvalidArrayElement, PStackEmpty, PUnimplementedFunction,
  PInvalidParameter, POperatingSystemError, PChannelNotOpen, PUnsupportedFeature,
  PInvalidWindow, PMaxStandardAssertMessage
}
 Standard assert messages for the PAssert macro. More...
 

Functions

void PPrintEnum (std::ostream &strm, int e, int begin, int end, char const *const *names)
 
int PReadEnum (std::istream &strm, int begin, int end, char const *const *names, bool matchCase=true)
 
int PParseEnum (const char *str, int begin, int end, char const *const *names, bool matchCase=true)
 
bool PAssertFunc (const char *file, int line, const char *className, PStandardAssertMessage msg)
 
bool PAssertFunc (const char *file, int line, const char *className, const char *msg)
 
bool PAssertFunc (const char *full_msg)
 
ostream & PGetErrorStream ()
 Get the stream being used for error output. More...
 
void PSetErrorStream (ostream *strm)
 Set the stream to be used for error output. More...
 
__inline const PObjectPTraceObjectInstance ()
 
static __inline const PObjectPTraceObjectInstance (const void *)
 
__inline const char * PTraceModule ()
 
void * runtime_malloc (size_t bytes)
 Allocate memory for the run time library. More...
 
void runtime_free (void *ptr)
 Free memory allocated by run time library. More...
 
void * operator new (size_t nSize, const char *file, int line)
 
void * operator new[] (size_t nSize, const char *file, int line)
 
void * operator new (size_t nSize)
 
void * operator new[] (size_t nSize)
 
void operator delete (void *ptr)
 
void operator delete[] (void *ptr)
 
template<class BaseClass >
BaseClass * PAssertCast (BaseClass *obj, const char *file, int line)
 

Macro Definition Documentation

#define __CLASS__   NULL
#define calloc (   n,
 
)    PMemoryHeap::Allocate(n, s, __FILE__, __LINE__)

Override of system call for memory check system.

This macro is used to allocate memory via the memory check system selected with the PMEMORY_CHECK compile time option. It will include the source file and line into the memory allocation to allow the PMemoryHeap class to keep track of the memory block.

#define cfree (   p)    PMemoryHeap::Deallocate(p, NULL)

Override of system call for memory check system.

This macro is used to deallocate memory via the memory check system selected with the PMEMORY_CHECK compile time option. It will include the source file and line into the memory allocation to allow the PMemoryHeap class to keep track of the memory block.

#define FALSE   0
#define free (   p)    PMemoryHeap::Deallocate(p, NULL)

Override of system call for memory check system.

This macro is used to deallocate memory via the memory check system selected with the PMEMORY_CHECK compile time option. It will include the source file and line into the memory allocation to allow the PMemoryHeap class to keep track of the memory block.

Referenced by runtime_free(), and P_fd_set::~P_fd_set().

#define malloc (   s)    PMemoryHeap::Allocate(s, __FILE__, __LINE__, NULL)

Override of system call for memory check system.

This macro is used to allocate memory via the memory check system selected with the PMEMORY_CHECK compile time option. It will include the source file and line into the memory allocation to allow the PMemoryHeap class to keep track of the memory block.

Referenced by runtime_malloc().

#define P_DECLARE_ENUM (   name,
  first,
  ... 
)    P_DECLARE_ENUM_EX(name, Num##name, first, 0, __VA_ARGS__)

This declares a standard enumeration (enum) of symbols with ++ and – operators.

The symbols Begin##name and End##name are automatically added to the enumeration and is equal to the first value, and one beyond the last value respectively. This operates in a similar manner to STL iterators so that a for loop like:


   for (MyEnum e = BeginMyEnum; e < EndMyEnum; ++e)

works as epected.

A symbol Num##name for the count of enumerations (End##name - Begin##name) is also defined.

#define P_DECLARE_ENUM_EX (   name,
  countName,
  firstName,
  firstValue,
  ... 
)
Value:
enum name { firstName = firstValue, Begin##name = firstName, __VA_ARGS__, End##name, countName = End##name-Begin##name }; \
friend __inline name operator++(name & e ) { PAssert(e < End##name, PInvalidParameter); return e = (name)(e+1); } \
friend __inline name operator++(name & e, int) { PAssert(e < End##name, PInvalidParameter); name o=e; e = (name)(e+1); return o; } \
friend __inline name operator--(name & e ) { PAssert(e >= Begin##name, PInvalidParameter); return e = (name)(e-1); } \
friend __inline name operator--(name & e, int) { PAssert(e >= Begin##name, PInvalidParameter); name o=e; e = (name)(e-1); return o; } \
static __inline name name##FromInt(int v) { return (name)(v < Begin##name ? Begin##name : v >= End##name ? (End##name-1) : v); }

This declares a standard enumeration (enum) of symbols with ++ and – operators.

The symbols Begin##name and End##name are automatically added to the enumeration and is equal to the first value, and one beyond the last value respectively. This operates in a similar manner to STL iterators so that a for loop like:


   for (MyEnum e = BeginMyEnum; e < EndMyEnum; ++e)

works as epected.

A symbol for the count of enumerations (End##name - Begin##name) is also defined.

#define P_DECLARE_ENUM_NAMES (   name,
  ... 
)
Value:
struct PEnumNames_##name { \
static char const * const * Names() { static char const * const Strings[] = { __VA_ARGS__ }; return Strings; } \
}; \
friend __inline std::ostream & operator<<(std::ostream & strm, name e) \
{ PPrintEnum(strm, e, Begin##name, End##name, PEnumNames_##name::Names()); return strm; } \
friend __inline std::istream & operator>>(std::istream & strm, name & e) \
{ e = (name)PReadEnum(strm, Begin##name, End##name, PEnumNames_##name::Names()); return strm; } \
static __inline const char * name##ToString(name e) { return e >= Begin##name && e < End##name ? PAssertNULL(PEnumNames_##name::Names()[e-Begin##name]) : ""; } \
static __inline name name##FromString(const char * str, bool matchCase = true) { return (name)PParseEnum(str, Begin##name, End##name, PEnumNames_##name::Names(), matchCase); }

This declares the functions and string table for the text names of an enum.

The enum is expected to be defined using P_DECLARE_ENUM() or P_DECLARE_ENUM_EX() and adds functions MyEnumToString() and MyEnumFromString() to convert between the string representation and the enum. The iostream operator<< and operator>> is also defined.

#define P_DECLARE_STREAMABLE_ENUM (   name,
  first,
  ... 
)    P_DECLARE_STREAMABLE_ENUM_EX(name, Num##name, first, 0, __VA_ARGS__)

This declares a standard enumeration using P_DECLARE_ENUM() and adds the text names so can be streamed using operator<< or operator>>.

See P_DECLARE_ENUM_NAMES() for more

#define P_DECLARE_STREAMABLE_ENUM_EX (   name,
  countName,
  firstName,
  firstValue,
  ... 
)
Value:
P_DECLARE_ENUM_EX(name, countName, firstName, firstValue, __VA_ARGS__) \
P_DECLARE_ENUM_NAMES(name, #firstName, P_ENUM_NAMES_PART1(PARG_COUNT(__VA_ARGS__), (__VA_ARGS__)))

This declares a standard enumeration using P_DECLARE_ENUM_EX() and adds the text names so can be streamed using operator<< or operator>>.

See P_DECLARE_ENUM_NAMES() for more

#define P_DECLARE_TRACED_ENUM   P_DECLARE_STREAMABLE_ENUM
#define P_DECLARE_TRACED_ENUM_EX   P_DECLARE_STREAMABLE_ENUM_EX
#define P_DEPRECATED
#define P_DISABLE_MSVC_WARNINGS (   warnings,
  statement 
)    P_PUSH_MSVC_WARNINGS(warnings) statement P_POP_MSVC_WARNINGS()
#define P_ENUM_NAMES_ARG_1 (   _1)    #_1
#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
#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
#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
#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
#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
#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
#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
#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
#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
#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
#define P_ENUM_NAMES_ARG_2 (   _1,
  _2 
)    #_1,#_2
#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
#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
#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
#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
#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
#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
#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
#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
#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
#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
#define P_ENUM_NAMES_ARG_3 (   _1,
  _2,
  _3 
)    #_1,#_2,#_3
#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
#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
#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
#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
#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
#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
#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
#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
#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
#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
#define P_ENUM_NAMES_ARG_4 (   _1,
  _2,
  _3,
  _4 
)    #_1,#_2,#_3,#_4
#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
#define P_ENUM_NAMES_ARG_5 (   _1,
  _2,
  _3,
  _4,
  _5 
)    #_1,#_2,#_3,#_4,#_5
#define P_ENUM_NAMES_ARG_6 (   _1,
  _2,
  _3,
  _4,
  _5,
  _6 
)    #_1,#_2,#_3,#_4,#_5,#_6
#define P_ENUM_NAMES_ARG_7 (   _1,
  _2,
  _3,
  _4,
  _5,
  _6,
  _7 
)    #_1,#_2,#_3,#_4,#_5,#_6,#_7
#define P_ENUM_NAMES_ARG_8 (   _1,
  _2,
  _3,
  _4,
  _5,
  _6,
  _7,
  _8 
)    #_1,#_2,#_3,#_4,#_5,#_6,#_7,#_8
#define P_ENUM_NAMES_ARG_9 (   _1,
  _2,
  _3,
  _4,
  _5,
  _6,
  _7,
  _8,
  _9 
)    #_1,#_2,#_3,#_4,#_5,#_6,#_7,#_8,#_9
#define P_ENUM_NAMES_PART1 (   narg,
  args 
)    P_ENUM_NAMES_PART2(narg, args)
#define P_ENUM_NAMES_PART2 (   narg,
  args 
)    P_ENUM_NAMES_ARG_##narg args
#define P_POP_MSVC_WARNINGS ( )
#define P_PUSH_MSVC_WARNINGS (   warnings)
#define P_REMOVE_VIRTUAL (   type,
  fn,
  ret 
)    P_REMOVE_VIRTUAL_INTERNAL(type, fn, { return ret; })
#define P_REMOVE_VIRTUAL_INTERNAL (   type,
  fn,
  body 
)    P_REMOVE_VIRTUAL_INTERNAL_BASE(fn)
#define P_REMOVE_VIRTUAL_INTERNAL_BASE (   fn)    __inline virtual struct ptlib_virtual_function_changed_or_removed ****** fn { return 0; }
#define P_REMOVE_VIRTUAL_VOID (   fn)    P_REMOVE_VIRTUAL_INTERNAL(void, fn, {})
#define P_STRINGISE (   v)    P_STRINGISE_PART2(v)

Turn the argument into a string.

#define P_STRINGISE_PART2 (   v)    #v
#define P_STRINGIZE (   v)    P_STRINGISE_PART2(v)
#define P_USE_ASSERTS   1
#define P_USE_INLINES   0
#define PABS (   v)    std::abs(v)
#define PANSI_CHAR   1
#define PARG_COUNT (   ...)    PARG_COUNT_PART1(PARG_COUNT_PART2(__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))

Count the number of arguments passed in macro.

#define PARG_COUNT_PART1 (   arg)    arg
#define PARG_COUNT_PART2 (   _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
#define PARRAYSIZE (   array)    ((PINDEX)(sizeof(array)/sizeof(array[0])))
#define PAssert (   b,
  msg 
)    ((b)?true:PAssertFunc(__FILE__,__LINE__,__CLASS__,(msg)))

This macro is used to assert that a condition must be true.

If the condition is false then an assert function is called with the source file and line number the macro was instantiated on, plus the message described by the msg parameter. This parameter may be either a standard value from the PStandardAssertMessage enum or a literal string.

Referenced by PKey< T >::Compare(), PFactoryTemplate< AbstractClass, ParamType, KeyType >::WorkerBase::Create(), PSortedList< PString >::erase(), PBYTEArray::GetAs(), PBaseArray< PHashTableList >::operator[](), PArray< PODBC::Field >::operator[](), PThreadPool< Timeout >::RemoveWork(), PStack< T >::Top(), PFactory< AbstractClass, KeyType >::Worker< ConcreteClass >::Worker(), and PParamFactory< AbstractClass, ParamType, KeyType >::Worker< ConcreteClass >::Worker().

#define PAssert2 (   b,
  cls,
  msg 
)    ((b)?true:PAssertFunc(__FILE__,__LINE__,(cls),(msg)))

This macro is used to assert that a condition must be true.

If the condition is false then an assert function is called with the source file and line number the macro was instantiated on, plus the message described by the msg parameter. This parameter may be either a standard value from the PStandardAssertMessage enum or a literal string. The cls parameter specifies the class name that the error occurred in

#define PAssertAlways (   msg)    PAssertFunc(__FILE__,__LINE__,__CLASS__,(msg))

This macro is used to assert immediately.

The assert function is called with the source file and line number the macro was instantiated on, plus the message described by the msg parameter. This parameter may be either a standard value from the PStandardAssertMessage enum or a literal string.

Referenced by PConstantString< ParentString >::AssignContents().

#define PAssertAlways2 (   cls,
  msg 
)    PAssertFunc(__FILE__,__LINE__,(cls),(msg))

This macro is used to assert immediately.

The assert function is called with the source file and line number the macro was instantiated on, plus the message described by the msg parameter. This parameter may be either a standard value from the PStandardAssertMessage enum or a literal string.

#define PAssertNULL (   ptr)
#define PAssertOS (   b)    ((b)?true:PAssertFunc(__FILE__,__LINE__,__CLASS__,POperatingSystemError))

This macro is used to assert that an operating system call succeeds.

If the condition is false then an assert function is called with the source file and line number the macro was instantiated on, plus the message described by the POperatingSystemError value in the PStandardAssertMessage enum.

#define PBIG_ENDIAN   3
#define PCHAR8   PANSI_CHAR
#define PCLASSINFO (   cls,
  par 
)
Value:
public: \
typedef cls P_thisClass; \
static inline const char * Class() \
{ return #cls; } \
virtual PBoolean InternalIsDescendant(const char * clsName) const \
{ return strcmp(clsName, this->Class()) == 0 || par::InternalIsDescendant(clsName); } \
virtual const char * GetClass(unsigned ancestor = 0) const \
{ return ancestor > 0 ? par::GetClass(ancestor-1) : this->Class(); } \
virtual PObject::Comparison CompareObjectMemoryDirect(const PObject & obj) const \
{ return PObject::InternalCompareObjectMemoryDirect(this, dynamic_cast<const cls *>(&obj), sizeof(cls)); } \
PNEW_AND_DELETE_FUNCTIONS

Declare all the standard PTLib class information.

This macro is used to provide the basic run-time typing capability needed by the library. All descendent classes from the PObject class require these functions for correct operation. Either use this macro or the PDECLARE_CLASS macro.

The use of the PDECLARE_CLASS macro is no longer recommended for reasons of compatibility with documentation systems.

#define PCLASSINFO_WITH_CLONE (   cls,
  par 
)
Value:
PCLASSINFO(cls, par) \
virtual PObject * Clone() const { return new cls(*this); }

Declare all the standard PTLib class information, plus Clone().

#define PDECLARE_CLASS (   cls,
  par 
)    class cls : public par { PCLASSINFO(cls, par)

Declare a class with PWLib class information.

This macro is used to declare a new class with a single public ancestor. It starts the class declaration and then uses the PCLASSINFO macro to get all the run-time type functions.

The use of this macro is no longer recommended for reasons of compatibility with documentation systems.

#define PDECLARE_POOL_ALLOCATOR ( )
Value:
void * operator new(size_t nSize); \
void * operator new(size_t nSize, const char * file, int line); \
void operator delete(void * ptr); \
void operator delete(void * ptr, const char *, int)
#define PDEFINE_POOL_ALLOCATOR (   cls)
Value:
void * cls::operator new(size_t) { return PFixedPoolAllocator<cls>()->allocate(1); } \
void * cls::operator new(size_t, const char *, int) { return PFixedPoolAllocator<cls>()->allocate(1); } \
void cls::operator delete(void * ptr) { PFixedPoolAllocator<cls>()->deallocate((cls *)ptr, 1); } \
void cls::operator delete(void * ptr, const char *, int) { PFixedPoolAllocator<cls>()->deallocate((cls *)ptr, 1); }
#define PDownCast (   cls,
  ptr 
)    PAssertCast<cls>(dynamic_cast<cls*>(ptr),__FILE__,__LINE__)
#define PError   (PGetErrorStream())

This macro is used to access the platform specific error output stream.

This is to be used in preference to assuming cerr is always available. On Unix platforms this {is} cerr but for MS-Windows this is another stream that uses the OutputDebugString() Windows API function. Note that a MS-DOS or Windows NT console application would still use cerr.

The PError stream would normally only be used for debugging information as a suitable display is not always available in windowed environments.

The macro is a wrapper for a global variable error stream. The internal variable is initialised to std::cerr for all but MS-Windows and NT GUI applications. An application could change this pointer to a std::ofstream variable of PError output is wished to be redirected to a file.

#define PFalse   false
#define PINLINE
#define PIsDescendant (   ptr,
  cls 
)    (dynamic_cast<const cls *>(ptr) != NULL)
#define PIsDescendantStr (   ptr,
  str 
)    ((ptr)->InternalIsDescendant(str))
#define PLITTLE_ENDIAN   2
#define PMAX (   v1,
  v2 
)    std::max(v1, v2)
#define PMEMORY_ALLOCATION_BREAKPOINT (   point)    PMemoryAllocationBreakpoint PMemoryAllocationBreakpointInstance(point)
#define PMEMORY_HEAP   1
#define PMEMORY_IGNORE_ALLOCATIONS_FOR_SCOPE   PMemoryHeapIgnoreAllocationsForScope instance_PMemoryHeapIgnoreAllocationsForScope
#define PMIN (   v1,
  v2 
)    std::min(v1, v2)
#define PNEW   new (__FILE__, __LINE__)

Macro for overriding system default new operator.

This macro is used to allocate memory via the memory check system selected with the PMEMORY_CHECK compile time option. It will include the source file and line into the memory allocation to allow the PMemoryHeap class to keep track of the memory block.

This macro could be used instead of the system new operator. Or you can place the line


  #define new PNEW

at the begining of the source file, after all declarations that use the PCLASSINFO macro.

Referenced by PHashTableInfo::Clone(), PBaseArray< PHashTableList >::Clone(), PASNIPAddress::Clone(), PList< PMultiPartInfo >::Clone(), PASNTimeTicks::Clone(), PASNCounter::Clone(), PASNGauge::Clone(), PQueue< PXMLElement >::Clone(), PSet< PString >::Clone(), PCharArray::Clone(), PStack< T >::Clone(), PBYTEArray::Clone(), PArray< PODBC::Field >::Clone(), PSortedList< PString >::Clone(), PDictionary< K, PString >::Clone(), POrdinalDictionary< K >::Clone(), PStringSet::Clone(), PStringDictionary< K >::Clone(), PFactoryTemplate< AbstractClass, const KeyType &, KeyType >::InternalRegister(), POrdinalDictionary< K >::SetAt(), PStringDictionary< K >::SetAt(), and POrdinalDictionary< K >::SetDataAt().

#define PNEW_AND_DELETE_FUNCTIONS
Value:
void * operator new(size_t nSize, const char * file, int line) \
{ return PMemoryHeap::Allocate(nSize, file, line, Class()); } \
void * operator new(size_t nSize) \
{ return PMemoryHeap::Allocate(nSize, NULL, 0, Class()); } \
void operator delete(void * ptr) \
{ PMemoryHeap::Deallocate(ptr, Class()); } \
void * operator new(size_t, void * placement) \
{ return placement; } \
void operator delete(void *, void *) \
{ } \
void * operator new[](size_t nSize, const char * file, int line) \
{ return PMemoryHeap::Allocate(nSize, file, line, Class()); } \
void * operator new[](size_t nSize) \
{ return PMemoryHeap::Allocate(nSize, NULL, 0, Class()); } \
void operator delete[](void * ptr) \
{ PMemoryHeap::Deallocate(ptr, Class()); } \
PSPECIAL_DELETE_FUNCTION
#define PRemoveConst (   cls,
  ptr 
)    (const_cast<cls*>(ptr))
#define PSPECIAL_DELETE_FUNCTION
#define PTRACE (   ...)    PTRACE_PART1(PARG_COUNT(__VA_ARGS__), (__VA_ARGS__))

Output trace.

This macro outputs a trace of any information needed, using standard stream output operators. The output is only made if the trace level set by the SetLevel() function is greater than or equal to the first argument.

There can be variable numbers of arguments to this macro. Its full form is:

PTRACE(level, instance, module, stream)

The level is the level for this trace log, instance is a PObject instance to generate a context for the trace, module is a string representing a subsytem for filtering and stream is a standard C++ stream output expression.

Both instance and module can by NULL, or absent. If only one of instance or module is present it is determined by its type (PObject * or char *) as to which it is.

The stream is only evaluated if level is below the PTrace::GetLevel() threshold, so do not expect any functions to always be executed.

Note: If this is used with a static function of a PObject descendant there will be an issue with the default usage of PTraceObjectInstance(). To avoid the issue you will need to make sure the PTRACE macro has four parameters, as in the full form descibed above.

Referenced by PThreadPool< Timeout >::AddWork().

#define PTRACE2 (   level,
  object,
  args 
)    PTRACE_INTERNAL(level, PTRACE_NO_CONDITION, args, object, PTraceModule())
#define PTRACE_ARG_2 (   level,
  args 
)    PTRACE_INTERNAL(level, PTRACE_NO_CONDITION, args, PTraceObjectInstance(), PTraceModule())
#define PTRACE_ARG_3 (   level,
  objectOrModule,
  args 
)    PTRACE_INTERNAL(level, PTRACE_NO_CONDITION, args, objectOrModule, PTraceObjectInstance(objectOrModule), PTraceModule())
#define PTRACE_ARG_4 (   level,
  object,
  module,
  args 
)    PTRACE_INTERNAL(level, PTRACE_NO_CONDITION, args, object, module)
#define PTRACE_ARG_LEVEL   "trace-level"
#define PTRACE_ARG_OPTION   "trace-option"
#define PTRACE_ARG_OUTPUT   "output"
#define PTRACE_ARG_ROLLOVER   "trace-rollover"
#define PTRACE_ARG_TRACE   "trace"
#define PTRACE_ARGLIST   PTRACE_ARGLIST_EXT("t","","o","","")
#define PTRACE_ARGLIST_EXT (   t,
  l,
  o,
  r,
 
)
Value:
t"-"PTRACE_ARG_TRACE". Trace enable (use multiple times for more detail).\n" \
l"-"PTRACE_ARG_LEVEL": Specify trace detail level.\n" \
o"-"PTRACE_ARG_OUTPUT": Specify filename for trace output\rMay be special value such as \"stderr\" dependent on platform.\n" \
r"-"PTRACE_ARG_ROLLOVER": Specify trace file rollover file name pattern.\n" \
O"-"PTRACE_ARG_OPTION": Specify trace option(s),\r" PTRACE_ARGLIST_OPT_HELP "\n"
#define PTRACE_ARGLIST_OPT_HELP
Value:
"use +X or -X to add/remove option where X is one of:\r" \
" block PTrace::Block constructs in output\r" \
" time time since prgram start\r" \
" date date and time\r" \
" gmt Date/time is in UTC\r" \
" thread thread name and identifier\r" \
" level log level\r" \
" file source file name and line number\r" \
" object PObject pointer\r" \
" context context identifier\r" \
" daily rotate output file daily\r" \
" hour rotate output file hourly\r" \
" minute rotate output file every minute\r" \
" append append to output file, otherwise overwrites\r" \
" <perm> file permission similar to unix chmod, but starts\r" \
" with +/- and only has one combination at a time,\r" \
" e.g. +uw is user write, +or is other read, etc"
#define PTRACE_BEGIN (   ...)    PTRACE_BEGIN_PART1(PARG_COUNT(__VA_ARGS__), (__VA_ARGS__))

Begin output trace.

This macro returns a ostream & for trace output.

This macro has variable arguments, and is of the form:

PTRACE_BEGIN(level, instance, module)

See PTRACE() for more information on level, instance, module.

#define PTRACE_BEGIN_ARG_1 (   level)    PTrace::Begin(level, __FILE__, __LINE__, PTraceObjectInstance(), PTraceModule())
#define PTRACE_BEGIN_ARG_2 (   level,
  objectOrModule 
)    PTrace::Begin(level, __FILE__, __LINE__, objectOrModule, PTraceObjectInstance(objectOrModule), PTraceModule())
#define PTRACE_BEGIN_ARG_3 (   level,
  object,
  module 
)    PTrace::Begin(level, __FILE__, __LINE__, object, module)
#define PTRACE_BEGIN_PART1 (   narg,
  args 
)    PTRACE_BEGIN_PART2(narg, args)
#define PTRACE_BEGIN_PART2 (   narg,
  args 
)    PTRACE_BEGIN_ARG_##narg args
#define PTRACE_BLOCK (   name)    PTrace::Block __trace_block_instance(__FILE__, __LINE__, name)

Trace an execution block.

This macro creates a trace variable for tracking the entry and exit of program blocks. It creates an instance of the PTraceBlock class that will output a trace message at the line PTRACE_BLOCK() is called and then on exit from the scope it is defined in.

#define PTRACE_CONTEXT_ID_FROM (   obj)    SetTraceContextIdentifier(obj)
#define PTRACE_CONTEXT_ID_NEW ( )    SetTraceContextIdentifier(PTrace::GetNextContextIdentifier())

Propagate PTRACE context identifier in an object from another.

The context identifier can group objects together with a single identifier which can aid in debugging highly threaded systems where the logs from various threads become very interleaved.

#define PTRACE_CONTEXT_ID_PUSH_THREAD (   obj)    PTraceSaveContextIdentifier praceSavedContextIdentifier(obj)

Referenced by PSafeWork::Work().

#define PTRACE_CONTEXT_ID_SET (   to,
  from 
)    (to).SetTraceContextIdentifier(from)
#define PTRACE_CONTEXT_ID_TO (   obj)    GetTraceContextIdentifier(obj)
#define PTRACE_IF (   ...)    PTRACE_IF_PART1(PARG_COUNT(__VA_ARGS__), (__VA_ARGS__))

Output trace on condition.

This macro conditionally outputs a trace of any information needed.

This macro has variable arguments, and is of the form:

PTRACE_IF(level, condition, instance, module, stream)

Note condition is only evaluated if level is below the PTrace::GetLevel() threshold, and stream is only evaluated if condition is evaluated to true.

See PTRACE() for more information on level, instance, module and stream.

#define PTRACE_IF2 (   level,
  condition,
  object,
  args 
)    PTRACE_INTERNAL(level, && (condition), args, object, PTraceModule())
#define PTRACE_IF_ARG_3 (   level,
  condition,
  args 
)    PTRACE_INTERNAL(level, && (condition), args, PTraceObjectInstance(), PTraceModule())
#define PTRACE_IF_ARG_4 (   level,
  condition,
  objectOrModule,
  args 
)    PTRACE_INTERNAL(level, && (condition), args, objectOrModule, PTraceObjectInstance(objectOrModule), PTraceModule())
#define PTRACE_IF_ARG_5 (   level,
  condition,
  object,
  module,
  args 
)    PTRACE_INTERNAL(level, && (condition), args, object, module)
#define PTRACE_IF_PART1 (   narg,
  args 
)    PTRACE_IF_PART2(narg, args)
#define PTRACE_IF_PART2 (   narg,
  args 
)    PTRACE_IF_ARG_##narg args
#define PTRACE_INITIALISE (   ...)    PTrace::Initialise(__VA_ARGS__)
#define PTRACE_INTERNAL (   level,
  condition,
  args,
  ... 
)
Value:
if (PTrace::CanTrace(level) condition) \
PTrace::Begin(level, __FILE__, __LINE__, __VA_ARGS__) << args << PTrace::End; \
else (void)0
#define PTRACE_LINE ( )
Value:
PTrace::Begin(1, __FILE__, __LINE__) << __FILE__ << '(' << __LINE__ << ')' << PTrace::End; \
else (void)0

Trace the execution of a line.

This macro outputs a trace of a source file line execution.

#define PTRACE_NO_CONDITION
#define PTRACE_PARAM (   ...)    __VA_ARGS__
#define PTRACE_PART1 (   narg,
  args 
)    PTRACE_PART2(narg, args)
#define PTRACE_PART2 (   narg,
  args 
)    PTRACE_ARG_##narg args
#define PTRACING   2
#define PTrue   true
#define realloc (   p,
 
)    PMemoryHeap::Reallocate(p, s, __FILE__, __LINE__)

Override of system call for memory check system.

This macro is used to allocate memory via the memory check system selected with the PMEMORY_CHECK compile time option. It will include the source file and line into the memory allocation to allow the PMemoryHeap class to keep track of the memory block.

#define TRUE   1

Typedef Documentation

typedef intptr_t P_INT_PTR
typedef bool PBoolean
typedef PIntSameOrder<char> PChar8
typedef PIntSameOrder<char> PInt8
typedef PIntSameOrder<unsigned char> PUInt8

Enumeration Type Documentation

Standard assert messages for the PAssert macro.

Enumerator
PLogicError 

A logic error occurred.

POutOfMemory 

A new or malloc failed.

PNullPointerReference 

A reference was made through a NULL pointer.

PInvalidCast 

An invalid cast to descendant is required.

PInvalidArrayIndex 

An index into an array was negative.

PInvalidArrayElement 

A NULL array element object was accessed.

PStackEmpty 

A Pop() was made of a stack with no elements.

PUnimplementedFunction 

Funtion is not implemented.

PInvalidParameter 

Invalid parameter was passed to a function.

POperatingSystemError 

Error was returned by Operating System.

PChannelNotOpen 

Operation attempted when channel not open.

PUnsupportedFeature 

Feature is not supported.

PInvalidWindow 

Access through invalid window.

PMaxStandardAssertMessage 

Number of standard assert message.

Function Documentation

void operator delete ( void *  ptr)
void operator delete[] ( void *  ptr)
void* operator new ( size_t  nSize,
const char *  file,
int  line 
)
inline
void* operator new ( size_t  nSize)
void* operator new[] ( size_t  nSize,
const char *  file,
int  line 
)
inline
void* operator new[] ( size_t  nSize)
template<class BaseClass >
BaseClass* PAssertCast ( BaseClass *  obj,
const char *  file,
int  line 
)
inline

References PAssertFunc(), and PInvalidCast.

bool PAssertFunc ( const char *  file,
int  line,
const char *  className,
PStandardAssertMessage  msg 
)

Referenced by PAssertCast().

bool PAssertFunc ( const char *  file,
int  line,
const char *  className,
const char *  msg 
)
bool PAssertFunc ( const char *  full_msg)
ostream& PGetErrorStream ( )

Get the stream being used for error output.

This stream is used for all trace output using the various trace functions and macros.

int PParseEnum ( const char *  str,
int  begin,
int  end,
char const *const *  names,
bool  matchCase = true 
)
void PPrintEnum ( std::ostream &  strm,
int  e,
int  begin,
int  end,
char const *const *  names 
)
int PReadEnum ( std::istream &  strm,
int  begin,
int  end,
char const *const *  names,
bool  matchCase = true 
)
void PSetErrorStream ( ostream *  strm)

Set the stream to be used for error output.

This stream is used for all error output using the PError macro.

Parameters
strmNew stream for error output
__inline const char* PTraceModule ( )
__inline const PObject* PTraceObjectInstance ( )
static __inline const PObject* PTraceObjectInstance ( const void *  )
static
void runtime_free ( void *  ptr)
inline

Free memory allocated by run time library.

This version of free is used for data that is not allocated using the memory check system, ie was malloc'ed inside the C run time library.

Parameters
ptrMemory block to free

References free.

void* runtime_malloc ( size_t  bytes)
inline

Allocate memory for the run time library.

This version of free is used for data that is not to be allocated using the memory check system, ie will be free'ed inside the C run time library.

Parameters
bytesSize of block to allocate

References malloc.