Loading...
Searching...
No Matches
Assure.h
Go to the documentation of this file.
// -*- c++ -*-
//------------------------------------------------------------------------------
// $Id: Assure.h,v 1.3 2007/05/14 19:19:50 vlg Exp $
//------------------------------------------------------------------------------
// Assure.h
//------------------------------------------------------------------------------
// Copyright (C) 1997-2000,2004,2005 Vladislav Grinchenko <vlg@users.sf.net>
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
// License as published by the Free Software Foundation; either
// version 2 of the License, or (at your option) any later version.
//------------------------------------------------------------------------------
#ifndef ASSURE_H
#define ASSURE_H
#include <unistd.h>
#include <errno.h> /* errno */
#include <signal.h> /* raise */
#include "assa/Logger.h"
// DO NOT PUT MACROS IN A NAMESPACE!
#define Assure_exit( exp_ ) \
do { \
if ( !(exp_) ) { \
DL((ASSA::ASSAERR,"Assure Aborted False Expression!\n")); \
DL((ASSA::ASSAERR,"Error on line %d in file %s\n", __LINE__, __FILE__)); \
::raise( SIGTERM ); \
} \
} while (0)
#define Assure_return(exp_) \
do { \
if ( !(exp_) ) { \
DL((ASSA::ASSAERR,"Assure Returned False Expression!\n")); \
DL((ASSA::ASSAERR,"Error on line %d in file %s\n", __LINE__, __FILE__)); \
return (false); \
} \
} while (0)
#define Assure_return_void(exp_) \
do { \
if ( !(exp_) ) { \
DL((ASSA::ASSAERR,"Assure Returned False Expression!\n")); \
DL((ASSA::ASSAERR,"Error on line %d in file %s\n", __LINE__, __FILE__)); \
return; \
} \
} while (0)
#define Assure_return_value(exp_,value_) \
do { \
if ( !(exp_) ) { \
DL((ASSA::ASSAERR,"Assure Returned False Expression!\n")); \
DL((ASSA::ASSAERR,"Error on line %d in file %s\n", __LINE__, __FILE__)); \
return (value_); \
} \
} while (0)
#endif /* ASSURE_H */
Logger.h
An abstraction to message logging facility.