Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[s4u] Group fields at the end of the class
authorGabriel Corona <gabriel.corona@loria.fr>
Mon, 30 May 2016 08:21:59 +0000 (10:21 +0200)
committerGabriel Corona <gabriel.corona@loria.fr>
Mon, 30 May 2016 08:26:00 +0000 (10:26 +0200)
include/simgrid/s4u/Activity.hpp
include/simgrid/s4u/comm.hpp
include/simgrid/s4u/engine.hpp
include/simgrid/s4u/file.hpp
include/simgrid/s4u/storage.hpp

index 533a92d..222c932 100644 (file)
@@ -32,12 +32,7 @@ XBT_PUBLIC_CLASS Activity {
 protected:
   Activity();
   virtual ~Activity();
 protected:
   Activity();
   virtual ~Activity();
-  
-private:
-  simgrid::simix::Synchro *pimpl_ = NULL;
 
 
-private:
-  e_s4u_activity_state_t state_ = inited;
 public:
   /** Starts a previously created activity.
    *
 public:
   /** Starts a previously created activity.
    *
@@ -56,9 +51,6 @@ public:
   /** Retrieve the current state of the activity */
   e_s4u_activity_state_t getState() {return state_;}
 
   /** Retrieve the current state of the activity */
   e_s4u_activity_state_t getState() {return state_;}
 
-private:
-  double remains_ = 0;
-public:
   /** Get the remaining amount of work that this Activity entails. When it's 0, it's done. */
   double getRemains();
   /** Set the [remaining] amount of work that this Activity will entail
   /** Get the remaining amount of work that this Activity entails. When it's 0, it's done. */
   double getRemains();
   /** Set the [remaining] amount of work that this Activity will entail
@@ -66,13 +58,16 @@ public:
    * It is forbidden to change the amount of work once the Activity is started */
   void setRemains(double remains);
 
    * It is forbidden to change the amount of work once the Activity is started */
   void setRemains(double remains);
 
-private:
-  void *userData_ = NULL;
-public:
   /** Put some user data onto the Activity */
   void setUserData(void *data) {userData_=data;}
   /** Retrieve the user data of the Activity */
   void *getUserData() { return userData_; }
   /** Put some user data onto the Activity */
   void setUserData(void *data) {userData_=data;}
   /** Retrieve the user data of the Activity */
   void *getUserData() { return userData_; }
+
+private:
+  simgrid::simix::Synchro *pimpl_ = nullptr;
+  e_s4u_activity_state_t state_ = inited;
+  double remains_ = 0;
+  void *userData_ = nullptr;
 }; // class
 
 }}; // Namespace simgrid::s4u
 }; // class
 
 }}; // Namespace simgrid::s4u
index be969c2..288e9c4 100644 (file)
@@ -38,18 +38,9 @@ public:
   void wait() override;
   void wait(double timeout) override;
 
   void wait() override;
   void wait(double timeout) override;
 
-private:
-  double rate_=-1;
-public:
   /** Sets the maximal communication rate (in byte/sec). Must be done before start */
   void setRate(double rate);
 
   /** Sets the maximal communication rate (in byte/sec). Must be done before start */
   void setRate(double rate);
 
-private:
-  void *dstBuff_ = NULL;
-  size_t dstBuffSize_ = 0;
-  void *srcBuff_ = NULL;
-  size_t srcBuffSize_ = sizeof(void*);
-public:
   /** Specify the data to send */
   void setSrcData(void * buff);
   /** Specify the size of the data to send */
   /** Specify the data to send */
   void setSrcData(void * buff);
   /** Specify the size of the data to send */
@@ -65,16 +56,22 @@ public:
   size_t getDstDataSize();
 
 
   size_t getDstDataSize();
 
 
-private: /* FIXME: expose these elements in the API */
+private:
+  double rate_ = -1;
+  void *dstBuff_ = nullptr;
+  size_t dstBuffSize_ = 0;
+  void *srcBuff_ = nullptr;
+  size_t srcBuffSize_ = sizeof(void*);
+
+  /* FIXME: expose these elements in the API */
   int detached_ = 0;
   int detached_ = 0;
-  int (*matchFunction_)(void *, void *, smx_synchro_t) = NULL;
-  void (*cleanFunction_)(void *) = NULL;
-  void (*copyDataFunction_)(smx_synchro_t, void*, size_t) = NULL;
+  int (*matchFunction_)(void *, void *, smx_synchro_t) = nullptr;
+  void (*cleanFunction_)(void *) = nullptr;
+  void (*copyDataFunction_)(smx_synchro_t, void*, size_t) = nullptr;
 
 
-private:
-  smx_process_t sender_ = NULL;
-  smx_process_t receiver_ = NULL;
-  Mailbox *mailbox_ = NULL;
+  smx_process_t sender_ = nullptr;
+  smx_process_t receiver_ = nullptr;
+  Mailbox *mailbox_ = nullptr;
 };
 
 }} // namespace simgrid::s4u
 };
 
 }} // namespace simgrid::s4u
