Kstars

SpatialException.h
1//# Filename: SpatialException.h
2//#
3//# Author: Peter Z Kunszt based on John Doug Reynolds'code
4//#
5//# Date: March 1998
6//#
7//# SPDX-FileCopyrightText: 2000 Peter Z. Kunszt Alex S. Szalay, Aniruddha R. Thakar
8//# The Johns Hopkins University
9//#
10//# Modification History:
11//#
12//# Oct 18, 2001 : Dennis C. Dinge -- Replaced ValVec with std::vector
13//#
14
15#ifndef _SpatialException_h
16#define _SpatialException_h
17
18#include "SpatialGeneral.h"
19
20/** HTM SpatialIndex Exception base class
21 This is the base class for all Science Archive exceptions. It may
22 be used as a generic exception, but programmers are encouraged to
23 use the more specific derived classes. Note that all Spatial
24 exceptions are also Standard Library exceptions by
25 inheritance.
26*/
27
28class LINKAGE SpatialException
29{
30 public:
31 /** Default and explicit constructor.
32 The default constructor
33 supplies a generic message indicating the exception type. The
34 explicit constructor sets the message to a copy of the provided
35 string. This behavior is shared by all derived classes.
36 */
37
38 SpatialException(const char *what = nullptr, int defIndex = 1) throw();
39
40 /** Standard constructor.
41 The message is assembled from copies of
42 the two component strings. The first indicates where in the
43 program the exception was thrown, and the second indicates why.
44 The null pointer is used to select standard components according
45 to the type of the exception. This behavior is shared by all
46 derived classes.
47 */
48 SpatialException(const char *context, const char *because, int defIndex = 1) throw();
49
50 /// Copy constructor.
51 SpatialException(const SpatialException &) throw();
52
53 /// Assignment operator.
54 SpatialException &operator=(const SpatialException &) throw();
55
56 /// Destructor.
57 virtual ~SpatialException() throw();
58
59 /// Returns the message as set during construction.
60 virtual const char *what() const throw();
61
62 /// return string length also for null strings
63 int slen(const char *) const;
64
65 /// deallocate string
66 void clear();
67
68 /// default error string
69 static const char *defaultstr[];
70
71 protected:
72 /// error string to assemble
73 char *str_;
74};
75
76/** SpatialException thrown by unimplemented functions.
77 This Exception should be thrown wherever
78 important functionality has been left temporarily unimplemented.
79 Typically this exception will apply to an entire function.
80*/
81
83{
84 public:
85 /// Default and explicit constructors.
86 SpatialUnimplemented(const char *what = nullptr) throw();
87
88 /// Standard constructor.
89 SpatialUnimplemented(const char *context, const char *because) throw();
90
91 /// Copy constructor.
93};
94
95/** SpatialException thrown on operational failure.
96 This Exception should be thrown when an operation
97 fails unexpectedly. A special constructor is provided for
98 assembling the message from the typical components: program
99 context, operation name, resource name, and explanation. As usual,
100 any component may be left out by specifying the null pointer.
101*/
102
103class LINKAGE SpatialFailure : public SpatialException
104{
105 public:
106 /// Default and explicit constructors.
107 SpatialFailure(const char *what = nullptr) throw();
108
109 /// Standard constructor.
110 SpatialFailure(const char *context, const char *because) throw();
111
112 /// Special constructor.
113 SpatialFailure(const char *context, const char *operation, const char *resource, const char *because = nullptr) throw();
114
115 /// Copy constructor.
116 SpatialFailure(const SpatialFailure &) throw();
117};
118
119/** SpatialException thrown on violation of array bounds.
120 This Exception should be thrown on detection of an
121 attempt to access elements beyond the boundaries of an array. A
122 special constructor is provided for assembling the message from the
123 typical components: program context, array name, violated boundary,
124 and violating index.
125*/
126
128{
129 public:
130 /// Default and explicit constructors.
131 SpatialBoundsError(const char *what = nullptr) throw();
132
133 /** Standard constructor.
134 If limit and index are -1, both are
135 considered unknown. Note that the upper limit of a zero-offset
136 array is not the same as the number of elements.
137 */
138 SpatialBoundsError(const char *context, const char *array, int32 limit = -1, int32 index = -1) throw();
139
140 /// Copy constructor.
141 SpatialBoundsError(const SpatialBoundsError &) throw();
142};
143
144/** SpatialException thrown on violation of interface protocols.
145 This Exception should be thrown when a program,
146 class, or function interface requirement is breached.
147 Specifically, this includes improper usage and invalid arguments.
148 For the latter, a special constructor is provided for assembling
149 the message from the typical components: program context, argument
150 name, and explanation.
151*/
152
154{
155 public:
156 /// Default and explicit constructors.
157 SpatialInterfaceError(const char *what = nullptr) throw();
158
159 /// Standard constructor.
160 SpatialInterfaceError(const char *context, const char *because) throw();
161
162 /// Special constructor.
163 SpatialInterfaceError(const char *context, const char *argument, const char *because) throw();
164
165 /// Copy constructor.
167};
168
169#endif /* _SpatialException_h */
SpatialException thrown on violation of array bounds.
HTM SpatialIndex Exception base class This is the base class for all Science Archive exceptions.
char * str_
error string to assemble
SpatialException thrown on operational failure.
SpatialException thrown on violation of interface protocols.
SpatialException thrown by unimplemented functions.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 17:04:46 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.