source: pacpusframework/branches/2.0-beta1/include/Pacpus/kernel/XmlComponentConfig.h@ 139

Last change on this file since 139 was 89, checked in by morasjul, 12 years ago

PACPUS 2.0 Beta deployed in new branch

Major changes:
-Add communication interface between components
-Add examples for communications interface (TestComponents)
-Move to Qt5 support

  • Property svn:executable set to *
File size: 3.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 January, 2006
8/// @version $Id: XmlComponentConfig.h 79 2013-01-14 08:52:06Z kurdejma $
9/// @copyright Copyright (c) UTC/CNRS Heudiasyc 2006 - 2013. All rights reserved.
10/// @brief Brief description.
11///
12/// Purpose: definit la structure XML des paramètres de configuration
13/// d'un composant
14
15#ifndef DEF_PACPUS_XMLCOMPONENTCONFIG_H
16#define DEF_PACPUS_XMLCOMPONENTCONFIG_H
17
18#include <Pacpus/kernel/pacpus.h>
19
20#include <QDomElement>
21
22namespace pacpus {
23
24class XmlConfigFile;
25
26/** XmlComponentConfig
27 * @brief Defines the XML structure of a component.
28 */
29class PACPUSLIB_API XmlComponentConfig
30{
31 friend class ComponentManager;
32public:
33 /** Ctor of XmlComponentConfig.
34 * @param name Name of the ComponentFactory, by convention equal to class name.
35 */
36 explicit XmlComponentConfig(const QString& name = QString::null);
37
38 /** Dtor of XmlComponentConfig. */
39 ~XmlComponentConfig();
40
41 /** Add the property @em name to the XML and set its value to @em 0 if it does not exist.
42 * @param name Name of the property.
43 */
44 void addProperty(const QString& name);
45
46 /** Delete a property from the XML.
47 * @return False if the property does not exist, false otherwise.
48 */
49 int delProperty(const QString& name);
50
51 /** Get the value of a property.
52 * @param name Name of the property.
53 * @param defaultValue Value returned if the property does not exist.
54 * @return Value of the property, @em defaultValue otherwise.
55 */
56 QString getProperty(const QString& name, const QString& defaultValue = QString::null) const;
57
58 /** Get the value of a property as a boolean.
59 * @param name Name of the property.
60 * @param defaultValue Value returned if the property does not exist.
61 * @return Value of the property, @em defaultValue otherwise.
62 */
63 bool getBoolProperty(const QString& name, bool defaultValue = false) const;
64
65 /** Get the value of a property as an integer.
66 * @param name Name of the property.
67 * @param defaultValue Value returned if the property does not exist.
68 * @return Value of the property, @em defaultValue otherwise.
69 */
70 int getIntProperty(const QString& name, int defaultValue = 0) const;
71
72 /** Get the value of a property as a double.
73 * @param name Name of the property.
74 * @param defaultValue Value returned if the property does not exist.
75 * @return Value of the property, @em defaultValue otherwise.
76 */
77 double getDoubleProperty(const QString& name, double defaultValue = 0.0) const;
78
79 /** Set the value of a property.
80 * @param name Name of the property.
81 * @param value Value to set.
82 */
83 void setProperty(const QString& name, const QString& value);
84
85 /** Check if a property exists.
86 * @param name Name of the property.
87 * @return True if the property exists, false otherwise.
88 */
89 bool hasProperty(const QString& name) const;
90
91private:
92 // Returns the local QDomElement.
93 QDomElement qDomElement() const;
94
95 // Copy internally the node in the internal QDomElement.
96 void localCopy(const QDomElement& elementToCopy);
97
98 QString const getComponentName() const;
99 QString const getComponentType() const;
100
101
102 QString const getConnectionType() const;
103 QString const getConnectionInput() const;
104 QString const getConnectionOutput() const;
105 int const getConnectionPriority() const;
106
107private:
108 QDomElement component_;
109 XmlConfigFile * parentDocument_;
110};
111
112} // namespace pacpus
113
114#endif // DEF_PACPUS_XMLCOMPONENTCONFIG_H
Note: See TracBrowser for help on using the repository browser.