DynamicModule.h

Go to the documentation of this file.
00001 /*
00002  * The information in this file is
00003  * Copyright(c) 2007 Ball Aerospace & Technologies Corporation
00004  * and is subject to the terms and conditions of the
00005  * GNU Lesser General Public License Version 2.1
00006  * The license text is available from   
00007  * http://www.gnu.org/licenses/lgpl.html
00008  */
00009 
00010 #ifndef DYNAMICMODULE_H
00011 #define DYNAMICMODULE_H
00012 
00013 #include <string>
00014 
00015 typedef void(*DMPROC)();
00016 
00017 /**
00018  *  Dynamic %Module
00019  *
00020  *  Platform independant class that supports dynamic linking for 
00021  *  Windows Dynamic Link Libraries (DLL's) and Solaris/Linux Dynamic
00022  *  Shared Objects (DSO's).
00023  */
00024 class DynamicModule
00025 {
00026 public:
00027    /**
00028     *  Loads the Dynamic Library
00029     *
00030     *  This method loads the Dynamic Link Library (DLL) or
00031     *  Dynamic Shared Object (DSO) into memory.
00032     *
00033     *  @param   moduleName
00034     *           Full path name for the dynamic library.
00035     *
00036     *  @return  This method returns true if the library is sucessfully
00037     *           loaded.
00038     */
00039    virtual bool load(const std::string& moduleName) = 0;
00040 
00041    /**
00042     *  Remove the dynamic library from memory
00043     *
00044     *  This method removes the Dynamic Link Library (DLL) or
00045     *  Dynamic Shared Object (DSO) from memory.
00046     *
00047     *  @return  This method returns true if the library is sucessfully
00048     *           unloaded from memory.
00049     */
00050    virtual bool unload() = 0;
00051 
00052    /**
00053     *  Has the module been loaded?
00054     *
00055     *  This method returns true if the Dynamic Link Library (DLL)
00056     *  or the Dynamic Shared Object (DSO) has been loaded and is resident 
00057     *  in memory.
00058     *
00059     *  @return  The method returns true if the library has already been loaded.
00060     */
00061    virtual bool isLoaded() const = 0;
00062 
00063    /**
00064     *  Gets the address of a library procedure.
00065     *
00066     *  This method returns the address of the specified  exported
00067     *  Dynamic Link Library (DLL) or the Dynamic Shared Object (DSO)
00068     *  procedure or function.  If the procedure or function does not
00069     *  exist, NULL is returned.
00070     *
00071     *  @param   name
00072     *           The string name of the exported procedure or function.
00073     *
00074     *  @return  This method returns the address of the procedure or
00075     *           function, otherwise NULL is returned.
00076     */
00077    virtual DMPROC getProcedureAddress(const std::string& name) const = 0;
00078 
00079 protected:
00080    /**
00081     * This should be destroyed by calling PlugInManagerServices::destroyDynamicModule.
00082     */
00083    virtual ~DynamicModule() {}
00084 };
00085 
00086 #endif   // DYNAMICMODULE_H

Software Development Kit - Opticks 4.9.0 Build 16218