Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
make e_smx_comm_type_t be en enum class
[simgrid.git] / src / kernel / activity / ActivityImpl.hpp
index ec860fc..6d14c86 100644 (file)
@@ -23,13 +23,15 @@ namespace activity {
 class XBT_PUBLIC ActivityImpl {
 public:
   ActivityImpl() = default;
-  explicit ActivityImpl(std::string name) : name_(name) {}
+  explicit ActivityImpl(std::string name) : name_(std::move(name)) {}
   virtual ~ActivityImpl() = default;
   e_smx_state_t state_ = SIMIX_WAITING; /* State of the activity */
-  std::string name_;                    /* Activity name if any */
   std::list<smx_simcall_t> simcalls_;   /* List of simcalls waiting for this activity */
   resource::Action* surf_action_ = nullptr;
 
+  const std::string& get_name() const { return name_; }
+  const char* get_cname() const { return name_.c_str(); }
+
   virtual void suspend();
   virtual void resume();
   virtual void post()    = 0; // What to do when a simcall terminates
@@ -42,6 +44,7 @@ public:
 
 private:
   std::atomic_int_fast32_t refcount_{0};
+  std::string name_;                    /* Activity name if any */
 
 public:
   static simgrid::xbt::signal<void(ActivityImplPtr)> on_suspended;