external_module.h
Go to the documentation of this file.
1 /*
2  * Copyright 2006-2008 The FLWOR 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 #ifndef ZORBA_EXTERNAL_MODULE_H
17 #define ZORBA_EXTERNAL_MODULE_H
18 
19 #include <zorba/config.h>
20 #include <zorba/zorba_string.h>
21 
22 
23 namespace zorba {
24 
25 
26 class ExternalFunction;
27 
28 
29 /***************************************************************************//**
30  An external module represents a group of external functions, all belonging to
31  the same target namespace. Class ExternalModule provides the interface for
32  retrieving the target namespace URI and/or the implementation of each contained
33  external function by function name.
34 
35  An external module can be a library module by itself, or be a component of
36  a library module.
37 
38  Instances of this class must be implemented by the application and provide
39  storage for the implementations of the external functions. The instances must
40  be registered in the static context in order for the functions to be accessible
41  by a query (see <a href="../../zorba/html/external_functions.html">
42  here</a> for more details.).
43 ********************************************************************************/
44 class ZORBA_DLL_PUBLIC ExternalModule
45 {
46  public:
47  virtual ~ExternalModule() {}
48 
49  /**
50  * @return the target namespace URI of the module.
51  */
52  virtual String
53  getURI() const = 0;
54 
55  /**
56  * @return the implementation of the function with the given name.
57  */
58  virtual ExternalFunction*
59  getExternalFunction(const String& aLocalname) = 0;
60 
61  /**
62  * \brief Function used for destroying the ExternalModule object
63  * passed as parameter.
64  *
65  * The user needs to override this function if the module
66  * passed as parameter was created using the createModule function
67  * which is used for dynamically loading modules from a shared
68  * library.
69  */
70  virtual void
71  destroy() {}
72 
73 };
74 
75 
76 } /* namespace zorba */
77 
78 #endif
79 
80 /*
81  * Local variables:
82  * mode: c++
83  * End:
84  */
85 /* vim:set et sw=2 ts=2: */
blog comments powered by Disqus