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();
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);
135 void scanComponents(
const String& baseDir);
139 ComponentPluginTable m_pluginTable;
void AGXPHYSICS_EXPORT shutdown()
Shutdown of the AGX Dynamics API will be done when the number of shutdown matches the number of calls...
Component(const agx::Name &name=agx::Name(), agx::Model *model=agx::Component::ClassModel(), agx::Device *device=nullptr)
AgXString< std::string > String
#define AGX_DECLARE_POINTER_TYPES(type)
static CpuDevice * instance()
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
static Component * load(const String &path, const Path &_namespace=Path())
std::recursive_mutex ReentrantMutex
#define AGX_DECLARE_VECTOR_TYPES(type)
#define DOXYGEN_END_INTERNAL_BLOCK()
#define DOXYGEN_START_INTERNAL_BLOCK()
Base class for Singletons that should have its shutdown called explicitly before exit of the applicat...