Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members

monitor.h

Go to the documentation of this file.
00001 /* -*- mode: C++; c-file-style: "stroustrup"; c-basic-offset: 4; indent-tabs-mode: nil; -*- */
00002 /*********************************************************************
00003  *
00004  * Filename : monitor.h (debug)
00005  *
00006  * This file is a part of the UPPAAL toolkit.
00007  * Copyright (c) 1995 - 2003, Uppsala University and Aalborg University.
00008  * All right reserved.
00009  *
00010  * $Id: monitor.h,v 1.2 2005/07/22 12:55:54 adavid Exp $
00011  *
00012  *********************************************************************/
00013 
00014 #ifndef INCLUDE_DEBUG_MONITOR_H
00015 #define INCLUDE_DEBUG_MONITOR_H
00016 
00017 #include <stddef.h>
00018 
00019 #ifdef ENABLE_MONITOR
00020 
00021 #ifdef __cplusplus
00022 extern "C" {
00023 #endif
00024 
00025 /** Remember a pointer and returns it.
00026  * @param ptr: pointer to remember
00027  * @param filename: in which file the call was made
00028  * @param line: at which line the call was made
00029  * @param function: in which function the call was made
00030  * @return ptr
00031  */
00032 void* debug_rememberPointer(void *ptr, const char *filename, int line, const char *function);
00033 
00034 /** Forget a previously remembered pointer.
00035  * @param ptr: pointer to forget
00036  * @param filename: in which file the call was made
00037  * @param line: at which line he call was made
00038  * @param function: in which function the call was made
00039  * @pre ptr was remembered before or an error will be printed
00040  */
00041 void debug_forgetPointer(void *ptr, const char *filename, int line, const char *function);
00042 
00043 /** Forget a previously remembered pointer
00044  * @param ptr: pointer to forget
00045  * @pre ptr was remembered before or an error will be printed
00046  */
00047 void debug_forgetPtr(void *ptr);
00048 
00049 /** Remember a position just before a call to forgetPtr.
00050  * The position will be gone after one call to forgetPtr.
00051  * @param filename: in which file the call was made
00052  * @param line: at which line he call was made
00053  * @param function: in which function the call was made
00054  */
00055 void debug_prepareDelete(const char *filename, int line, const char *function);
00056 
00057 /** Push a position for later retrieval by pop.
00058  * @param filename: in which file the call was made
00059  * @param line: at which line he call was made
00060  * @param function: in which function the call was made
00061  */
00062 void debug_pushPosition(const char *filename, int line, const char *function);
00063 
00064 /** Equivalent to calling prepareDelete on a previously pushed position.
00065  */
00066 void debug_pop();
00067 
00068 /* Macros to simplify calls */
00069 
00070 #define debug_remember(TYPE, PTR) ((TYPE) debug_rememberPointer(PTR, __FILE__, __LINE__, __FUNCTION__))
00071 #define debug_forget(PTR) debug_forgetPointer(PTR, __FILE__, __LINE__, __FUNCTION__)
00072 #define debug_mark() debug_prepareDelete(__FILE__, __LINE__, __FUNCTION__)
00073 #define debug_push() debug_pushPosition(__FILE__, __LINE__, __FUNCTION__)
00074 
00075 #ifdef __cplusplus
00076 }
00077 #endif
00078 
00079 #endif /* ENABLE_MONITOR */
00080 
00081 #endif /* INCLUDE_DEBUG_MONITOR_H */

Generated on Fri Jun 30 00:02:51 2006 for Module debug by  doxygen 1.4.2