libassa
3.5.1
Main Page
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
assa
Assure.h
Go to the documentation of this file.
1
// -*- c++ -*-
2
//------------------------------------------------------------------------------
3
// $Id: Assure.h,v 1.3 2007/05/14 19:19:50 vlg Exp $
4
//------------------------------------------------------------------------------
5
// Assure.h
6
//------------------------------------------------------------------------------
7
// Copyright (C) 1997-2000,2004,2005 Vladislav Grinchenko <vlg@users.sf.net>
8
//
9
// This library is free software; you can redistribute it and/or
10
// modify it under the terms of the GNU Library General Public
11
// License as published by the Free Software Foundation; either
12
// version 2 of the License, or (at your option) any later version.
13
//------------------------------------------------------------------------------
14
#ifndef ASSURE_H
15
#define ASSURE_H
16
17
#include <unistd.h>
18
#include <errno.h>
/* errno */
19
#include <signal.h>
/* raise */
20
21
#include "
assa/Logger.h
"
22
23
// DO NOT PUT MACROS IN A NAMESPACE!
24
39
#define Assure_exit( exp_ ) \
40
do { \
41
if ( !(exp_) ) { \
42
DL((ASSA::ASSAERR,"Assure Aborted False Expression!\n")); \
43
DL((ASSA::ASSAERR,"Error on line %d in file %s\n", __LINE__, __FILE__)); \
44
::raise( SIGTERM ); \
45
} \
46
} while (0)
47
48
64
#define Assure_return(exp_) \
65
do { \
66
if ( !(exp_) ) { \
67
DL((ASSA::ASSAERR,"Assure Returned False Expression!\n")); \
68
DL((ASSA::ASSAERR,"Error on line %d in file %s\n", __LINE__, __FILE__)); \
69
return (false); \
70
} \
71
} while (0)
72
84
#define Assure_return_void(exp_) \
85
do { \
86
if ( !(exp_) ) { \
87
DL((ASSA::ASSAERR,"Assure Returned False Expression!\n")); \
88
DL((ASSA::ASSAERR,"Error on line %d in file %s\n", __LINE__, __FILE__)); \
89
return; \
90
} \
91
} while (0)
92
109
#define Assure_return_value(exp_,value_) \
110
do { \
111
if ( !(exp_) ) { \
112
DL((ASSA::ASSAERR,"Assure Returned False Expression!\n")); \
113
DL((ASSA::ASSAERR,"Error on line %d in file %s\n", __LINE__, __FILE__)); \
114
return (value_); \
115
} \
116
} while (0)
117
118
#endif
/* ASSURE_H */
Logger.h
An abstraction to message logging facility.
Generated on Thu Aug 28 2014 22:59:58 for libassa by
1.8.8