1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one
3  * or more contributor license agreements. See the NOTICE file
4  * distributed with this work for additional information
5  * regarding copyright ownership. The ASF licenses this file
6  * to you under the Apache License, Version 2.0 (the  "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  *     http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */
18 
19 #include "XPathInit.hpp"
20 
21 
22 
23 #include "FunctionLang.hpp"
24 #include "XObject.hpp"
25 #include "XUnknown.hpp"
26 #include "XPath.hpp"
27 #include "XPathEnvSupportDefault.hpp"
28 #include "XPathProcessorImpl.hpp"
29 
30 
31 
32 namespace XALAN_CPP_NAMESPACE {
33 
34 
35 
36 unsigned long   XPathInit::s_initCounter = 0;
37 
38 
39 
XPathInit(MemoryManager & theManager)40 XPathInit::XPathInit(MemoryManager& theManager) :
41     m_platformSupportInit(theManager),
42     m_domSupportInit(theManager)
43 {
44     ++s_initCounter;
45 
46     if (s_initCounter == 1)
47     {
48         initialize(theManager);
49     }
50 }
51 
52 
53 
54 XPathInit*
create(MemoryManager & theManager)55 XPathInit::create(MemoryManager&    theManager)
56 {
57     XPathInit*  theResult;
58 
59     return XalanConstruct(theManager, theResult, theManager);
60 }
61 
62 
63 
~XPathInit()64 XPathInit::~XPathInit()
65 {
66     --s_initCounter;
67 
68     if (s_initCounter == 0)
69     {
70         terminate();
71     }
72 }
73 
74 
75 
76 void
initialize(MemoryManager & theManager)77 XPathInit::initialize(MemoryManager& theManager)
78 {
79     FunctionLang::initialize(theManager);
80 
81     XObject::initialize(theManager);
82 
83     XUnknown::initialize(theManager);
84 
85     XPath::initialize(theManager);
86 
87     XPathEnvSupportDefault::initialize(theManager);
88 }
89 
90 
91 
92 void
terminate()93 XPathInit::terminate()
94 {
95     XPathEnvSupportDefault::terminate();
96 
97     XPath::terminate();
98 
99     XUnknown::terminate();
100 
101     XObject::terminate();
102 
103     FunctionLang::terminate();
104 }
105 
106 
107 
108 }
109