Changeset 288 in pacpusframework for trunk/include/Pacpus/kernel/ComponentManager.h
- Timestamp:
- 03/26/14 21:27:30 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/Pacpus/kernel/ComponentManager.h
r207 r288 28 28 #include <QPluginLoader> 29 29 30 namespace pacpus { 30 namespace pacpus 31 { 31 32 32 33 class ComponentBase; 33 34 34 35 /// @todo Documentation 35 typedef QMap<QString, Component Base *> ComponentMap;36 typedef QMap<QString, ComponentSharedPointer> ComponentMap; 36 37 /// @todo Documentation 37 typedef QMap<QString, ComponentFactoryBase *> FactoryMap;38 typedef QMap<QString, ComponentFactoryBase* > FactoryMap; 38 39 39 40 /// Singleton recording the components and managing them. … … 59 60 struct destroyer { 60 61 /// Invokes ComponentManager::destroy() method if @b mgr pointer is not null. 61 void operator()(ComponentManager 62 void operator()(ComponentManager* mgr) const 62 63 { 63 64 if (!mgr) { … … 72 73 * @return Number of components loaded by the manager. 73 74 */ 74 std::size_t loadComponents( const QString& file);75 std::size_t loadComponents(QString const& file); 75 76 76 77 /** Start all the components … … 83 84 * @return True if the component exists and has been started, otherwise false. 84 85 */ 85 bool start( const QString& component);86 bool start(QString const& component); 86 87 87 88 /** Stop all the components … … 94 95 * @return True if the component has been stopped, otherwise false. 95 96 */ 96 bool stop( const QString& component);97 bool stop(QString const& component); 97 98 98 99 /** Get a pointer to the component referred by @em name. … … 100 101 * @return Pointer to the component if it exists, otherwise @em NULL. 101 102 */ 102 Component Base* getComponent(const QString& name);103 ComponentSharedPointer getComponent(QString const& name); 103 104 104 105 /** Get the list of all the names of the component known by the manager. … … 111 112 * @return True if the plugin has been loaded, otherwise false. 112 113 */ 113 bool loadPlugin( const QString& filename);114 bool loadPlugin(QString const& filename); 114 115 115 116 private: 116 bool stop(Component Base*component) const;117 bool stop(ComponentSharedPointer component) const; 117 118 118 119 /// Create a new component of type 'type' and with the name 'name' 119 bool createComponent( const QString& type, const QString& name);120 bool createComponent(QString const& type, QString const& name); 120 121 121 bool checkComponent( const QString& componentName);122 bool checkComponentInput( const QString & componentName, const QString& inputName);123 bool checkComponentOutput( const QString & componentName, const QString& outputName);122 bool checkComponent(QString const& componentName); 123 bool checkComponentInput(QString const& componentName, QString const& inputName); 124 bool checkComponentOutput(QString const& componentName, QString const& outputName); 124 125 125 bool createConnection( const QString& type, const QString& name, const QString& , int );126 bool createConnection(QString const& type, QString const& name, QString const& , int ); 126 127 127 bool registerComponent(Component Base* addr, const QString& name);128 bool registerComponentFactory(ComponentFactoryBase* addr, const QString& type);128 bool registerComponent(ComponentSharedPointer addr, QString const& name); 129 bool registerComponentFactory(ComponentFactoryBase* addr, QString const& type); 129 130 130 bool unregisterComponent( const QString& name);131 bool unregisterComponentFactory( const QString& type);131 bool unregisterComponent(QString const& name); 132 bool unregisterComponentFactory(QString const& type); 132 133 133 134 // Allow 2 functions to access to private members of ComponentManager 134 friend void ComponentFactoryBase::addFactory(ComponentFactoryBase* addr, const QString& type);135 friend void ComponentFactoryBase:: addComponent(const QString& name);135 friend void ComponentFactoryBase::addFactory(ComponentFactoryBase* addr, QString const& type); 136 friend void ComponentFactoryBase::createComponent(QString const& name); 136 137 137 138 /// private constructor accessible only via static create() function
Note:
See TracChangeset
for help on using the changeset viewer.