Skip to content
Snippets Groups Projects
Commit 0e11fb38 authored by Sylvester Joosten's avatar Sylvester Joosten
Browse files

rename ServiceMixin --> Service as it's not really a Mixin like the others, more like a base

parent cae79e27
Branches
Tags
1 merge request!464Draft: working implemenation of Property
......@@ -33,7 +33,7 @@ constexpr std::string_view logLevelName(LogLevel level) {
// Note: the log action is responsible for dealing with concurrent calls
// the default LogAction is a thread-safe example
class LogSvc : public ServiceMixin<LogSvc> {
class LogSvc : public Service<LogSvc> {
public:
using LogAction = std::function<void(LogLevel, std::string_view, std::string_view)>;
void defaultLevel(const LogLevel l) { m_level.set(l); }
......
......@@ -11,9 +11,9 @@
// (mostly needed for the service base class)
#define ALGORITHMS_DEFINE_SERVICE(className) \
protected: \
className() : ServiceMixin<className>(#className) {} \
className() : Service<className>(#className) {} \
public: \
friend class ServiceMixin<className>; \
friend class Service<className>; \
className(const className&) = delete; \
void operator=(const className&) = delete;
......@@ -60,7 +60,7 @@ class ServiceSvc {
// CRTP mixin to add the instance method
// This could have been part of DEFINE_SERVICE macro, but I think it is better
// to keep the macro magic to a minimum to maximize transparency
template <class SvcType> class ServiceMixin : public PropertyMixin {
template <class SvcType> class Service : public PropertyMixin {
public:
static SvcType& instance() {
// This is guaranteed to be thread-safe from C++11 onwards.
......@@ -69,7 +69,7 @@ template <class SvcType> class ServiceMixin : public PropertyMixin {
}
// constructor for the service mixin registers the service, except
// for the ServiceSvc which is its own thing (and that would be ciricular)
ServiceMixin(std::string_view name) {
Service(std::string_view name) {
ServiceSvc::instance().add(name, this);
}
};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment