Exception Class Reference
[Exception Classes]

#include <Combinations.hpp>

Inheritance diagram for Exception:

Inheritance graph
[legend]
List of all members.

Detailed Description

The Exception class is the base class from which all exception objects thrown in the library are derived.

None of the functions in this class throws exceptions because an exception has probably already been thrown or is about to be thrown. Each exception object contains the following:

Exception provides all of the functions required for it and its derived classes, including functions that operate on the text strings in the stack.

See also:
exceptiontest.cpp for some examples of how to use this class.

Definition at line 167 of file Combinations.hpp.

Public Types

enum  Severity { unrecoverable, recoverable }
 Exception severity classes. More...

Public Member Functions

 Exception () throw ()
 Default constructor.
 Exception (const std::string &errorText, const unsigned long &errorId=0, const Severity &severity=unrecoverable) throw ()
 Full constructor for exception.
 Exception (const char *errorText, const unsigned long &errorId=0, const Severity &severity=unrecoverable) throw ()
 Full constructor for exception.
 Exception (const Exception &exception) throw ()
 Copy constructor.
 ~Exception () throw ()
 Destructor.
Exceptionoperator= (const Exception &e) throw ()
 Assignment operator.
void terminate () throw ()
 Ends the application.
unsigned long getErrorId () const throw ()
 Returns the error ID of the exception.
ExceptionsetErrorId (const unsigned long &errId) throw ()
 Sets the error ID to the specified value.
ExceptionaddLocation (const ExceptionLocation &location) throw ()
 Adds the location information to the exception object.
const ExceptionLocation getLocation (const size_t &index=0) const throw ()
 Returns the ExceptionLocation object at the specified index.
size_t getLocationCount () const throw ()
 Returns the number of locations stored in the exception location array.
bool isRecoverable () const throw ()
 If the thrower (that is, whatever creates the exception) determines the exception is recoverable, 1 is returned.
ExceptionsetSeverity (const Severity &sever) throw ()
 Sets the severity of the exception.
ExceptionaddText (const std::string &errorText) throw ()
 Appends the specified text to the text string on the top of the exception text stack.
std::string getText (const size_t &index=0) const throw ()
 Returns an exception text string from the exception text stack.
size_t getTextCount () const throw ()
 Returns the number of text strings in the exception text stack.
std::string getName () const throw ()
 Returns the name of the object's class.
void dump (std::ostream &s) const throw ()
 Debug output function.
std::string what () const throw ()
 Dump to a string.

Protected Member Functions

int overflow (int c)
 This is the streambuf function that actually outputs the data to the device.

Protected Attributes

unsigned long errorId
 Error code.
std::vector< ExceptionLocationlocations
 Stack of exception locations (where it was thrown).
Severity severity
 Severity of exception.
std::vector< std::string > text
 Text stack describing exception condition.

Friends

std::ostream & operator<< (std::ostream &s, const Exception &e) throw ()
 Output stream operator for ::Exception.


Member Enumeration Documentation

enum Severity
 

Exception severity classes.

Enumeration values:
unrecoverable  program can not recover from this exception
recoverable  program can recover from this exception

Definition at line 171 of file Combinations.hpp.


Constructor & Destructor Documentation

Exception  )  throw ()
 

Default constructor.

Does nothing.

Definition at line 66 of file Exception.cpp.

Exception const std::string &  errorText,
const unsigned long &  errorId = 0,
const Severity severity = unrecoverable
throw ()
 

Full constructor for exception.

Parameters:
errorText text message detailing exception.
errorId error code related to exception e.g. MQ result code.
severity severity of error.

Definition at line 71 of file Exception.cpp.

Exception const char *  errorText,
const unsigned long &  errorId = 0,
const Severity severity = unrecoverable
throw ()
 

Full constructor for exception.

Parameters:
errorText text message detailing exception.
errorId error code related to exception e.g. MQ result code.
severity severity of error.

Definition at line 81 of file Exception.cpp.

Exception const Exception exception  )  throw ()
 

Copy constructor.

Definition at line 91 of file Exception.cpp.

~Exception  )  throw () [inline]
 

Destructor.

Definition at line 214 of file Combinations.hpp.


Member Function Documentation

Exception & addLocation const ExceptionLocation location  )  throw ()
 

Adds the location information to the exception object.

The library captures this information when an exception is thrown or rethrown. An array of ExceptionLocation objects is stored in the exception object.

Parameters:
location An IExceptionLocation object containing the following:
  • Function name
  • File name
  • Line number where the function is called

Definition at line 114 of file Exception.cpp.

Exception & addText const std::string &  errorText  )  throw ()
 

Appends the specified text to the text string on the top of the exception text stack.

Parameters:
errorText The text you want to append.

Definition at line 142 of file Exception.cpp.

Referenced by GPSZcount::addWeeks(), GPSZcount::addZcounts(), FileSpec::extractCommonTime(), FileSpec::init(), FileHunter::init(), Exception::overflow(), SMODFData::reallyPutRecord(), RinexObsHeader::reallyPutRecord(), RinexNavHeader::reallyPutRecord(), RinexMetHeader::reallyPutRecord(), Rinex3ObsHeader::reallyPutRecord(), IonexHeader::reallyPutRecord(), AntexHeader::reallyPutRecord(), FileHunter::searchHelper(), and Position::setToString().

void dump std::ostream &  s  )  const throw ()
 

Debug output function.

Parameters:
s stream to output debugging information for this class to.

Definition at line 169 of file Exception.cpp.

Referenced by FileHunter::dump(), gpstk::operator<<(), and Exception::what().

