Changeset 288 in pacpusframework for trunk/src/PacpusLib/ComponentManager.cpp
- Timestamp:
- Mar 26, 2014, 9:27:30 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/PacpusLib/ComponentManager.cpp
r277 r288 125 125 } 126 126 127 bool ComponentManager::registerComponentFactory(ComponentFactoryBase* addr, const QString& type)127 bool ComponentManager::registerComponentFactory(ComponentFactoryBase* addr, QString const& type) 128 128 { 129 129 LOG_TRACE("registerComponentFactory(type="<< type << ")"); … … 141 141 } 142 142 143 bool ComponentManager::unregisterComponentFactory( const QString& type)143 bool ComponentManager::unregisterComponentFactory(QString const& type) 144 144 { 145 145 LOG_TRACE("unregisterComponentFactory(type="<< type << ")"); … … 156 156 } 157 157 158 bool ComponentManager::registerComponent( ComponentBase* addr, const QString& name)158 bool ComponentManager::registerComponent(boost::shared_ptr<ComponentBase> addr, QString const& name) 159 159 { 160 160 LOG_TRACE("registerComponent(name="<< name << ")"); … … 171 171 } 172 172 173 bool ComponentManager::unregisterComponent( const QString& name)173 bool ComponentManager::unregisterComponent(QString const& name) 174 174 { 175 175 LOG_TRACE("unregisterComponent(name="<< name << ")"); … … 180 180 } 181 181 182 // FIXME: delete component 183 ComponentBase* component = componentMap_.value(name, NULL); 184 //delete component; 185 182 boost::shared_ptr<ComponentBase> component = componentMap_.value(name, NULL); 183 186 184 // FIXME: remove from map (causes segfault in QMap::qMapLessThanKey on Windows) 187 185 //componentMap_.remove(name); 188 186 LOG_INFO("unregistered component '" << name << "'"); 189 190 return true; 191 } 192 193 bool ComponentManager::createComponent(const QString& type, const QString& name) 187 return true; 188 } 189 190 bool ComponentManager::createComponent(QString const& type, QString const& name) 194 191 { 195 192 LOG_TRACE("createComponent(type=" << type << ", " << "name="<< name << ")"); … … 198 195 ComponentFactoryBase* factory = factoryMap_.value(type); 199 196 assert(factory); 200 factory-> addComponent(name);197 factory->createComponent(name); 201 198 return true; 202 199 } … … 209 206 } 210 207 211 bool ComponentManager::loadPlugin( const QString& filename)208 bool ComponentManager::loadPlugin(QString const& filename) 212 209 { 213 210 LOG_TRACE("loadPlugin(filename=" << filename << ")"); … … 236 233 } 237 234 238 bool ComponentManager::checkComponent( const QString& componentName)235 bool ComponentManager::checkComponent(QString const& componentName) 239 236 { 240 237 if (NULL == getComponent(componentName)) { … … 245 242 } 246 243 247 bool ComponentManager::checkComponentInput( const QString & componentName, const QString& inputName)244 bool ComponentManager::checkComponentInput(QString const& componentName, QString const& inputName) 248 245 { 249 246 if (!checkComponent(componentName)) { … … 257 254 } 258 255 259 bool ComponentManager::checkComponentOutput( const QString & componentName, const QString& outputName)256 bool ComponentManager::checkComponentOutput(QString const& componentName, QString const& outputName) 260 257 { 261 258 if (!checkComponent(componentName)) { … … 269 266 } 270 267 271 bool ComponentManager::createConnection( const QString & outputSignature, const QString & inputSignature, const QString& type, int priority = 0)268 bool ComponentManager::createConnection(QString const& outputSignature, QString const& inputSignature, QString const& type, int priority = 0) 272 269 { 273 270 // FIXME: use 2 signatures (output component + output connection) instead of 1 separated by a (".") dot … … 289 286 } 290 287 291 std::size_t ComponentManager::loadComponents( const QString& configFilename)288 std::size_t ComponentManager::loadComponents(QString const& configFilename) 292 289 { 293 290 LOG_TRACE("loadComponents(filename=" << configFilename << ")"); … … 334 331 335 332 // copy locally the config parameters of the component 336 Component Base *component = getComponent(componentName);333 ComponentSharedPointer component = getComponent(componentName); 337 334 if (NULL == component) { 338 335 LOG_WARN("component '" << componentName << "' does not exist"); … … 356 353 QString componentName = cfg.getComponentName(); 357 354 358 Component Base *component = getComponent(componentName);359 if ( NULL ==component) {355 ComponentSharedPointer component = getComponent(componentName); 356 if (!component) { 360 357 LOG_WARN("component '" << componentName << "' does not exist"); 361 358 continue; … … 430 427 } 431 428 432 bool ComponentManager::start( const QString& componentName)429 bool ComponentManager::start(QString const& componentName) 433 430 { 434 431 LOG_TRACE("start(component=" << componentName << ")"); 435 432 436 Component Base*component = getComponent(componentName);433 ComponentSharedPointer component = getComponent(componentName); 437 434 if (!component) { 438 435 LOG_WARN("cannot start component '" << componentName << "'. It does not exist!"); … … 465 462 } 466 463 467 bool ComponentManager::stop(Component Base *component) const464 bool ComponentManager::stop(ComponentSharedPointer component) const 468 465 { 469 466 if (!component) { … … 477 474 } 478 475 479 bool ComponentManager::stop( const QString& componentName)476 bool ComponentManager::stop(QString const& componentName) 480 477 { 481 478 LOG_TRACE("stop(component=" << componentName << ")"); 482 479 483 Component Base*component = getComponent(componentName);480 ComponentSharedPointer component = getComponent(componentName); 484 481 if (!component) { 485 482 LOG_WARN("cannot stop component '" << componentName << "'" << ". It does not exist"); … … 495 492 } 496 493 497 Component Base * ComponentManager::getComponent(const QString& name)494 ComponentSharedPointer ComponentManager::getComponent(QString const& name) 498 495 { 499 496 LOG_TRACE("getComponent(name=" << name << ")");
Note:
See TracChangeset
for help on using the changeset viewer.