[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 116 2013-06-25 11:44:25Z 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 |
|
---|
[116] | 18 | #include <Pacpus/kernel/PacpusLibConfig.h>
|
---|
[3] | 19 |
|
---|
| 20 | class QString;
|
---|
| 21 |
|
---|
| 22 | namespace pacpus {
|
---|
| 23 |
|
---|
| 24 | class ComponentManager;
|
---|
| 25 | class ComponentBase;
|
---|
| 26 |
|
---|
[116] | 27 | /// ComponentFactoryBase
|
---|
| 28 | /// @brief Provide an abstract class to the template ComponentFactory.
|
---|
[3] | 29 | class PACPUSLIB_API ComponentFactoryBase
|
---|
| 30 | {
|
---|
| 31 | friend class ComponentManager;
|
---|
[116] | 32 |
|
---|
[3] | 33 | public:
|
---|
[116] | 34 | /// Ctor of ComponentFactoryBase.
|
---|
[43] | 35 | ComponentFactoryBase();
|
---|
[116] | 36 | /// Dtor of ComponentFactoryBase.
|
---|
[43] | 37 | virtual ~ComponentFactoryBase();
|
---|
[3] | 38 |
|
---|
| 39 | protected:
|
---|
[116] | 40 | /// Creates a new component having @em name as component name.
|
---|
| 41 | /// Caller becomes the owner of its lifetime
|
---|
| 42 | ///
|
---|
| 43 | /// @param name Name of the instantiated component.
|
---|
| 44 | /// @returns Pointer on the newly created component.
|
---|
[43] | 45 | virtual ComponentBase * instantiateComponent(const QString& name) = 0;
|
---|
| 46 |
|
---|
[116] | 47 | /// Registers a new factory.
|
---|
| 48 | ///
|
---|
| 49 | /// @param addr Address of the factory.
|
---|
| 50 | /// @param type Name of the type created by the factory.
|
---|
[43] | 51 | void addFactory(ComponentFactoryBase* addr, const QString& type);
|
---|
| 52 |
|
---|
[116] | 53 | /// Adds a new component.
|
---|
| 54 | ///
|
---|
| 55 | /// @param name Name of the new component.
|
---|
[43] | 56 | void addComponent(const QString& name);
|
---|
[3] | 57 |
|
---|
| 58 | private:
|
---|
[43] | 59 | ComponentManager* mgr_;
|
---|
[3] | 60 | };
|
---|
| 61 |
|
---|
| 62 | } // namespace pacpus
|
---|
| 63 |
|
---|
[31] | 64 | #endif
|
---|