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