COMPASS  5.4.4
End-to-end AO simulation tool using GPU acceleration
carma_exception.h
Go to the documentation of this file.
1 // -----------------------------------------------------------------------------
2 // This file is part of COMPASS <https://anr-compass.github.io/compass/>
3 //
4 // Copyright (C) 2011-2023 COMPASS Team <https://github.com/ANR-COMPASS>
5 // All rights reserved.
6 
7 // -----------------------------------------------------------------------------
8 
16 
17 
18 #ifndef CARMA_EXCEPTION_H_
19 #define CARMA_EXCEPTION_H_
20 
21 #include <iostream>
22 #include <string>
23 #include <sstream>
24 
25 #define Carma_Error(s) CarmaException(s, __FILE__, __LINE__)
26 
28 
37  private:
38  std::string a_reason;
39  std::string a_file;
40  unsigned int a_line;
41  public:
52  CarmaException(std::string reason, std::string file, unsigned int line)
53  : a_reason(reason), a_file(file), a_line(line) {}
54 
62 
71  std::string show_reason() const {
72  std::stringstream buf;
73  buf << a_reason << " in " << a_file << "@" << a_line << std::endl;
74  return buf.str();
75  }
76 };
77 
78 #endif /* CARMA_EXCEPTION_H_ */
Carma exception throw by libcarma.
~CarmaException()
Destructor.
std::string show_reason() const
Format into a const char *.
CarmaException(std::string reason, std::string file, unsigned int line)
Constructor.