File: SpatialException.h

package info (click to toggle)
siril 1.4.0~rc2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 47,352 kB
  • sloc: ansic: 174,082; cpp: 28,254; python: 7,891; makefile: 974; xml: 777; sh: 271
file content (169 lines) | stat: -rw-r--r-- 5,769 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
//#		Filename:	SpatialException.h
//#
//#		Author:		Peter Z Kunszt based on John Doug Reynolds'code
//#
//#		Date:		March 1998
//#
//#	    SPDX-FileCopyrightText: 2000 Peter Z. Kunszt Alex S. Szalay, Aniruddha R. Thakar
//#                     The Johns Hopkins University
//#
//#     Modification History:
//#
//#     Oct 18, 2001 : Dennis C. Dinge -- Replaced ValVec with std::vector
//#

#ifndef _SpatialException_h
#define _SpatialException_h

#include "SpatialGeneral.h"

/** HTM SpatialIndex Exception base class
    This is the base class for all Science Archive exceptions.  It may
    be used as a generic exception, but programmers are encouraged to
    use the more specific derived classes.  Note that all Spatial
    exceptions are also Standard Library exceptions by
    inheritance.
*/

class LINKAGE SpatialException
{
  public:
    /** Default and explicit constructor.
            The default constructor
            supplies a generic message indicating the exception type.  The
            explicit constructor sets the message to a copy of the provided
            string.  This behavior is shared by all derived classes.
        */

    SpatialException(const char *what = nullptr, int defIndex = 1) throw();

    /** Standard constructor.
            The message is assembled from copies of
            the two component strings.  The first indicates where in the
            program the exception was thrown, and the second indicates why.
            The null pointer is used to select standard components according
            to the type of the exception.  This behavior is shared by all
            derived classes.
        */
    SpatialException(const char *context, const char *because, int defIndex = 1) throw();

    /// Copy constructor.
    SpatialException(const SpatialException &) throw();

    /// Assignment operator.
    SpatialException &operator=(const SpatialException &) throw();

    /// Destructor.
    virtual ~SpatialException() throw();

    /// Returns the message as set during construction.
    virtual const char *what() const throw();

    /// return string length also for null strings
    int slen(const char *) const;

    /// deallocate string
    void clear();

    /// default error string
    static const char *defaultstr[];

  protected:
    /// error string to assemble
    char *str_;
};

/** SpatialException thrown by unimplemented functions.
    This Exception should be thrown wherever
    important functionality has been left temporarily unimplemented.
    Typically this exception will apply to an entire function.
*/

class LINKAGE SpatialUnimplemented : public SpatialException
{
  public:
    /// Default and explicit constructors.
    SpatialUnimplemented(const char *what = nullptr) throw();

    /// Standard constructor.
    SpatialUnimplemented(const char *context, const char *because) throw();

    /// Copy constructor.
    SpatialUnimplemented(const SpatialUnimplemented &) throw();
};

/** SpatialException thrown on operational failure.
    This Exception should be thrown when an operation
    fails unexpectedly.  A special constructor is provided for
    assembling the message from the typical components: program
    context, operation name, resource name, and explanation.  As usual,
    any component may be left out by specifying the null pointer.
*/

class LINKAGE SpatialFailure : public SpatialException
{
  public:
    /// Default and explicit constructors.
    SpatialFailure(const char *what = nullptr) throw();

    /// Standard constructor.
    SpatialFailure(const char *context, const char *because) throw();

    /// Special constructor.
    SpatialFailure(const char *context, const char *operation, const char *resource, const char *because = nullptr) throw();

    /// Copy constructor.
    SpatialFailure(const SpatialFailure &) throw();
};

/** SpatialException thrown on violation of array bounds.
    This Exception should be thrown on detection of an
    attempt to access elements beyond the boundaries of an array.  A
    special constructor is provided for assembling the message from the
    typical components: program context, array name, violated boundary,
    and violating index.
*/

class LINKAGE SpatialBoundsError : public SpatialException
{
  public:
    /// Default and explicit constructors.
    SpatialBoundsError(const char *what = nullptr) throw();

    /** Standard constructor.
            If limit and index are -1, both are
            considered unknown.  Note that the upper limit of a zero-offset
            array is not the same as the number of elements.
        */
    SpatialBoundsError(const char *context, const char *array, int32 limit = -1, int32 index = -1) throw();

    /// Copy constructor.
    SpatialBoundsError(const SpatialBoundsError &) throw();
};

/** SpatialException thrown on violation of interface protocols.
    This Exception should be thrown when a program,
    class, or function interface requirement is breached.
    Specifically, this includes improper usage and invalid arguments.
    For the latter, a special constructor is provided for assembling
    the message from the typical components: program context, argument
    name, and explanation.
*/

class LINKAGE SpatialInterfaceError : public SpatialException
{
  public:
    /// Default and explicit constructors.
    SpatialInterfaceError(const char *what = nullptr) throw();

    /// Standard constructor.
    SpatialInterfaceError(const char *context, const char *because) throw();

    /// Special constructor.
    SpatialInterfaceError(const char *context, const char *argument, const char *because) throw();

    /// Copy constructor.
    SpatialInterfaceError(const SpatialInterfaceError &) throw();
};

#endif /* _SpatialException_h */