ServiceDescriptor¶
-
class ServiceDescriptor¶
Public Types
-
using Ptr = std::unique_ptr<ServiceDescriptor>¶
Public Functions
-
inline ServiceDescriptor(const TypeId serviceTypeId, const TypeId implementationTypeId, std::unique_ptr<std::string> serviceKey, std::unique_ptr<std::string> implementationKey, const ServiceLifeTime lifeTime, IServiceFactory::Ptr implementationFactory, const ptrdiff_t castOffset = 0)¶
Construct a new service descriptor object.
- Parameters:
serviceTypeId – - service type identifier
implementationTypeId – - service implementation type identifier, a type must inherit from a service type
serviceKey – - service key
implementationKey – - service implementation key
lifeTime – - service lifetime: Singleton, Scoped or Transient
implementationFactory – - service implementation factory can be nullptr in that case describer is treated as alias
castOffset – - cast offset is a difference in bytes between implementation pointer and cast service pointer, should be non-zero for multi inheritance scenarios
-
ServiceDescriptor(const ServiceDescriptor&) = default¶
-
ServiceDescriptor(ServiceDescriptor&&) = default¶
-
ServiceDescriptor &operator=(const ServiceDescriptor&) = default¶
-
ServiceDescriptor &operator=(ServiceDescriptor&&) = default¶
-
inline const std::string *getServiceKey() const¶
Get the service key pointer.
-
inline const std::string *getImplementationKey() const¶
Get the service implementation key pointer.
-
inline ServiceLifeTime getLifeTime() const¶
Get the lifetime object.
-
inline const IServiceFactory *getImplementationFactory() const¶
Get the service implementation factory pointer.
-
inline ptrdiff_t getCastOffset() const¶
Get the service cast offset, non-zero for multi inheritance.
-
inline bool isAlias() const¶
Check if service is alias (implementation factory is nullptr)
Friends
-
inline friend bool operator==(const ServiceDescriptor &l, const ServiceDescriptor &r)¶
-
inline friend bool operator!=(const ServiceDescriptor &l, const ServiceDescriptor &r)¶
-
using Ptr = std::unique_ptr<ServiceDescriptor>¶