17 #ifndef AGX_COMPONENTMANAGER_H
18 #define AGX_COMPONENTMANAGER_H
35 typedef Component* ( *ComponentConstructor )( Device *device );
36 typedef void ( *ComponentDestructor )( Component * );
37 typedef const char* ( *ComponentNameFunction )();
45 AbstractComponentPlugin(
const String& path);
46 virtual ~AbstractComponentPlugin();
48 const String& getPath()
const;
50 virtual Component *create(Device *device) = 0;
51 virtual void destroy(Component *component) = 0;
58 void loadSymbol(T&
function,
const char *symbol);
62 ComponentConstructor m_constructor;
63 ComponentDestructor m_destructor;
64 ComponentNameFunction m_nameFunction;
77 class ComponentPlugin :
public AbstractComponentPlugin
80 ComponentPlugin(
const String& path);
81 virtual Component *create(Device *device);
82 virtual void destroy(Component *component);
88 ComponentPlugin<T>::ComponentPlugin(
const String& path) : AbstractComponentPlugin(path)
93 Component *ComponentPlugin<T>::create(Device *device)
99 void ComponentPlugin<T>::destroy(Component * )
104 typedef HashTable<String, AbstractComponentPlugin*> ComponentPluginTable;
109 static ComponentManager *instance();
111 Component *create(
const Path& path,
const Name& implementation = Name(), Device *device = CpuDevice::instance());
116 SINGLETON_CLASSNAME_METHOD();
119 virtual ~ComponentManager();
120 friend class AbstractComponentPlugin;
121 void registerPlugin(AbstractComponentPlugin *plugin);
122 void unregisterPlugin(AbstractComponentPlugin *plugin);
132 typedef Callback1<const String&> ScanCallback;
133 void scan(
const String& path, ScanCallback callback);
134 void load(
const String& path);
135 void scanComponents(
const String& baseDir);
139 ComponentPluginTable m_pluginTable;
#define AGX_DECLARE_POINTER_TYPES(type)
#define AGX_DECLARE_VECTOR_TYPES(type)
Base class for Singletons that should have its shutdown called explicitly before exit of the applicat...
#define DOXYGEN_END_INTERNAL_BLOCK()
#define DOXYGEN_START_INTERNAL_BLOCK()
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
AgXString< std::string > String
void AGXPHYSICS_EXPORT shutdown()
Shutdown agx.
std::recursive_mutex ReentrantMutex