PTLib  Version 2.18.8
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
object.h File Reference
#include <ptlib_config.h>
#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 <functional>
#include <limits>
#include <typeinfo>
#include <memory>
#include "atomic.h"
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  PAutoPtr< T >
 
struct  PDebugLocation
 Information about a source file location. More...
 
class  PTrace
 Class to encapsulate tracing functions. More...
 
class  PTrace::Block
 Class to trace Execution blocks. More...
 
class  PTrace::ThrottleBase
 Class to reduce noise level for some logging. More...
 
struct  PTrace::Throttle< lowLevel, interval, highLevel, maxShown >
 Template class to reduce noise level for some logging. More...
 
class  PTraceSaveContextIdentifier
 
class  PMinMaxAvg< ValueType, AccumType >
 Template class for integral types (incluing PTimeInterval) for calcualting minimum, maximum and average. More...
 
class  PProfiling::TimeScope
 This class, along with the PPROFILE_TIMESCOPE() macro, allows the measurement of the time used by a section of code delimited by the scope (block till the close brace) with minimum, maximum and averages displayed as a PTRACE(). More...
 
class  PProfiling::TimeScope::Measure
 Class used by PPROFILE_TIMESCOPE() macro to do the measurement of time between construction and destruction. More...
 
struct  PProfiling::HighWaterMarkData
 
struct  PProfiling::HighWaterMark< CLS >
 
class  PMemoryHeap
 Memory heap checking class. More...
 
struct  PMemoryHeap::State
 
struct  PMemoryHeap::Header
 
class  PMemoryHeapIgnoreAllocationsForScope
 
class  PMemoryAllocationBreakpoint
 
class  PSingleton< Type, GuardType, Creator >
 Template class for a simple singleton object. More...
 
class  PSafeSingleton< Type, Creator >
 
class  PObject
 Ultimate parent class for all objects in the class library. More...
 
struct  PIntSameOrder< type >
 
struct  PIntReversedOrder< type >
 

Namespaces

 PProfiling
 

Macros

#define P_MAX_INDEX   ::std::numeric_limits<PINDEX>::max()
 
#define PASSERTINDEX(idx)   PAssert((idx) >= 0, PInvalidArrayIndex)
 
#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 PIGNORE_RETURN(t, e)   do { t unused __attribute__((unused)) = (e); } while(0)
 
#define FALSE   0
 
#define TRUE   1
 
#define PTrue   true
 
#define PFalse   false
 
#define P_USE_INLINES   0
 
#define PINLINE
 
#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)
 Count the number of arguments passed in macro. More...
 
#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
 
#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_DEBUG_LOCATION   PDebugLocation(__FILE__, __LINE__)
 
#define P_USE_ASSERTS   1
 
#define __CLASS__   NULL
 
#define PAssert(b, msg)   ((b)?true:PAssertFunc(PDebugLocation(__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(PDebugLocation(__FILE__,__LINE__,(cls)),(msg)))
 This macro is used to assert that a condition must be true. More...
 
#define PAssertOS(b)   ((b)?true:PAssertFunc(PDebugLocation(__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(PDebugLocation(__FILE__,__LINE__,__CLASS__),(msg))
 This macro is used to assert immediately. More...
 
#define PAssertAlways2(cls, msg)   PAssertFunc(PDebugLocation(__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()   (PTrace::CanTrace(1)) ? (void)(PTrace::Begin(1, __FILE__, __LINE__) << __FILE__ << '(' << __LINE__ << ')' << PTrace::End) : (void)0
 Trace the execution of a line. More...
 
#define PTRACE_INTERNAL(level, condition, args,...)   (PTrace::CanTrace(level) condition) ? ((PTrace::Begin(level, __FILE__, __LINE__, __VA_ARGS__) << args << PTrace::End), true) : false
 
#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_ONCE(level,...)
 Execute trace precisely once, and no more. More...
 