unsigned long getErrorId  )  const throw () [inline]
 

Returns the error ID of the exception.

Definition at line 234 of file Combinations.hpp.

const ExceptionLocation getLocation const size_t &  index = 0  )  const throw ()
 

Returns the ExceptionLocation object at the specified index.

Parameters:
index If the index is not valid, a 0 pointer is returned. (well, not really since someone changed all this bah)

Definition at line 122 of file Exception.cpp.

size_t getLocationCount  )  const throw ()
 

Returns the number of locations stored in the exception location array.

Definition at line 136 of file Exception.cpp.

References Exception::locations.

std::string getName  )  const throw () [inline]
 

Returns the name of the object's class.

Reimplemented in InvalidConstraintSystem, TypeIDNotFound, SatIDNotFound, SourceIDNotFound, CommonTimeNotFound, ValueNotFound, NumberOfTypesMismatch, NumberOfSatsMismatch, DecimateEpoch, InvalidEquationSystem, InvalidConstraint, ProcessingException, SynchronizeException, TestException::TE, InvalidAntex, ARException, CRCException, InvalidParameter, InvalidRequest, AssertionFailure, AccessError, IndexOutOfBoundsException, InvalidArgumentException, ConfigurationException, FileMissingException, SystemSemaphoreException, SystemPipeException, SystemQueueException, OutOfMemory, ObjectNotFound, NullPointerException, UnimplementedException, AssertFailedException, InvalidDOP, EngAlmanac::SVNotPresentException, Epoch::EpochException, Epoch::FormatException, InvalidParameter, InvalidRequest, AssertionFailure, AccessError, IndexOutOfBoundsException, InvalidArgumentException, ConfigurationException, FileMissingException, SystemSemaphoreException, SystemPipeException, SystemQueueException, OutOfMemory, ObjectNotFound, NullPointerException, UnimplementedException, ExpressionException, EndOfFile, FFStreamError, WrongBlockNumber, WrongBlockFormat, FileHunterException, FileSpecException, IonoModel::InvalidIonoModel, IonoModelStore::NoIonoModelFound, MatrixException, SingularMatrixException, InvalidSolver, StringException, SVExclusionList::NoSVExclusionFound, SVExclusionList::SVExclusionFileNotFound, SVNumXRef::NoPRNNumberFound, SVNumXRef::NoNAVSTARNumberFound, GeometryException, TropModel::InvalidTropModel, InvalidValue, VectorException, and InvalidWeights.

Definition at line 318 of file Combinations.hpp.

string getText const size_t &  index = 0  )  const throw ()
 

Returns an exception text string from the exception text stack.

Parameters:
index The default index is 0, which is the top of the stack. If you specify an index which is not valid, a 0 pointer is returned.

Definition at line 149 of file Exception.cpp.

size_t getTextCount  )  const throw ()
 

Returns the number of text strings in the exception text stack.

Definition at line 163 of file Exception.cpp.

References Exception::text.

bool isRecoverable  )  const throw () [inline]
 

If the thrower (that is, whatever creates the exception) determines the exception is recoverable, 1 is returned.

If the thrower determines it is unrecoverable, 0 is returned.

Definition at line 281 of file Combinations.hpp.

Exception & operator= const Exception e  )  throw ()
 

Assignment operator.

Definition at line 100 of file Exception.cpp.

int overflow int  c  )  [protected]
 

This is the streambuf function that actually outputs the data to the device.

Since all output should be done with the standard ostream operators, this function should never be called directly. In the case of this class, the characters to be output are stored in a buffer and added to the exception text after each newline.

Definition at line 183 of file Exception.cpp.

References Exception::addText().

Exception& setErrorId const unsigned long &  errId  )  throw () [inline]
 

Sets the error ID to the specified value.

Parameters:
errId The identifier you want to associate with this error.

Definition at line 243 of file Combinations.hpp.

Exception& setSeverity const Severity sever  )  throw () [inline]
 

Sets the severity of the exception.

Parameters:
sever Use the enumeration Severity to specify the severity of the exception.

Definition at line 290 of file Combinations.hpp.

void terminate  )  throw () [inline]
 

Ends the application.

Normally, the library only intends this function to be used internally by the library's exception-handling macros when the compiler you are using does not support C++ exception handling. This only occurs if you define the NO_EXCEPTIONS_SUPPORT macro.

Definition at line 229 of file Combinations.hpp.

string what  )  const throw ()
 

Dump to a string.

Definition at line 207 of file Exception.cpp.

References Exception::dump().


Friends And Related Function Documentation

std::ostream& operator<< std::ostream &  s,
const Exception e
throw () [friend]
 

Output stream operator for ::Exception.

This is intended just to dump all the data in the ::Exception to the indicated stream.

Warning:
Warning: It will _not_ preserve the state of the stream.
Parameters:
s stream to send ::Exception information to.
e ::Exception to "dump".
Returns:
a reference to the stream s.


Member Data Documentation

unsigned long errorId [protected]
 

Error code.

Definition at line 346 of file Combinations.hpp.

std::vector<ExceptionLocation> locations [protected]
 

Stack of exception locations (where it was thrown).

Definition at line 348 of file Combinations.hpp.

Referenced by Exception::getLocationCount().

Severity severity [protected]
 

Severity of exception.

Definition at line 350 of file Combinations.hpp.

std::vector<std::string> text [protected]
 

Text stack describing exception condition.

Definition at line 352 of file Combinations.hpp.

Referenced by Exception::getTextCount().


The documentation for this class was generated from the following files:
Generated on Mon May 20 03:31:55 2013 for GPS ToolKit Software Library by  doxygen 1.3.9.1