Changeset 146 in pacpusframework for branches/2.0-beta1/include/Pacpus
- Timestamp:
- Jul 31, 2013, 11:20:11 AM (11 years ago)
- Location:
- branches/2.0-beta1/include/Pacpus/kernel
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.0-beta1/include/Pacpus/kernel/ComponentManager.h
r89 r146 38 38 39 39 /// Singleton recording the components and managing them. 40 class ComponentManager40 class PACPUSLIB_API ComponentManager 41 41 { 42 42 friend class ComponentBase; … … 45 45 /// @returns a pointer to the ComponentManager object 46 46 /// @deprecated Use getInstance() 47 PACPUS_DEPRECATED_MSG( static PACPUSLIB_APIComponentManager * create(), "use 'getInstance()'" );47 PACPUS_DEPRECATED_MSG( static ComponentManager * create(), "use 'getInstance()'" ); 48 48 49 49 /// Returns an instance of the singleton ComponentManager class. 50 50 /// @returns Pointer to the ComponentManager singleton. 51 static PACPUSLIB_APIComponentManager* getInstance();51 static ComponentManager* getInstance(); 52 52 53 53 /// Destroys the ComponentManager singleton. 54 54 /// 55 55 /// After this call, every pointer to the ComponentManager becomes invalid. 56 static PACPUSLIB_APIvoid destroy();56 static void destroy(); 57 57 58 58 /// Automatic deleter class. … … 72 72 * @return Number of components loaded by the manager. 73 73 */ 74 PACPUSLIB_APIstd::size_t loadComponents(const QString& file);74 std::size_t loadComponents(const QString& file); 75 75 76 76 /** Start all the components 77 77 * @return True if all the component has been started, otherwise false. 78 78 */ 79 PACPUSLIB_APIbool start();79 bool start(); 80 80 81 81 /** Start only the component passed in parameter. … … 83 83 * @return True if the component exists and has been started, otherwise false. 84 84 */ 85 PACPUSLIB_APIbool start(const QString& component);85 bool start(const QString& component); 86 86 87 87 /** Stop all the components 88 88 * @return True if all the component has been stopped, otherwise false. 89 89 */ 90 PACPUSLIB_APIbool stop();90 bool stop(); 91 91 92 92 /** Stop only the component passed in parameter. … … 94 94 * @return True if the component has been stopped, otherwise false. 95 95 */ 96 PACPUSLIB_APIbool stop(const QString& component);96 bool stop(const QString& component); 97 97 98 98 /** Get a pointer to the component referred by @em name. … … 100 100 * @return Pointer to the component if it exists, otherwise @em NULL. 101 101 */ 102 PACPUSLIB_APIComponentBase* getComponent(const QString& name);102 ComponentBase* getComponent(const QString& name); 103 103 104 104 /** Get the list of all the names of the component known by the manager. 105 105 * @return List of all the component's name. 106 106 */ 107 PACPUSLIB_APIQStringList getAllComponentsName() const;107 QStringList getAllComponentsName() const; 108 108 109 109 /** Load a new plugin from the file filename (it may be a .so/.dll file) … … 111 111 * @return True if the plugin has been loaded, otherwise false. 112 112 */ 113 PACPUSLIB_APIbool loadPlugin(const QString& filename);113 bool loadPlugin(const QString& filename); 114 114 115 115 private: 116 bool stop(ComponentBase* component) const; 117 116 118 /// Create a new component of type 'type' and with the name 'name' 117 119 bool createComponent(const QString& type, const QString& name); … … 122 124 bool registerComponentFactory(ComponentFactoryBase* addr, const QString& type); 123 125 124 bool un RegisterComponent(const QString& name);125 bool un RegisterComponentFactory(const QString& type);126 bool unregisterComponent(const QString& name); 127 bool unregisterComponentFactory(const QString& type); 126 128 127 129 // Allow 2 functions to access to private members of ComponentManager -
branches/2.0-beta1/include/Pacpus/kernel/PacpusEvent.h
r131 r146 42 42 43 43 public: 44 PacpusEvent(PacpusEventType type, road_time_t t = road_time(), road_timerange_t tr = 0):QEvent(QEvent::Type(type)),t_(t),tr_(tr) {} 45 virtual ~PacpusEvent() {} 44 PacpusEvent(PacpusEventType type, road_time_t t = road_time(), road_timerange_t tr = 0) 45 : QEvent(QEvent::Type(type)) 46 , t_(t) 47 , tr_(tr) 48 {} 49 virtual ~PacpusEvent() 50 {} 46 51 47 virtual QDataStream& streamOut(QDataStream& out) {return out;}; // NOTE virtual pure ?? 48 virtual QDataStream& streamIn(QDataStream& in) {return in;}; 52 // NOTE virtual pure ?? 53 virtual QDataStream& streamOut(QDataStream& out) 54 { 55 return out; 56 } 57 virtual QDataStream& streamIn(QDataStream& in) 58 { 59 return in; 60 } 49 61 50 p ublic: // TODO make protected62 protected: // TODO make protected 51 63 road_time_t t_; 52 64 road_timerange_t tr_; … … 63 75 QDataStream& streamIn(QDataStream& in) {return in >> (quint64&)t_ >> tr_ /*>> data_*/;} 64 76 65 p ublic: // TODO make protected77 protected: 66 78 T data_; 67 79 }; … … 70 82 { 71 83 public: 72 PacpusGenericEvent(PacpusEventType type, char* data, size_t size):PacpusEvent(type) { 73 data_ = (char*)malloc(size); 84 PacpusGenericEvent(PacpusEventType type, char* data, size_t size) 85 : PacpusEvent(type) 86 { 87 data_ = new char[size]; 74 88 memcpy(data_,data,size); 75 89 _size = size; 76 90 77 91 } 78 virtual ~PacpusGenericEvent() {free(data_);} 92 93 virtual ~PacpusGenericEvent() 94 { 95 delete[] data_; 96 } 97 79 98 char* data_; 80 99 size_t _size; -
branches/2.0-beta1/include/Pacpus/kernel/XmlConfigFile.h
r89 r146 27 27 28 28 #include <QDomElement> 29 #include <QFile> 29 30 #include <QMutex> 30 31 #include <QStringList> … … 47 48 /// @todo Documentation 48 49 static void destroy(); 50 51 /// @returns a list of all names of components declared in the XML tree 52 QStringList getAllComponentsNames() const; 49 53 /// @todo Documentation 50 QDomElement getComponent(QString name); 51 /// @returns a list of all names of components declared in the XML tree 52 QStringList getAllComponentsNames(); 54 QDomElement getComponent(QString name) const; 55 56 // TODO: QStringList getAllConnectionsNames() const; 57 QDomElement getConnection(QString connectionName) const; 58 53 59 /// @todo Documentation 54 QStringList getAllPlugins(); 60 QStringList getAllPluginsNames(); 61 55 62 /// @todo Documentation 56 63 int loadFile(QString fileName); 57 58 QDomNodeList getAllComponents();59 60 QDomNodeList getAllConnections();61 62 QDomElement getConnection(QString connectionName);63 64 64 65 /// @todo Documentation 65 66 /// not used 66 67 void saveFile(QString fileName); 68 67 69 /// @todo Documentation 68 70 /// not used 69 71 void addComponent(QDomElement component); 72 70 73 /// @todo Documentation 74 /// @deprecated Use removeComponent() 71 75 /// not used 72 void delComponent(QDomElement component); 76 PACPUS_DEPRECATED_MSG( void delComponent(QDomElement component), "use removeComponent()" ); 77 void removeComponent(QDomElement component); 73 78 74 79 protected: 80 QDomNodeList getAllComponents() const; 81 QDomNodeList getAllConnections() const; 82 QDomNodeList getAllPlugins(); 83 75 84 private: 76 85 XmlConfigFile(); 77 86 ~XmlConfigFile(); 78 87 79 static XmlConfigFile * _xmlConfigFile;80 81 88 QDomElement createComponent(QString name); 82 89 90 QString libraryExtension() const; 91 QString libraryPrefix() const; 92 QString libraryPostfix() const; 93 83 94 private: 84 QDomDocument _document; 85 QFile * _file; 86 QMutex _mutex; 95 static XmlConfigFile * m_xmlConfigFile; 96 97 QDomDocument m_document; 98 QFile m_file; 99 QMutex m_mutex; 87 100 88 int _numberOfComponents; 101 QString m_libraryExtension; 102 QString m_libraryPrefix; 103 QString m_libraryPostfix; 104 105 int m_numberOfComponents; 89 106 }; 90 107
Note:
See TracChangeset
for help on using the changeset viewer.