errors.cpp
Go to the documentation of this file.
00001 
00008 /*****************************************************************************
00009 ** Includes
00010 *****************************************************************************/
00011 
00012 #include <iostream>
00013 #include "../../include/ecl/errors/compile_time_assert.hpp"
00014 #include "../../include/ecl/errors/handlers.hpp"
00015 #include "../../include/ecl/errors/run_time_functions.hpp"
00016 #include "../../include/ecl/errors/macros.hpp"
00017 
00018 
00019 /*****************************************************************************
00020 ** Globals
00021 *****************************************************************************/
00025 template <int M, int N>
00026 class Test {
00027 public:
00028         Test() {
00029                 ecl_compile_time_assert( M >= 0 );
00030                 ecl_compile_time_assert( N >= 0 );
00031         }
00032 };
00036 /*****************************************************************************
00037 ** Main
00038 *****************************************************************************/
00039 
00040 int main() {
00041 
00042     std::cout << std::endl;
00043     std::cout << "***********************************************************" << std::endl;
00044     std::cout << "                       Error functions" << std::endl;
00045     std::cout << "***********************************************************" << std::endl;
00046     std::cout << std::endl;
00047 
00048     std::cout << "Constructing an error of type 'Unknown Error'" << std::endl;
00049     std::cout << std::endl;
00050     ecl::Error error(ecl::UnknownError);
00051     std::cout << "Error::what() " << std::endl;
00052     std::cout << error.what() << std::endl;
00053     std::cout << "Error::print(LOC) " << std::endl;
00054     error.print(LOC);
00055 
00056     std::cout << std::endl;
00057     std::cout << "***********************************************************" << std::endl;
00058     std::cout << "                       Asserts and Aborts" << std::endl;
00059     std::cout << "***********************************************************" << std::endl;
00060     std::cout << std::endl;
00061 
00062     ecl::Error configuration_error(ecl::ConfigurationError);
00063     Test<3,1> test;
00064 //    ecl_compile_time_assert(1 >= 3);
00065 //    ecl_verbose_compile_time_assert( 1 >= 0, BAD_INEQUALITY );
00066 //    ecl_run_time_abort ( LOC,  ConfigurationError );
00067 //    ecl_run_time_abort ( LOC,  "Custom error report." );
00068     ecl_run_time_assert ( 2 < 1, LOC, configuration_error.flag() );
00069 //    ecl_run_time_assert ( 2 < 1, LOC, ConfigurationError );
00070 //    ecl_run_time_assert ( 2 < 1, LOC, "Inequality broken." );
00071 
00072     return 0;
00073 }
00074 


ecl_errors
Author(s): Daniel Stonier
autogenerated on Thu Jun 16 2016 09:47:14