ServiceLifeTime

class ServiceLifeTime

Public Types

enum class Type

3 types of available service lifetimes

Values:

enumerator Singleton
enumerator Scoped
enumerator Transient
enumerator Count

Public Functions

inline explicit constexpr ServiceLifeTime(const Type type)

Construct a new Service Life Time object with a specified type.

constexpr ServiceLifeTime(ServiceLifeTime&&) = default
constexpr ServiceLifeTime(const ServiceLifeTime&) = default
constexpr ServiceLifeTime &operator=(ServiceLifeTime&&) = default
constexpr ServiceLifeTime &operator=(const ServiceLifeTime&) = default
inline constexpr bool is(const Type type) const

checks if lifetime is given type

inline constexpr bool isSingleton() const

checks if lifetime is singleton

inline constexpr bool isScoped() const

checks if lifetime is scoped

inline constexpr bool isTransient() const

checks if lifetime is transient

inline constexpr bool operator!=(const ServiceLifeTime &lifeTime) const
inline constexpr bool operator==(const ServiceLifeTime &lifeTime) const
inline std::string_view toString() const

Public Static Functions

static inline constexpr ServiceLifeTime singleton()

creates singleton service lifetime

static inline constexpr ServiceLifeTime scoped()

creates scoped service lifetime

static inline constexpr ServiceLifeTime transient()

creates transient service lifetime