#ifndef SERVICEFACTORY_HPP
#define SERVICEFACTORY_HPP

#include <map>
#include "Service.hpp"

namespace mole {
  
  namespace serv {
    
    /**
     * A service factory is a tool used by a server, to know which services
     * the server can set at disposition to the client.
     */
    class ServiceFactory {
      
    public :
      
      /**
       * Constructs an empty Service factory.
       */
      ServiceFactory();
      ~ServiceFactory();
  
      /**
       * Gets a service, by its name.
       *
       * @param name Name of the service.
       */
      Service * getService(std::string name);
      
      /**
       * Adds a service, and publish it in the factory.
       *
       * @param name The key in the map corresponding to the service
       * @param service The service to add in the factory.
       */
      void addService(std::string name, Service * service);

		/**
		 * Returns a listing of all services registers in the factory.
		 */
			std::string listServices();
      
    private :
      /** Map associating a name to a service */
      std::map<std::string, Service *> list;
      
    };
    
  }; // end of serv
  
}; // end of mole

#endif
