#ifndef REQUESTFACTORY_HPP
#define REQUESTFACTORY_HPP

#include <string>
#include <map>

#include "Request.hpp"

namespace mole {
  
  namespace ctx {

    /**
     * A request is an object needed by a service. So it is necessary to
     * have for each service a request that could be used.
     * That is what the request factory purpose : associating a request to
     * a service : the key is the same name as the service.
     */
    class RequestFactory {
      
    public :
      
      /**
       * Constructs an empty Request factory.
       */
      RequestFactory();
      ~RequestFactory();
      
      /**
       * Gets a request, by its name.
       *
       * @param name Name of the request.
       */
      Request * getRequest(std::string name);
      
      /**
       * Adds a request, and publish it in the factory.
       * The request is identified by a name.
       *
       * @param key Request identificator.
       * @param request The request to add in the factory.
       */
      void addRequest(std::string key, Request * request);
      
    private :
      /** Map associating a name to a service */
      std::map<std::string, Request *> list;
      
    };
    
  }; // end of serv
  
}; // end of mole


#endif