#define PTRACE_BEGIN(...)   PTRACE_BEGIN_PART1(PARG_COUNT(__VA_ARGS__), (__VA_ARGS__))
 Begin output trace. More...
 
#define PTRACE_THROTTLE(var,...)   PTrace::Throttle<__VA_ARGS__> var
 
#define PTRACE_THROTTLE_STATIC(var,...)   static PTrace::Throttle<__VA_ARGS__> var
 
#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)   PObject::CopyTraceContextIdentifier(to, from)
 
#define PTRACE_CONTEXT_ID_FROM(obj)   SetTraceContextIdentifier(obj)
 
#define PTRACE_CONTEXT_ID_TO(obj)   CopyTraceContextIdentifier(obj)
 
#define PTRACE_CONTEXT_ID_PUSH_THREAD(obj)   PTraceSaveContextIdentifier ptraceSavedContextIdentifier(obj)
 
#define P_DECLARE_TRACED_ENUM   P_DECLARE_STREAMABLE_ENUM
 
#define P_DECLARE_TRACED_ENUM_EX   P_DECLARE_STREAMABLE_ENUM_EX
 
#define PPROFILE_EXCLUDE(func)   func
 
#define __PRETTY_FUNCTION__   __FUNCTION__
 
#define PPROFILE_BLOCK(...)
 
#define PPROFILE_FUNCTION()
 
#define PPROFILE_PRE_SYSTEM()
 
#define PPROFILE_POST_SYSTEM()
 
#define PPROFILE_SYSTEM(...)   __VA_ARGS__
 
#define PPROFILE_TIMESCOPE(name, context,...)
 
#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(align)
 
#define PMEMORY_IGNORE_ALLOCATIONS_FOR_SCOPE   PMemoryHeapIgnoreAllocationsForScope instance_PMemoryHeapIgnoreAllocationsForScope
 
#define PMEMORY_ALLOCATION_BREAKPOINT(point)   PMemoryAllocationBreakpoint PMemoryAllocationBreakpointInstance(point)
 
#define PDECLARE_POOL_ALLOCATOR(cls)
 
#define PDEFINE_POOL_ALLOCATOR(cls)
 
#define PCLASSINFO_ALIGNED(cls, par, align)
 
#define PCLASSINFO(cls, par)   PCLASSINFO_ALIGNED(cls, (par), 0)
 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 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< int8_t > PChar8
 
typedef PIntSameOrder< int8_t > PInt8
 
typedef PIntSameOrder< uint8_t > 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)
 
__inline ostream & operator<< (ostream &strm, const PDebugLocation &location)
 
bool PAssertFunc (const PDebugLocation &location, PStandardAssertMessage msg)
 
bool PAssertFunc (const PDebugLocation &location, const char *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 ()
 
__inline uint64_t PProfiling::GetCycles ()
 
 PProfiling::PPROFILE_EXCLUDE (int64_t CyclesToNanoseconds(uint64_t cycles))
 
 PProfiling::PPROFILE_EXCLUDE (float CyclesToSeconds(uint64_t cycles))
 
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)
 
void PThreadYield ()
 
template<class Type >
Type * PSingletonCreatorDefault ()
 
template<class BaseClass >
BaseClass * PAssertCast (BaseClass *obj, const char *file, int line)
 

Variables

bool PAssertWalksStack
 
unsigned PAssertCount
 

Macro Definition Documentation

