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