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

Last change on this file since 336 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
RevLine 
[89]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
[196]18#include <Pacpus/kernel/PacpusLibConfig.h>
[89]19
20#include <QDomElement>
21
22namespace pacpus {
23
[176]24//class QDomNamedNodeMap;
[89]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 */
[288]37 explicit XmlComponentConfig(QString const& name = QString::null);
[89]38
39 /** Dtor of XmlComponentConfig. */
40 ~XmlComponentConfig();
41
[176]42 QDomNamedNodeMap getProperties() const;
43
[89]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 */
[288]47 void addProperty(QString const& name);
[89]48
49 /** Delete a property from the XML.
50 * @return False if the property does not exist, false otherwise.
51 */
[288]52 int delProperty(QString const& name);
[89]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 */
[288]59 QString getProperty(QString const& name, QString const& defaultValue = QString::null) const;
[89]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 */
[288]66 bool getBoolProperty(QString const& name, bool defaultValue = false) const;
[89]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 */
[288]73 int getIntProperty(QString const& name, int defaultValue = 0) const;
[89]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 */
[288]80 double getDoubleProperty(QString const& name, double defaultValue = 0.0) const;
[89]81
82 /** Set the value of a property.
83 * @param name Name of the property.
84 * @param value Value to set.
85 */
[288]86 void setProperty(QString const& name, QString const& value);
[89]87
88 /** Check if a property exists.
89 * @param name Name of the property.
90 * @return True if the property exists, false otherwise.
91 */
[288]92 bool hasProperty(QString const& name) const;
[266]93
94public:
[89]95 // Returns the local QDomElement.
[270]96 QDomElement const& getDomElement() const;
[266]97
98private:
[89]99 // Copy internally the node in the internal QDomElement.
[176]100 void localCopy(const QDomElement & elementToCopy);
[89]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.