#define __CLASS__   NULL
#define __PRETTY_FUNCTION__   __FUNCTION__
#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_DEBUG_LOCATION   PDebugLocation(__FILE__, __LINE__)
#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); }
Invalid parameter was passed to a function.
Definition: object.h:378
#define PAssert(b, msg)
This macro is used to assert that a condition must be true.
Definition: object.h:400

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); }
__inline std::ostream & operator<<(std::ostream &strm, const PHashTableList &hash)
Definition: dict.h:180
int PParseEnum(const char *str, int begin, int end, char const *const *names, bool matchCase=true)
int PReadEnum(std::istream &strm, int begin, int end, char const *const *names, bool matchCase=true)
#define PAssertNULL(ptr)
This macro is used to assert that a pointer must be non-null.
Definition: object.h:428
void PPrintEnum(std::ostream &strm, int e, int begin, int end, char const *const *names)

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__)))
#define P_DECLARE_ENUM_NAMES(name,...)
This declares the functions and string table for the text names of an enum.
Definition: object.h:303
#define P_DECLARE_ENUM_EX(name, countName, firstName, firstValue,...)
This declares a standard enumeration (enum) of symbols with ++ and – operators.
Definition: object.h:229
#define P_ENUM_NAMES_PART1(narg, args)
Definition: object.h:254
#define PARG_COUNT(...)
Count the number of arguments passed in macro.
Definition: object.h:209

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_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)

Count the number of arguments passed in macro.

