+
+/* This class exists to allow chained setters as in exec->set_name()->set_priority()->set_blah()
+ * The difficulty is that set_name() must return a qualified child class, not the generic ancestor
+ * But the getter is still in the ancestor to be usable on generic activities with no downcast */
+template <class AnyActivityImpl> class ActivityImpl_T : public ActivityImpl {
+private:
+ std::string tracing_category_ = "";
+
+public:
+ AnyActivityImpl& set_name(const std::string& name) /* Hides the function in the ancestor class */
+ {
+ ActivityImpl::set_name(name);
+ return static_cast<AnyActivityImpl&>(*this);
+ }
+
+ AnyActivityImpl& set_tracing_category(const std::string& category)
+ {
+ tracing_category_ = category;
+ return static_cast<AnyActivityImpl&>(*this);
+ }
+ const std::string& get_tracing_category() const { return tracing_category_; }
+};
+