/home/vlg/develop/libASSA/libassa/assa/Assure.h

Go to the documentation of this file.
00001 // -*- c++ -*-
00002 //------------------------------------------------------------------------------
00003 // $Id: Assure.h,v 1.2 2006/07/20 02:30:53 vlg Exp $
00004 //------------------------------------------------------------------------------
00005 //                           Assure.h
00006 //------------------------------------------------------------------------------
00007 //  Copyright (C) 1997-2000,2004,2005  Vladislav Grinchenko <vlg@users.sf.net>
00008 //
00009 //  This library is free software; you can redistribute it and/or
00010 //  modify it under the terms of the GNU Library General Public
00011 //  License as published by the Free Software Foundation; either
00012 //  version 2 of the License, or (at your option) any later version.
00013 //------------------------------------------------------------------------------
00014 #ifndef ASSURE_H
00015 #define ASSURE_H
00016 
00017 #include <unistd.h>
00018 #include <errno.h>              /* errno */
00019 #include <signal.h>             /* raise */
00020 
00021 #include "assa/Logger.h"
00022 
00023 namespace ASSA {
00024 
00039 #define Assure_exit( exp_ ) \
00040     do { \
00041         if ( !(exp_) ) { \
00042             DL((ASSA::ASSAERR,"Assure Aborted False Expression!\n"));       \
00043             DL((ASSA::ASSAERR,"Error on line %d in file %s\n", __LINE__, __FILE__)); \
00044            ::raise( SIGTERM ); \
00045         } \
00046     } while (0)
00047 
00048 
00064 #define Assure_return(exp_) \
00065     do { \
00066         if ( !(exp_) ) { \
00067             DL((ASSA::ASSAERR,"Assure Returned False Expression!\n"));      \
00068             DL((ASSA::ASSAERR,"Error on line %d in file %s\n", __LINE__, __FILE__)); \
00069             return (false); \
00070         } \
00071     } while (0) 
00072 
00084 #define Assure_return_void(exp_) \
00085     do { \
00086         if ( !(exp_) ) { \
00087             DL((ASSA::ASSAERR,"Assure Returned False Expression!\n"));  \
00088             DL((ASSA::ASSAERR,"Error on line %d in file %s\n", __LINE__, __FILE__)); \
00089             return; \
00090         } \
00091     } while (0) 
00092 
00109 #define Assure_return_value(exp_,value_) \
00110     do { \
00111         if ( !(exp_) ) { \
00112             DL((ASSA::ASSAERR,"Assure Returned False Expression!\n"));  \
00113             DL((ASSA::ASSAERR,"Error on line %d in file %s\n", __LINE__, __FILE__)); \
00114             return (value_); \
00115         } \
00116     } while (0) 
00117 
00118 } // end namespace ASSA
00119 
00120 #endif /* ASSURE_H */  

Generated on Sun Aug 13 15:08:00 2006 for libassa by  doxygen 1.4.6