PixelLightAPI  .
DynLibImpl.h
Go to the documentation of this file.
00001 /*********************************************************\
00002  *  File: DynLibImpl.h                                   *
00003  *
00004  *  Copyright (C) 2002-2011 The PixelLight Team (http://www.pixellight.org/)
00005  *
00006  *  This file is part of PixelLight.
00007  *
00008  *  PixelLight is free software: you can redistribute it and/or modify
00009  *  it under the terms of the GNU Lesser General Public License as published by
00010  *  the Free Software Foundation, either version 3 of the License, or
00011  *  (at your option) any later version.
00012  *
00013  *  PixelLight is distributed in the hope that it will be useful,
00014  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00016  *  GNU Lesser General Public License for more details.
00017  *
00018  *  You should have received a copy of the GNU Lesser General Public License
00019  *  along with PixelLight. If not, see <http://www.gnu.org/licenses/>.
00020 \*********************************************************/
00021 
00022 
00023 #ifndef __PLCORE_DYNLIB_IMPL_H__
00024 #define __PLCORE_DYNLIB_IMPL_H__
00025 #pragma once
00026 
00027 
00028 //[-------------------------------------------------------]
00029 //[ Includes                                              ]
00030 //[-------------------------------------------------------]
00031 #include "PLCore/String/String.h"
00032 
00033 
00034 //[-------------------------------------------------------]
00035 //[ Namespace                                             ]
00036 //[-------------------------------------------------------]
00037 namespace PLCore {
00038 
00039 
00040 //[-------------------------------------------------------]
00041 //[ Forward declarations                                  ]
00042 //[-------------------------------------------------------]
00043 class Url;
00044 
00045 
00046 //[-------------------------------------------------------]
00047 //[ Classes                                               ]
00048 //[-------------------------------------------------------]
00049 /**
00050 *  @brief
00051 *    Abstract base class for platform specific 'DynLib' implementations
00052 *
00053 *  @note
00054 *    - Implementation of the bridge design pattern, this class is the implementor of the 'DynLib' abstraction
00055 */
00056 class DynLibImpl {
00057 
00058 
00059     //[-------------------------------------------------------]
00060     //[ Friends                                               ]
00061     //[-------------------------------------------------------]
00062     friend class DynLib;
00063 
00064 
00065     //[-------------------------------------------------------]
00066     //[ Protected functions                                   ]
00067     //[-------------------------------------------------------]
00068     protected:
00069         /**
00070         *  @brief
00071         *    Constructor
00072         */
00073         DynLibImpl();
00074 
00075         /**
00076         *  @brief
00077         *    Destructor
00078         */
00079         virtual ~DynLibImpl();
00080 
00081 
00082     //[-------------------------------------------------------]
00083     //[ Protected virtual DynLibImpl functions                ]
00084     //[-------------------------------------------------------]
00085     protected:
00086         /**
00087         *  @brief
00088         *    Returns if the dynamic library has been loaded
00089         *
00090         *  @return
00091         *    'true' if loaded, else 'false'
00092         */
00093         virtual bool IsLoaded() const = 0;
00094 
00095         /**
00096         *  @brief
00097         *    Loads a dynamic library
00098         *
00099         *  @param[in] cUrl
00100         *    Path to the dynamic library
00101         *
00102         *  @return
00103         *    'true' if the library could be loaded, else false
00104         */
00105         virtual bool Load(const Url &cUrl) = 0;
00106 
00107         /**
00108         *  @brief
00109         *    Get the absolute path to the dynamic library
00110         *
00111         *  @return
00112         *    The absolute path to the dynamic library (native path style)
00113         */
00114         virtual String GetAbsPath() const = 0;
00115 
00116         /**
00117         *  @brief
00118         *    Unloads the dynamic library
00119         *
00120         *  @return
00121         *    'true' if the library could be unloaded, else false
00122         */
00123         virtual bool Unload() = 0;
00124 
00125         /**
00126         *  @brief
00127         *    Returns a pointer to a symbol in the library
00128         *
00129         *  @param[in] sSymbol
00130         *    Name of the symbol to retrieve
00131         *
00132         *  @return
00133         *    Pointer to the symbol, or a null pointer on error
00134         *
00135         *  @note
00136         *    - The pointer to the symbol only stays valid as long as this dynamic library instance is not unloaded
00137         */
00138         virtual void *GetSymbol(const String &sSymbol) const = 0;
00139 
00140 
00141 };
00142 
00143 
00144 //[-------------------------------------------------------]
00145 //[ Namespace                                             ]
00146 //[-------------------------------------------------------]
00147 } // PLCore
00148 
00149 
00150 #endif // __PLCORE_DYNLIB_IMPL_H__


PixelLight PixelLight 0.9.10-R1
Copyright (C) 2002-2011 by The PixelLight Team
Last modified Fri Dec 23 2011 15:50:52
The content of this PixelLight document is published under the
Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported