PixelLightAPI  .
ModuleMain.h
Go to the documentation of this file.
00001 /*********************************************************\
00002  *  File: ModuleMain.h                                   *
00003  *
00004  *  Copyright (C) 2002-2012 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_MODULEMAIN_H__
00024 #define __PLCORE_MODULEMAIN_H__
00025 #pragma once
00026 
00027 
00028 //[-------------------------------------------------------]
00029 //[ Includes                                              ]
00030 //[-------------------------------------------------------]
00031 #include "PLCore/Core/MemoryManagerOnlyOncePerProject.inl"  // By adding this in here, usually every PixelLight basing project will add automatically the correct memory manager features
00032 #include "PLCore/Base/Rtti.h"
00033 
00034 
00035 //[-------------------------------------------------------]
00036 //[ Macros                                                ]
00037 //[-------------------------------------------------------]
00038 /**
00039 *  @brief
00040 *    Defines a module inside an application or library
00041 *
00042 *  @param[in] ModuleName
00043 *    Module name
00044 *
00045 *  @remarks
00046 *    Use this in applications or libraries that are linked
00047 *    directly to the main project (statically or dynamically),
00048 *    but not inside a dynamically loaded plugin library.
00049 */
00050 #define pl_module(ModuleName) \
00051     class ModuleInfo { \
00052         public: \
00053             ModuleInfo() { \
00054                 ModuleInfo::Register(); \
00055             } \
00056         private: \
00057             static void Register() \
00058             { \
00059                 PLCore::String sName        = ModuleName; \
00060                 PLCore::String sVendor      = "Unknown"; \
00061                 PLCore::String sLicense     = "Unknown"; \
00062                 PLCore::String sDescription = "Unknown module"; \
00063 
00064 /**
00065 *  @brief
00066 *    Defines a module inside a plugin library
00067 *
00068 *  @param[in] ModuleName
00069 *    Module name
00070 *
00071 *  @remarks
00072 *    Use this in a library that is dynamically loaded as a plugin
00073 */
00074 #define pl_module_plugin(ModuleName) \
00075     extern "C" PLCORE_PLUGIN_API bool PLIsPluginDebugBuild() \
00076     { \
00077         return PLCORE_IS_DEBUGMODE; \
00078     } \
00079     \
00080     extern "C" PLCORE_PLUGIN_API int PLGetPluginInfo() \
00081     { \
00082         return PLCore::ModuleID<int>::GetModuleID(); \
00083     } \
00084     \
00085     pl_module(ModuleName) \
00086 
00087 /**
00088 *  @brief
00089 *    Sets the module vendor name
00090 *
00091 *  @param[in] Vendor
00092 *    Vendor name
00093 */
00094 #define pl_module_vendor(Vendor) \
00095             sVendor = Vendor; \
00096 
00097 /**
00098 *  @brief
00099 *    Sets the module license
00100 *
00101 *  @param[in] License
00102 *    License
00103 */
00104 #define pl_module_license(License) \
00105             sLicense = License; \
00106 
00107 /**
00108 *  @brief
00109 *    Sets the module description
00110 *
00111 *  @param[in] Description
00112 *    Module description
00113 */
00114 #define pl_module_description(Description) \
00115             sDescription = Description; \
00116 
00117 /**
00118 *  @brief
00119 *    Sets the module version
00120 *
00121 *  @param[in] Version
00122 *    Version string
00123 */
00124 #define pl_module_version(Version)
00125 
00126 /**
00127 *  @brief
00128 *    Sets the module dependencies for Windows 32/64 bit release/debug mode
00129 *
00130 *  @param[in] Dependencies
00131 *    Module dependencies
00132 */
00133 #define pl_module_dependencies_windows_64_release(Dependencies)
00134 #define pl_module_dependencies_windows_32_release(Dependencies)
00135 #define pl_module_dependencies_windows_64_debug(Dependencies)
00136 #define pl_module_dependencies_windows_32_debug(Dependencies)
00137 
00138 /**
00139 *  @brief
00140 *    Sets the module dependencies for Linux 32/64 bit release/debug mode
00141 *
00142 *  @param[in] Dependencies
00143 *    Module dependencies
00144 */
00145 #define pl_module_dependencies_linux_64_release(Dependencies)
00146 #define pl_module_dependencies_linux_32_release(Dependencies)
00147 #define pl_module_dependencies_linux_64_debug(Dependencies)
00148 #define pl_module_dependencies_linux_32_debug(Dependencies)
00149 
00150 /**
00151 *  @brief
00152 *    Sets the module dependencies for Android 32/64 bit release/debug mode
00153 *
00154 *  @param[in] Dependencies
00155 *    Module dependencies
00156 */
00157 #define pl_module_dependencies_android_64_release(Dependencies)
00158 #define pl_module_dependencies_android_32_release(Dependencies)
00159 #define pl_module_dependencies_android_64_debug(Dependencies)
00160 #define pl_module_dependencies_android_32_debug(Dependencies)
00161 
00162 /**
00163 *  @brief
00164 *    Sets the module dependencies for Mac OS X 32/64 bit release/debug mode
00165 *
00166 *  @param[in] Dependencies
00167 *    Module dependencies
00168 */
00169 #define pl_module_dependencies_macosx_64_release(Dependencies)
00170 #define pl_module_dependencies_macosx_32_release(Dependencies)
00171 #define pl_module_dependencies_macosx_64_debug(Dependencies)
00172 #define pl_module_dependencies_macosx_32_debug(Dependencies)
00173 
00174 /**
00175 *  @brief
00176 *    Sets the module's default active state
00177 *
00178 *  @param[in] Active
00179 *    Default active state (1 or 0)
00180 *
00181 *  @note
00182 *    - If not other defined, modules are active by default
00183 */
00184 #define pl_module_active(Active)
00185 
00186 /**
00187 *  @brief
00188 *    Sets the module's default delayed shared library loading state
00189 *
00190 *  @param[in] Delayed
00191 *    Default delayed shared library loading state (1 or 0)
00192 *
00193 *  @note
00194 *    - If not other defined, modules are loading their shared libraries delayed by default
00195 */
00196 #define pl_module_delayed(Delayed)
00197 
00198 /**
00199 *  @brief
00200 *    Ends the module definition
00201 */
00202 #define pl_module_end \
00203             PLCore::ModuleID<int>::RegisterModule(sName, sVendor, sLicense, sDescription); \
00204         } \
00205     }; \
00206     \
00207     ModuleInfo __ModuleInfo;
00208 
00209 
00210 #endif // __PLCORE_MODULEMAIN_H__


PixelLight PixelLight 0.9.11-R1
Copyright (C) 2002-2012 by The PixelLight Team
Last modified Thu Feb 23 2012 14:08:57
The content of this PixelLight document is published under the
Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported