⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 object.h

📁 mgcp协议源代码。支持多种编码:g711
💻 H
📖 第 1 页 / 共 5 页
字号:
/* * 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.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 * */#ifdef __GNUC__#pragma interface#endif#include <stdio.h>#include <stdarg.h>#include <stdlib.h>#include <string.h>#ifdef __USE_STL__#include <string>#include <iomanip>#include <iostream>#include <strstream>#else#include <iostream.h>#ifndef __MWERKS__#include <iomanip.h>#endif#endif///////////////////////////////////////////////////////////////////////////////// Disable inlines when debugging for faster compiles (the compiler doesn't// actually inline the function with debug on any way).#ifndef P_USE_INLINES#ifdef _DEBUG#define P_USE_INLINES 0#else#define P_USE_INLINES 1#endif#endif#if P_USE_INLINES#define PINLINE inline#else#define PINLINE#endif///////////////////////////////////////////////////////////////////////////////// Declare the debugging support/// Standard assert messages for the PAssert macro.enum PStandardAssertMessage {  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};/** 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 sourcefile and line number the macro was instantiated on, plus the message describedby the #msg# parameter. This parameter may be either a standard valuefrom the #PStandardAssertMessage# enum or a literal string.*/#define PAssert(b, m) if(b);else PAssertFunc(__FILE__, __LINE__, (m))/** 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 sourcefile and line number the macro was instantiated on, plus the messagedescribed by the #POperatingSystemError# value in the #PStandardAssertMessage#enum. */#define PAssertOS(b) \              if(b);else PAssertFunc(__FILE__, __LINE__, POperatingSystemError)/** 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 fileand line number the macro was instantiated on, plus the message described bythe PNullPointerReference value in the #PStandardAssertMessage# enum.Note that this evaluates the expression defined by #ptr# twice. Toprevent incorrect behaviour with this, the macro will assume that the#ptr# parameter is an L-Value. */#define PAssertNULL(p) ((&(p)&&(p)!=NULL)?(p):(PAssertFunc(__FILE__, \                                        __LINE__, PNullPointerReference), (p)))/** This macro is used to assert immediately.The assert function is called with the source file and line number the macrowas instantiated on, plus the message described by the #msg# parameter. Thisparameter may be either a standard value from the #PStandardAssertMessage#enum or a literal string.*/#define PAssertAlways(m) PAssertFunc(__FILE__, __LINE__, (m))void PAssertFunc(const char * file, int line, PStandardAssertMessage msg);void PAssertFunc(const char * file, int line, const char * msg);/** Get the stream being used for error output.This stream is used for all trace output using the various trace functionsand macros.*/ostream & PGetErrorStream();/** Set the stream to be used for error output.This stream is used for all error output using the #PError# macro.*/void PSetErrorStream(ostream * strm /** New stream for error output */ );/** 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. OnUnix platforms this {\bfis} #cerr# but for MS-Windows this is another streamthat uses the OutputDebugString() Windows API function. Note that a MS-DOS orWindows NT console application would still use #cerr#.The #PError# stream would normally only be used for debugging information asa suitable display is not always available in windowed environments.   The macro is a wrapper for a global variable #PErrorStream# which is a pointerto an #ostream#. The variable is initialised to #cerr# for all but MS-Windowsand NT GUI applications. An application could change this pointer to a#ofstream# variable of #PError# output is wished to be redirected to a file.*/#define PError (PGetErrorStream())///////////////////////////////////////////////////////////////////////////////// Debug and tracing#ifndef PTRACING#ifndef _DEBUG#define PTRACING 0

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -