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

  1 karl  1.17 //%2006////////////////////////////////////////////////////////////////////////
  2 kumpf 1.1  //
  3 karl  1.12 // Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
  4            // Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
  5            // Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;
  6 karl  1.9  // IBM Corp.; EMC Corporation, The Open Group.
  7 karl  1.12 // Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
  8            // IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
  9 karl  1.13 // Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
 10            // EMC Corporation; VERITAS Software Corporation; The Open Group.
 11 karl  1.17 // Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
 12            // EMC Corporation; Symantec Corporation; The Open Group.
 13 kumpf 1.1  //
 14            // Permission is hereby granted, free of charge, to any person obtaining a copy
 15            // of this software and associated documentation files (the "Software"), to
 16            // deal in the Software without restriction, including without limitation the
 17            // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
 18            // sell copies of the Software, and to permit persons to whom the Software is
 19            // furnished to do so, subject to the following conditions:
 20            // 
 21            // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
 22            // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
 23            // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
 24            // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
 25            // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
 26            // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
 27            // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 28            // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 29            //
 30            //==============================================================================
 31            //
 32            //%/////////////////////////////////////////////////////////////////////////////
 33            
 34 kumpf 1.1  #ifndef Pegasus_InternalException_h
 35            #define Pegasus_InternalException_h
 36            
 37            #include <Pegasus/Common/Config.h>
 38            #include <Pegasus/Common/Linkage.h>
 39            #include <Pegasus/Common/Exception.h>
 40 jim.wunderlich 1.14 #include <Pegasus/Common/PegasusAssert.h>
 41                     
 42 kumpf          1.1  PEGASUS_NAMESPACE_BEGIN
 43                     
 44                     /** Class AssertionFailureException
 45                     This is an Exception class tied to the definiton of an assert named
 46                     PEGASUS_ASSERT.  This assertion can be included at any point in Pegasus
 47                     code
 48                     */
 49                     class PEGASUS_COMMON_LINKAGE AssertionFailureException : public Exception
 50                     {
 51                     public:
 52                     
 53                         AssertionFailureException(
 54 kumpf          1.21         const char* file,
 55                             size_t line,
 56                             const String& message);
 57 mike           1.19 
 58                         virtual ~AssertionFailureException();
 59 kumpf          1.1  };
 60                     
 61                     
 62                     /* Macro to Create the equivalent of an assert but without the
 63                        termination.  This can be used as a temporary marker for asserts
 64                        that are not working.  Prints out the error but continues.
 65                        NOTE: This is useful in test programs to keep us aware that we
 66                        have problems without halting the test sequence.
 67                        This was created primarily to put temporary asserts into tests that
 68                        are not yet working correctly but will not stop the test sequence.
 69                     */
 70                     #define ASSERTTEMP(COND) \
 71                         do \
 72                         { \
 73 kumpf          1.21         if (!(COND)) \
 74                             { \
 75                                 cerr << "TEMP Assert Error TEMP **********" \
 76                                     <<__FILE__ << " " << __LINE__ \
 77                                     << " " << #COND << endl; \
 78                             } \
 79 kumpf          1.1      } while (0)
 80                     
 81                     
 82                     // ATTN: P3  KS documentation Required
 83                     class PEGASUS_COMMON_LINKAGE NullPointer : public Exception
 84                     {
 85                     public:
 86                     
 87                         static const char MSG[];
 88 kumpf          1.22     static const char KEY[];
 89 kumpf          1.1  
 90 mike           1.19     NullPointer();
 91 chuck          1.5  
 92 mike           1.19     virtual ~NullPointer();
 93 kumpf          1.1  };
 94                     
 95                     // ATTN: P3  KS documentation Required
 96                     class PEGASUS_COMMON_LINKAGE UndeclaredQualifier : public Exception
 97                     {
 98                     public:
 99                     
100                         static const char MSG[];
101 kumpf          1.22     static const char KEY[];
102 kumpf          1.1  
103 mike           1.19     UndeclaredQualifier(const String& qualifierName) ;
104 chuck          1.5  
105 mike           1.19     virtual ~UndeclaredQualifier();
106 kumpf          1.1  };
107                     
108                     // ATTN: P3  KS documentation Required
109                     class PEGASUS_COMMON_LINKAGE BadQualifierScope : public Exception
110                     {
111                     public:
112                     
113 kumpf          1.22     static const char MSG[];
114                         static const char KEY[];
115 kumpf          1.1  
116 mike           1.19     BadQualifierScope(
117 kumpf          1.22         const String& qualifierName,
118 kumpf          1.21         const String& scopeString);
119 chuck          1.5  
120 mike           1.19     virtual ~BadQualifierScope();
121 kumpf          1.1  };
122                     
123                     // ATTN: P3  KS documentation Required
124                     class PEGASUS_COMMON_LINKAGE BadQualifierOverride : public Exception
125                     {
126                     public:
127                     
128                         static const char MSG[];
129 kumpf          1.22     static const char KEY[];
130 kumpf          1.1  
131 mike           1.19     BadQualifierOverride(const String& qualifierName);
132                     
133                         virtual ~BadQualifierOverride();
134 kumpf          1.1  };
135                     
136                     class PEGASUS_COMMON_LINKAGE BadQualifierType : public Exception
137                     {
138                     public:
139                     
140                         static const char MSG[];
141 kumpf          1.22     static const char KEY[];
142 kumpf          1.1  
143 mike           1.19     BadQualifierType(const String& qualifierName);
144                         virtual ~BadQualifierType();
145 kumpf          1.1  };
146                     
147                     // ATTN: P3  KS documentation Required
148                     class PEGASUS_COMMON_LINKAGE ClassAlreadyResolved : public Exception
149                     {
150                     public:
151                     
152                         static const char MSG[];
153 kumpf          1.22     static const char KEY[];
154 kumpf          1.1  
155 mike           1.19     ClassAlreadyResolved(const String& className);
156                     
157                         virtual ~ClassAlreadyResolved();
158 kumpf          1.1  };
159                     
160                     // ATTN: P3  KS documentation Required
161                     class PEGASUS_COMMON_LINKAGE ClassNotResolved : public Exception
162                     {
163                     public:
164                     
165                         static const char MSG[];
166 kumpf          1.22     static const char KEY[];
167 kumpf          1.1  
168 mike           1.19     ClassNotResolved(const String& className);
169                         virtual ~ClassNotResolved();
170 kumpf          1.1  };
171                     
172                     // ATTN: P3  KS documentation Required
173                     class PEGASUS_COMMON_LINKAGE InstanceAlreadyResolved : public Exception
174                     {
175                     public:
176                     
177                         static const char MSG[];
178 kumpf          1.22     static const char KEY[];
179 kumpf          1.1  
180 mike           1.19     InstanceAlreadyResolved();
181                         virtual ~InstanceAlreadyResolved();
182 kumpf          1.1  };
183                     
184                     // ATTN: P3  KS documentation Required
185                     class PEGASUS_COMMON_LINKAGE InstantiatedAbstractClass : public Exception
186                     {
187                     public:
188                     
189                         static const char MSG[];
190 kumpf          1.22     static const char KEY[];
191 kumpf          1.1  
192 mike           1.19     InstantiatedAbstractClass(const String& className);
193                         virtual ~InstantiatedAbstractClass();
194 kumpf          1.1  };
195                     
196                     // ATTN: P3  KS documentation Required
197                     class PEGASUS_COMMON_LINKAGE NoSuchProperty : public Exception
198                     {
199                     public:
200                     
201                         static const char MSG[];
202 kumpf          1.22     static const char KEY[];
203 kumpf          1.1  
204 mike           1.19     NoSuchProperty(const String& propertyName);
205                         virtual ~NoSuchProperty();
206 kumpf          1.1  };
207                     
208                     // ATTN: P3  KS documentation Required
209                     class PEGASUS_COMMON_LINKAGE NoSuchFile : public Exception
210                     {
211                     public:
212                     
213                         static const char MSG[];
214 kumpf          1.22     static const char KEY[];
215 kumpf          1.1  
216 mike           1.19     NoSuchFile(const String& fileName);
217                         virtual ~NoSuchFile();
218 kumpf          1.1  };
219                     
220                     // ATTN: P3  KS documentation Required
221                     class PEGASUS_COMMON_LINKAGE FileNotReadable : public Exception
222                     {
223                     public:
224                     
225                         static const char MSG[];
226 kumpf          1.22     static const char KEY[];
227 kumpf          1.1  
228 mike           1.19     FileNotReadable(const String& fileName);
229                         virtual ~FileNotReadable();
230 kumpf          1.1  };
231                     
232                     // ATTN: P3  KS documentation Required
233                     class PEGASUS_COMMON_LINKAGE CannotRemoveDirectory : public Exception
234                     {
235                     public:
236                     
237                         static const char MSG[];
238 kumpf          1.22     static const char KEY[];
239 kumpf          1.1  
240 mike           1.19     CannotRemoveDirectory(const String& path);
241                         virtual ~CannotRemoveDirectory();
242 kumpf          1.1  };
243                     
244                     // ATTN: P3  KS documentation Required
245                     class PEGASUS_COMMON_LINKAGE CannotRemoveFile : public Exception
246                     {
247                     public:
248                     
249                         static const char MSG[];
250 kumpf          1.22     static const char KEY[];
251 kumpf          1.1  
252 mike           1.19     CannotRemoveFile(const String& path);
253                         virtual ~CannotRemoveFile();
254 kumpf          1.1  };
255                     
256                     // ATTN: P3  KS documentation Required
257                     class PEGASUS_COMMON_LINKAGE CannotRenameFile : public Exception
258                     {
259                     public:
260                     
261                         static const char MSG[];
262 kumpf          1.22     static const char KEY[];
263 kumpf          1.1  
264 mike           1.19     CannotRenameFile(const String& path);
265                         virtual ~CannotRenameFile();
266 kumpf          1.1  };
267                     
268                     // ATTN: P3  KS documentation Required
269                     class PEGASUS_COMMON_LINKAGE NoSuchDirectory : public Exception
270                     {
271                     public:
272                     
273                         static const char MSG[];
274 kumpf          1.22     static const char KEY[];
275 kumpf          1.1  
276 mike           1.19     NoSuchDirectory(const String& directoryName);
277                         virtual ~NoSuchDirectory();
278 kumpf          1.1  };
279                     
280                     // ATTN: P3  KS documentation Required
281                     class PEGASUS_COMMON_LINKAGE CannotCreateDirectory : public Exception
282                     {
283                     public:
284                     
285                         static const char MSG[];
286 kumpf          1.22     static const char KEY[];
287 kumpf          1.1  
288 mike           1.19     CannotCreateDirectory(const String& path);
289                         virtual ~CannotCreateDirectory();
290 kumpf          1.1  };
291                     
292                     // ATTN: P3  KS documentation Required
293                     class PEGASUS_COMMON_LINKAGE CannotOpenFile : public Exception
294                     {
295                     public:
296                     
297                         static const char MSG[];
298 kumpf          1.22     static const char KEY[];
299 kumpf          1.1  
300 mike           1.19     CannotOpenFile(const String& path);
301                         virtual ~CannotOpenFile();
302 kumpf          1.1  };
303                     
304                     // ATTN: P3  KS documentation Required
305                     class PEGASUS_COMMON_LINKAGE NotImplemented : public Exception
306                     {
307                     public:
308                     
309                         static const char MSG[];
310 kumpf          1.22     static const char KEY[];
311 kumpf          1.1  
312 mike           1.19     NotImplemented(const String& method);
313                         virtual ~NotImplemented();
314 kumpf          1.1  };
315                     
316                     class PEGASUS_COMMON_LINKAGE StackUnderflow : public Exception
317                     {
318                     public:
319                     
320                         static const char MSG[];
321 kumpf          1.22     static const char KEY[];
322 kumpf          1.1  
323 mike           1.19     StackUnderflow();
324                         virtual ~StackUnderflow();
325 kumpf          1.1  };
326                     
327                     class PEGASUS_COMMON_LINKAGE StackOverflow : public Exception
328                     {
329                     public:
330                     
331                         static const char MSG[];
332 kumpf          1.22     static const char KEY[];
333 kumpf          1.1  
334 mike           1.19     StackOverflow();
335                         virtual ~StackOverflow();
336 kumpf          1.1  };
337                     
338                     class PEGASUS_COMMON_LINKAGE DynamicLoadFailed : public Exception
339                     {
340                     public:
341                     
342                         static const char MSG[];
343 kumpf          1.22     static const char KEY[];
344 kumpf          1.1  
345 mike           1.19     DynamicLoadFailed(const String& libraryName);
346                         virtual ~DynamicLoadFailed();
347 kumpf          1.1  };
348                     
349                     class PEGASUS_COMMON_LINKAGE DynamicLookupFailed : public Exception
350                     {
351                     public:
352                     
353                         static const char MSG[];
354 kumpf          1.22     static const char KEY[];
355 kumpf          1.1  
356 mike           1.19     DynamicLookupFailed(const String& symbolName);
357                         virtual ~DynamicLookupFailed();
358 kumpf          1.1  };
359                     
360                     class PEGASUS_COMMON_LINKAGE CannotOpenDirectory : public Exception
361                     {
362                     public:
363                     
364                         static const char MSG[];
365 kumpf          1.22     static const char KEY[];
366 kumpf          1.1  
367 mike           1.19     CannotOpenDirectory(const String& path);
368                         virtual ~CannotOpenDirectory();
369 kumpf          1.1  };
370                     
371                     class PEGASUS_COMMON_LINKAGE ParseError : public Exception
372                     {
373                     public:
374                     
375                         static const char MSG[];
376 kumpf          1.22     static const char KEY[];
377 kumpf          1.1  
378 mike           1.19     ParseError(const String& message);
379                         virtual ~ParseError();
380 kumpf          1.1  };
381                     
382                     class PEGASUS_COMMON_LINKAGE MissingNullTerminator : public Exception
383                     {
384                     public:
385                     
386                         static const char MSG[];
387 kumpf          1.22     static const char KEY[];
388 kumpf          1.1  
389 mike           1.19     MissingNullTerminator();
390                         virtual ~MissingNullTerminator();
391 chuck          1.5  };
392                     
393                     class PEGASUS_COMMON_LINKAGE MalformedLanguageHeader: public Exception
394                     {
395                     public:
396                     
397                         static const char MSG[];
398 kumpf          1.22     static const char KEY[];
399 chuck          1.5  
400 mike           1.19     MalformedLanguageHeader(const String& error);
401                         virtual ~MalformedLanguageHeader();
402 chuck          1.5  };
403                     
404                     class PEGASUS_COMMON_LINKAGE InvalidAcceptLanguageHeader: public Exception
405                     {
406                     public:
407                     
408                         static const char MSG[];
409 kumpf          1.22     static const char KEY[];
410 chuck          1.5  
411 mike           1.19     InvalidAcceptLanguageHeader(const String& error);
412                         virtual ~InvalidAcceptLanguageHeader();
413 kumpf          1.1  };
414                     
415 chuck          1.5  class PEGASUS_COMMON_LINKAGE InvalidContentLanguageHeader: public Exception
416                     {
417                     public:
418                     
419                         static const char MSG[];
420 kumpf          1.22     static const char KEY[];
421 chuck          1.5  
422 mike           1.19     InvalidContentLanguageHeader(const String& error);
423                         virtual ~InvalidContentLanguageHeader();
424 chuck          1.5  };
425                     
426 kumpf          1.1  class PEGASUS_COMMON_LINKAGE InvalidAuthHeader: public Exception
427                     {
428                     public:
429                     
430                         static const char MSG[];
431 kumpf          1.22     static const char KEY[];
432 kumpf          1.1  
433 mike           1.19     InvalidAuthHeader();
434                         virtual ~InvalidAuthHeader();
435 kumpf          1.1  };
436                     
437                     class PEGASUS_COMMON_LINKAGE UnauthorizedAccess: public Exception
438                     {
439                     public:
440                     
441                         static const char MSG[];
442 kumpf          1.22     static const char KEY[];
443 kumpf          1.1  
444 mike           1.19     UnauthorizedAccess();
445                         virtual ~UnauthorizedAccess();
446 kumpf          1.1  };
447                     
448 kumpf          1.4  class PEGASUS_COMMON_LINKAGE IncompatibleTypesException : public Exception
449                     {
450                     public:
451 kumpf          1.22     IncompatibleTypesException();
452                         virtual ~IncompatibleTypesException();
453 kumpf          1.4  };
454                     
455 kumpf          1.10 class PEGASUS_COMMON_LINKAGE InternalSystemError : public Exception
456                     {
457                     public:
458                     
459                         static const char MSG[];
460                     
461 mike           1.19     InternalSystemError();
462                         virtual ~InternalSystemError();
463 kumpf          1.10 };
464                     
465 kumpf          1.4  
466 kumpf          1.1  /** The CIMException defines the CIM exceptions that are formally defined in
467 kumpf          1.2      the CIM Operations over HTTP specification.  TraceableCIMException allows
468 kumpf          1.1      file name and line number information to be added for diagnostic purposes.
469                     */
470 kumpf          1.2  class PEGASUS_COMMON_LINKAGE TraceableCIMException : public CIMException
471 kumpf          1.1  {
472                     public:
473                     
474 kumpf          1.2      TraceableCIMException(
475 kumpf          1.21         CIMStatusCode code,
476                             const String& message,
477                             const String& file,
478                             Uint32 line);
479                     
480                         TraceableCIMException(
481                             CIMStatusCode code,
482 kumpf          1.23         const MessageLoaderParms& parms,
483 kumpf          1.21         const String& file,
484                             Uint32 line);
485                     
486                         TraceableCIMException(
487                             const ContentLanguageList& langs,
488                             CIMStatusCode code,
489                             const String& message,
490                             const String& file,
491                             Uint32 line);
492 chuck          1.5  
493 kumpf          1.2      TraceableCIMException(const CIMException & cimException);
494                     
495                         String getDescription() const;
496 kumpf          1.1  
497                         String getTraceDescription() const;
498 kumpf          1.11 
499                         String getCIMMessage() const;
500                         void setCIMMessage(const String& cimMessage);
501                     
502                         String getFile() const;
503                         Uint32 getLine() const;
504 kumpf          1.16     const ContentLanguageList& getContentLanguages() const;
505 kumpf          1.2  };
506 kumpf          1.1  
507 kumpf          1.2  #define PEGASUS_CIM_EXCEPTION(CODE, EXTRA_MESSAGE) \
508 kumpf          1.11     TraceableCIMException(CODE, EXTRA_MESSAGE, String(__FILE__), __LINE__)
509 chuck          1.5  
510                     #define PEGASUS_CIM_EXCEPTION_LANG(LANGS, CODE, EXTRA_MESSAGE) \
511 kumpf          1.11     TraceableCIMException( \
512 kumpf          1.22         LANGS, CODE, EXTRA_MESSAGE, String(__FILE__), __LINE__)
513                     
514 humberto       1.7  #define PEGASUS_CIM_EXCEPTION_L(CODE, MSG_PARMS) \
515 kumpf          1.11     TraceableCIMException(CODE, MSG_PARMS, String(__FILE__), __LINE__)
516 kumpf          1.1  
517 kumpf          1.22 /** Macro to prevent overflow of a signed int value when said value is
518 dave.sudlik    1.18  *  doubled. If String/Array/Buffer size is greater than 0x3FFFFFFF, then
519                      *  something is suspect, throw bad_alloc exception.
520                      */
521                     #define PEGASUS_CHECK_CAPACITY_OVERFLOW(capacity) \
522                         do \
523                         { \
524                             if (capacity > 0x3FFFFFFF) \
525                                 throw PEGASUS_STD(bad_alloc)(); \
526                         } \
527                         while (0)
528                     
529 marek          1.25 /** The following function CheckRep serves to reduce the function call
530                      *  overhead caused by calling a non-inlined function that only checks
531                      *  if a pointer is not NULL.
532                      *  The function ThrowUnitializedObjectException throws 
533                      *  an UninitialisedObjectException.
534                      *  A function to throw the exception is used to reduce object size of
535                      *  function CheckRep which is inlined in many places across
536                      *  the common library.
537                      */
538                     PEGASUS_COMMON_LINKAGE extern void ThrowUninitializedObjectException();
539                     
540                     inline void CheckRep(void * rep)
541                     {
542                         if (!rep) 
543                             ThrowUninitializedObjectException();
544                     };
545                     
546 kumpf          1.1  PEGASUS_NAMESPACE_END
547                     
548                     #endif /* Pegasus_InternalException_h */

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2