libStatGen Software  1
GlfException.h
1 /*
2  * Copyright (C) 2010 Regents of the University of Michigan
3  *
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef __GLF_EXCEPTION_H__
19 #define __GLF_EXCEPTION_H__
20 
21 #include <stdexcept> // stdexcept header file
22 
23 #include "GlfStatus.h"
24 
25 /// GlfException objects should be thrown by functions that operate on
26 /// Glf files for exceptions.
27 class GlfException : public std::exception
28 {
29 public:
30  /// Constructor that sets the exception to a default status
31  /// and error message.
32  GlfException();
33 
34  /// Constructor that sets the exception to a default status
35  /// and the specified error message.
36  /// \param what_arg error message associated with this exception.
37  GlfException(const std::string& what_arg);
38 
39  /// Constructor that sets the exception to the specified status
40  /// and error message.
41  /// \param status glf status associated with this exception.
42  /// \param errorMsg error message associated with this exception.
43  GlfException(GlfStatus::Status status, const std::string& errorMsg);
44 
45  /// Constructor that sets the exception to the specified status.
46  /// \param status glf status associated with this exception.
47  GlfException(const GlfStatus& status);
48 
49  virtual ~GlfException() throw();
50 
51  /// Returns the error message of this exception.
52  /// \return errror message
53  virtual const char* what() const throw();
54 
55 private:
56  GlfStatus myStatus;
57 }; // end class GlfException
58 
59 
60 #endif
GlfException::GlfException
GlfException()
Constructor that sets the exception to a default status and error message.
Definition: GlfException.cpp:20
GlfStatus::Status
Status
Return value enum for the GlfFile class methods.
Definition: GlfStatus.h:31
GlfStatus
This class is used to track the status results of some methods in the GLF classes using the status en...
Definition: GlfStatus.h:27
GlfException
GlfException objects should be thrown by functions that operate on Glf files for exceptions.
Definition: GlfException.h:28
GlfException::what
virtual const char * what() const
Returns the error message of this exception.
Definition: GlfException.cpp:50