1 | // %pacpus:license{
|
---|
2 | // This file is part of the PACPUS framework distributed under the
|
---|
3 | // CECILL-C License, Version 1.0.
|
---|
4 | // %pacpus:license}
|
---|
5 | /// @file
|
---|
6 | /// @author Gerald Dherbomez <firstname.surname@utc.fr>
|
---|
7 | /// @date February, 2006
|
---|
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 | ///
|
---|
12 | /// Purpose: The ComponentFactoryBase class is used to provide an
|
---|
13 | /// abstract class to the template ComponentFactory
|
---|
14 |
|
---|
15 | #ifndef DEF_PACPUS_COMPONENTFACTORYBASE_H
|
---|
16 | #define DEF_PACPUS_COMPONENTFACTORYBASE_H
|
---|
17 |
|
---|
18 | #include <Pacpus/kernel/PacpusLibConfig.h>
|
---|
19 |
|
---|
20 | class QString;
|
---|
21 |
|
---|
22 | namespace pacpus {
|
---|
23 |
|
---|
24 | class ComponentManager;
|
---|
25 | class ComponentBase;
|
---|
26 |
|
---|
27 | /// ComponentFactoryBase
|
---|
28 | /// @brief Provide an abstract class to the template ComponentFactory.
|
---|
29 | class PACPUSLIB_API ComponentFactoryBase
|
---|
30 | {
|
---|
31 | friend class ComponentManager;
|
---|
32 |
|
---|
33 | public:
|
---|
34 | /// Ctor of ComponentFactoryBase.
|
---|
35 | ComponentFactoryBase();
|
---|
36 | /// Dtor of ComponentFactoryBase.
|
---|
37 | virtual ~ComponentFactoryBase();
|
---|
38 |
|
---|
39 | protected:
|
---|
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.
|
---|
45 | virtual ComponentBase * instantiateComponent(const QString& name) = 0;
|
---|
46 |
|
---|
47 | /// Registers a new factory.
|
---|
48 | ///
|
---|
49 | /// @param addr Address of the factory.
|
---|
50 | /// @param type Name of the type created by the factory.
|
---|
51 | void addFactory(ComponentFactoryBase* addr, const QString& type);
|
---|
52 |
|
---|
53 | /// Adds a new component.
|
---|
54 | ///
|
---|
55 | /// @param name Name of the new component.
|
---|
56 | void addComponent(const QString& name);
|
---|
57 |
|
---|
58 | private:
|
---|
59 | ComponentManager* mgr_;
|
---|
60 | };
|
---|
61 |
|
---|
62 | } // namespace pacpus
|
---|
63 |
|
---|
64 | #endif
|
---|