Go to the documentation of this file.
46 #ifndef GNSSTK_EXCEPTION_HPP
47 #define GNSSTK_EXCEPTION_HPP
67 class ExceptionLocation
79 const std::string& funcName = std::string(),
80 const unsigned long& lineNum = 0)
105 void dump(std::ostream& s)
const;
108 std::string
what()
const;
119 friend std::ostream&
operator<<( std::ostream& s,
175 const unsigned long&
errorId = 0,
187 const unsigned long&
errorId = 0,
221 {
errorId = errId;
return *
this; };
263 {
severity = sever;
return *
this; };
280 std::string
getText(
const size_t& index=0)
const;
287 {
return "Exception"; };
294 void dump(std::ostream& s)
const;
297 std::string
what()
const;
307 friend std::ostream&
operator<<( std::ostream& s,
349 #if defined ( __FUNCTION__ )
350 #define FILE_LOCATION gnsstk::ExceptionLocation(__FILE__, __FUNCTION__, __LINE__)
352 #define FILE_LOCATION gnsstk::ExceptionLocation(__FILE__, "", __LINE__)
356 #if defined (NO_EXCEPTIONS_SUPPORT)
357 #define GNSSTK_THROW(exc) { exc.addLocation(FILE_LOCATION); exc.terminate(); }
360 #define GNSSTK_RETHROW(exc) { exc.addLocation(FILE_LOCATION); exc.terminate(); }
364 #define GNSSTK_THROW(exc) { exc.addLocation(FILE_LOCATION); throw exc; }
367 #define GNSSTK_RETHROW(exc) { exc.addLocation(FILE_LOCATION); throw; }
373 #define GNSSTK_ASSERT(CONDITION) if (!(CONDITION)) { \
374 gnsstk::AssertionFailure exc("Assertion failed: " #CONDITION); \
388 #define NEW_EXCEPTION_CLASS(child, parent) \
389 class child : public parent \
393 child() : parent() {} \
395 child(const child& a): parent(a) {} \
397 child(const gnsstk::Exception& a) : parent(a) {}; \
404 child(const std::string& a, unsigned long b = 0,\
405 gnsstk::Exception::Severity c = gnsstk::Exception::unrecoverable) \
414 child(const char* a, unsigned long b = 0,\
415 gnsstk::Exception::Severity c = gnsstk::Exception::unrecoverable) \
421 std::string getName() const {return ( # child);} \
423 child& operator=(const child& kid) \
424 { parent::operator=(kid); return *this; } \
426 friend std::ostream& operator<<(std::ostream& s, const child& c) \
427 { c.dump(s); return s; } \
503 class StopIterator {};
Exception & setSeverity(const Severity &sever)
bool isRecoverable() const
unsigned long errorId
Error code.
Exception & operator=(const Exception &e)
Assignment operator.
void dump(std::ostream &s) const
std::vector< ExceptionLocation > locations
Stack of exception locations (where it was thrown).
std::string what() const
Dump to a string.
ExceptionLocation(const std::string &filename=std::string(), const std::string &funcName=std::string(), const unsigned long &lineNum=0)
size_t getTextCount() const
Returns the number of text strings in the exception text stack.
unsigned long getLineNumber() const
Accessor for line of source file where exception occurred.
Exception & addLocation(const ExceptionLocation &location)
unsigned long lineNumber
Line in source file where exception occurred.
NEW_EXCEPTION_CLASS(FileSpecException, gnsstk::Exception)
std::string getText(const size_t &index=0) const
size_t getLocationCount() const
std::string getName() const
Returns the name of the object's class.
std::string fileName
Name of source file where exception occurred.
Severity
Exception severity classes.
Exception & setErrorId(const unsigned long &errId)
void dump(std::ostream &s) const
unsigned long getErrorId() const
Returns the error ID of the exception.
std::string what() const
Dump to a string.
const ExceptionLocation getLocation(const size_t &index=0) const
Exception & addText(const std::string &errorText)
std::string getFileName() const
Accessor for name of source file where exception occurred.
std::string streamBuffer
Buffer for stream output.
Severity severity
Severity of exception.
friend std::ostream & operator<<(std::ostream &s, const ExceptionLocation &e)
std::vector< std::string > text
Text stack describing exception condition.
std::string getFunctionName() const
Accessor for name of function where exception occurred.
std::string functionName
Name of function where exception occurred.
friend std::ostream & operator<<(std::ostream &s, const Exception &e)
gnsstk
Author(s):
autogenerated on Wed Oct 25 2023 02:40:39