(file) Return to Exception.h CVS log (file) (dir) Up to [Pegasus] / pegasus / src / Pegasus / Common

  1 mike  1.22 //%/////////////////////////////////////////////////////////////////////////////
  2            //
  3            // Copyright (c) 2000, 2001 The Open group, BMC Software, Tivoli Systems, IBM
  4            //
  5            // Permission is hereby granted, free of charge, to any person obtaining a copy
  6            // of this software and associated documentation files (the "Software"), to 
  7            // deal in the Software without restriction, including without limitation the 
  8            // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 
  9            // sell copies of the Software, and to permit persons to whom the Software is
 10            // furnished to do so, subject to the following conditions:
 11            // 
 12            // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN 
 13            // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
 14            // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
 15            // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR 
 16            // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 
 17            // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 
 18            // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 19            // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 20            //
 21            //==============================================================================
 22 mike  1.22 //
 23            // Author: Mike Brasher (mbrasher@bmc.com)
 24            //
 25            // Modified By:
 26            //
 27            //%/////////////////////////////////////////////////////////////////////////////
 28            
 29            #ifndef Pegasus_Exception_h
 30            #define Pegasus_Exception_h
 31            
 32            #include <cstring>
 33            #include <Pegasus/Common/Config.h>
 34            #include <Pegasus/Common/String.h>
 35            #include <Pegasus/Common/CIMStatusCode.h>
 36            
 37            PEGASUS_NAMESPACE_BEGIN
 38            
 39            /** Class Exception  - This 
 40            */
 41            class PEGASUS_COMMON_LINKAGE Exception
 42            {
 43 mike  1.22 public:
 44            
 45                Exception(const String& message);
 46            
 47                Exception(const char* message);
 48            
 49                ~Exception();
 50            
 51                const String& getMessage() const { return _message; }
 52            
 53            protected:
 54            
 55                String _message;
 56            };
 57            
 58            /** Class AssertionFailureException
 59            This is an Exception class tied to the definiton of an assert named
 60            PEGASUS_ASSERT.  This assertion can be included at any point in Pegasus
 61            code
 62            */
 63            class PEGASUS_COMMON_LINKAGE AssertionFailureException : public Exception
 64 mike  1.22 {
 65            public:
 66            
 67                AssertionFailureException(
 68            	const char* file,
 69            	size_t line,
 70            	const String& message);
 71            };
 72            
 73            /** define PEGASUS_ASSERT assertion statement.  This statement tests the 
 74                condition defined by the parameters and if not True executes an 
 75            
 76                <pre>
 77                throw AssertionFailureException
 78                </pre>
 79            
 80                defining the file, line and condition that was tested.
 81            */
 82            #define PEGASUS_ASSERT(COND) \
 83                do \
 84                { \
 85 mike  1.22 	if (!(COND)) \
 86            	{ \
 87            	    throw AssertionFailureException(__FILE__, __LINE__, #COND); \
 88            	} \
 89                } while (0)
 90            
 91            /// ATTN:
 92            class PEGASUS_COMMON_LINKAGE BadReference : public Exception
 93            {
 94            public:
 95            
 96                BadReference(const String& message) : Exception(message) { }
 97            };
 98            
 99            /// ATTN:
100            class PEGASUS_COMMON_LINKAGE OutOfBounds : public Exception
101            {
102            public:
103            
104                static const char MSG[];
105            
106 mike  1.22     OutOfBounds() : Exception(MSG) { }
107            };
108            
109            /// ATTN:
110            class PEGASUS_COMMON_LINKAGE AlreadyExists : public Exception
111            {
112            public:
113            
114                static const char MSG[];
115            
116                AlreadyExists(const String& x = String()) : Exception(MSG + x) { }
117            };
118            
119            /// ATTN:
120            class PEGASUS_COMMON_LINKAGE NullPointer : public Exception
121            {
122            public:
123            
124                static const char MSG[];
125            
126                NullPointer() : Exception(MSG) { }
127 mike  1.22 };
128            
129            /// ATTN:
130            class PEGASUS_COMMON_LINKAGE IllegalName : public Exception
131            {
132            public:
133            
134                static const char MSG[];
135            
136                IllegalName() : Exception(MSG) { }
137            };
138            
139            /// ATTN:
140            class PEGASUS_COMMON_LINKAGE UnitializedHandle : public Exception
141            {
142            public:
143            
144                static const char MSG[];
145            
146                UnitializedHandle() : Exception(MSG) { }
147            };
148 mike  1.22 
149            /// ATTN:
150            class PEGASUS_COMMON_LINKAGE InvalidPropertyOverride : public Exception
151            {
152            public:
153            
154                static const char MSG[];
155            
156                InvalidPropertyOverride(const String& message)
157            	: Exception(MSG + message) { }
158            };
159            
160            /// ATTN:
161            class PEGASUS_COMMON_LINKAGE InvalidMethodOverride : public Exception
162            {
163            public:
164            
165                static const char MSG[];
166            
167                InvalidMethodOverride(const String& message)
168            	: Exception(MSG + message) { }
169 mike  1.22 };
170            
171            /// ATTN:
172            class PEGASUS_COMMON_LINKAGE UndeclaredQualifier : public Exception
173            {
174            public:
175            
176                static const char MSG[];
177            
178                UndeclaredQualifier(const String& qualifierName)
179            	: Exception(MSG + qualifierName) { }
180            };
181            
182            /// ATTN:
183            class PEGASUS_COMMON_LINKAGE BadQualifierScope : public Exception
184            {
185            public:
186            
187                static const char MSG[];
188            
189                BadQualifierScope(const String& qualifierName, const String& scopeString)
190 mike  1.22 	: Exception(MSG + qualifierName + String(" scope=") + scopeString) { }
191            };
192            
193            /// ATTN:
194            class PEGASUS_COMMON_LINKAGE BadQualifierOverride : public Exception
195            {
196            public:
197            
198                static const char MSG[];
199            
200                BadQualifierOverride(const String& qualifierName)
201            	: Exception(MSG + qualifierName) { }
202            };
203            
204            class PEGASUS_COMMON_LINKAGE BadQualifierType : public Exception
205            {
206            public:
207            
208                static const char MSG[];
209            
210                BadQualifierType(const String& qualifierName)
211 mike  1.22 	: Exception(MSG + qualifierName) { }
212            };
213            
214            /// ATTN:
215            class PEGASUS_COMMON_LINKAGE NullType : public Exception
216            {
217            public:
218            
219                static const char MSG[];
220            
221                NullType() : Exception(MSG) { }
222            };
223            
224            /// ATTN:
225            class PEGASUS_COMMON_LINKAGE AddedReferenceToClass : public Exception
226            {
227            public:
228            
229                static const char MSG[];
230            
231                AddedReferenceToClass(const String& className)
232 mike  1.22 	: Exception(MSG + className) { }
233            };
234            
235            /// ATTN:
236            class PEGASUS_COMMON_LINKAGE ClassAlreadyResolved : public Exception
237            {
238            public:
239            
240                static const char MSG[];
241            
242                ClassAlreadyResolved(const String& className)
243            	: Exception(MSG + className) { }
244            };
245            
246            /// ATTN:
247            class PEGASUS_COMMON_LINKAGE ClassNotResolved : public Exception
248            {
249            public:
250            
251                static const char MSG[];
252            
253 mike  1.22     ClassNotResolved(const String& className)
254            	: Exception(MSG + className) { }
255            };
256            
257            /// ATTN:
258            class PEGASUS_COMMON_LINKAGE InstanceAlreadyResolved : public Exception
259            {
260            public:
261            
262                static const char MSG[];
263            
264                InstanceAlreadyResolved() : Exception(MSG) { }
265            };
266            
267            /// ATTN:
268            class PEGASUS_COMMON_LINKAGE InstantiatedAbstractClass : public Exception
269            {
270            public:
271            
272                static const char MSG[];
273            
274 mike  1.22     InstantiatedAbstractClass() : Exception(MSG) { }
275            };
276            
277            /// ATTN:
278            class PEGASUS_COMMON_LINKAGE NoSuchProperty : public Exception
279            {
280            public:
281            
282                static const char MSG[];
283            
284                NoSuchProperty(const String& propertyName)
285            	: Exception(MSG + propertyName) { }
286            };
287            
288            /// ATTN:
289            class PEGASUS_COMMON_LINKAGE TruncatedCharacter : public Exception
290            {
291            public:
292            
293                static const char MSG[];
294            
295 mike  1.22     TruncatedCharacter() : Exception(MSG) { }
296            };
297            
298            /// ATTN:
299            class PEGASUS_COMMON_LINKAGE ExpectedReferenceValue : public Exception
300            {
301            public:
302            
303                static const char MSG[];
304            
305                ExpectedReferenceValue() : Exception(MSG) { }
306            };
307            
308            /// ATTN:
309            class PEGASUS_COMMON_LINKAGE MissingReferenceClassName : public Exception
310            {
311            public:
312            
313                static const char MSG[];
314            
315                MissingReferenceClassName() : Exception(MSG) { }
316 mike  1.22 };
317            
318            /// ATTN:
319            class PEGASUS_COMMON_LINKAGE IllegalTypeTag : public Exception
320            {
321            public:
322            
323                static const char MSG[];
324            
325                IllegalTypeTag() : Exception(MSG) { }
326            };
327            
328            /// ATTN:
329            class PEGASUS_COMMON_LINKAGE TypeMismatch : public Exception
330            {
331            public:
332            
333                static const char MSG[];
334            
335                TypeMismatch() : Exception(MSG) { }
336            };
337 mike  1.22 
338            /// ATTN:
339            class PEGASUS_COMMON_LINKAGE NoSuchFile : public Exception
340            {
341            public:
342            
343                static const char MSG[];
344            
345                NoSuchFile(const String& fileName) : Exception(MSG + fileName) { }
346            };
347            class PEGASUS_COMMON_LINKAGE CannotBindToAddress : public Exception
348            {
349            public:
350            
351                static const char MSG[];
352            
353                CannotBindToAddress(const String& address) : Exception(MSG + address) { }
354            };
355            
356            /// ATTN:
357            class PEGASUS_COMMON_LINKAGE CannotRemoveDirectory : public Exception
358 mike  1.22 {
359            public:
360            
361                static const char MSG[];
362            
363                CannotRemoveDirectory(const String& path) : Exception(MSG + path) { }
364            };
365            
366            /// ATTN:
367            class PEGASUS_COMMON_LINKAGE CannotRemoveFile : public Exception
368            {
369            public:
370            
371                static const char MSG[];
372            
373                CannotRemoveFile(const String& path) : Exception(MSG + path) { }
374            };
375            
376            /// ATTN:
377            class PEGASUS_COMMON_LINKAGE CannotRenameFile : public Exception
378            {
379 mike  1.22 public:
380            
381                static const char MSG[];
382            
383                CannotRenameFile(const String& path) : Exception(MSG + path) { }
384            };
385            
386            /// ATTN:
387            class PEGASUS_COMMON_LINKAGE NoSuchDirectory : public Exception
388            {
389            public:
390            
391                static const char MSG[];
392            
393                NoSuchDirectory(const String& directoryName)
394            	: Exception(MSG + directoryName) { }
395            };
396            
397            class PEGASUS_COMMON_LINKAGE ChangeDirectoryFailed : public Exception
398            {
399            public:
400 mike  1.22 
401                static const char MSG[];
402            
403                ChangeDirectoryFailed(const String& directoryName)
404            	: Exception(MSG + directoryName) { }
405            };
406            
407            /// ATTN:
408            class PEGASUS_COMMON_LINKAGE CannotCreateDirectory : public Exception
409            {
410            public:
411            
412                static const char MSG[];
413            
414                CannotCreateDirectory(const String& path)
415            	: Exception(MSG + path) { }
416            };
417            
418            /// ATTN:
419            class PEGASUS_COMMON_LINKAGE NoSuchNameSpace : public Exception
420            {
421 mike  1.22 public:
422            
423                static const char MSG[];
424            
425                NoSuchNameSpace(const String& directoryName)
426            	: Exception(MSG + directoryName) { }
427            };
428            
429            /// ATTN:
430            class PEGASUS_COMMON_LINKAGE CannotOpenFile : public Exception
431            {
432            public:
433            
434                static const char MSG[];
435            
436                CannotOpenFile(const String& path)
437            	: Exception(MSG + path) { }
438            };
439            
440            /// ATTN:
441            class PEGASUS_COMMON_LINKAGE NotImplemented : public Exception
442 mike  1.22 {
443            public:
444            
445                static const char MSG[];
446            
447                NotImplemented(const String& method) : Exception(MSG + method) { }
448            };
449            
450            #define PEGASUS_CIM_EXCEPTION(CODE, EXTRA_MESSAGE) \
451                CIMException(CODE, __FILE__, __LINE__, EXTRA_MESSAGE)
452            
453            /** The CIMException defines the CIM exceptions that are formally defined in 
454                the CIM Operations over HTTP specification.
455                @example
456                <PRE>
457            	throw CIMException(CIM_ERR_NOT_SUPPORTED);
458                </PRE>
459            */
460            class PEGASUS_COMMON_LINKAGE CIMException : public Exception
461            {
462            public:
463 mike  1.22 
464                CIMException(
465            	CIMStatusCode code, 
466            	const char* file = "",
467            	Uint32 line = 0,
468            	const String& extraMessage = String());
469            
470                CIMStatusCode getCode() const { return _code; }
471            
472            private:
473            
474                CIMStatusCode _code;
475            };
476            
477            class PEGASUS_COMMON_LINKAGE StackUnderflow : public Exception
478            {
479            public:
480            
481                static const char MSG[];
482            
483                StackUnderflow() : Exception(MSG) { }
484 mike  1.22 };
485            
486            class PEGASUS_COMMON_LINKAGE QueueUnderflow : public Exception
487            {
488            public:
489            
490                static const char MSG[];
491            
492                QueueUnderflow() : Exception(MSG) { }
493            };
494            
495            
496            class PEGASUS_COMMON_LINKAGE BadFormat : public Exception
497            {
498            public:
499            
500                static const char MSG[];
501            
502                BadFormat() : Exception(MSG) { }
503            };
504            
505 mike  1.22 class PEGASUS_COMMON_LINKAGE BadDateTimeFormat : public Exception
506            {
507            public:
508            
509                static const char MSG[];
510            
511                BadDateTimeFormat() : Exception(MSG) { }
512            };
513            
514            class PEGASUS_COMMON_LINKAGE IncompatibleTypes : public Exception
515            {
516            public:
517            
518                static const char MSG[];
519            
520                IncompatibleTypes() : Exception(MSG) { }
521            };
522            
523            class PEGASUS_COMMON_LINKAGE BadlyFormedCGIQueryString : public Exception
524            {
525            public:
526 mike  1.22 
527                static const char MSG[];
528            
529                BadlyFormedCGIQueryString() : Exception(MSG) { }
530            };
531            
532            class PEGASUS_COMMON_LINKAGE IllformedObjectName : public Exception
533            {
534            public:
535            
536                static const char MSG[];
537            
538                IllformedObjectName(const String& instanceName)
539            	: Exception(MSG + instanceName) { }
540            };
541            
542            class PEGASUS_COMMON_LINKAGE DynamicLoadFailed : public Exception
543            {
544            public:
545            
546                static const char MSG[];
547 mike  1.22 
548                DynamicLoadFailed(const String& libraryName)
549            	: Exception(MSG + libraryName) { }
550            };
551            
552            class PEGASUS_COMMON_LINKAGE DynamicLookupFailed : public Exception
553            {
554            public:
555            
556                static const char MSG[];
557            
558                DynamicLookupFailed(const String& symbolName)
559            	: Exception(MSG + symbolName) { }
560            };
561            
562            class PEGASUS_COMMON_LINKAGE CannotOpenDirectory : public Exception
563            {
564            public:
565            
566                static const char MSG[];
567            
568 mike  1.22     CannotOpenDirectory(const String& path) : Exception(MSG + path) { }
569            };
570            
571            class PEGASUS_COMMON_LINKAGE CorruptFile : public Exception
572            {
573            public:
574            
575                static const char MSG[];
576            
577                CorruptFile(const String& path) : Exception(MSG + path) { }
578            };
579            
580            PEGASUS_COMMON_LINKAGE void ThrowUnitializedHandle();
581            
582            PEGASUS_NAMESPACE_END
583            
584            #endif /* Pegasus_Exception_h */

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2