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, type must inhetit from service type

  • serviceKey – - service key

  • implementationKey – - service implementation key

  • lifeTime – - service life time: 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 casted service pointer, should be non zero for multiinheritance scenarios

ServiceDescriptor(const ServiceDescriptor&) = default
ServiceDescriptor(ServiceDescriptor&&) = default
ServiceDescriptor &operator=(const ServiceDescriptor&) = default
ServiceDescriptor &operator=(ServiceDescriptor&&) = default
inline TypeId getServiceTypeId() const

Get the service TypeId.

inline TypeId getImplementationTypeId() const

Get the service implementation TypeId.

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 multiinheritance.

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)