1 | // This file is part of the PACPUS framework distributed under the
|
---|
2 | // CECILL-C License, Version 1.0.
|
---|
3 | //
|
---|
4 | /// @file
|
---|
5 | /// @author Gerald Dherbomez <firstname.surname@utc.fr>
|
---|
6 | /// @date February, 2006
|
---|
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 | ///
|
---|
11 | /// Purpose: The ComponentFactoryBase class is used to provide an
|
---|
12 | /// abstract class to the template ComponentFactory
|
---|
13 |
|
---|
14 | #ifndef DEF_PACPUS_COMPONENTFACTORYBASE_H
|
---|
15 | #define DEF_PACPUS_COMPONENTFACTORYBASE_H
|
---|
16 |
|
---|
17 | #include <Pacpus/kernel/pacpus.h>
|
---|
18 |
|
---|
19 | class QString;
|
---|
20 |
|
---|
21 | namespace pacpus {
|
---|
22 |
|
---|
23 | class ComponentManager;
|
---|
24 | class ComponentBase;
|
---|
25 |
|
---|
26 | /** ComponentFactoryBase
|
---|
27 | * @brief Provide an abstract class to the template ComponentFactory.
|
---|
28 | */
|
---|
29 | class PACPUSLIB_API ComponentFactoryBase
|
---|
30 | {
|
---|
31 | friend class ComponentManager;
|
---|
32 | public:
|
---|
33 | /** Ctor of ComponentFactoryBase. */
|
---|
34 | ComponentFactoryBase();
|
---|
35 | /** Dtor of ComponentFactoryBase. */
|
---|
36 | virtual ~ComponentFactoryBase();
|
---|
37 |
|
---|
38 | protected:
|
---|
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);
|
---|
55 |
|
---|
56 | private:
|
---|
57 | ComponentManager* mgr_;
|
---|
58 | };
|
---|
59 |
|
---|
60 | } // namespace pacpus
|
---|
61 |
|
---|
62 | #endif
|
---|