/** \defgroup Parsing Parsing classes */

/** @addtogroup Parsing
    @{
*/

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

    It holds information about a command to be executed.
*/

#ifndef CCOMMAND_H
#define CCOMMAND_H


/**
   \brief This class represents a command to execute with the
   parameters.
*/
class CCommand
{
 public:
  /**
     \brief This enum represents the command that can be called.
  */
  enum TYPE_COMMAND { COMMAND_HELP,
                      COMMAND_RUN,
                      COMMAND_SET,
                      COMMAND_PRINT,
                      COMMAND_QUIT,
                      COMMAND_END };

  /**
     \brief This enum represents the different values that can be
     set by the user.
  */
  enum TYPE_PARAMETER { PARAMETER_FORMULASTRING,
                        PARAMETER_SIGNINCREMENT,
                        PARAMETER_NOSIGNINCREMENT,
                        PARAMETER_NOSIGNPRECISION,
                        PARAMETER_ZOOM,
                        PARAMETER_MINVECTOR,
                        PARAMETER_MAXVECTOR,
                        PARAMETER_VIEWERPOS,
                        PARAMETER_LIGHTDIRECTION,
                        PARAMETER_SURFACEAMBIENTCOLOR,
                        PARAMETER_SURFACEDIFFUSECOLOR,
                        PARAMETER_SURFACESPECULARCOLOR,
                        PARAMETER_SURFACESPECULAREXPONENT,
                        PARAMETER_BOXAMBIENTCOLOR,
                        PARAMETER_BOXDIFFUSECOLOR,
                        PARAMETER_BOXSPECULARCOLOR,
                        PARAMETER_BOXSPECULAREXPONENT,
                        PARAMETER_BACKGROUNDCOLOR,
                        PARAMETER_WIDTH,
                        PARAMETER_HEIGHT,

                        // On/Off options
                        PARAMETER_PERSPECTIVE,
                        PARAMETER_BOUNDINGBOX,
                        PARAMETER_SIGN,
                        PARAMETER_OPENGLSPECULAR,

                        // End
                        PARAMETER_END };

  /**
     \brief This enum represents the type of parameter a "set" function needs.
  */
  enum TYPE_PARAMETERTYPE { PARAMETERTYPE_STRING,
                            PARAMETERTYPE_FLOAT,
                            PARAMETERTYPE_VECTOR,
                            PARAMETERTYPE_COLOR,
                            PARAMETERTYPE_INT,
                            PARAMETERTYPE_END };

  static const std::string
    s_CommandString[COMMAND_END]; /** String table corresponding
                                      to the different commands. */
  static const std::string
    s_ParameterString[PARAMETER_END]; /** String table corresponding
                                          to the different parameters. */


  TYPE_COMMAND m_CommandID; /** ID of the command to exectute. */
  
  TYPE_PARAMETER m_ParameterID; /** ID of the parameter of the command. */

  /** \brief Union containing a pointer to the parameter of the command. */
  union DataUnion
  {
    std::string *String;  /** String member. */
    float       *Float;   /** Float member.  */
    CVector3f   *Vector;  /** Vector member. */
    CColor      *Color;   /** Color member.  */
    int         *Int;     /** Int member.    */
  } m_pData;  /** Union containing a pointer to the parameter of the command. */

  /**
     \brief CCommand simple constructor.
  */
  CCommand()
  {
    m_CommandID = COMMAND_END;
    m_ParameterID = PARAMETER_END;
    m_pData.Int = NULL;
  }

  /**
     \brief This function returns the type of parameter needed by the command.
  */
  TYPE_PARAMETERTYPE GetParameterType() const;
};


#endif // CCOMMAND_H

/** @} */
