Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[S4U] Actor: Add 'const' keyword to getter methods
authorChristian Heinrich <franz-christian.heinrich@inria.fr>
Fri, 29 Jun 2018 09:21:57 +0000 (11:21 +0200)
committerChristian Heinrich <franz-christian.heinrich@inria.fr>
Fri, 29 Jun 2018 09:23:33 +0000 (11:23 +0200)
This signals to users that calling these methods will not
change the state of the object.

src/simix/ActorImpl.hpp

index 3dd5f0c..c650cd2 100644 (file)
@@ -114,14 +114,14 @@ private:
   bool daemon = false;
 public:
   void daemonize();
-  bool isDaemon() { return daemon; } /** Whether this actor has been daemonized */
-  bool isSuspended() { return suspended; }
+  bool isDaemon() const { return daemon; } /** Whether this actor has been daemonized */
+  bool isSuspended() const { return suspended; }
   simgrid::s4u::Actor* restart();
   smx_activity_t suspend(ActorImpl* issuer);
   void resume();
   smx_activity_t sleep(double duration);
   void setUserData(void* data) { userdata = data; }
-  void* getUserData() { return userdata; }
+  void* getUserData() const { return userdata; }
 };
 
 /* Used to keep the list of actors blocked on a synchro  */