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

Last change on this file since 342 was 290, checked in by Marek Kurdej, 11 years ago

Some clean-up.

  • Property svn:executable set to *
File size: 2.1 KB
Line 
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 76 2013-01-10 17:05:10Z 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#include <boost/smart_ptr/shared_ptr.hpp>
21//#include <boost/smart_ptr/weak_ptr.hpp>
22
23class QString;
24
25namespace pacpus
26{
27
28class ComponentBase;
29
30typedef boost::shared_ptr<ComponentBase> ComponentSharedPointer;
31//typedef boost::weak_ptr<ComponentBase> ComponentWeakPointer;
32
33class ComponentManager;
34
35/** ComponentFactoryBase
36 * @brief Provide an abstract class to the template ComponentFactory.
37 */
38class PACPUSLIB_API ComponentFactoryBase
39{
40 friend class ComponentManager;
41
42public:
43 /** Ctor of ComponentFactoryBase. */
44 ComponentFactoryBase();
45 /** Dtor of ComponentFactoryBase. */
46 virtual ~ComponentFactoryBase();
47
48protected:
49 /** Create a new component having @em name as component name.
50 * @param name Name of the instantiated component.
51 * @return Pointer on the newly created component, you become the owner of its lifetime.
52 */
53 virtual ComponentSharedPointer instantiateComponent(QString const& name) = 0;
54
55 /** Register a new factory.
56 * @param addr Address of the factory.
57 * @param type Name of the type created by the factory.
58 */
59 void addFactory(ComponentFactoryBase* addr, QString const& type);
60
61 /** Add a new component.
62 * @param name Name of the new component.
63 */
64 void createComponent(QString const& name);
65
66private:
67 ComponentManager* mgr_;
68};
69
70} // namespace pacpus
71
72#endif
Note: See TracBrowser for help on using the repository browser.