source: pacpusframework/trunk/include/Pacpus/kernel/XmlComponentConfig.h@ 288

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

Using boost::shared_ptr for storing components.

  • Property svn:executable set to *
File size: 3.9 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/PacpusLibConfig.h>
19
20#include <QDomElement>
21
22namespace pacpus {
23
24//class QDomNamedNodeMap;
25class XmlConfigFile;
26
27/** XmlComponentConfig
28 * @brief Defines the XML structure of a component.
29 */
30class PACPUSLIB_API XmlComponentConfig
31{
32 friend class ComponentManager;
33public:
34 /** Ctor of XmlComponentConfig.
35 * @param name Name of the ComponentFactory, by convention equal to class name.
36 */
37 explicit XmlComponentConfig(QString const& name = QString::null);
38
39 /** Dtor of XmlComponentConfig. */
40 ~XmlComponentConfig();
41
42 QDomNamedNodeMap getProperties() const;
43
44 /** Add the property @em name to the XML and set its value to @em 0 if it does not exist.
45 * @param name Name of the property.
46 */
47 void addProperty(QString const& name);
48
49 /** Delete a property from the XML.
50 * @return False if the property does not exist, false otherwise.
51 */
52 int delProperty(QString const& name);
53
54 /** Get the value of a property.
55 * @param name Name of the property.
56 * @param defaultValue Value returned if the property does not exist.
57 * @return Value of the property, @em defaultValue otherwise.
58 */
59 QString getProperty(QString const& name, QString const& defaultValue = QString::null) const;
60
61 /** Get the value of a property as a boolean.
62 * @param name Name of the property.
63 * @param defaultValue Value returned if the property does not exist.
64 * @return Value of the property, @em defaultValue otherwise.
65 */
66 bool getBoolProperty(QString const& name, bool defaultValue = false) const;
67
68 /** Get the value of a property as an integer.
69 * @param name Name of the property.
70 * @param defaultValue Value returned if the property does not exist.
71 * @return Value of the property, @em defaultValue otherwise.
72 */
73 int getIntProperty(QString const& name, int defaultValue = 0) const;
74
75 /** Get the value of a property as a double.
76 * @param name Name of the property.
77 * @param defaultValue Value returned if the property does not exist.
78 * @return Value of the property, @em defaultValue otherwise.
79 */
80 double getDoubleProperty(QString const& name, double defaultValue = 0.0) const;
81
82 /** Set the value of a property.
83 * @param name Name of the property.
84 * @param value Value to set.
85 */
86 void setProperty(QString const& name, QString const& value);
87
88 /** Check if a property exists.
89 * @param name Name of the property.
90 * @return True if the property exists, false otherwise.
91 */
92 bool hasProperty(QString const& name) const;
93
94public:
95 // Returns the local QDomElement.
96 QDomElement const& getDomElement() const;
97
98private:
99 // Copy internally the node in the internal QDomElement.
100 void localCopy(const QDomElement & elementToCopy);
101
102 QString const getComponentName() const;
103 QString const getComponentType() const;
104
105 QString const getConnectionType() const;
106 QString const getConnectionInput() const;
107 QString const getConnectionOutput() const;
108 int const getConnectionPriority() const;
109
110private:
111 QDomElement component_;
112 XmlConfigFile * parentDocument_;
113};
114
115} // namespace pacpus
116
117#endif // DEF_PACPUS_XMLCOMPONENTCONFIG_H
Note: See TracBrowser for help on using the repository browser.