Changeset 288 in pacpusframework for trunk/include/Pacpus/kernel/ComponentFactoryBase.h


Ignore:
Timestamp:
03/26/14 21:27:30 (10 years ago)
Author:
Marek Kurdej
Message:

Using boost::shared_ptr for storing components.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/Pacpus/kernel/ComponentFactoryBase.h

    r196 r288  
    1818#include <Pacpus/kernel/PacpusLibConfig.h>
    1919
     20#include <boost/shared_ptr.hpp>
     21//#include <boost/weak_ptr.hpp>
     22
    2023class QString;
    2124
    22 namespace pacpus {
     25namespace pacpus
     26{
     27
     28class ComponentBase;
     29
     30typedef boost::shared_ptr<ComponentBase> ComponentSharedPointer;
     31//typedef boost::weak_ptr<ComponentBase> ComponentWeakPointer;
    2332
    2433class ComponentManager;
    25 class ComponentBase;
    2634
    2735/** ComponentFactoryBase
     
    3139{
    3240    friend class ComponentManager;
     41
    3342public:
    3443    /** Ctor of ComponentFactoryBase. */
     
    4251     * @return Pointer on the newly created component, you become the owner of its lifetime.
    4352     */
    44     virtual ComponentBase * instantiateComponent(const QString& name) = 0;
     53    virtual ComponentSharedPointer instantiateComponent(QString const& name) = 0;
    4554   
    4655    /** Register a new factory.
     
    4857     * @param type Name of the type created by the factory.
    4958     */
    50     void addFactory(ComponentFactoryBase* addr, const QString& type);
     59    void addFactory(ComponentFactoryBase* addr, QString const& type);
    5160   
    5261    /** Add a new component.
    5362     * @param name Name of the new component.
    5463     */
    55     void addComponent(const QString& name);
     64    void createComponent(QString const& name);
    5665
    5766private:
Note: See TracChangeset for help on using the changeset viewer.