00001 /*========================================================================= 00002 00003 Program: Insight Segmentation & Registration Toolkit 00004 Module: $RCSfile: itkDynamicLoader.h,v $ 00005 Language: C++ 00006 Date: $Date: 2006-11-29 18:19:00 $ 00007 Version: $Revision: 1.26 $ 00008 00009 Copyright (c) Insight Software Consortium. All rights reserved. 00010 See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details. 00011 00012 This software is distributed WITHOUT ANY WARRANTY; without even 00013 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00014 PURPOSE. See the above copyright notices for more information. 00015 00016 =========================================================================*/ 00017 #ifndef __itkDynamicLoader_h 00018 #define __itkDynamicLoader_h 00019 00020 #include "itkObject.h" 00021 #include "itkObjectFactory.h" 00022 #include <itksys/DynamicLoader.hxx> 00023 00024 namespace itk 00025 { 00026 00036 //BTX 00037 typedef itksys::DynamicLoader::LibraryHandle LibHandle; 00038 // Cannot use this as this is a void (*)() but ITK old API used to be void* 00039 typedef itksys::DynamicLoader::SymbolPointer SymbolPointer; 00040 //ETX 00041 00042 class ITKCommon_EXPORT DynamicLoader : public Object 00043 { 00044 public: 00046 typedef DynamicLoader Self; 00047 typedef Object Superclass; 00048 typedef SmartPointer<Self> Pointer; 00049 typedef SmartPointer<const Self> ConstPointer; 00050 00052 itkNewMacro(Self); 00053 00055 itkTypeMacro(DynamicLoader,Object); 00056 00060 static LibHandle OpenLibrary(const char*); 00061 00064 static int CloseLibrary(LibHandle); 00065 00067 static void* GetSymbolAddress(LibHandle, const char*); 00068 00070 static const char* LibPrefix(); 00071 00073 static const char* LibExtension(); 00074 00076 static const char* LastError(); 00077 00078 protected: 00079 DynamicLoader(); 00080 ~DynamicLoader(); 00081 00082 private: 00083 DynamicLoader(const Self&); //purposely not implemented 00084 void operator=(const Self&); //purposely not implemented 00085 00086 }; 00087 00088 } // end namespace itk 00089 00090 #endif 00091