index ecd7f7d..046eea7 100644 (file)
@@ -52,14 +52,14 @@ public:
   
   /** @brief Retrieve the engine singleton */
   static s4u::Engine *instance();
   
   /** @brief Retrieve the engine singleton */
   static s4u::Engine *instance();
-private:
-  static s4u::Engine *instance_;
 
 
-public:
   /** @brief Retrieve the root AS, containing all others */
   simgrid::s4u::As *rootAs();
   /** @brief Retrieve the AS of the given name (or nullptr if not found) */
   simgrid::s4u::As *asByNameOrNull(const char *name);
   /** @brief Retrieve the root AS, containing all others */
   simgrid::s4u::As *rootAs();
   /** @brief Retrieve the AS of the given name (or nullptr if not found) */
   simgrid::s4u::As *asByNameOrNull(const char *name);
+
+private:
+  static s4u::Engine *instance_ = nullptr;
 };
 }} // namespace simgrid::s4u
 
 };
 }} // namespace simgrid::s4u
 
index 0e97633..809bd78 100644 (file)
@@ -28,14 +28,10 @@ XBT_PUBLIC_CLASS File {
 public:
   File(const char *fullpath, void* userdata);
   ~File();
 public:
   File(const char *fullpath, void* userdata);
   ~File();
-private:
-  smx_file_t pimpl_;
-  const char *path_;
 
 
-public:
   /** Retrieves the path to the file */
   const char *path() { return path_;}
   /** Retrieves the path to the file */
   const char *path() { return path_;}
-public:
+
   /** Simulates a read action. Returns the size of data actually read
    *
    *  FIXME: reading from a remotely mounted disk is not implemented yet.
   /** Simulates a read action. Returns the size of data actually read
    *
    *  FIXME: reading from a remotely mounted disk is not implemented yet.
@@ -53,10 +49,7 @@ public:
   void setUserdata(void *data) {userdata_ = data;}
   /** Retrieves the previously stored data */
   void* userdata() {return userdata_;}
   void setUserdata(void *data) {userdata_ = data;}
   /** Retrieves the previously stored data */
   void* userdata() {return userdata_;}
-private:
-  void *userdata_=NULL;
 
 
-public:
   /** Retrieve the datasize */
   sg_size_t size();
 
   /** Retrieve the datasize */
   sg_size_t size();
 
@@ -79,6 +72,10 @@ public:
   XBT_PUBLIC(msg_error_t) MSG_file_rmove(msg_file_t fd, msg_host_t host, const char* fullpath);
   */
 
   XBT_PUBLIC(msg_error_t) MSG_file_rmove(msg_file_t fd, msg_host_t host, const char* fullpath);
   */
 
+private:
+  smx_file_t pimpl_ = nullptr;
+  const char *path_ = nullptr;
+  void *userdata_ = nullptr;
 };
 
 }} // namespace simgrid::s4u
 };
 
 }} // namespace simgrid::s4u
index 3d9dd19..4504bb8 100644 (file)
@@ -16,9 +16,12 @@ namespace simgrid {
 namespace s4u {
 
 XBT_PUBLIC_CLASS Storage {
 namespace s4u {
 
 XBT_PUBLIC_CLASS Storage {
+  friend s4u::Engine;
+
 private:
   Storage(std::string name, smx_storage_t inferior);
   virtual ~Storage();
 private:
   Storage(std::string name, smx_storage_t inferior);
   virtual ~Storage();
+
 public:
   /** Retrieve a Storage by its name. It must exist in the platform file */
   static Storage &byName(const char* name);
 public:
   /** Retrieve a Storage by its name. It must exist in the platform file */
   static Storage &byName(const char* name);
@@ -39,20 +42,17 @@ XBT_PUBLIC(const char *) MSG_storage_get_host(msg_storage_t storage);
    */
 protected:
   smx_storage_t inferior();
    */
 protected:
   smx_storage_t inferior();
-private:
-  friend s4u::Engine;
-
-  static boost::unordered_map<std::string, Storage *> *storages_;
-  std::string name_;
-  smx_storage_t pimpl_;
-
 
 public:
   void setUserdata(void *data) {userdata_ = data;}
   void *userdata() {return userdata_;}
 
 public:
   void setUserdata(void *data) {userdata_ = data;}
   void *userdata() {return userdata_;}
+  
 private:
 private:
-  void *userdata_ = NULL;
+  static boost::unordered_map<std::string, Storage *> *storages_;
 
 
+  std::string name_;
+  smx_storage_t pimpl_ = nullptr;
+  void *userdata_ = nullptr;
 };
 
 } /* namespace s4u */
 };
 
 } /* namespace s4u */