Fledge
An open source edge computing platform for industrial users
All Classes Functions Variables Pages
service_registry.h
1 #ifndef _SERVICE_REGISTRY_H
2 #define _SERVICE_REGISTRY_H
3 /*
4  * Fledge service registry.
5  *
6  * Copyright (c) 2017 OSisoft, LLC
7  *
8  * Released under the Apache 2.0 Licence
9  *
10  * Author: Mark Riddoch
11  */
12 #include <service_record.h>
13 #include <vector>
14 #include <map>
15 #include <string>
16 
21  public:
22  static ServiceRegistry *getInstance();
23  bool registerService(ServiceRecord *service);
24  bool unRegisterService(ServiceRecord *service);
25  bool unRegisterService(const std::string& uuid);
26  ServiceRecord *findService(const std::string& name);
27  std::string getUUID(ServiceRecord *service);
28  private:
30  ~ServiceRegistry();
31  static ServiceRegistry *m_instance;
32  std::vector<ServiceRecord *> m_services;
33  std::map<std::string, ServiceRecord *> m_uuids;
34 };
35 
36 #endif
ServiceRegistry Singleton class.
Definition: service_registry.h:20
std::string getUUID(ServiceRecord *service)
Return the uuid of the registration record for a given service.
Definition: service_registry.cpp:160
Definition: service_record.h:15
bool unRegisterService(ServiceRecord *service)
Unregister a service with the service registry.
Definition: service_registry.cpp:85
bool registerService(ServiceRecord *service)
Register a service with the service registry.
Definition: service_registry.cpp:52
static ServiceRegistry * getInstance()
Return the singleton instance of the service registry.
Definition: service_registry.cpp:39
ServiceRecord * findService(const std::string &name)
Find a service that is registered with the service registry.
Definition: service_registry.cpp:142