1 #ifndef SERVICEPROVIDER_HPP
2 #define SERVICEPROVIDER_HPP
6 #include "UserInterface.hpp"
7 #include "ServiceComponent.hpp"
8 #include "services/EmailServiceAPI.hpp"
9 #include "services/CodiceServiceAPI.hpp"
10 #include "services/codice-service/CodiceCache.hpp"
11 #include "services/DataGatheringServiceAPI.hpp"
16 typedef ShowcaseFactoryPtr<ServiceComponent> ServiceComponentFactoryPtr;
18 class SystemConfiguration;
19 typedef std::shared_ptr<SystemConfiguration> SystemConfigurationPtr;
27 void init(GraphPtr graph,
const GraphNode& node);
29 bool hasComponent(
const QString& name)
const;
30 ServiceComponentPtr createComponent(
const QString& name);
32 FactoryKey<ServiceComponent>
33 registerFactory(
const QString &name, ServiceComponentFactoryPtr factory);
35 bool unregisterFactory(FactoryKey<ServiceComponent> key);
45 std::shared_ptr<EmailServiceAPI> emailService(
const QString& name = QString());
49 std::shared_ptr<CodiceServiceAPI> codiceService();
53 std::shared_ptr<CodiceServiceCache> codiceServiceCache();
57 std::shared_ptr<DataGathering::DataGatheringServiceAPI> dataGatheringService();
63 service(
const QString& componentName,
const QString& name = QString())
const;
66 void addServiceInstance(
const QString& component,
const QString& name,
67 ServiceInstancePtr instance);
68 void removeServiceInstance(
const QString& component,
const QString& name);
71 FactoryMap<ServiceComponent> m_componentFactories;
74 typedef std::map<QString, ServiceInstancePtr> ServiceMap;
76 std::map<QString, ServiceMap> m_services;
78 SystemConfigurationPtr m_systemConfig;
82 std::shared_ptr<CodiceServiceAPI> m_codiceService;
85 std::shared_ptr<CodiceServiceCache> m_codiceServiceCache;
89 typedef std::shared_ptr<ServiceProvider> ServiceProviderPtr;
93 #endif // SERVICEPROVIDER_HPP