coin-Bcp
BCP_error.hpp
Go to the documentation of this file.
1 // Copyright (C) 2000, International Business Machines
2 // Corporation and others. All Rights Reserved.
3 #ifndef _BCP_ERROR_H
4 #define _BCP_ERROR_H
5 
6 // This file is fully docified.
7 
8 #include <string>
9 #include <cstdio>
10 #include <cstdlib>
11 #include <cstdarg>
12 
21 public:
22  static bool abort_on_error;
23 
24 public:
27 #if 0
28  BCP_fatal_error(const char * error) {
29  printf("%s", error);
30  fflush(0);
31  abort();
32  }
33 #endif
34  BCP_fatal_error(const std::string& str) {
35  printf("%s", str.c_str());
36  fflush(0);
37  if (abort_on_error)
38  abort();
39  }
40  BCP_fatal_error(const char * format, ...) {
41  va_list valist;
42  va_start(valist,format);
43  vprintf(format, valist);
44  va_end(valist);
45  fflush(0);
46  if (abort_on_error)
47  abort();
48  }
51 };
52 
53 #endif
BCP_fatal_error(const std::string &str)
The constructor prints out the error message, flushes the stdout buffer and aborts execution...
Definition: BCP_error.hpp:34
~BCP_fatal_error()
The destructor exists only because it must.
Definition: BCP_error.hpp:50
Currently there isn&#39;t any error handling in BCP.
Definition: BCP_error.hpp:20
static bool abort_on_error
Definition: BCP_error.hpp:22
BCP_fatal_error(const char *format,...)
Definition: BCP_error.hpp:40