📄 object.h
字号:
/* * object.h * * Mother of all ancestor classes. * * Portable Windows Library * * Copyright (c) 1993-1998 Equivalence Pty. Ltd. * * The contents of this file are subject to the Mozilla Public License * Version 1.0 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See * the License for the specific language governing rights and limitations * under the License. * * The Original Code is Portable Windows Library. * * The Initial Developer of the Original Code is Equivalence Pty. Ltd. * * Portions are Copyright (C) 1993 Free Software Foundation, Inc. * All Rights Reserved. * * Contributor(s): ______________________________________. * * $Log: object.h,v $ * Revision 1.110 2004/08/14 14:17:29 csoutheren * Fixed problem with PAssert and associated functions caused by using expressions * as statements. inline functions are your friend :) * * Revision 1.109 2004/08/05 12:09:35 rjongbloed * Added macros for "remove const" and "down cast" funcions with and without RTTI. * Added ability to disable Asserts. * Change PAssert macros so pass through the boolean result so that they can be used * in if statements, allowing a chance to continue if ignore assert. * * Revision 1.108 2004/07/11 07:56:35 csoutheren * Applied jumbo VxWorks patch, thanks to Eize Slange * * Revision 1.107 2004/07/03 06:49:49 rjongbloed * Added PTRACE_PARAM() macro to fix warnings on parameters used in PTRACE * macros only. * * Revision 1.106 2004/06/01 07:42:19 csoutheren * Restored memory allocation checking * Added configure flag to enable, thanks to Derek Smithies * * Revision 1.105 2004/06/01 05:22:43 csoutheren * Restored memory check functionality * * Revision 1.104 2004/05/12 04:36:17 csoutheren * Fixed problems with using sem_wait and friends on systems that do not * support atomic integers * * Revision 1.103 2004/04/18 04:33:36 rjongbloed * Changed all operators that return BOOL to return standard type bool. This is primarily * for improved compatibility with std STL usage removing many warnings. * * Revision 1.102 2004/04/11 13:26:25 csoutheren * Removed namespace problems and removed warnings for Windows <string> * * Revision 1.101 2004/04/11 03:20:41 csoutheren * Added Unix implementation of PCriticalSection * * Revision 1.100 2004/04/11 02:55:17 csoutheren * Added PCriticalSection for Windows * Added compile time option for PContainer to use critical sections to provide thread safety under some circumstances * * Revision 1.99 2004/04/09 11:54:46 csoutheren * Added configure.in check for STL streams, and tested with gcc 2.95.3, * gcc 3.3.1, and gcc 3.3.3 * * Revision 1.98 2004/04/09 07:53:51 rjongbloed * Fixed backward compatibility after STL streams change * * Revision 1.97 2004/04/09 00:56:35 csoutheren * Fixed problem with new class name code * * Revision 1.96 2004/04/09 00:42:58 csoutheren * Changed Unix build to use slightly different method for * keep class names, as GCC does not use actual class names for typeinfo * * Revision 1.95 2004/04/04 13:24:18 rjongbloed * Changes to support native C++ Run Time Type Information * * Revision 1.94 2004/04/03 08:57:31 csoutheren * Replaced pseudo-RTTI with real RTTI * * Revision 1.93 2004/04/03 08:22:20 csoutheren * Remove pseudo-RTTI and replaced with real RTTI * * Revision 1.92 2004/04/03 07:41:00 csoutheren * Fixed compile problem with ostringstream/ostrstream * * Revision 1.91 2004/04/03 07:16:05 rjongbloed * Fixed backward compatibility with MSVC 6 * * Revision 1.90 2004/04/03 06:54:22 rjongbloed * Many and various changes to support new Visual C++ 2003 * * Revision 1.89 2003/09/17 09:00:59 csoutheren * Moved PSmartPointer and PNotifier into seperate files * Added detection for system regex libraries on all platforms * * Revision 1.88 2003/09/17 05:41:58 csoutheren * Removed recursive includes * * Revision 1.87 2003/09/17 01:18:02 csoutheren * Removed recursive include file system and removed all references * to deprecated coooperative threading support * * Revision 1.86 2002/10/14 21:42:37 rogerh * Only use malloc.h on Windows * * Revision 1.85 2002/10/10 04:43:43 robertj * VxWorks port, thanks Martijn Roest * * Revision 1.84 2002/10/08 12:41:51 robertj * Changed for IPv6 support, thanks S閎astien Josset. * * Revision 1.83 2002/09/16 01:08:59 robertj * Added #define so can select if #pragma interface/implementation is used on * platform basis (eg MacOS) rather than compiler, thanks Robert Monaghan. * * Revision 1.82 2002/08/06 02:27:58 robertj * GNU C++ v3 compatibility. * * Revision 1.81 2002/06/25 02:22:47 robertj * Improved assertion system to allow C++ class name to be displayed if * desired, especially relevant to container classes. * * Revision 1.80 2002/06/14 10:29:43 rogerh * STL + gcc 3.1 compile fix. Submitted by Klaus Kaempf <kkaempf@suse.de> * * Revision 1.79 2002/06/13 08:34:05 rogerh * gcc 3.1 needs iostream instead of iostream.h * * Revision 1.78 2002/05/22 00:23:31 craigs * Added GMTTime flag to tracing options * * Revision 1.77 2002/04/19 00:20:51 craigs * Added option to append to log file rather than create anew each time * * Revision 1.76 2002/01/26 23:55:55 craigs * Changed for GCC 3.0 compatibility, thanks to manty@manty.net * * Revision 1.75 2001/10/18 19:56:26 yurik * Fixed WinCE x86 compilation problems with memory check off * * Revision 1.74 2001/08/12 11:26:07 robertj * Put back PMEMORY_CHECK taken out by the Carbon port. * * Revision 1.73 2001/08/11 07:57:30 rogerh * Add Mac OS Carbon changes from John Woods <jfw@jfwhome.funhouse.com> * * Revision 1.72 2001/05/03 06:27:29 robertj * Added return value to PMemoryCheck::SetIgnoreAllocations() so get previous state. * * Revision 1.71 2001/03/24 01:11:10 robertj * Added missing PTRACE_IF define in non PTRACING mode. * * Revision 1.70 2001/03/23 05:34:09 robertj * Added PTRACE_IF to output trace if a conditional is TRUE. * * Revision 1.69 2001/03/01 02:15:16 robertj * Fixed PTRACE_LINE() so drops filename and line which may not be in trace otherwise. * * Revision 1.68 2001/02/22 08:16:41 robertj * Added standard trace file setup subroutine. * * Revision 1.67 2001/02/13 03:27:24 robertj * Added function to do heap validation. * * Revision 1.66 2001/02/09 04:41:27 robertj * Removed added non memrycheck implementations of new/delete when using GNU C++. * * Revision 1.65 2001/02/07 04:47:49 robertj * Added changes for possible random crashes in multi DLL environment * due to memory allocation wierdness, thanks Milan Dimitrijevic. * * Revision 1.64 2001/01/24 06:15:44 yurik * Windows CE port-related declarations * * Revision 1.63 2000/07/28 05:13:47 robertj * Fixed silly mistake in runtime_malloc() function, should return a pointer! * * Revision 1.62 2000/07/20 05:46:34 robertj * Added runtime_malloc() function for cases where memory check code must be bypassed. * * Revision 1.61 2000/07/13 15:45:35 robertj * Removed #define std that causes everyone so much grief! * * Revision 1.60 2000/06/26 11:17:19 robertj * Nucleus++ port (incomplete). * * Revision 1.59 2000/02/29 12:26:14 robertj * Added named threads to tracing, thanks to Dave Harvey * * Revision 1.58 2000/01/07 12:31:12 robertj * Fixed 8 byte alignment on memory heap checking. * * Revision 1.57 2000/01/05 00:29:12 robertj * Fixed alignment problems in memory checking debug functions. * * Revision 1.56 1999/11/30 00:22:54 robertj * Updated documentation for doc++ * * Revision 1.55 1999/11/01 00:10:27 robertj * Added override of new functions for MSVC memory check code. * * Revision 1.54 1999/10/19 09:21:30 robertj * Added functions to get current trace options and level. * * Revision 1.53 1999/09/13 13:15:06 robertj * Changed PTRACE so will output to system log in PServiceProcess applications. * * Revision 1.52 1999/08/24 08:15:23 robertj * Added missing operator on smart pointer to return the pointer! * * Revision 1.51 1999/08/24 06:54:36 robertj * Cleaned up the smart pointer code (macros). * * Revision 1.50 1999/08/22 13:38:39 robertj * Fixed termination hang up problem with memory check code under unix pthreads. * * Revision 1.49 1999/08/17 03:46:40 robertj * Fixed usage of inlines in optimised version. * * Revision 1.48 1999/08/10 10:45:09 robertj * Added mutex in memory check detection code. * * Revision 1.47 1999/07/18 15:08:24 robertj * Fixed 64 bit compatibility * * Revision 1.46 1999/06/14 07:59:37 robertj * Enhanced tracing again to add options to trace output (timestamps etc). * * Revision 1.45 1999/05/01 11:29:19 robertj * Alpha linux port changes. * * Revision 1.44 1999/04/18 12:58:39 robertj * MSVC 5 backward compatibility * * Revision 1.43 1999/03/09 10:30:17 robertj * Fixed ability to have PMEMORY_CHECK on/off on both debug/release versions. * * Revision 1.42 1999/03/09 02:59:50 robertj * Changed comments to doc++ compatible documentation. * * Revision 1.41 1999/02/23 07:11:26 robertj * Improved trace facility adding trace levels and #define to remove all trace code. * * Revision 1.40 1999/02/22 10:48:14 robertj * Fixed delete operator prototypes for MSVC6 and GNU compatibility. * * Revision 1.39 1999/02/19 11:33:02 robertj * Fixed compatibility problems with GNU/MSVC6 * * Revision 1.38 1999/02/16 08:12:22 robertj * MSVC 6.0 compatibility changes. * * Revision 1.37 1999/01/07 03:35:35 robertj * Added default for PCHAR8 to ANSI, removes need for compiler option. * * Revision 1.36 1998/12/15 09:00:29 robertj * Fixed 8 byte alignment problem in memory leak check code for sparc. * * Revision 1.35 1998/11/03 00:57:19 robertj * Added allocation breakpoint variable. * * Revision 1.34 1998/10/26 11:05:26 robertj * Added raw free for things allocated within the runtime library. * * Revision 1.33 1998/10/18 14:26:55 robertj * Improved tracing functions. * * Revision 1.32 1998/10/15 07:47:21 robertj * Added ability to ignore G++lib memory leaks. * * Revision 1.31 1998/10/15 01:53:58 robertj * GNU compatibility. * * Revision 1.30 1998/10/13 14:23:29 robertj * Complete rewrite of memory leak detection. * * Revision 1.29 1998/09/23 06:20:57 robertj * Added open source copyright license. * * Revision 1.28 1998/09/14 12:29:11 robertj * Fixed memory leak dump under windows to not include static globals. * Fixed problem with notifier declaration not allowing implementation inline after macro. * * Revision 1.27 1997/07/08 13:13:45 robertj * DLL support. * * Revision 1.26 1997/04/27 05:50:11 robertj * DLL support. * * Revision 1.25 1997/02/05 11:54:10 robertj * Fixed problems with memory check and leak detection. * * Revision 1.24 1996/09/16 12:57:23 robertj * DLL support * * Revision 1.23 1996/08/17 10:00:23 robertj * Changes for Windows DLL support. * * Revision 1.22 1996/07/15 10:27:51 robertj * Changed endian classes to be memory mapped. * * Revision 1.21 1996/05/09 12:14:48 robertj * Fixed up 64 bit integer class for Mac platform. * * Revision 1.20 1996/02/24 14:19:29 robertj * Fixed bug in endian independent integer code for memory transfers. * * Revision 1.19 1996/01/28 02:46:43 robertj * Removal of MemoryPointer classes as usage didn't work for GNU. * Added missing bit shift operators to 64 bit integer class. * * Revision 1.18 1996/01/23 13:14:32 robertj * Added const version of PMemoryPointer. * Added constructor to endian classes for the base type. * * Revision 1.17 1996/01/02 11:54:11 robertj * Mac OS compatibility changes. * * Revision 1.16 1995/11/09 12:17:10 robertj * Added platform independent base type access classes. * * Revision 1.15 1995/06/17 11:12:47 robertj * Documentation update. * * Revision 1.14 1995/06/04 12:34:19 robertj * Added trace functions. * * Revision 1.13 1995/04/25 12:04:35 robertj * Fixed borland compatibility. * Fixed function hiding ancestor virtuals. * * Revision 1.12 1995/03/14 12:41:54 robertj * Updated documentation to use HTML codes. * * Revision 1.11 1995/03/12 04:40:55 robertj * Changed standard error code for not open from file to channel. * * Revision 1.10 1995/02/19 04:19:14 robertj * Added dynamically linked command processing. * * Revision 1.9 1995/02/05 00:48:07 robertj * Fixed template version. * * Revision 1.8 1995/01/15 04:51:31 robertj * Mac compatibility. * Added levels of memory checking. * * Revision 1.7 1995/01/09 12:38:31 robertj * Changed variable names around during documentation run. * Fixed smart pointer comparison. * Fixed serialisation stuff. * Documentation. * * Revision 1.6 1995/01/03 09:39:06 robertj * Put standard malloc style memory allocation etc into memory check system. * * Revision 1.5 1994/12/12 10:08:30 robertj * Renamed PWrapper to PSmartPointer.. * * Revision 1.4 1994/12/05 11:23:28 robertj * Fixed PWrapper macros. * * Revision 1.3 1994/11/19 00:22:55 robertj * Changed PInteger to be INT, ie standard type like BOOL/WORD etc. * Moved null object check in notifier to construction rather than use. * Added virtual to the callback function in notifier destination class. * * Revision 1.2 1994/11/03 09:25:30 robertj * Made notifier destination object not to be descendent of PObject. * * Revision 1.1 1994/10/30 12:01:37 robertj * Initial revision * */#ifndef _POBJECT_H#define _POBJECT_H#ifdef P_USE_PRAGMA#pragma interface#endif#ifdef _WIN32#include "msos/ptlib/contain.h"#else#include "unix/ptlib/contain.h"#endif#if defined(P_VXWORKS)#include <private/stdiop.h>#endif#include <stdio.h>#include <stdarg.h>#include <stdlib.h>#ifdef _WIN32 #include <malloc.h>#endif#include <string.h>#ifdef __USE_STL__ #include <string> #include <iomanip> #include <iostream> #if (__GNUC__ >= 3) #include <sstream> //typedef std::ostringstream ostrstream; #else #include <strstream> #endif //using namespace std;#else #if (__GNUC__ >= 3) #include <iostream> #ifndef __MWERKS__ #include <iomanip> #endif #else #include <iostream.h> #ifdef __GNUC__ #include <strstream.h> #else #include <strstrea.h> #endif #ifndef __MWERKS__ #include <iomanip.h> #endif #endif#endif#ifdef _WIN32_WCE #include <stdlibx.h>#endif#if (__GNUC__ < 3)typedef long _Ios_Fmtflags;#endif#if _MSC_VER<1300#define _BADOFF -1#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -