Claw  1.7.3
Namespaces | Macros | Functions
assert.hpp File Reference

Some assert macros to strengthen you code. More...

#include <iostream>
#include <sstream>
#include <cstdlib>

Go to the source code of this file.

Namespaces

namespace  claw
 This is the main namespace.

Macros

#define CLAW_ASSERT(b, s)   claw::debug_assert( __FILE__, __FUNCTION__, __LINE__, (b), (s) )
 Print a message on std::cerr and stop the program if a condition is not true.
#define CLAW_FAIL(s)   claw::debug_assert( __FILE__, __FUNCTION__, __LINE__, false, (s) )
 Print a message on std::cerr and stop the program.
#define CLAW_PRECOND(b)   CLAW_ASSERT( b, "precondition failed: " #b )
 Abort the program if a precondition is not true.
#define CLAW_POSTCOND(b)   CLAW_ASSERT( b, "postcondition failed: " #b )
 Abort the program if a postcondition is not true.

Functions

void claw::debug_assert (const char *file, const char *func, unsigned int line, bool b, const std::string &s)
 The method used by CLAW_ASSERT macro. Souldn't be used elsewhere.

Detailed Description

Some assert macros to strengthen you code.

Author
Julien Jorge

Definition in file assert.hpp.

Macro Definition Documentation

CLAW_ASSERT (   b,
 
)    claw::debug_assert( __FILE__, __FUNCTION__, __LINE__, (b), (s) )

Print a message on std::cerr and stop the program if a condition is not true.

Parameters
bCondition to verify.
sAn error message.

Definition at line 90 of file assert.hpp.

Referenced by claw::arguments::add_argument(), claw::arguments::get_integer(), claw::arguments::get_real(), claw::arguments::get_string(), and claw::graphic::pcx::writer::file_output_buffer::raw().

CLAW_FAIL (   s)    claw::debug_assert( __FILE__, __FUNCTION__, __LINE__, false, (s) )

Print a message on std::cerr and stop the program.

Parameters
sAn error message.

Definition at line 94 of file assert.hpp.

CLAW_POSTCOND (   b)    CLAW_ASSERT( b, "postcondition failed: " #b )

Abort the program if a postcondition is not true.

Parameters
bCondition to verify.

Definition at line 101 of file assert.hpp.

Referenced by claw::graphic::image::base_iterator< Image, Pixel >::base_iterator(), and claw::tween::base_tweener::update().

CLAW_PRECOND (   b)    CLAW_ASSERT( b, "precondition failed: " #b )

Abort the program if a precondition is not true.

Parameters
bCondition to verify.

Definition at line 98 of file assert.hpp.

Referenced by claw__graphic__jpeg__destination_manager__empty_output_buffer(), claw__graphic__jpeg__destination_manager__term_destination(), claw__graphic__jpeg__source_manager__fill_input_buffer(), claw__graphic__jpeg__source_manager__skip_input_data(), claw::socket_traits_unix::connect(), claw::socket_traits_win32::connect(), claw::automaton< State, Edge, StateComp, EdgeComp >::edges(), claw::arguments_table::get_integer(), claw::arguments_table::get_real(), claw::arguments_table::get_string(), claw::math::box_2d< T >::intersection(), claw::socket_traits_unix::listen(), claw::socket_traits_win32::listen(), claw::graphic::xbm::reader::load(), claw::graphic::png::reader::load(), claw::graphic::jpeg::reader::load(), claw::graphic::bitmap::reader::load(), claw::graphic::pcx::reader::load(), claw::graphic::targa::reader::load(), claw::graphic::image::base_iterator< Image, Pixel >::operator*(), claw::graphic::image::base_iterator< Image, Pixel >::operator++(), claw::graphic::image::base_iterator< Image, Pixel >::operator+=(), claw::graphic::image::base_iterator< Image, Pixel >::operator-(), claw::graphic::image::base_iterator< Image, Pixel >::operator--(), claw::graphic::image::base_iterator< Image, Pixel >::operator-=(), claw::graphic::image::base_iterator< Image, Pixel >::operator->(), claw::net::basic_socketbuf< CharT, Traits >::overflow(), claw::automaton< State, Edge, StateComp, EdgeComp >::reachables(), claw::graphic::xbm::writer::save(), claw::graphic::png::writer::save(), claw::graphic::jpeg::writer::save(), claw::socket_traits_unix::select_read(), claw::socket_traits_win32::select_read(), claw::graphic::jpeg::reader::source_manager::skip_input_data(), claw::graphic::png::reader::source_manager::source_manager(), claw::automaton< State, Edge, StateComp, EdgeComp >::state_is_final(), claw::automaton< State, Edge, StateComp, EdgeComp >::state_is_initial(), claw::net::basic_socketbuf< CharT, Traits >::sync(), claw::graphic::png::writer::target_manager::target_manager(), claw::net::basic_socketbuf< CharT, Traits >::underflow(), and claw::tween::base_tweener::update().