XMLConfigurator.hh
1.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/**
* XMLConfigurator.hh
*
* Created on: 17 oct. 2012
* Author: AKKA IS
*/
#ifndef XMLConfigurator_HH_
#define XMLConfigurator_HH_
#include <string>
#include <map>
#include <FileConfigurator.hh>
namespace AMDA
{
namespace XMLConfigurator
{
class NodeCfg;
typedef NodeCfg RootNodeCfg;
typedef boost::shared_ptr<RootNodeCfg> RootNodeCfgSPtr;
typedef boost::shared_ptr<NodeCfg> NodeCfgSPtr;
// Parameter XML Configurator
typedef std::map<std::string, RootNodeCfgSPtr> RootNodeCfgMap;
class XMLConfigurator : public AMDA::Parameters::FileConfigurator
{
public:
XMLConfigurator(const char* pXSDFile, bool isUsedXmlId);
virtual ~XMLConfigurator();
/**
* Parse an XML file to configure an Object Parameter.
*/
virtual bool proceed(const char* filename, const AMDA::Parameters::CfgContext& context, bool optionalFile);
/**
* Add a node parser.
* @param xpath example "param/get/baseParam"
* @param node A NodeCfgSPtr to parse baseParam XML node
*/
void addNodeParser( const char* xpath, NodeCfgSPtr node);
RootNodeCfgMap& getXmlConfiguratorMap() {
return _xmlConfiguratorMap;
}
protected:
RootNodeCfgMap _xmlConfiguratorMap;
char* _XSDFile;
private :
bool _isUsedXmlId;
};
}/* namespace XMLConfigurator */
} /* namespace AMDA */
#endif /* XMLConfigurator_HH_ */