ITK  4.1.0
Insight Segmentation and Registration Toolkit
itkDynamicLoader.h
Go to the documentation of this file.
00001 /*=========================================================================
00002  *
00003  *  Copyright Insight Software Consortium
00004  *
00005  *  Licensed under the Apache License, Version 2.0 (the "License");
00006  *  you may not use this file except in compliance with the License.
00007  *  You may obtain a copy of the License at
00008  *
00009  *         http://www.apache.org/licenses/LICENSE-2.0.txt
00010  *
00011  *  Unless required by applicable law or agreed to in writing, software
00012  *  distributed under the License is distributed on an "AS IS" BASIS,
00013  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00014  *  See the License for the specific language governing permissions and
00015  *  limitations under the License.
00016  *
00017  *=========================================================================*/
00018 #ifndef __itkDynamicLoader_h
00019 #define __itkDynamicLoader_h
00020 
00021 #include "itkObject.h"
00022 #include "itkObjectFactory.h"
00023 #include "itksys/DynamicLoader.hxx"
00024 
00025 namespace itk
00026 {
00037 //BTX
00038 typedef itksys::DynamicLoader::LibraryHandle LibHandle;
00039 // Cannot use this as this is a void (*)() but ITK old API used to be void*
00040 typedef itksys::DynamicLoader::SymbolPointer SymbolPointer;
00041 //ETX
00042 
00043 class ITKCommon_EXPORT DynamicLoader:public Object
00044 {
00045 public:
00047   typedef DynamicLoader              Self;
00048   typedef Object                     Superclass;
00049   typedef SmartPointer< Self >       Pointer;
00050   typedef SmartPointer< const Self > ConstPointer;
00051 
00053   itkNewMacro(Self);
00054 
00056   itkTypeMacro(DynamicLoader, Object);
00057 
00061   static LibHandle OpenLibrary(const char *);
00062 
00065   static int CloseLibrary(LibHandle);
00066 
00068   static void *GetSymbolAddress(LibHandle, const char *);
00069 
00071   static const char * LibPrefix();
00072 
00074   static const char * LibExtension();
00075 
00077   static const char * LastError();
00078 
00079 protected:
00080   DynamicLoader();
00081   ~DynamicLoader();
00082 private:
00083   DynamicLoader(const Self &);  //purposely not implemented
00084   void operator=(const Self &); //purposely not implemented
00085 };
00086 } // end namespace itk
00087 
00088 #endif
00089