Changeset 288 in pacpusframework for trunk/src/PacpusLib/ComponentFactoryBase.cpp
- Timestamp:
- Mar 26, 2014, 9:27:30 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/PacpusLib/ComponentFactoryBase.cpp
r89 r288 10 10 #include <Pacpus/kernel/Log.h> 11 11 12 #include < cassert>12 #include <boost/assert.hpp> 13 13 #include <QString> 14 14 … … 23 23 // get the adress of the ComponentManager instance 24 24 mgr_ = ComponentManager::getInstance(); 25 BOOST_ASSERT(mgr_); 25 26 } 26 27 … … 30 31 } 31 32 32 void ComponentFactoryBase::addFactory(ComponentFactoryBase* addr, const QString& type)33 void ComponentFactoryBase::addFactory(ComponentFactoryBase* addr, QString const& type) 33 34 { 34 35 LOG_DEBUG("addFactory(type="<< type << ")"); 35 36 36 assert(mgr_);37 37 if (!mgr_->registerComponentFactory(addr, type)) { 38 38 /* … … 44 44 } 45 45 46 void ComponentFactoryBase:: addComponent(const QString& name)46 void ComponentFactoryBase::createComponent(QString const& name) 47 47 { 48 48 LOG_DEBUG("addComponent(" << name << ")"); 49 49 50 // FIXME: instantiated component is never deleted! 51 // who should do it? ComponentManager? 52 ComponentBase * addr = instantiateComponent(name); 53 assert(mgr_); 54 if (!mgr_->registerComponent(addr, name)) { 55 delete addr; 56 addr = NULL; 57 } 50 ComponentSharedPointer component = instantiateComponent(name); 51 mgr_->registerComponent(component, name); 58 52 }
Note:
See TracChangeset
for help on using the changeset viewer.