[62] | 1 | // This file is part of the PACPUS framework distributed under the
|
---|
| 2 | // CECILL-C License, Version 1.0.
|
---|
| 3 | //
|
---|
[66] | 4 | /// @file
|
---|
[62] | 5 | /// @author Gerald Dherbomez <firstname.surname@utc.fr>
|
---|
[63] | 6 | /// @date February, 2006
|
---|
[62] | 7 | /// @version $Id: ComponentFactoryBase.h 66 2013-01-09 16:54:11Z kurdejma $
|
---|
| 8 | /// @copyright Copyright (c) UTC/CNRS Heudiasyc 2006 - 2013. All rights reserved.
|
---|
| 9 | /// @brief Brief description.
|
---|
| 10 | ///
|
---|
[63] | 11 | /// Purpose: The ComponentFactoryBase class is used to provide an
|
---|
| 12 | /// abstract class to the template ComponentFactory
|
---|
[3] | 13 |
|
---|
[31] | 14 | #ifndef DEF_PACPUS_COMPONENTFACTORYBASE_H
|
---|
| 15 | #define DEF_PACPUS_COMPONENTFACTORYBASE_H
|
---|
[3] | 16 |
|
---|
[31] | 17 | #include <Pacpus/kernel/pacpus.h>
|
---|
[3] | 18 |
|
---|
| 19 | class QString;
|
---|
| 20 |
|
---|
| 21 | namespace pacpus {
|
---|
| 22 |
|
---|
| 23 | class ComponentManager;
|
---|
| 24 | class ComponentBase;
|
---|
| 25 |
|
---|
[31] | 26 | /** ComponentFactoryBase
|
---|
| 27 | * @brief Provide an abstract class to the template ComponentFactory.
|
---|
| 28 | */
|
---|
[3] | 29 | class PACPUSLIB_API ComponentFactoryBase
|
---|
| 30 | {
|
---|
| 31 | friend class ComponentManager;
|
---|
| 32 | public:
|
---|
[43] | 33 | /** Ctor of ComponentFactoryBase. */
|
---|
| 34 | ComponentFactoryBase();
|
---|
| 35 | /** Dtor of ComponentFactoryBase. */
|
---|
| 36 | virtual ~ComponentFactoryBase();
|
---|
[3] | 37 |
|
---|
| 38 | protected:
|
---|
[43] | 39 | /** Create a new component having @em name as component name.
|
---|
| 40 | * @param name Name of the instantiated component.
|
---|
| 41 | * @return Pointer on the newly created component, you become the owner of its lifetime.
|
---|
| 42 | */
|
---|
| 43 | virtual ComponentBase * instantiateComponent(const QString& name) = 0;
|
---|
| 44 |
|
---|
| 45 | /** Register a new factory.
|
---|
| 46 | * @param addr Address of the factory.
|
---|
| 47 | * @param type Name of the type created by the factory.
|
---|
| 48 | */
|
---|
| 49 | void addFactory(ComponentFactoryBase* addr, const QString& type);
|
---|
| 50 |
|
---|
| 51 | /** Add a new component.
|
---|
| 52 | * @param name Name of the new component.
|
---|
| 53 | */
|
---|
| 54 | void addComponent(const QString& name);
|
---|
[3] | 55 |
|
---|
| 56 | private:
|
---|
[43] | 57 | ComponentManager* mgr_;
|
---|
[3] | 58 | };
|
---|
| 59 |
|
---|
| 60 | } // namespace pacpus
|
---|
| 61 |
|
---|
[31] | 62 | #endif
|
---|