libcwd: The C++ Debugging Support Library - Reference Manual
Author: Carlo Wood
Description: C++ debugging support library with ostream debug output
Keywords: libcwd, debug output, debug facility, debug channel, object orientation, OO, C++, nested debug output, ostream, memory allocation, debugging, source file and line number

Main Page Reference Manual Namespace List Compound List Namespace Members Compound Members File Members

# libcwd/private_set_alloc_checking.h

Go to the documentation of this file.

    00001 // $Header$
    00002 //
    00003 // Copyright (C) 2000 - 2004, by
    00004 //
    00005 // Carlo Wood, Run on IRC <carlo@alinoe.com>
    00006 // RSA-1024 0x624ACAD5 1997-01-26                    Sign & Encrypt
    00007 // Fingerprint16 = 32 EC A7 B6 AC DB 65 A6  F6 F6 55 DD 1C DC FF 61
    00008 //
    00009 // This file may be distributed under the terms of the Q Public License
    00010 // version 1.0 as appearing in the file LICENSE.QPL included in the
    00011 // packaging of this file.
    00012 //
    00013
    00018 #ifndef LIBCWD_PRIVATE_SET_ALLOC_CHECKING_H
    00019 #define LIBCWD_PRIVATE_SET_ALLOC_CHECKING_H
    00020
    00021 #ifndef LIBCWD_CONFIG_H
    00022 #include <libcwd/config.h>
    00023 #endif
    00024 #ifndef LIBCWD_PRIVATE_STRUCT_TSD_H
    00025 #include <libcwd/private_struct_TSD.h>
    00026 #endif
    00027
    00028 namespace libcwd {
    00029   namespace _private_ {
    00030
    00031 #if CWDEBUG_ALLOC
    00032 #if CWDEBUG_DEBUGM
    00033   extern void set_alloc_checking_off(LIBCWD_TSD_PARAM);
    00034   extern void set_alloc_checking_on(LIBCWD_TSD_PARAM);
    00035   extern int set_library_call_on(LIBCWD_TSD_PARAM);
    00036   extern void set_library_call_off(int saved_internal LIBCWD_COMMA_TSD_PARAM);
    00037 #else
    00038   inline void set_alloc_checking_off(LIBCWD_TSD_PARAM) { ++__libcwd_tsd.internal; }
    00039   inline void set_alloc_checking_on(LIBCWD_TSD_PARAM) { --__libcwd_tsd.internal; }
    00040   inline int set_library_call_on(LIBCWD_TSD_PARAM)
    00041       {
    00042         int internal_saved = __libcwd_tsd.internal;
    00043         __libcwd_tsd.internal = 0;
    00044         ++__libcwd_tsd.library_call;
    00045         return internal_saved;
    00046       }
    00047   inline void set_library_call_off(int saved_internal LIBCWD_COMMA_TSD_PARAM)
    00048       {
    00049         __libcwd_tsd.internal = saved_internal;
    00050         --__libcwd_tsd.library_call;
    00051       }
    00052 #endif
    00053   inline void set_invisible_on(LIBCWD_TSD_PARAM) { ++__libcwd_tsd.invisible; }
    00054   inline void set_invisible_off(LIBCWD_TSD_PARAM) { --__libcwd_tsd.invisible; }
    00055 #else // !CWDEBUG_ALLOC
    00056   inline void set_alloc_checking_off(LIBCWD_TSD_PARAM) { }
    00057   inline void set_alloc_checking_on(LIBCWD_TSD_PARAM) { }
    00058   inline int set_library_call_on(LIBCWD_TSD_PARAM) { return 0; }
    00059   inline void set_library_call_off(int LIBCWD_COMMA_TSD_PARAM) { }
    00060   inline void set_invisible_on(LIBCWD_TSD_PARAM) { }
    00061   inline void set_invisible_off(LIBCWD_TSD_PARAM) { }
    00062 #endif // !CWDEBUG_ALLOC
    00063
    00064   } // namespace _private_
    00065 } // namespace libcwd
    00066
    00067 #endif // LIBCWD_PRIVATE_SET_ALLOC_CHECKING_H