libmoldeo (Moldeo 1.0 Core)  1.0
libmoldeo is the group of objects and functions that executes the basic operations of Moldeo 1.0 Platform.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
moBasePlugin.h
Go to the documentation of this file.
1 /*******************************************************************************
2 
3  moBasePlugin.h
4 
5  ****************************************************************************
6  * *
7  * This source is free software; you can redistribute it and/or modify *
8  * it under the terms of the GNU General Public License as published by *
9  * the Free Software Foundation; either version 2 of the License, or *
10  * (at your option) any later version. *
11  * *
12  * This code is distributed in the hope that it will be useful, but *
13  * WITHOUT ANY WARRANTY; without even the implied warranty of *
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
15  * General Public License for more details. *
16  * *
17  * A copy of the GNU General Public License is available on the World *
18  * Wide Web at <http://www.gnu.org/copyleft/gpl.html>. You can also *
19  * obtain it by writing to the Free Software Foundation, *
20  * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
21  * *
22  ****************************************************************************
23 
24  Copyright(C) 2006 Fabricio Costa
25 
26  Authors:
27  Fabricio Costa
28  Andrés Colubri
29 
30 *******************************************************************************/
31 
32 #ifndef __MO_BASE_PLUGIN_H__
33 #define __MO_BASE_PLUGIN_H__
34 
35 #include "moText.h"
36 
37 #if defined(_WIN32)
38  #include <windows.h>
39  typedef HINSTANCE MOpluginHandle;
40  #define MO_PLG_API __declspec(dllexport)
41  #define MO_PLG_ENTRY __stdcall
42 #else
43  #include <dlfcn.h>
44  typedef void* MOpluginHandle;
45  #define MO_PLG_API
46  #define MO_PLG_ENTRY
47  #ifdef MO_MACOSX
48  #define moPluginExtension moText(".dylib")
49  #endif
50  #ifdef MO_LINUX
51  #define moPluginExtension moText(".so")
52  #endif
53 #endif
54 
56 {
57  #if defined(_WIN32)
58  return LoadLibraryA(fn);
59  #else
60  return dlopen(fn, RTLD_LAZY);
61  #endif
62 }
63 
64 inline void moUnloadPlugin(MOpluginHandle &handle)
65 {
66  #if defined(_WIN32)
67  FreeLibrary(handle);
68  handle = NULL;
69  #else
70  dlclose(handle);
71  handle = NULL;
72  #endif
73 }
74 
76 
80 
81  public:
82 
84  m_Name = moText("");
85  m_FullPath = moText("");
86  m_MoldeoObjectType = MO_OBJECT_UNDEFINED;
87  }
88 
90  *this = src;
91  }
92 
94 
99  moPluginDefinition( const moText& p_name, const moText& p_fullpath, moMoldeoObjectType p_type ) {
100  m_Name = p_name;
101  m_FullPath = p_fullpath;
102  m_MoldeoObjectType = p_type;
103  }
104 
105  virtual ~moPluginDefinition() {}
106 
108  m_Name = src.m_Name;
109  m_FullPath = src.m_FullPath;
110  m_MoldeoObjectType = src.m_MoldeoObjectType;
111  return *this;
112  }
113 
116  return m_Name;
117  }
118 
121  return m_FullPath;
122  }
123 
126  return m_MoldeoObjectType;
127  }
128 
129  protected:
130 
134 
135 
136 };
137 
138 moDeclareExportedDynamicArray( moPluginDefinition, moPluginDefinitions );
139 
140 #endif
moText GetFullPath()
Devuelve la ruta y nombre completos del archivo del plugin.
Definition: moBasePlugin.h:120
moMoldeoObjectType
Tipos de objetos en Moldeo.
Definition: moTypes.h:525
moMoldeoObjectType GetType()
Devuelve el tipo de objeto que crea el plugin.
Definition: moBasePlugin.h:125
moText GetName()
Devuelve el nombre del plugin.
Definition: moBasePlugin.h:115
#define LIBMOLDEO_API
Definition: moTypes.h:180
moDeclareExportedDynamicArray(moPluginDefinition, moPluginDefinitions)
clase de para manejar textos
Definition: moText.h:75
Definición de un plugin.
Definition: moBasePlugin.h:79
virtual ~moPluginDefinition()
Definition: moBasePlugin.h:105
void moUnloadPlugin(MOpluginHandle &handle)
Definition: moBasePlugin.h:64
moText0 moText
Definition: moText.h:291
void * MOpluginHandle
Definition: moBasePlugin.h:44
moPluginDefinition(const moText &p_name, const moText &p_fullpath, moMoldeoObjectType p_type)
constructor
Definition: moBasePlugin.h:99
moMatrix3 & operator=(const moMatrix3 &rkM)
moMoldeoObjectType m_MoldeoObjectType
Definition: moBasePlugin.h:133
moPluginDefinition(const moPluginDefinition &src)
Definition: moBasePlugin.h:89
MOpluginHandle moLoadPlugin(moText fn)
Definition: moBasePlugin.h:55