Content-Based Networking Simulation Library Documentation (v. 1.2.1)

logging.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 //
00003 //  This file is part of CBNSIM, the Content-Based Networking
00004 //  Simulation Library.
00005 //
00006 //  Authors: See the file AUTHORS for full details.
00007 //
00008 //  Copyright (C) 2002-2004 University of Colorado
00009 //
00010 //  This program is free software; you can redistribute it and/or
00011 //  modify it under the terms of the GNU General Public License
00012 //  as published by the Free Software Foundation; either version 2
00013 //  of the License, or (at your option) any later version.
00014 //
00015 //  This program is distributed in the hope that it will be useful,
00016 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
00017 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018 //  GNU General Public License for more details.
00019 //
00020 //  You should have received a copy of the GNU General Public License
00021 //  along with this program; if not, write to the Free Software
00022 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307,
00023 //  USA, or send email to serl@cs.colorado.edu.
00024 //
00025 // $Id: logging.h,v 1.4 2011-08-25 12:33:30 carzanig Exp $
00026 //
00027 #include <cassert>
00028 #include <iostream>
00029 
00030 #ifndef CBNSIM_LOGGING_H
00031 #define CBNSIM_LOGGING_H
00032 
00038 #include <siena/forwarding.h>
00039 #include <siena/ssimp_types.h>
00040 
00041 using ssimp::Message;
00042 using ssimp::SimplifyingPredicate;
00043 
00047 namespace cbnsim
00048 {
00049   extern bool g_debug_on;
00050   extern bool g_info_on;
00051   extern bool g_error_on;
00052 
00056   void sff_print( const SimplifyingPredicate& pred, siena::if_t id = 0 );
00057 
00061   void sff_print( const Message& msg );
00062 };
00063 
00064 #ifdef CBNDEBUG_ON
00065 #define CBNDEBUG(u) if( cbnsim::g_debug_on ) { std::cout << "DEBUG: " << u << endl; }
00066 #else
00067 #define CBNDEBUG(u)
00068 #endif // CBNDEBUG_ON
00069 
00070 #define CBNINFO(u) if( cbnsim::g_info_on ) { std::cout << "INFO: " << u << endl; }
00071 #define CBNERROR(u) if( cbnsim::g_error_on ) { std::cerr << "ERROR: " << u << endl; }
00072 
00073 #ifndef CBNASSERT_OFF
00074 #define CBNASSERT(exp,msg) if(!(exp)){CBNERROR(msg);assert(exp);}
00075 #else
00076 #define CBNASSERT(exp,msg)
00077 #endif // CBNASSERT_OFF
00078 
00079 #endif // CBNSIM_LOGGING_H