source: pacpusframework/trunk/include/Pacpus/kernel/ComponentFactoryBase.h@ 52

Last change on this file since 52 was 43, checked in by sgosseli, 12 years ago

Minor: add some documentation, update the license header, update the coding style.

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