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// <summary>
42// </summary>
43// <use visibility=export>
44// <reviewed reviewer="UNKNOWN" date="" tests="">
45// </reviewed>
46
47// <synopsis>
48//
49// The top-level generic MSSelection error handler class. The
50// handleError() overloadable method takes the action of reporting
51// the error. The handleError() method of this defualt handler
52// constructs a message string and throws an exception of the type
53// supplied. This operation has been factored out into this object
54// to allow more control on the error handler mechanism from
55// outside.
56//
57//</synopsis>
58
60 public:
61 // The default constructor generates the message "Table error".
65
68
69 virtual void reportError(const char* token, const String source = String(""));
71
72 virtual void reset();
74
75 const std::vector<String>& getMessages() const { return messageList; }
76 Int nMessages() const { return messageList.size(); }
77
78 protected:
79 std::vector<String> tokenList, messageList;
80};
81
82// <synopsis>
83//
84// The handleError() method is overloaded to send the accumulated
85// error messages to the LogIO object as warning messages.
86//
87//</synopsis>
88
90 public:
92 virtual MSSelectionLogError* clone() { return new MSSelectionLogError(); };
94 virtual void handleError(MSSelectionError& mssErrorType) {
95 if (messageList.size() > 0) {
97 mssErrorType.addMessage(mesg);
98 LogIO logIO;
99 logIO << mssErrorType.getMesg() << LogIO::WARN;
100 }
101 }
102};
103} // namespace casacore
104
105#endif
const String & getMesg() const
Definition Error.h:176
@ WARN
Change the message priority to WARN.
Definition LogIO.h:177
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:355
For temporary backward namespace compatibility, use casa as alias for casacore.
Definition mainpage.dox:28
int Int
Definition aipstype.h:48