ADTaaron-thesisarm-ehast-experimentalcleanup-dtorsctordeferred_resndemanglerenumforall-pointer-decaygc_noraiijacob/cs343-translationjenkins-sandboxmemorynew-astnew-ast-unique-exprnew-envno_listpersistent-indexerpthread-emulationqualifiedEnumresolv-newstringwith_gc
Last change
on this file since c3a4385 was
843054c2,
checked in by Peter A. Buhr <pabuhr@…>, 9 years ago
|
licencing: seventh groups of files
|
-
Property mode set to
100644
|
File size:
1.4 KB
|
Rev | Line | |
---|
[51587aa] | 1 | // |
---|
| 2 | // Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo |
---|
| 3 | // |
---|
| 4 | // The contents of this file are covered under the licence agreement in the |
---|
| 5 | // file "LICENCE" distributed with Cforall. |
---|
| 6 | // |
---|
[01aeade] | 7 | // SemanticError.h -- |
---|
[51587aa] | 8 | // |
---|
| 9 | // Author : Richard C. Bilson |
---|
| 10 | // Created On : Mon May 18 07:44:20 2015 |
---|
[01aeade] | 11 | // Last Modified By : Peter A. Buhr |
---|
| 12 | // Last Modified On : Tue May 19 07:22:23 2015 |
---|
| 13 | // Update Count : 1 |
---|
[51587aa] | 14 | // |
---|
[51b7345] | 15 | |
---|
| 16 | #ifndef SEMANTICERROR_H |
---|
| 17 | #define SEMANTICERROR_H |
---|
| 18 | |
---|
| 19 | #include <exception> |
---|
| 20 | #include <string> |
---|
| 21 | #include <strstream> |
---|
| 22 | #include <list> |
---|
| 23 | #include <iostream> |
---|
| 24 | |
---|
[01aeade] | 25 | class SemanticError : public std::exception { |
---|
| 26 | public: |
---|
| 27 | SemanticError(); |
---|
| 28 | SemanticError( std::string error ); |
---|
| 29 | template< typename T > SemanticError( const std::string &error, const T *obj ); |
---|
| 30 | ~SemanticError() throw() {} |
---|
| 31 | |
---|
| 32 | void append( SemanticError &other ); |
---|
| 33 | bool isEmpty() const; |
---|
| 34 | void print( std::ostream &os ); |
---|
| 35 | |
---|
| 36 | // constructs an exception using the given message and the printed |
---|
| 37 | // representation of the obj (T must have a print method) |
---|
| 38 | private: |
---|
| 39 | std::list< std::string > errors; |
---|
[51b7345] | 40 | }; |
---|
| 41 | |
---|
| 42 | template< typename T > |
---|
[01aeade] | 43 | SemanticError::SemanticError( const std::string &error, const T *obj ) { |
---|
| 44 | std::ostrstream os; |
---|
| 45 | os << "Error: " << error; |
---|
| 46 | obj->print( os ); |
---|
| 47 | errors.push_back( std::string( os.str(), os.pcount() ) ); |
---|
[51b7345] | 48 | } |
---|
| 49 | |
---|
[01aeade] | 50 | #endif // SEMANTICERROR_H |
---|
| 51 | |
---|
[51587aa] | 52 | // Local Variables: // |
---|
| 53 | // tab-width: 4 // |
---|
| 54 | // mode: c++ // |
---|
| 55 | // compile-command: "make install" // |
---|
| 56 | // End: // |
---|
Note: See
TracBrowser
for help on using the repository browser.