Changeset 13 in pacpusframework for trunk/include/Pacpus/kernel/ComponentManager.h
- Timestamp:
- 01/08/13 01:15:23 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/Pacpus/kernel/ComponentManager.h
r12 r13 1 /********************************************************************* 2 // created: 2006/02/07 - 11:20 3 // filename: componentManager.h 4 // 5 // author: Gerald Dherbomez 6 // 7 // purpose: This class records the components and manages them 8 // This class is a singleton 9 // Use the static ComponentManager::create() function 10 // to get a pointer on this object. 11 *********************************************************************/ 1 /** 2 * 3 * Distributed under the UTC Heudiascy Pacpus License, Version 1.0. 4 * Copyright (c) UTC Heudiasyc 2010 - 2013. All rights reserved. 5 * 6 * See the LICENSE file for more information or a copy at: 7 * http://www.hds.utc.fr/~kurdejma/LICENSE_1_0.txt 8 * 9 */ 12 10 13 11 #ifndef COMPONENTMANAGER_H … … 15 13 16 14 #include <cstddef> 15 17 16 #include <QMap> 18 17 #include <QList> … … 27 26 28 27 class ComponentBase; 29 //class ComponentFactoryBase;30 28 31 29 typedef QMap<QString, ComponentBase *> ComponentMap; 32 30 typedef QMap<QString, ComponentFactoryBase *> FactoryMap; 33 31 32 /** ComponentManager 33 * @brief Singleton recording the components and managing them. 34 */ 34 35 class ComponentManager 35 36 { … … 41 42 PACPUS_DEPRECATED_MSG( static PACPUSLIB_API ComponentManager * create(), "use 'getInstance()'" ); 42 43 43 /// @returns a pointer to the ComponentManager object 44 static PACPUSLIB_API ComponentManager * getInstance(); 44 /** Get the singleton of the ComponentManager class. 45 * @return Pointer to the ComponentManager singleton. 46 */ 47 static PACPUSLIB_API ComponentManager* getInstance(); 45 48 46 /// Destroys the ComponentManager object 49 /** Destroy the ComponentManager singleton. 50 * After this call, every pointer to the ComponentManager becomes invalid. 51 */ 47 52 static PACPUSLIB_API void destroy(); 48 53 … … 57 62 }; 58 63 59 /// Call this function to load the components included in the XML config file 60 /// Usually, this is done in the main() ! 64 /** Load the components included in the XML config file. 65 * @param file Name of the XML file. 66 * @return Number of components loaded by the manager. 67 */ 61 68 std::size_t PACPUSLIB_API loadComponents(QString file); 62 69 63 /// Start all the components 70 /** Start all the components 71 * @return True if all the component has been started, otherwise false. 72 */ 64 73 int PACPUSLIB_API start(); 65 74 66 /// Start only the component passed in parameter 75 /** Start only the component passed in parameter. 76 * @param component Component to start. 77 * @return True if the component exists and has been started, otherwise false. 78 */ 67 79 int PACPUSLIB_API start(QString component); 68 80 69 /// Stop all the components 81 /** Stop all the components 82 * @return True if all the component has been stopped, otherwise false. 83 */ 70 84 int PACPUSLIB_API stop(); 71 85 72 /// Stop only the component passed in parameter 86 /** Stop only the component passed in parameter. 87 * @param component Component to stop. 88 * @return True if the component has been stopped, otherwise false. 89 */ 73 90 int PACPUSLIB_API stop(QString component); 74 91 75 /// Get a pointer to the component referred by 'name' parameter 92 /** Get a pointer to the component referred by @em name. 93 * @param name Name of the component. 94 * @return Pointer to the component if it exists, otherwise @em NULL. 95 */ 76 96 PACPUSLIB_API ComponentBase* getComponent(QString name); 77 97 78 /// Get the list of all the names of the component known by the manager 98 /** Get the list of all the names of the component known by the manager. 99 * @return List of all the component's name. 100 */ 79 101 PACPUSLIB_API QStringList getAllComponentsName(); 80 102 81 /// Load a new plugin from the file filename (it may be a .so/.dll file) 103 /** Load a new plugin from the file filename (it may be a .so/.dll file) 104 * @param filename Name of the shared object or the dll. 105 * @return True if the plugin has been loaded, otherwise false. 106 */ 82 107 bool PACPUSLIB_API loadPlugin(QString filename); 83 108
Note:
See TracChangeset
for help on using the changeset viewer.