source: NonGTP/Xerces/xerces/include/xercesc/util/PanicHandler.hpp @ 358

Revision 358, 4.0 KB checked in by bittner, 19 years ago (diff)

xerces added

Line 
1/*
2 * Copyright 2003,2004 The Apache Software Foundation.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17/*
18 * $Log: PanicHandler.hpp,v $
19 * Revision 1.7  2004/09/08 13:56:22  peiyongz
20 * Apache License Version 2.0
21 *
22 * Revision 1.6  2003/12/24 17:12:21  cargilld
23 * Memory management update.
24 *
25 * Revision 1.5  2003/12/24 15:24:13  cargilld
26 * More updates to memory management so that the static memory manager.
27 *
28 * Revision 1.4  2003/05/22 18:15:16  neilg
29 * The PanicHandler interface should not inherit from XMemory.
30 * The reason for this is that the default implementation does not
31 * allocate memory dynamically and if such an inheritance relation existed,
32 * a user would have to be very careful about installing a memory
33 * handler on their own PanicHandler before handing it to the
34 * XMLPlatformUtils::Initialize() method, since otherwise
35 * the (uninitialized) XMLPlatformUtils::fgMemoryManager would be used
36 * upon construction of their PanicHandler implementation.
37 *
38 * Revision 1.3  2003/05/15 19:04:35  knoaman
39 * Partial implementation of the configurable memory manager.
40 *
41 * Revision 1.2  2003/03/10 16:05:11  peiyongz
42 * assignment operator
43 *
44 * Revision 1.1  2003/03/09 17:06:16  peiyongz
45 * PanicHandler
46 *
47 * $Id: PanicHandler.hpp,v 1.7 2004/09/08 13:56:22 peiyongz Exp $
48 *
49 */
50
51#ifndef PANICHANDLER_HPP
52#define PANICHANDLER_HPP
53
54#include <xercesc/util/XMemory.hpp>
55
56XERCES_CPP_NAMESPACE_BEGIN
57
58/**
59  * Receive notification of panic.
60  *
61  * <p>This is the interface, through which the Xercesc reports
62  *    a panic to the application.
63  * </p>
64  *
65  * <p>Application may implement this interface, instantiate an
66  *    object of the derivative, and plug it to Xercesc in the
67  *    invocation to XMLPlatformUtils::Initialize(), if it prefers
68  *    to handling panic itself rather than Xercesc doing it.
69  * </p>
70  *
71  */
72
73class XMLUTIL_EXPORT PanicHandler
74{
75public:
76
77    /** @name Public Types */
78    //@{
79    enum PanicReasons
80    {
81          Panic_NoTransService
82        , Panic_NoDefTranscoder
83        , Panic_CantFindLib
84        , Panic_UnknownMsgDomain
85        , Panic_CantLoadMsgDomain
86        , Panic_SynchronizationErr
87        , Panic_SystemInit
88
89        , PanicReasons_Count
90    };
91    //@}
92
93protected:
94
95    /** @name hidden Constructors */
96    //@{
97    /** Default constructor */
98    PanicHandler(){};
99
100public:
101
102    /** Destructor */
103    virtual ~PanicHandler(){};   
104    //@}
105
106    /** @name The virtual panic handler interface */
107    //@{
108   /**
109    * Receive notification of panic
110    *
111    * This method is called when an unrecoverable error has occurred in the Xerces library. 
112    *
113    * This method must not return normally, otherwise, the results are undefined.
114    *
115    * Ways of handling this call could include throwing an exception or exiting the process.
116    *
117    * Once this method has been called, the results of calling any other Xerces API,
118    * or using any existing Xerces objects are undefined.   
119    *
120    * @param reason The reason of panic
121    *
122    */
123    virtual void panic(const PanicHandler::PanicReasons reason) = 0;
124    //@}
125
126    static const char* getPanicReasonString(const PanicHandler::PanicReasons reason);
127   
128private:
129
130    /* Unimplemented Constructors and operators */
131    /* Copy constructor */
132    PanicHandler(const PanicHandler&);
133   
134    /** Assignment operator */
135    PanicHandler& operator=(const PanicHandler&);
136};
137
138XERCES_CPP_NAMESPACE_END
139
140#endif
Note: See TracBrowser for help on using the repository browser.