2024-04-27 15:31:23 -03:00
|
|
|
#ifndef XNA_GAME_SERVICECONTAINER_HPP
|
|
|
|
#define XNA_GAME_SERVICECONTAINER_HPP
|
|
|
|
|
|
|
|
#include "../default.hpp"
|
2024-05-06 10:32:17 -03:00
|
|
|
#include "../csharp/service.hpp"
|
|
|
|
#include <map>
|
2024-04-27 15:31:23 -03:00
|
|
|
|
|
|
|
namespace xna {
|
2024-08-02 11:29:56 -03:00
|
|
|
//A collection of game services.
|
2024-05-06 10:32:17 -03:00
|
|
|
class GameServiceContainer : public IServiceProvider {
|
|
|
|
public:
|
2024-08-02 11:29:56 -03:00
|
|
|
//Adds a service to the GameServiceContainer.
|
2024-05-06 10:32:17 -03:00
|
|
|
void AddService(Type& type, std::any& provider);
|
|
|
|
|
|
|
|
// Inherited via IServiceProvider
|
|
|
|
std::any GetService(Type& serviceType) override;
|
2024-04-27 15:31:23 -03:00
|
|
|
|
2024-08-02 11:29:56 -03:00
|
|
|
//Removes the object providing a specified service.
|
|
|
|
void RemoveService(Type& type);
|
|
|
|
|
2024-05-06 10:32:17 -03:00
|
|
|
private:
|
|
|
|
std::map<size_t, std::any> services;
|
2024-04-27 15:31:23 -03:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|