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

Fix inaccuracies in comments

parent 0e11fb38
Branches
No related tags found
1 merge request!464Draft: working implemenation of Property
...@@ -67,7 +67,7 @@ public: ...@@ -67,7 +67,7 @@ public:
Property(const Property&) = delete; Property(const Property&) = delete;
void operator=(const Property&) = delete; void operator=(const Property&) = delete;
// Only settable by explicitly calling the value operator // Only settable by explicitly calling the ::set() member functio n
// as we want the Property to mostly act as if it is constant // as we want the Property to mostly act as if it is constant
virtual void set(std::any v) { virtual void set(std::any v) {
m_value = std::any_cast<T>(v); m_value = std::any_cast<T>(v);
...@@ -77,6 +77,9 @@ public: ...@@ -77,6 +77,9 @@ public:
// version that does not go through std::any // version that does not go through std::any
// Get const reference to the value // Get const reference to the value
virtual std::any get() const { return m_value; } virtual std::any get() const { return m_value; }
// Direct access to the value. Use this one whenever possible (or go through the
// automatic casting)
const ValueType& value() const { return m_value; } const ValueType& value() const { return m_value; }
// automatically cast to T // automatically cast to T
......
...@@ -21,10 +21,10 @@ namespace algorithms { ...@@ -21,10 +21,10 @@ namespace algorithms {
// Service service --> keeps track of all services :) // Service service --> keeps track of all services :)
// --> exposes the underlying property mixin of the service so // --> exposes the underlying Configurable object of the service so
// we can configure the services by name in the framework // we can configure the services by name in the framework
// boundary plugin // boundary plugin
// --> Special service (does not use the service mixin to avoid // --> Special service (does not use the Service base class to avoid
// circularity) // circularity)
class ServiceSvc { class ServiceSvc {
public: public:
...@@ -57,7 +57,7 @@ class ServiceSvc { ...@@ -57,7 +57,7 @@ class ServiceSvc {
}; };
// Thread-safe lazy-evaluated minimal service system // Thread-safe lazy-evaluated minimal service system
// CRTP mixin to add the instance method // CRTP base class to add the instance method
// This could have been part of DEFINE_SERVICE macro, but I think it is better // 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 // to keep the macro magic to a minimum to maximize transparency
template <class SvcType> class Service : public PropertyMixin { template <class SvcType> class Service : public PropertyMixin {
...@@ -67,8 +67,8 @@ template <class SvcType> class Service : public PropertyMixin { ...@@ -67,8 +67,8 @@ template <class SvcType> class Service : public PropertyMixin {
static SvcType svc; static SvcType svc;
return svc; return svc;
} }
// constructor for the service mixin registers the service, except // constructor for the service base class registers the service, except
// for the ServiceSvc which is its own thing (and that would be ciricular) // for the ServiceSvc which is its own thing (avoid circularity)
Service(std::string_view name) { Service(std::string_view name) {
ServiceSvc::instance().add(name, this); 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