source: pacpusframework/branches/0.0.x/include/Pacpus/kernel/ComponentFactoryBase.h

Last change on this file was 116, checked in by Marek Kurdej, 11 years ago

Added: PacpusException - base class for all exceptions. DbiteExceptions inherits from it.
Added: PacpusLibConfig.h - dllimport/dllexport clauses separated from pacpus.h.
Update: comments.

  • Property svn:keywords set to Id
File size: 1.8 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 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
20class QString;
21
22namespace pacpus {
23
24class ComponentManager;
25class ComponentBase;
26
27/// ComponentFactoryBase
28/// @brief Provide an abstract class to the template ComponentFactory.
29class PACPUSLIB_API ComponentFactoryBase
30{
31 friend class ComponentManager;
32
33public:
34 /// Ctor of ComponentFactoryBase.
35 ComponentFactoryBase();
36 /// Dtor of ComponentFactoryBase.
37 virtual ~ComponentFactoryBase();
38
39protected:
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
58private:
59 ComponentManager* mgr_;
60};
61
62} // namespace pacpus
63
64#endif
Note: See TracBrowser for help on using the repository browser.