XMLConfigurator.hh 1.4 KB
/**
 * 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 void proceed(const char* filename, const AMDA::Parameters::CfgContext& context);

      /**
       * 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_ */