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

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

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2