#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
#define PARRAYSIZE (   array)    ((PINDEX)(sizeof(array)/sizeof(array[0])))
#define PAssert (   b,
  msg 
)    ((b)?true:PAssertFunc(PDebugLocation(__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 PFactoryTemplate< AbstractClass, ParamType, KeyType >::WorkerBase::Create(), PSortedList< PString >::erase(), PBYTEArray::GetAs(), P_WXWINDOWS_DEVICE_CLASS::InternalOpen(), P_WXWINDOWS_DEVICE_CLASS::OnPaint(), PBaseArray< PHashTableList >::operator[](), PArray< PODBC::Field >::operator[](), PThreadPool< Worker >::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(PDebugLocation(__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(PDebugLocation(__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(), and PSyncQueue< PQueuedThreadPool::QueuedWorkerThread::QueuedWork >::Dequeue().

#define PAssertAlways2 (   cls,
  msg 
)    PAssertFunc(PDebugLocation(__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 PASSERTINDEX (   idx)    PAssert((idx) >= 0, PInvalidArrayIndex)
#define PAssertNULL (   ptr)
Value:
(((ptr)!=NULL)?(ptr): \
Information about a source file location.
Definition: object.h:333
#define __CLASS__
Definition: object.h:386
A reference was made through a NULL pointer.
Definition: object.h:372
bool PAssertFunc(const PDebugLocation &location, PStandardAssertMessage msg)

This macro is used to assert that a pointer must be non-null.

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

Note that this evaluates the expression defined by ptr twice. To prevent incorrect behaviour with this, the macro will assume that the ptr parameter is an L-Value.

Referenced by PQueuedThreadPool< Work_T >::QueuedWorkerThread::AddWork(), PList< PMultiPartInfo >::back(), PList< PMultiPartInfo >::front(), PJSON::GetAs(), PLDAPStructBase::GetInitialiser(), PFactoryTemplate< AbstractClass, const KeyType &, KeyType >::InternalRegister(), PJSON::IsType(), PList< T >::iterator_base::Next(), PSet< T >::iterator_base::Next(), PDictionary< K, D >::iterator_base::Next(), PDynaLink::EntryPoint< FuncPtr >::operator FuncPtr(), PNotifierTemplate< PChannel::AsyncContext & >::operator()(), PSmartPtr< T >::operator*(), PSafePtr< PMonitoredSockets >::operator*(), PSmartPtr< T >::operator->(), PSafePtr< PMonitoredSockets >::operator->(), PNotifierFunctionTemplate< ParamType >::PNotifierFunctionTemplate(), PList< T >::iterator_base::Prev(), PSet< T >::iterator_base::Prev(), PDictionary< K, D >::iterator_base::Prev(), PList< T >::iterator_base::Ptr(), and PSet< T >::iterator_base::Ptr().

#define PAssertOS (   b)    ((b)?true:PAssertFunc(PDebugLocation(__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 
)    PCLASSINFO_ALIGNED(cls, (par), 0)

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_ALIGNED (   cls,
  par,
  align 
)
Value:
public: \
typedef cls P_thisClass; \
__inline static const char * Class() { return typeid(cls).name(); } \
__inline bool IsClass(const char * name) const { return strcmp(name, Class()) == 0; } \
virtual PObject::Comparison CompareObjectMemoryDirect(const PObject & obj) const \
{ return PObject::InternalCompareObjectMemoryDirect(this, dynamic_cast<const cls *>(&obj), sizeof(cls)); } \
Comparison
Result of the comparison operation performed by the Compare() function.
Definition: object.h:2251
#define PNEW_AND_DELETE_FUNCTIONS(align)
Definition: object.h:1908
Ultimate parent class for all objects in the class library.
Definition: object.h:2204
static Comparison InternalCompareObjectMemoryDirect(const PObject *obj1, const PObject *obj2, PINDEX size)
Internal function caled from CompareObjectMemoryDirect()
#define PCLASSINFO_WITH_CLONE (   cls,
  par 
)
Value:
PCLASSINFO(cls, par) \
virtual PObject * Clone() const { return new cls(*this); }
#define PCLASSINFO(cls, par)
Declare all the standard PTLib class information.
Definition: object.h:2164
Ultimate parent class for all objects in the class library.
Definition: object.h:2204

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 (   cls)
Value:
virtual ~cls() { } \
__inline static const char * Class() { return typeid(cls).name(); } \
#define PNEW_AND_DELETE_FUNCTIONS(align)
Definition: object.h:1908
#define PDEFINE_POOL_ALLOCATOR (   cls)
#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 PIGNORE_RETURN (   t,
 
)    do { t unused __attribute__((unused)) = (e); } while(0)
#define PINLINE
#define PIsDescendant (   ptr,
  cls 
)    (dynamic_cast<const cls *>(ptr) != NULL)
#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 (   align)
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()); } \
static void Deallocate(void *ptr, const char *className)
Free a memory block.
static void * Allocate(size_t nSize, const char *file, int line, const char *className)
Allocate a memory block.
#define PSPECIAL_DELETE_FUNCTION
Definition: object.h:1899
#define PPROFILE_BLOCK (   ...)
#define PPROFILE_EXCLUDE (   func )    func
#define PPROFILE_FUNCTION ( )
#define PPROFILE_POST_SYSTEM ( )
#define PPROFILE_PRE_SYSTEM ( )
#define PPROFILE_SYSTEM (   ...)    __VA_ARGS__
#define PPROFILE_TIMESCOPE (   name,
  context,
  ... 
)
Value:
static ::PProfiling::TimeScope p_profile_timescope_static_instance##name(PDebugLocation(__FILE__, __LINE__, #name), __VA_ARGS__); \
::PProfiling::TimeScope::Measure p_profile_timescope_instance##name(p_profile_timescope_static_instance##name, context)
Information about a source file location.
Definition: object.h:333
Class used by PPROFILE_TIMESCOPE() macro to do the measurement of time between construction and destr...
Definition: object.h:1486
#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.

The general policy for levels in trace logs is: Level 0 - Fatal error - program will likely crash Level 1 - Error - program should continue, but call will likely fail. Level 2 - Warning - something not right, call might continue with something missing Level 3 - Info - all should be well, but enough information to track something odd Level 4 - Debug1 - More info on what's ahppening, including protocol packet dumps Level 5 - Debug2 - A lot more information, including more details on protocol Level 6 - Debug3 - A ridiculous amount of debugging, includes media packets. Level 7 - Debug4 - A hard disk filler. Used only to track down the nastiest of problems

Referenced by PThreadPool< Worker >::AddWork(), P_WXWINDOWS_DEVICE_CLASS::Close(), P_WXWINDOWS_DEVICE_CLASS::FrameComplete(), P_WXWINDOWS_DEVICE_CLASS::InternalClose(), P_WXWINDOWS_DEVICE_CLASS::InternalFrameComplete(), P_WXWINDOWS_DEVICE_CLASS::InternalOpen(), P_WXWINDOWS_DEVICE_CLASS::OnClose(), P_WXWINDOWS_DEVICE_CLASS::OnPaint(), P_WXWINDOWS_DEVICE_CLASS::Open(), PQueuedThreadPool< Worker >::PQueuedThreadPool(), PThreadPool< Worker >::RemoveWork(), and P_WXWINDOWS_DEVICE_CLASS::SetFrameSize().

#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_ARG_LEVEL
Definition: object.h:559
#define PTRACE_ARG_ROLLOVER
Definition: object.h:561
#define PTRACE_ARG_TRACE
Definition: object.h:558
#define PTRACE_ARG_OPTION
Definition: object.h:562
#define PTRACE_ARG_OUTPUT
Definition: object.h:560
#define PTRACE_ARGLIST_OPT_HELP
Definition: object.h:538
#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 program start\r" \
" date date and time\r" \
" gmt Date/time is in UTC\r" \
" thread thread name and identifier\r" \
" level log level\r" \
" source source file name and line number\r" \
" object PObject pointer\r" \
" context context identifier\r" \
" single single line output\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 ptraceSavedContextIdentifier(obj)

Referenced by PSafeWork::Work().

#define PTRACE_CONTEXT_ID_SET (   to,
  from 
)    PObject::CopyTraceContextIdentifier(to, from)
#define PTRACE_CONTEXT_ID_TO (   obj)    CopyTraceContextIdentifier(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,
  ... 
)    (PTrace::CanTrace(level) condition) ? ((PTrace::Begin(level, __FILE__, __LINE__, __VA_ARGS__) << args << PTrace::End), true) : false
#define PTRACE_LINE ( )    (PTrace::CanTrace(1)) ? (void)(PTrace::Begin(1, __FILE__, __LINE__) << __FILE__ << '(' << __LINE__ << ')' << PTrace::End) : (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_ONCE (   level,
  ... 
)
Value:
{ \
static PAtomicBoolean firstTrace(true); \
PTRACE_IF((level), firstTrace.TestAndSet(false), __VA_ARGS__); \
}
Definition: atomic.h:267
#define PTRACE_IF(...)
Output trace on condition.
Definition: object.h:1053

