external_module.h
Go to the documentation of this file.
00001 /*
00002  * Copyright 2006-2008 The FLWOR 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 #ifndef ZORBA_EXTERNAL_MODULE_H
00017 #define ZORBA_EXTERNAL_MODULE_H
00018 
00019 #include <zorba/config.h>
00020 #include <zorba/zorba_string.h>
00021 
00022 
00023 namespace zorba {
00024 
00025 
00026 class ExternalFunction;
00027 
00028 
00029 /***************************************************************************//**
00030   An external module represents a group of external functions, all belonging to
00031   the same target namespace. Class ExternalModule provides the interface for
00032   retrieving the target namespace URI and/or the implementation of each contained
00033   external function by function name. 
00034 
00035   An external module can be a library module by itself, or be a component of
00036   a library module.
00037  
00038   Instances of this class must be implemented by the application and provide 
00039   storage for the implementations of the external functions. The instances must
00040   be registered in the static context in order for the functions to be accessible
00041   by a query (see <a href="../../zorba/html/external_functions.html">
00042   here</a> for more details.). 
00043 ********************************************************************************/
00044 class ZORBA_DLL_PUBLIC ExternalModule 
00045 {
00046  public:
00047   virtual ~ExternalModule() {}
00048 
00049   /**
00050    * @return the target namespace URI of the module.
00051    */
00052   virtual String
00053   getURI() const = 0;
00054 
00055   /**
00056    * @return the implementation of the function with the given name.
00057    */
00058   virtual ExternalFunction*
00059   getExternalFunction(const String& aLocalname) = 0;
00060 
00061   /**
00062    * \brief Function used for destroying the ExternalModule object
00063    *        passed as parameter.
00064    *
00065    * The user needs to override this function if the module
00066    * passed as parameter was created using the createModule function
00067    * which is used for dynamically loading modules from a shared
00068    * library.
00069    */
00070   virtual void
00071   destroy() {}
00072 
00073 };
00074 
00075 
00076 } /* namespace zorba */
00077 
00078 #endif
00079 
00080 /*
00081  * Local variables:
00082  * mode: c++
00083  * End:
00084  */
00085 /* vim:set et sw=2 ts=2: */
blog comments powered by Disqus