<HTML><HEAD><SCRIPT language="JavaScript" src="../resources/script.js" type="text/javascript"></SCRIPT><TITLE>Xerces-C++: XMLGrammarPool.hpp Source File</TITLE><link href="XercesApi.css" rel="stylesheet" type="text/css"></HEAD><BODY alink="#ff0000" bgcolor="#ffffff" leftmargin="4" link="#0000ff" marginheight="4" marginwidth="4" text="#000000" topmargin="4" vlink="#0000aa"><TABLE border="0" cellpadding="0" cellspacing="0" width="620"><TR><TD align="left" height="60" rowspan="3" valign="top" width="135"><IMG border="0" height="60" hspace="0" src="../resources/logo.gif" vspace="0" width="135"></TD><TD align="left" colspan="4" height="5" valign="top" width="456"><IMG border="0" height="5" hspace="0" src="../resources/line.gif" vspace="0" width="456"></TD><TD align="left" height="60" rowspan="3" valign="top" width="29"><IMG border="0" height="60" hspace="0" src="../resources/right.gif" vspace="0" width="29"></TD></TR><TR><TD align="left" bgcolor="#0086b2" colspan="4" height="35" valign="top" width="456"><IMG alt="" border="0" height="35" hspace="0" src="../graphics/api-header.jpg" vspace="0" width="456"></TD></TR><TR><TD align="left" height="20" valign="top" width="168"><IMG border="0" height="20" hspace="0" src="../resources/bottom.gif" vspace="0" width="168"></TD><TD align="left" height="20" valign="top" width="96"><A href="http://xml.apache.org/" onMouseOut="rolloverOff('xml');" onMouseOver="rolloverOn('xml');" target="new"><IMG alt="http://xml.apache.org/" border="0" height="20" hspace="0" name="xml" onLoad="rolloverLoad('xml','../resources/button-xml-hi.gif','../resources/button-xml-lo.gif');" src="../resources/button-xml-lo.gif" vspace="0" width="96"></A></TD><TD align="left" height="20" valign="top" width="96"><A href="http://www.apache.org/" onMouseOut="rolloverOff('asf');" onMouseOver="rolloverOn('asf');" target="new"><IMG alt="http://www.apache.org/" border="0" height="20" hspace="0" name="asf" onLoad="rolloverLoad('asf','../resources/button-asf-hi.gif','../resources/button-asf-lo.gif');" src="../resources/button-asf-lo.gif" vspace="0" width="96"></A></TD><TD align="left" height="20" valign="top" width="96"><A href="http://www.w3.org/" onMouseOut="rolloverOff('w3c');" onMouseOver="rolloverOn('w3c');" target="new"><IMG alt="http://www.w3.org/" border="0" height="20" hspace="0" name="w3c" onLoad="rolloverLoad('w3c','../resources/button-w3c-hi.gif','../resources/button-w3c-lo.gif');" src="../resources/button-w3c-lo.gif" vspace="0" width="96"></A></TD></TR></TABLE><TABLE border="0" cellpadding="0" cellspacing="0" width="620"><TR><TD align="left" valign="top" width="120"><IMG border="0" height="14" hspace="0" src="../resources/join.gif" vspace="0" width="120"><BR> <A href="../../index.html" onMouseOut="rolloverOff('side-ext-2');" onMouseOver="rolloverOn('side-ext-2');"><IMG alt="Home" border="0" height="12" hspace="0" name="side-ext-2" onLoad="rolloverLoad('side-ext-2','../graphics/ext-2-label-2.jpg','../graphics/ext-2-label-3.jpg');" src="../graphics/ext-2-label-3.jpg" vspace="0" width="120"></A><BR> <IMG border="0" height="6" hspace="0" src="../resources/separator.gif" vspace="0" width="120"><BR> <A href="../index.html" onMouseOut="rolloverOff('side-index');" onMouseOver="rolloverOn('side-index');"><IMG alt="Readme" border="0" height="12" hspace="0" name="side-index" onLoad="rolloverLoad('side-index','../graphics/index-label-2.jpg','../graphics/index-label-3.jpg');" src="../graphics/index-label-3.jpg" vspace="0" width="120"></A><BR> <A href="../charter.html" onMouseOut="rolloverOff('side-charter');" onMouseOver="rolloverOn('side-charter');"><IMG alt="Charter" border="0" height="12" hspace="0" name="side-charter" onLoad="rolloverLoad('side-charter','../graphics/charter-label-2.jpg','../graphics/charter-label-3.jpg');" src="../graphics/charter-label-3.jpg" vspace="0" width="120"></A><BR> <A href="../releases.html" onMouseOut="rolloverOff('side-releases');" onMouseOver="rolloverOn('side-releases');"><IMG alt="Release Info" border="0" height="12" hspace="0" name="side-releases" onLoad="rolloverLoad('side-releases','../graphics/releases-label-2.jpg','../graphics/releases-label-3.jpg');" src="../graphics/releases-label-3.jpg" vspace="0" width="120"></A><BR> <IMG border="0" height="6" hspace="0" src="../resources/separator.gif" vspace="0" width="120"><BR> <A href="../install.html" onMouseOut="rolloverOff('side-install');" onMouseOver="rolloverOn('side-install');"><IMG alt="Installation" border="0" height="12" hspace="0" name="side-install" onLoad="rolloverLoad('side-install','../graphics/install-label-2.jpg','../graphics/install-label-3.jpg');" src="../graphics/install-label-3.jpg" vspace="0" width="120"></A><BR> <A href="http://xml.apache.org/xerces-c/download.cgi" onMouseOut="rolloverOff('side-ext-20');" onMouseOver="rolloverOn('side-ext-20');"><IMG alt="Download" border="0" height="12" hspace="0" name="side-ext-20" onLoad="rolloverLoad('side-ext-20','../graphics/ext-20-label-2.jpg','../graphics/ext-20-label-3.jpg');" src="../graphics/ext-20-label-3.jpg" vspace="0" width="120"></A><BR> <A href="../build.html" onMouseOut="rolloverOff('side-build');" onMouseOver="rolloverOn('side-build');"><IMG alt="Build Instructions" border="0" height="12" hspace="0" name="side-build" onLoad="rolloverLoad('side-build','../graphics/build-label-2.jpg','../graphics/build-label-3.jpg');" src="../graphics/build-label-3.jpg" vspace="0" width="120"></A><BR> <IMG border="0" height="6" hspace="0" src="../resources/separator.gif" vspace="0" width="120"><BR> <A href="../faqs.html" onMouseOut="rolloverOff('side-faqs');" onMouseOver="rolloverOn('side-faqs');"><IMG alt="FAQs" border="0" height="12" hspace="0" name="side-faqs" onLoad="rolloverLoad('side-faqs','../graphics/faqs-label-2.jpg','../graphics/faqs-label-3.jpg');" src="../graphics/faqs-label-3.jpg" vspace="0" width="120"></A><BR> <A href="../samples.html" onMouseOut="rolloverOff('side-samples');" onMouseOver="rolloverOn('side-samples');"><IMG alt="Samples" border="0" height="12" hspace="0" name="side-samples" onLoad="rolloverLoad('side-samples','../graphics/samples-label-2.jpg','../graphics/samples-label-3.jpg');" src="../graphics/samples-label-3.jpg" vspace="0" width="120"></A><BR> <A href="../api.html" onMouseOut="rolloverOff('side-api');" onMouseOver="rolloverOn('side-api');"><IMG alt="API Docs" border="0" height="12" hspace="0" name="side-api" onLoad="rolloverLoad('side-api','../graphics/api-label-2.jpg','../graphics/api-label-3.jpg');" src="../graphics/api-label-3.jpg" vspace="0" width="120"></A><BR> <IMG border="0" height="6" hspace="0" src="../resources/separator.gif" vspace="0" width="120"><BR> <A href="../ApacheDOMC++Binding.html" onMouseOut="rolloverOff('side-ext-70');" onMouseOver="rolloverOn('side-ext-70');"><IMG alt="DOM C++ Binding" border="0" height="12" hspace="0" name="side-ext-70" onLoad="rolloverLoad('side-ext-70','../graphics/ext-70-label-2.jpg','../graphics/ext-70-label-3.jpg');" src="../graphics/ext-70-label-3.jpg" vspace="0" width="120"></A><BR> <IMG alt="Programming" border="0" height="12" hspace="0" src="../graphics/program-label-1.jpg" vspace="0" width="120"><BR> <A href="../migrate.html" onMouseOut="rolloverOff('side-migrate');" onMouseOver="rolloverOn('side-migrate');"><IMG alt="Migration Guide" border="0" height="12" hspace="0" name="side-migrate" onLoad="rolloverLoad('side-migrate','../graphics/migrate-label-2.jpg','../graphics/migrate-label-3.jpg');" src="../graphics/migrate-label-3.jpg" vspace="0" width="120"></A><BR> <IMG border="0" height="6" hspace="0" src="../resources/separator.gif" vspace="0" width="120"><BR> <A href="../feedback.html" onMouseOut="rolloverOff('side-feedback');" onMouseOver="rolloverOn('side-feedback');"><IMG alt="Feedback" border="0" height="12" hspace="0" name="side-feedback" onLoad="rolloverLoad('side-feedback','../graphics/feedback-label-2.jpg','../graphics/feedback-label-3.jpg');" src="../graphics/feedback-label-3.jpg" vspace="0" width="120"></A><BR> <A href="bug-report.html" onMouseOut="rolloverOff('side-bug-report');" onMouseOver="rolloverOn('side-bug-report');"><IMG alt="Bug-Reporting" border="0" height="12" hspace="0" name="side-bug-report" onLoad="rolloverLoad('side-bug-report','../graphics/bug-report-label-2.jpg','../graphics/bug-report-label-3.jpg');" src="../graphics/bug-report-label-3.jpg" vspace="0" width="120"></A><BR> <A href="../pdf.html" onMouseOut="rolloverOff('side-pdf');" onMouseOver="rolloverOn('side-pdf');"><IMG alt="PDF Document" border="0" height="12" hspace="0" name="side-pdf" onLoad="rolloverLoad('side-pdf','../graphics/pdf-label-2.jpg','../graphics/pdf-label-3.jpg');" src="../graphics/pdf-label-3.jpg" vspace="0" width="120"></A><BR> <IMG border="0" height="6" hspace="0" src="../resources/separator.gif" vspace="0" width="120"><BR> <A href="http://svn.apache.org/viewcvs.cgi/xerces/?root=Apache-SVN" onMouseOut="rolloverOff('side-ext-102');" onMouseOver="rolloverOn('side-ext-102');"><IMG alt="Source Repository" border="0" height="12" hspace="0" name="side-ext-102" onLoad="rolloverLoad('side-ext-102','../graphics/ext-102-label-2.jpg','../graphics/ext-102-label-3.jpg');" src="../graphics/ext-102-label-3.jpg" vspace="0" width="120"></A><BR> <A href="http://marc.theaimsgroup.com/?l=xerces-c-users" onMouseOut="rolloverOff('side-ext-104');" onMouseOver="rolloverOn('side-ext-104');"><IMG alt="User Mail Archive" border="0" height="12" hspace="0" name="side-ext-104" onLoad="rolloverLoad('side-ext-104','../graphics/ext-104-label-2.jpg','../graphics/ext-104-label-3.jpg');" src="../graphics/ext-104-label-3.jpg" vspace="0" width="120"></A><BR> <A href="http://marc.theaimsgroup.com/?l=xerces-c-dev" onMouseOut="rolloverOff('side-ext-106');" onMouseOver="rolloverOn('side-ext-106');"><IMG alt="Devel Mail Archive" border="0" height="12" hspace="0" name="side-ext-106" onLoad="rolloverLoad('side-ext-106','../graphics/ext-106-label-2.jpg','../graphics/ext-106-label-3.jpg');" src="../graphics/ext-106-label-3.jpg" vspace="0" width="120"></A><BR> <IMG border="0" height="14" hspace="0" src="../resources/close.gif" vspace="0" width="120"><BR></TD><TD align="left" valign="top" width="500"><TABLE border="0" cellpadding="3" cellspacing="0"><TR><TD> <TABLE border="0" cellpadding="0" cellspacing="0" width="494"><TR><TD bgcolor="#FFFFFF" colspan="2" width="494"><TABLE border="0" cellpadding="0" cellspacing="0" width="494"><TR><TD bgcolor="#039acc" height="1" width="1"><IMG border="0" height="1" hspace="0" src="../resources/void.gif" vspace="0" width="1"></TD><TD bgcolor="#039acc" height="1" width="492"><IMG border="0" height="1" hspace="0" src="../resources/void.gif" vspace="0" width="492"></TD><TD bgcolor="#0086b2" height="1" width="1"><IMG border="0" height="1" hspace="0" src="../resources/void.gif" vspace="0" width="1"></TD></TR><TR><TD bgcolor="#039acc" width="1"><IMG border="0" height="1" hspace="0" src="../resources/void.gif" vspace="0" width="1"></TD><TD bgcolor="#0086b2" width="492"><FONT color="#ffffff" face="arial,helvetica,sanserif" size="+1"><IMG border="0" height="2" hspace="0" src="../resources/void.gif" vspace="0" width="2"><B>API Docs for SAX and DOM</B></FONT></TD><TD bgcolor="#017299" width="1"><IMG border="0" height="1" hspace="0" src="../resources/void.gif" vspace="0" width="1"></TD></TR><TR><TD bgcolor="#0086b2" height="1" width="1"><IMG border="0" height="1" hspace="0" src="../resources/void.gif" vspace="0" width="1"></TD><TD bgcolor="#017299" height="1" width="492"><IMG border="0" height="1" hspace="0" src="../resources/void.gif" vspace="0" width="492"></TD><TD bgcolor="#017299" height="1" width="1"><IMG border="0" height="1" hspace="0" src="../resources/void.gif" vspace="0" width="1"></TD></TR></TABLE></TD></TR><TR><TD width="10"> </TD><TD width="484"><FONT color="#000000" face="arial,helvetica,sanserif"> <P> <!-- Generated by Doxygen 1.4.1 --> <div class="qindex"><a class="qindex" href="index.html">Main Page</a> | <a class="qindex" href="hierarchy.html">Class Hierarchy</a> | <a class="qindex" href="classes.html">Alphabetical List</a> | <a class="qindex" href="annotated.html">Class List</a> | <a class="qindex" href="dirs.html">Directories</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="functions.html">Class Members</a> | <a class="qindex" href="globals.html">File Members</a> | <a class="qindex" href="pages.html">Related Pages</a></div> <div class="nav"> <a class="el" href="dir_000000.html">src</a> / <a class="el" href="dir_000001.html">xercesc</a> / <a class="el" href="dir_000006.html">framework</a></div> <h1>XMLGrammarPool.hpp</h1><a href="XMLGrammarPool_8hpp.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment">00001 <span class="comment">/*</span> 00002 <span class="comment"> * Copyright 1999-2004 The Apache Software Foundation.</span> 00003 <span class="comment"> * </span> 00004 <span class="comment"> * Licensed under the Apache License, Version 2.0 (the "License");</span> 00005 <span class="comment"> * you may not use this file except in compliance with the License.</span> 00006 <span class="comment"> * You may obtain a copy of the License at</span> 00007 <span class="comment"> * </span> 00008 <span class="comment"> * http://www.apache.org/licenses/LICENSE-2.0</span> 00009 <span class="comment"> * </span> 00010 <span class="comment"> * Unless required by applicable law or agreed to in writing, software</span> 00011 <span class="comment"> * distributed under the License is distributed on an "AS IS" BASIS,</span> 00012 <span class="comment"> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</span> 00013 <span class="comment"> * See the License for the specific language governing permissions and</span> 00014 <span class="comment"> * limitations under the License.</span> 00015 <span class="comment"> */</span> 00016 00017 <span class="comment">/*</span> 00018 <span class="comment"> * $Id: XMLGrammarPool.hpp 191054 2005-06-17 02:56:35Z jberry $</span> 00019 <span class="comment"> */</span> 00020 00021 <span class="preprocessor">#if !defined(XMLGRAMMARPOOL_HPP)</span> <a name="l00022"></a><a class="code" href="XMLGrammarPool_8hpp.html#a0">00022</a> <span class="preprocessor"></span><span class="preprocessor">#define XMLGRAMMARPOOL_HPP</span> 00023 <span class="preprocessor"></span> 00024 <span class="preprocessor">#include <<a class="code" href="PlatformUtils_8hpp.html">xercesc/util/PlatformUtils.hpp</a>></span> 00025 <span class="preprocessor">#include <xercesc/util/RefHashTableOf.hpp></span> 00026 <span class="preprocessor">#include <<a class="code" href="XMemory_8hpp.html">xercesc/util/XMemory.hpp</a>></span> 00027 <span class="preprocessor">#include <<a class="code" href="XSModel_8hpp.html">xercesc/framework/psvi/XSModel.hpp</a>></span> 00028 00029 00030 <a class="code" href="XercesDefs_8hpp.html#a3">XERCES_CPP_NAMESPACE_BEGIN</a> 00031 00032 <span class="keyword">class </span>Grammar; 00033 <span class="keyword">class </span><a class="code" href="classXMLGrammarDescription.html">XMLGrammarDescription</a>; 00034 <span class="keyword">class </span>DTDGrammar; 00035 <span class="keyword">class </span>SchemaGrammar; 00036 <span class="keyword">class </span><a class="code" href="classXMLDTDDescription.html">XMLDTDDescription</a>; 00037 <span class="keyword">class </span><a class="code" href="classXMLSchemaDescription.html">XMLSchemaDescription</a>; 00038 <span class="keyword">class </span>XMLStringPool; 00039 <span class="keyword">class </span><a class="code" href="classBinInputStream.html">BinInputStream</a>; 00040 <span class="keyword">class </span><a class="code" href="classBinOutputStream.html">BinOutputStream</a>; 00041 <a name="l00042"></a><a class="code" href="classXMLGrammarPool.html">00042</a> <span class="keyword">class </span><a class="code" href="XercesDefs_8hpp.html#a10"></a> XMLGrammarPool : <span class="keyword">public</span> <a class="code" href="classXMemory.html">XMemory</a> 00043 { 00044 <span class="keyword">public</span> : 00045 <span class="comment">// -----------------------------------------------------------------------</span> 00047 <span class="comment"></span> <span class="comment">// -----------------------------------------------------------------------</span> 00049 <span class="comment"></span> <a name="l00054"></a><a class="code" href="classXMLGrammarPool.html#z572_0">00054</a> <span class="keyword">virtual</span> ~XMLGrammarPool(){}; 00056 00057 <span class="comment">// -----------------------------------------------------------------------</span> 00059 <span class="comment"></span> <span class="comment">// -----------------------------------------------------------------------</span> 00061 <span class="comment"></span> 00075 <span class="keyword">virtual</span> <span class="keywordtype">bool</span> cacheGrammar(Grammar* <span class="keyword">const</span> gramToCache) = 0; 00076 00084 <span class="keyword">virtual</span> Grammar* retrieveGrammar(<a class="code" href="classXMLGrammarDescription.html">XMLGrammarDescription</a>* <span class="keyword">const</span> gramDesc) = 0; 00085 00086 00095 <span class="keyword">virtual</span> Grammar* orphanGrammar(<span class="keyword">const</span> XMLCh* <span class="keyword">const</span> nameSpaceKey) = 0; 00096 00097 00103 <span class="keyword">virtual</span> RefHashTableOfEnumerator<Grammar> getGrammarEnumerator() <span class="keyword">const </span>= 0; 00104 00111 <span class="keyword">virtual</span> <span class="keywordtype">bool</span> clear() = 0; 00112 00122 <span class="keyword">virtual</span> <span class="keywordtype">void</span> lockPool() = 0; 00123 00134 <span class="keyword">virtual</span> <span class="keywordtype">void</span> unlockPool() = 0; 00135 00137 00138 <span class="comment">// -----------------------------------------------------------------------</span> 00140 <span class="comment"></span> <span class="comment">// -----------------------------------------------------------------------</span> 00142 <span class="comment"></span> 00147 <span class="keyword">virtual</span> DTDGrammar* createDTDGrammar() = 0; 00148 00153 <span class="keyword">virtual</span> SchemaGrammar* createSchemaGrammar() = 0; 00154 00159 <span class="keyword">virtual</span> <a class="code" href="classXMLDTDDescription.html">XMLDTDDescription</a>* createDTDDescription(<span class="keyword">const</span> XMLCh* <span class="keyword">const</span> systemId) = 0; 00164 <span class="keyword">virtual</span> <a class="code" href="classXMLSchemaDescription.html">XMLSchemaDescription</a>* createSchemaDescription(<span class="keyword">const</span> XMLCh* <span class="keyword">const</span> targetNamespace) = 0; 00165 00167 00168 <span class="comment">// -----------------------------------------------------------------------</span> 00170 <span class="comment"></span> <span class="comment">// ----------------------------------------------------------------------- </span> 00172 <span class="comment"></span> 00173 <span class="comment">/***</span> 00174 <span class="comment"> * Return an XSModel derived from the components of all SchemaGrammars</span> 00175 <span class="comment"> * in the grammar pool. If the pool is locked, this should</span> 00176 <span class="comment"> * be a thread-safe operation. It should return null if and only if</span> 00177 <span class="comment"> * the pool is empty.</span> 00178 <span class="comment"> *</span> 00179 <span class="comment"> * Calling getXSModel() on an unlocked grammar pool may result in the</span> 00180 <span class="comment"> * creation of a new XSModel with the old XSModel being deleted. The</span> 00181 <span class="comment"> * function will return a different address for the XSModel if it has</span> 00182 <span class="comment"> * changed.</span> 00183 <span class="comment"> * </span> 00184 <span class="comment"> * @deprecated (shouldn't use address to determine if XSModel changed)</span> 00185 <span class="comment"> */</span> 00186 <span class="keyword">virtual</span> <a class="code" href="classXSModel.html">XSModel</a> *getXSModel() = 0; 00187 00188 <span class="comment">/***</span> 00189 <span class="comment"> * Return an XSModel derived from the components of all SchemaGrammars</span> 00190 <span class="comment"> * in the grammar pool. If the pool is locked, this should</span> 00191 <span class="comment"> * be a thread-safe operation.</span> 00192 <span class="comment"> *</span> 00193 <span class="comment"> * NOTE: The function should NEVER return NULL. If there are no grammars in</span> 00194 <span class="comment"> * the pool it should return an XSModel containing the Schema for Schema. </span> 00195 <span class="comment"> *</span> 00196 <span class="comment"> * Calling getXSModel() on an unlocked grammar pool may result in the</span> 00197 <span class="comment"> * creation of a new XSModel with the old XSModel being deleted.</span> 00198 <span class="comment"> * The bool parameter will indicate if the XSModel was changed.</span> 00199 <span class="comment"> * </span> 00200 <span class="comment"> * For source code compatibility, default implementation is to say</span> 00201 <span class="comment"> * XSModelWasChanged.</span> 00202 <span class="comment"> */</span> <a name="l00203"></a><a class="code" href="classXMLGrammarPool.html#z578_1">00203</a> <span class="keyword">virtual</span> <a class="code" href="classXSModel.html">XSModel</a> *getXSModel(<span class="keywordtype">bool</span>& XSModelWasChanged) 00204 { 00205 XSModelWasChanged = <span class="keyword">true</span>; 00206 <span class="keywordflow">return</span> getXSModel(); 00207 } 00208 00209 <span class="comment">// @}</span> 00210 00211 <span class="comment">// -----------------------------------------------------------------------</span> 00213 <span class="comment"></span> <span class="comment">// ----------------------------------------------------------------------- </span> 00215 <span class="comment"></span> <a name="l00220"></a><a class="code" href="classXMLGrammarPool.html#z580_0">00220</a> <span class="keyword">inline</span> <a class="code" href="classMemoryManager.html">MemoryManager</a>* getMemoryManager() 00221 { 00222 <span class="keywordflow">return</span> fMemMgr; 00223 } 00224 00231 <span class="keyword">virtual</span> XMLStringPool *getURIStringPool() = 0; 00233 00234 <span class="comment">// -----------------------------------------------------------------------</span> 00236 <span class="comment"></span> <span class="comment">// ----------------------------------------------------------------------- </span> 00237 00238 <span class="comment">/***</span> 00239 <span class="comment"> *</span> 00240 <span class="comment"> * 1. Context: Serialize/Deserialize All Grammars In One Session</span> 00241 <span class="comment"> *</span> 00242 <span class="comment"> * Since it is common that a declaration in one grammar may reference </span> 00243 <span class="comment"> * to definitions in other grammars, it is required to serialize those </span> 00244 <span class="comment"> * related (or interdependent) grammars in to one persistent data store </span> 00245 <span class="comment"> * in one serialization session (storing), and deserialize them from the</span> 00246 <span class="comment"> * persistent data store in one deserialization session (loading) back</span> 00247 <span class="comment"> * to the grammar pool. </span> 00248 <span class="comment"> *</span> 00249 <span class="comment"> * 2. Multiple serializations</span> 00250 <span class="comment"> *</span> 00251 <span class="comment"> * It is acceptable that client application requests more than one </span> 00252 <span class="comment"> * grammar serialization on a particular grammar pool, to track the </span> 00253 <span class="comment"> * different grammars cached, or for whatever reasons that client </span> 00254 <span class="comment"> * application is interested in. </span> 00255 <span class="comment"> *</span> 00256 <span class="comment"> * 3. Multiple deserializations</span> 00257 <span class="comment"> * </span> 00258 <span class="comment"> * Request for grammar deserialization either after the grammar pool has </span> 00259 <span class="comment"> * its own cached grammars, or request for more than one grammar </span> 00260 <span class="comment"> * deserialization, may cause undesired and unpredictable consequence</span> 00261 <span class="comment"> * and therefore client application shall be aware that individual </span> 00262 <span class="comment"> * implementationis may NOT support this.</span> 00263 <span class="comment"> *</span> 00264 <span class="comment"> * However it is strongly recommended that the client application requests </span> 00265 <span class="comment"> * no more than one grammar deserialization even a particular implementation</span> 00266 <span class="comment"> * may allow multiple deserializations.</span> 00267 <span class="comment"> *</span> 00268 <span class="comment"> * 4. Locking</span> 00269 <span class="comment"> *</span> 00270 <span class="comment"> * Both serialization and deserialization requires to lock the grammar pool</span> 00271 <span class="comment"> * before operation and unlock after operation. In the case the grammar pool</span> 00272 <span class="comment"> * is locked by a third party, the request for serialization/deserialization</span> 00273 <span class="comment"> * will NOT be entertained.</span> 00274 <span class="comment"> *</span> 00275 <span class="comment"> * 5. Versioning</span> 00276 <span class="comment"> *</span> 00277 <span class="comment"> * The Persistent data store has a version tag to be verified during </span> 00278 <span class="comment"> * deserialization, thus a grammar pool may decide if it supports</span> 00279 <span class="comment"> * a binary data created by a different release of Xerces.</span> 00280 <span class="comment"> * </span> 00281 <span class="comment"> * 6. Clean up</span> 00282 <span class="comment"> *</span> 00283 <span class="comment"> * The client application shall be aware that in the event of an exception</span> 00284 <span class="comment"> * thrown due to a corrupted data store during deserialization, implementation</span> 00285 <span class="comment"> * may not be able to clean up all resources allocated, and therefore it is </span> 00286 <span class="comment"> * client application's responsibility to clean up those unreleased resources.</span> 00287 <span class="comment"> *</span> 00288 <span class="comment"> *</span> 00289 <span class="comment"> */</span> 00290 <span class="keyword">virtual</span> <span class="keywordtype">void</span> serializeGrammars(<a class="code" href="classBinOutputStream.html">BinOutputStream</a>* <span class="keyword">const</span>) = 0; 00291 <span class="keyword">virtual</span> <span class="keywordtype">void</span> deserializeGrammars(<a class="code" href="classBinInputStream.html">BinInputStream</a>* <span class="keyword">const</span>) = 0; 00292 00293 <span class="comment">/*</span> 00294 <span class="comment"> * Set/get a flag to not create XSAnnotations when deserializing the grammar.</span> 00295 <span class="comment"> * Defaults to false (create XSAnnotations when deserializing the grammar).</span> 00296 <span class="comment"> */</span> <a name="l00297"></a><a class="code" href="classXMLGrammarPool.html#a2">00297</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> setIgnoreSerializedAnnotations(<span class="keyword">const</span> <span class="keywordtype">bool</span> flag) 00298 { 00299 fIgnoreSerializedAnnotations = flag; 00300 }; <a name="l00301"></a><a class="code" href="classXMLGrammarPool.html#a3">00301</a> <span class="keyword">inline</span> <span class="keywordtype">bool</span> getIgnoreSerializedAnnotations()<span class="keyword"> const</span> 00302 <span class="keyword"> </span>{ 00303 <span class="keywordflow">return</span> fIgnoreSerializedAnnotations; 00304 }; 00305 00306 <span class="keyword">protected</span> : 00307 <span class="comment">// -----------------------------------------------------------------------</span> 00309 <span class="comment"></span> <span class="comment">// -----------------------------------------------------------------------</span> <a name="l00311"></a><a class="code" href="classXMLGrammarPool.html#z581_0">00311</a> <span class="comment"></span> XMLGrammarPool(<a class="code" href="classMemoryManager.html">MemoryManager</a>* <span class="keyword">const</span> memMgr = XMLPlatformUtils::fgMemoryManager) 00312 :fMemMgr(memMgr) 00313 ,fIgnoreSerializedAnnotations(false) 00314 { 00315 }; 00317 00318 <span class="keyword">private</span> : 00319 <span class="comment">// -----------------------------------------------------------------------</span> 00321 <span class="comment"></span> <span class="comment">// -----------------------------------------------------------------------</span> 00323 <span class="comment"></span> XMLGrammarPool(<span class="keyword">const</span> XMLGrammarPool& ); 00324 XMLGrammarPool& operator=(<span class="keyword">const</span> XMLGrammarPool& ); 00326 00327 <span class="comment">// -----------------------------------------------------------------------</span> 00328 <span class="comment">//</span> 00329 <span class="comment">// fMemMgr: plugged-in (or defaulted-in) memory manager</span> 00330 <span class="comment">// not owned </span> 00331 <span class="comment">// no reset after initialization</span> 00332 <span class="comment">//</span> 00333 <span class="comment">// -----------------------------------------------------------------------</span> 00334 00335 <a class="code" href="classMemoryManager.html">MemoryManager</a>* <span class="keyword">const</span> fMemMgr; 00336 <span class="keywordtype">bool</span> fIgnoreSerializedAnnotations; 00337 00338 }; 00339 00340 <a class="code" href="XercesDefs_8hpp.html#a4">XERCES_CPP_NAMESPACE_END</a> 00341 00342 <span class="preprocessor">#endif</span> </pre></div> </FONT></TD></TR></TABLE><BR> </TD></TR></TABLE></TD></TR></TABLE><BR><TABLE border="0" cellpadding="0" cellspacing="0" width="620"><TR><TD bgcolor="#0086b2"><IMG height="1" src="images/dot.gif" width="1" alt=""></TD></TR><TR><TD align="center"><FONT color="#0086b2" size="-1"><I> Copyright © 1994-2004 The Apache Software Foundation. All Rights Reserved. </I></FONT></TD></TR></TABLE></BODY></HTML>