CatapultServer  v0.5.0.1 (Elephant)
ServiceRegistrar.h
Go to the documentation of this file.
1 
21 #pragma once
22 #include "ServiceRegistrarPhase.h"
23 #include <memory>
24 #include <string>
25 
26 namespace catapult {
27  namespace extensions {
28  class ServiceLocator;
29  class ServiceState;
30  }
31 }
32 
33 namespace catapult { namespace extensions {
34 
38  std::string Name;
39 
42  };
43 
46  public:
47  virtual ~ServiceRegistrar() = default;
48 
49  public:
51  virtual ServiceRegistrarInfo info() const = 0;
52 
54  virtual void registerServiceCounters(ServiceLocator& locator) = 0;
55 
57  virtual void registerServices(ServiceLocator& locator, ServiceState& state) = 0;
58  };
59 
61 #define DECLARE_SERVICE_REGISTRAR(NAME) std::unique_ptr<extensions::ServiceRegistrar> Create##NAME##ServiceRegistrar
62 }}
catapult::extensions::ServiceRegistrarInfo::Phase
ServiceRegistrarPhase Phase
Phase during which the registrar should be invoked.
Definition: ServiceRegistrar.h:41
catapult::extensions::ServiceRegistrar::registerServices
virtual void registerServices(ServiceLocator &locator, ServiceState &state)=0
Boots and registers dependent services with locator given state.
ServiceRegistrarPhase.h
catapult::extensions::ServiceRegistrar
A registrar for registering a service.
Definition: ServiceRegistrar.h:45
catapult::extensions::ServiceRegistrarInfo
Information about a service registrar.
Definition: ServiceRegistrar.h:36
catapult::extensions::ServiceRegistrar::~ServiceRegistrar
virtual ~ServiceRegistrar()=default
catapult::extensions::ServiceState
State that is used as part of service registration.
Definition: ServiceState.h:51
catapult::extensions::ServiceRegistrar::info
virtual ServiceRegistrarInfo info() const =0
Gets information about the registrar.
catapult
Definition: AddressExtractionExtension.cpp:28
catapult::extensions::ServiceRegistrarPhase
ServiceRegistrarPhase
Definition: ServiceRegistrarPhase.h:27
catapult::extensions::ServiceRegistrar::registerServiceCounters
virtual void registerServiceCounters(ServiceLocator &locator)=0
Registers service dependent counters with locator.
catapult::extensions::ServiceRegistrarInfo::Name
std::string Name
Registrar friendly name.
Definition: ServiceRegistrar.h:38
catapult::extensions::ServiceLocator
A service locator for local node services.
Definition: ServiceLocator.h:33