/** \defgroup Parsing Parsing classes */

/** @addtogroup Parsing
    @{
*/

/** @file CSingletonHandler.cpp
    \brief This file contains the implementation of the CSingletonHandler.

    It frees the singleton at the end of the program.
*/

#include <cmath>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>

#include "popassert.h"
#include "CColor.h"
#include "CVector3f.h"
#include "CVectBase.h"
#include "compute.h"
#include "CMathExpression.h"
#include "CRenderObj.h"
#include "CCommand.h"
#include "CCommandExecutor.h"
#include "CCommandParser.h"

/**
   \brief This is the class that takes care of the singletons
   used by the console interface.

   It allocates and frees memory for the CCommandExecutor and
   the CCommandParser singletons.
*/
class CSingletonHandler
{
public:
  /**
     \brief The CSingletonHandler constructor that allocates
     memory for the singletons.
  */
  CSingletonHandler()
  {
    CCommandExecutor::getInstance();
    CCommandParser::getInstance();
  }

  /**
     \brief The CSingletonHandler destructor that frees
     memory for the singletons.
  */
  ~CSingletonHandler()
  {
    CCommandParser::freeInstance();
    CCommandExecutor::freeInstance();
  }
};

/**
   \brief Static instance of the CSingletonHandler so that the
   destructor will be called at the end of the program.
*/
static CSingletonHandler singletonHandler;

/** @} */
