/** \file
 *
 *  Contains the XmlAPI class definition.
 *
 *  Copyright (c) 2007,2008,2009 MBARI
 *  MBARI Proprietary Information.  All Rights Reserved
 *
 */

/** \defgroup xml Xml
 *
 * Provided as an alternative to Lua for mission scripting.
 *
 * This class leverages the relatively small tinyxml library for parsing
 * an xml mission file.
 */

#ifndef XMLAPI_H_
#define XMLAPI_H_

#include "missionScript/MissionAPI.h"

/**
 * Implements ScriptAPI (and by definition, ModuleAPI) in the xml programming
 * language.
 *
 * A wrapper for the xml programming language interface.  Allows scripted
 * modules and components to share much of the same API as c++ modules and
 * components.  Works closely with Tethys.xml code.
 *
 *  \ingroup xml
 */
class XmlAPI : public MissionAPI
{
public:

    virtual ~XmlAPI();

    /// Load the mission with the indicated filename
    /// In case of error, log message with indicated severity
    virtual MissionNode* loadMissionFile( const char* filename, Logger& logger,
                                          Syslog::Severity severity );

    /// Static function to load the mission with the indicated filename
    /// In case of error, log message with indicated severity
    static MissionNode* LoadMissionFile( const char* filename, Logger& logger,
                                         Syslog::Severity severity );

    /// Static function to parse the mission from the provided xml string
    static MissionNode* ParseMission( const char* xmlString, Logger& logger,
                                      Syslog::Severity severity );


private:

    /// Private constructor for singleton
    XmlAPI();

    static XmlAPI Instance_;

};

#endif /* XMLAPI_H_ */
