| API Docs for SAX and DOM |
| Main Page Class Hierarchy Alphabetical List Compound List File List Compound Members File Members # XMLRegisterCleanup.hpp Go to the documentation of this file.
    00001 /*
    00002  * Copyright 1999-2000,2004 The Apache Software Foundation.
    00003  *
    00004  * Licensed under the Apache License, Version 2.0 (the "License");
    00005  * you may not use this file except in compliance with the License.
    00006  * You may obtain a copy of the License at
    00007  *
    00008  *      http://www.apache.org/licenses/LICENSE-2.0
    00009  *
    00010  * Unless required by applicable law or agreed to in writing, software
    00011  * distributed under the License is distributed on an "AS IS" BASIS,
    00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    00013  * See the License for the specific language governing permissions and
    00014  * limitations under the License.
    00015  */
    00016
    00017 /*
    00018  * $Id: XMLRegisterCleanup.hpp,v 1.5 2004/09/08 13:56:24 peiyongz Exp $
    00019  * $Log: XMLRegisterCleanup.hpp,v $
    00020  * Revision 1.5  2004/09/08 13:56:24  peiyongz
    00021  * Apache License Version 2.0
    00022  *
    00023  * Revision 1.4  2004/02/24 22:57:28  peiyongz
    00024  * XercesDeprecatedDOMLib
    00025  *
    00026  * Revision 1.3  2004/01/29 11:48:47  cargilld
    00027  * Code cleanup changes to get rid of various compiler diagnostic messages.
    00028  *
    00029  * Revision 1.2  2002/11/04 15:22:05  tng
    00030  * C++ Namespace Support.
    00031  *
    00032  * Revision 1.1.1.1  2002/02/01 22:22:15  peiyongz
    00033  * sane_include
    00034  *
    00035  * Revision 1.4  2001/10/25 21:55:29  peiyongz
    00036  * copy ctor explicity declared private to prevent supprise.
    00037  *
    00038  * Revision 1.3  2001/10/24 18:13:06  peiyongz
    00039  * CVS tag added
    00040  *
    00041  *
    00042  */
    00043
    00044 #if !defined(XMLREGISTERCLEANUP_HPP)
    00045 #define XMLREGISTERCLEANUP_HPP
    00046
    00047 #include <xercesc/util/Mutexes.hpp>
    00048
    00049 XERCES_CPP_NAMESPACE_BEGIN
    00050
    00051 //
    00052 //  For internal use only.
    00053 //
    00054 //  This class is used by the platform utilities class to support
    00055 //  reinitialisation of global/static data which is lazily created.
    00056 //  Since that data is widely spread out the platform utilities
    00057 //  class cannot know about them directly. So, the code that creates such
    00058 //  objects creates an registers a cleanup for the object. The platform
    00059 //  termination call will iterate the list and delete the objects.
    00060 //
    00061 //  N.B. These objects need to be statically allocated.  I couldn't think
    00062 //  of a neat way of ensuring this - can anyone else?
    00063
    00064 class  XMLRegisterCleanup
    00065 {
    00066 public :
    00067     // The cleanup function to be called on XMLPlatformUtils::Terminate()
    00068     typedef void (*XMLCleanupFn)();
    00069
    00070     void doCleanup();
    00071
    00072     // This function is called during initialisation of static data to
    00073     // register a function to be called on XMLPlatformUtils::Terminate.
    00074     // It gives an object that uses static data an opportunity to reset
    00075     // such data.
    00076     void registerCleanup(XMLCleanupFn cleanupFn);
    00077
    00078     // This function can be called either from XMLPlatformUtils::Terminate
    00079     // to state that the cleanup has been performed and should not be
    00080     // performed again, or from code that you have written that determines
    00081     // that cleanup is no longer necessary.
    00082     void unregisterCleanup();
    00083
    00084     // The default constructor sets a state that ensures that this object
    00085     // will do nothing
    00086     XMLRegisterCleanup();
    00087
    00088 private:
    00089     // -----------------------------------------------------------------------
    00090     //  Unimplemented constructors and operators
    00091     // -----------------------------------------------------------------------
    00092     XMLRegisterCleanup(const XMLRegisterCleanup&);
    00093     XMLRegisterCleanup& operator=(const XMLRegisterCleanup&);
    00094
    00095     // This is the cleanup function to be called
    00096     XMLCleanupFn m_cleanupFn;
    00097
    00098     // These are list pointers to the next/prev cleanup function to be called
    00099     XMLRegisterCleanup *m_nextCleanup, *m_prevCleanup;
    00100
    00101     // This function reinitialises the object to the default state
    00102     void resetCleanup();
    00103 };
    00104
    00105 XERCES_CPP_NAMESPACE_END
    00106
    00107 #endif

Copyright © 1994-2004 The Apache Software Foundation. All Rights Reserved.