casacore
Loading...
Searching...
No Matches
MSSelectionErrorHandler.h
Go to the documentation of this file.
1//# MSSelectionErrorHandler.h: MSSelection error handler class
2//# Copyright (C) 1994,1995,1996,1997,1999,2000
3//# Associated Universities, Inc. Washington DC, USA.
4//#
5//# This library is free software; you can redistribute it and/or modify it
6//# under the terms of the GNU Library General Public License as published by
7//# the Free Software Foundation; either version 2 of the License, or (at your
8//# option) any later version.
9//#
10//# This library is distributed in the hope that it will be useful, but WITHOUT
11//# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12//# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
13//# License for more details.
14//#
15//# You should have received a copy of the GNU Library General Public License
16//# along with this library; if not, write to the Free Software Foundation,
17//# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
18//#
19//# Correspondence concerning AIPS++ should be addressed as follows:
20//# Internet email: casa-feedback@nrao.edu.
21//# Postal address: AIPS++ Project Office
22//# National Radio Astronomy Observatory
23//# 520 Edgemont Road
24//# Charlottesville, VA 22903-2475 USA
25
26#ifndef MS_MSSELECTIONERRORHANDLER_H
27#define MS_MSSELECTIONERRORHANDLER_H
28
29//# Includes
30#include <casacore/casa/aips.h>
31#include <casacore/casa/Logging/LogIO.h>
32#include <casacore/casa/Exceptions/Error.h>
33#include <casacore/ms/MSSel/MSSelectionError.h>
34#include <vector>
35
36namespace casacore { //# NAMESPACE CASACORE - BEGIN
37
38 //# This header file defines the error handler class for the
39 //# MSSelection module
40
41
42 // <summary>
43 // </summary>
44 // <use visibility=export>
45 // <reviewed reviewer="UNKNOWN" date="" tests="">
46 // </reviewed>
47
48 // <synopsis>
49 //
50 // The top-level generic MSSelection error handler class. The
51 // handleError() overloadable method takes the action of reporting
52 // the error. The handleError() method of this defualt handler
53 // constructs a message string and throws an exception of the type
54 // supplied. This operation has been factored out into this object
55 // to allow more control on the error handler mechanism from
56 // outside.
57 //
58 //</synopsis>
59
61 {
62 public:
63 // The default constructor generates the message "Table error".
67
70
71 virtual void reportError(const char *token,const String source=String(""));
73
74 virtual void reset();
76
77 const std::vector<String>& getMessages() const
78 { return messageList; }
79 Int nMessages() const
80 { return messageList.size(); }
81
82 protected:
83 std::vector<String> tokenList, messageList;
84 };
85
86 // <synopsis>
87 //
88 // The handleError() method is overloaded to send the accumulated
89 // error messages to the LogIO object as warning messages.
90 //
91 //</synopsis>
92
94 {
95 public:
97 virtual MSSelectionLogError* clone() {return new MSSelectionLogError();};
99 virtual void handleError(MSSelectionError& mssErrorType)
100 {
101 if (messageList.size() > 0)
102 {
103 String mesg(constructMessage());
104 mssErrorType.addMessage(mesg);
105 LogIO logIO;
106 logIO << mssErrorType.getMesg() << LogIO::WARN;
107 }
108 }
109 };
110} //# NAMESPACE CASACORE - END
111
112
113#endif
const String & getMesg() const
Definition Error.h:146
@ WARN
Change the message priority to WARN.
Definition LogIO.h:178
virtual void reportError(const char *token, const String source=String(""))
const std::vector< String > & getMessages() const
virtual MSSelectionErrorHandler * clone()
MSSelectionErrorHandler()
The default constructor generates the message "Table error".
MSSelectionErrorHandler & operator=(const MSSelectionErrorHandler &that)
MSSelectionErrorHandler(const MSSelectionErrorHandler &that)
virtual void handleError(MSSelectionError &)
void addMessage(String &message)
virtual MSSelectionLogError * clone()
virtual void handleError(MSSelectionError &mssErrorType)
String: the storage and methods of handling collections of characters.
Definition String.h:223
this file contains all the compiler specific defines
Definition mainpage.dox:28
int Int
Definition aipstype.h:48