kopia lustrzana https://github.com/OpenDroneMap/ODM
51 wiersze
1.9 KiB
C++
51 wiersze
1.9 KiB
C++
/*****************************************************************************/
|
|
/* */
|
|
/* Header: assert.hpp */
|
|
/* */
|
|
/* Accompanies STANN Version 0.5 Beta */
|
|
/* Aug 05, 2008 */
|
|
/* */
|
|
/* Copyright 2007, 2008 */
|
|
/* Michael Connor and Piyush Kumar */
|
|
/* Florida State University */
|
|
/* Tallahassee FL, 32306-4532 */
|
|
/* */
|
|
/*****************************************************************************/
|
|
|
|
#ifndef REVIVER_ASSERT_HPP
|
|
#define REVIVER_ASSERT_HPP
|
|
|
|
#include <iostream>
|
|
/*!
|
|
\file
|
|
\brief Implementation of assert functions
|
|
This file contains an assert function implementation
|
|
*/
|
|
|
|
/*!
|
|
\brief Assert function
|
|
This function prints error messages along with file and line numbers
|
|
\param b bool to be checked
|
|
\param desc Error message
|
|
\param line Line number
|
|
\param file File name
|
|
\return True is there is no error
|
|
*/
|
|
bool MyAssertFunction( bool b, char* desc, int line, char* file){
|
|
if (b) return true;
|
|
std::cerr << "\n\nAssertion Failure\n";
|
|
std::cerr << "Description : " << desc << std::endl;
|
|
std::cerr << "Filename : " << file << std::endl;
|
|
std::cerr << "Line No : " << line << std::endl;
|
|
exit(1);
|
|
}
|
|
|
|
#if defined( _DEBUG )
|
|
#define Assert( exp, description ) MyAssertFunction( (int)(exp), description, __LINE__, __FILE__ )
|
|
#else
|
|
#define Assert( exp, description )
|
|
#endif
|
|
|
|
|
|
#endif
|