/** \defgroup Parsing Parsing classes */

/** @addtogroup Parsing
    @{
*/

/** @file CCommandExecutor.h
    \brief This file contains the declaration of the CCommandExecutor class.

    This class executes a command.
*/

#ifndef CCOMMANDEXECUTOR_H
#define CCOMMANDEXECUTOR_H


/**
   \brief This class executes a certain command.
*/
class CCommandExecutor
{
 public:
  /**
     \brief This function returns a pointer to the unique instance
     of the CCommandExecutor and creates it if it doesn't exist yet.
  */
  static CCommandExecutor* getInstance()
    {
      if (s_pInstance == NULL)
        {
          s_pInstance = new CCommandExecutor;
        }
      return s_pInstance;
    }

  /**
     \brief This function frees the unique instance of the
     CCommandExecutor.
  */
  static void freeInstance()
    {
      if (s_pInstance)
        {
          delete s_pInstance;
          s_pInstance = NULL;
        }
    }


  /**
     \brief This function executes a command that is passed in a 
     CCommand class.
  */
  void Execute(const CCommand& command, CRenderObj& surfaceobj) const;

 private:

  static const std::string
    s_HelpMessages[CCommand::PARAMETER_END+1]; /** String table corresponding
                                                   to the help messages. */

  /**
     \brief The CCommandExecutor empty private constructor.
  */
  CCommandExecutor() {}


  static CCommandExecutor* s_pInstance; /** Static pointer to the unique
                                            instance of the CCommandExecutor. */


  /**
     \brief This function is used to know if a file exists or not.
  */
  static bool FileExist(const std::string& FileName);
};

#endif // CCOMMANDEXECUTOR_H

/** @} */