Execute trace precisely once, and no more.

Note, this will execute once only if the current log level is sufficient. Thus, if log level is increased it will still execute even if the statement was passed previously.

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

#define PTRACE_PARAM (   ...)    __VA_ARGS__
#define PTRACE_PART1 (   narg,
  args 
)    PTRACE_PART2(narg, args)
#define PTRACE_PART2 (   narg,
  args 
)    PTRACE_ARG_##narg args
#define PTRACE_THROTTLE (   var,
  ... 
)    PTrace::Throttle<__VA_ARGS__> var
#define PTRACE_THROTTLE_STATIC (   var,
  ... 
)    static PTrace::Throttle<__VA_ARGS__> var
#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<int8_t> PChar8
typedef PIntSameOrder<int8_t> PInt8
typedef PIntSameOrder<uint8_t> 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)
__inline ostream& operator<< ( ostream &  strm,
const PDebugLocation location 
)
template<class BaseClass >
BaseClass* PAssertCast ( BaseClass *  obj,
const char *  file,
int  line 
)
inline

References PAssertFunc(), and PInvalidCast.

bool PAssertFunc ( const PDebugLocation location,
PStandardAssertMessage  msg 
)

Referenced by PAssertCast().

bool PAssertFunc ( const PDebugLocation location,
const char *  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
template<class Type >
Type* PSingletonCreatorDefault ( )
__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.

Variable Documentation

unsigned PAssertCount
bool PAssertWalksStack