Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
cosmetic cleanups in S4U
authorFrederic Suter <frederic.suter@cc.in2p3.fr>
Thu, 14 Mar 2019 09:57:51 +0000 (10:57 +0100)
committerFrederic Suter <frederic.suter@cc.in2p3.fr>
Thu, 14 Mar 2019 10:20:59 +0000 (11:20 +0100)
27 files changed:
include/simgrid/s4u/Activity.hpp
include/simgrid/s4u/Actor.hpp
include/simgrid/s4u/Barrier.hpp
include/simgrid/s4u/Comm.hpp
include/simgrid/s4u/ConditionVariable.hpp
include/simgrid/s4u/Engine.hpp
include/simgrid/s4u/Exec.hpp
include/simgrid/s4u/Host.hpp
include/simgrid/s4u/Io.hpp
include/simgrid/s4u/Link.hpp
include/simgrid/s4u/Mailbox.hpp
include/simgrid/s4u/Mutex.hpp
include/simgrid/s4u/NetZone.hpp
include/simgrid/s4u/Semaphore.hpp
include/simgrid/s4u/Storage.hpp
include/simgrid/s4u/VirtualMachine.hpp
src/s4u/s4u_Actor.cpp
src/s4u/s4u_Comm.cpp
src/s4u/s4u_Engine.cpp
src/s4u/s4u_Exec.cpp
src/s4u/s4u_Host.cpp
src/s4u/s4u_Io.cpp
src/s4u/s4u_Link.cpp
src/s4u/s4u_Mailbox.cpp
src/s4u/s4u_Netzone.cpp
src/s4u/s4u_Semaphore.cpp
src/s4u/s4u_Storage.cpp

index 39570d2..d478353 100644 (file)
@@ -28,15 +28,17 @@ namespace s4u {
  * - Synchronization activities may possibly be connected to no action.
  */
 class XBT_PUBLIC Activity {
-  friend simgrid::s4u::Comm;
+  friend Comm;
   friend XBT_PUBLIC void intrusive_ptr_release(Comm * c);
   friend XBT_PUBLIC void intrusive_ptr_add_ref(Comm * c);
-  friend simgrid::s4u::Exec;
-  friend simgrid::s4u::ExecSeq;
-  friend simgrid::s4u::ExecPar;
+
+  friend Exec;
+  friend ExecSeq;
+  friend ExecPar;
   friend XBT_PUBLIC void intrusive_ptr_release(Exec * e);
   friend XBT_PUBLIC void intrusive_ptr_add_ref(Exec * e);
-  friend simgrid::s4u::Io;
+
+  friend Io;
   friend XBT_PUBLIC void intrusive_ptr_release(Io* i);
   friend XBT_PUBLIC void intrusive_ptr_add_ref(Io* i);
 
index cd957d8..1ccfd6a 100644 (file)
@@ -120,11 +120,11 @@ namespace s4u {
  */
 
 /** @brief Simulation Agent */
-class XBT_PUBLIC Actor : public simgrid::xbt::Extendable<Actor> {
-  friend simgrid::s4u::Exec;
-  friend simgrid::s4u::Mailbox;
-  friend simgrid::kernel::actor::ActorImpl;
-  friend simgrid::kernel::activity::MailboxImpl;
+class XBT_PUBLIC Actor : public xbt::Extendable<Actor> {
+  friend Exec;
+  friend Mailbox;
+  friend kernel::actor::ActorImpl;
+  friend kernel::activity::MailboxImpl;
 
   kernel::actor::ActorImpl* const pimpl_;
 
@@ -145,24 +145,23 @@ public:
   static ActorPtr self();
 
   /** Signal to others that a new actor has been created **/
-  static simgrid::xbt::signal<void(simgrid::s4u::ActorPtr)> on_creation;
+  static xbt::signal<void(ActorPtr)> on_creation;
   /** Signal to others that an actor has been suspended**/
-  static simgrid::xbt::signal<void(simgrid::s4u::ActorPtr)> on_suspend;
+  static xbt::signal<void(ActorPtr)> on_suspend;
   /** Signal to others that an actor has been resumed **/
-  static simgrid::xbt::signal<void(simgrid::s4u::ActorPtr)> on_resume;
+  static xbt::signal<void(ActorPtr)> on_resume;
   /** Signal to others that an actor is sleeping **/
-  static simgrid::xbt::signal<void(simgrid::s4u::ActorPtr)> on_sleep;
+  static xbt::signal<void(ActorPtr)> on_sleep;
   /** Signal to others that an actor wakes up for a sleep **/
-  static simgrid::xbt::signal<void(simgrid::s4u::ActorPtr)> on_wake_up;
+  static xbt::signal<void(ActorPtr)> on_wake_up;
   /** Signal to others that an actor is going to migrated to another host**/
-  static simgrid::xbt::signal<void(simgrid::s4u::ActorPtr)> on_migration_start;
+  static xbt::signal<void(ActorPtr)> on_migration_start;
   /** Signal to others that an actor is has been migrated to another host **/
-  static simgrid::xbt::signal<void(simgrid::s4u::ActorPtr)> on_migration_end;
+  static xbt::signal<void(ActorPtr)> on_migration_end;
   /** Signal indicating that an actor is about to disappear.
-   *  This signal is fired for any dying actor, which is mostly useful when
-   *  designing plugins and extensions. If you want to register to the
-   *  termination of a given actor, use this_actor::on_exit() instead.*/
-  static simgrid::xbt::signal<void(simgrid::s4u::ActorPtr)> on_destruction;
+   *  This signal is fired for any dying actor, which is mostly useful when designing plugins and extensions. If you
+   *  want to register to the termination of a given actor, use this_actor::on_exit() instead.*/
+  static xbt::signal<void(ActorPtr)> on_destruction;
 
   /** Create an actor from a std::function<void()>
    *
@@ -208,7 +207,7 @@ public:
   /** Retrieves the name of that actor as a C string */
   const char* get_cname() const;
   /** Retrieves the host on which that actor is running */
-  s4u::Host* get_host();
+  Host* get_host();
   /** Retrieves the actor ID of that actor */
   aid_t get_pid() const;
   /** Retrieves the actor ID of that actor's creator */
index aef52a4..92ece5a 100644 (file)
@@ -42,7 +42,7 @@ public:
   friend XBT_PUBLIC void intrusive_ptr_add_ref(Barrier* barrier);
   friend XBT_PUBLIC void intrusive_ptr_release(Barrier* barrier);
 };
-}
-} // namespace simgrid::s4u
+} // namespace s4u
+} // namespace simgrid
 
 #endif
index cdcd9f0..26e1399 100644 (file)
@@ -38,9 +38,9 @@ class XBT_PUBLIC Comm : public Activity {
   Comm() : Activity() {}
 
 public:
-  friend XBT_PUBLIC void intrusive_ptr_release(simgrid::s4u::Comm * c);
-  friend XBT_PUBLIC void intrusive_ptr_add_ref(simgrid::s4u::Comm * c);
-  friend simgrid::s4u::Mailbox; // Factory of comms
+  friend XBT_PUBLIC void intrusive_ptr_release(Comm* c);
+  friend XBT_PUBLIC void intrusive_ptr_add_ref(Comm* c);
+  friend Mailbox; // Factory of comms
 
   virtual ~Comm();
 
index 773e5e0..6e6ec31 100644 (file)
@@ -23,10 +23,10 @@ namespace s4u {
  */
 class XBT_PUBLIC ConditionVariable {
 private:
-  friend simgrid::kernel::activity::ConditionVariableImpl;
-  simgrid::kernel::activity::ConditionVariableImpl* const cond_;
+  friend kernel::activity::ConditionVariableImpl;
+  kernel::activity::ConditionVariableImpl* const cond_;
 
-  explicit ConditionVariable(simgrid::kernel::activity::ConditionVariableImpl* cond) : cond_(cond) {}
+  explicit ConditionVariable(kernel::activity::ConditionVariableImpl* cond) : cond_(cond) {}
 
 public:
   ConditionVariable(ConditionVariable const&) = delete;
@@ -105,7 +105,7 @@ public:
   void notify_all();
 };
 
-}
-} // namespace simgrid::s4u
+} // namespace s4u
+} // namespace simgrid
 
 #endif
index 37151a5..0d4aee0 100644 (file)
@@ -65,8 +65,8 @@ public:
 
   template <class F> void register_actor(const std::string& name)
   {
-    simgrid::simix::register_function(name, [](std::vector<std::string> args) {
-      return simgrid::simix::ActorCode([args] {
+    simix::register_function(name, [](std::vector<std::string> args) {
+      return simix::ActorCode([args] {
         F code(std::move(args));
         code();
       });
@@ -75,8 +75,8 @@ public:
 
   template <class F> void register_actor(const std::string& name, F code)
   {
-    simgrid::simix::register_function(name, [code](std::vector<std::string> args) {
-      return simgrid::simix::ActorCode([code, args] { code(std::move(args)); });
+    simix::register_function(name, [code](std::vector<std::string> args) {
+      return simix::ActorCode([code, args] { code(std::move(args)); });
     });
   }
 
@@ -106,14 +106,14 @@ public:
   /** @brief Returns the list of all hosts found in the platform */
   std::vector<Host*> get_all_hosts();
   std::vector<Host*> get_filtered_hosts(const std::function<bool(Host*)>& filter);
-  simgrid::s4u::Host* host_by_name(const std::string& name);
-  simgrid::s4u::Host* host_by_name_or_null(const std::string& name);
+  Host* host_by_name(const std::string& name);
+  Host* host_by_name_or_null(const std::string& name);
 
   size_t get_link_count();
   std::vector<Link*> get_all_links();
   std::vector<Link*> get_filtered_links(const std::function<bool(Link*)>& filter);
-  simgrid::s4u::Link* link_by_name(const std::string& name);
-  simgrid::s4u::Link* link_by_name_or_null(const std::string& name);
+  Link* link_by_name(const std::string& name);
+  Link* link_by_name_or_null(const std::string& name);
 
   size_t get_actor_count();
   std::vector<ActorPtr> get_all_actors();
@@ -121,16 +121,16 @@ public:
 
   size_t get_storage_count();
   std::vector<Storage*> get_all_storages();
-  simgrid::s4u::Storage* storage_by_name(const std::string& name);
-  simgrid::s4u::Storage* storage_by_name_or_null(const std::string& name);
+  Storage* storage_by_name(const std::string& name);
+  Storage* storage_by_name_or_null(const std::string& name);
 
-  std::vector<simgrid::kernel::routing::NetPoint*> get_all_netpoints();
-  simgrid::kernel::routing::NetPoint* netpoint_by_name_or_null(const std::string& name);
+  std::vector<kernel::routing::NetPoint*> get_all_netpoints();
+  kernel::routing::NetPoint* netpoint_by_name_or_null(const std::string& name);
 
-  simgrid::s4u::NetZone* get_netzone_root();
-  void set_netzone_root(s4u::NetZone* netzone);
+  NetZone* get_netzone_root();
+  void set_netzone_root(NetZone* netzone);
 
-  simgrid::s4u::NetZone* netzone_by_name_or_null(const std::string& name);
+  NetZone* netzone_by_name_or_null(const std::string& name);
 
   /** @brief Retrieves all netzones of the type indicated by the template argument */
   template <class T> std::vector<T*> get_filtered_netzones()
@@ -155,8 +155,8 @@ public:
   void set_config(const std::string& str);
 
 private:
-  simgrid::kernel::EngineImpl* const pimpl;
-  static s4u::Engine* instance_;
+  kernel::EngineImpl* const pimpl;
+  static Engine* instance_;
 
   //////////////// Deprecated functions
 #ifndef DOXYGEN
@@ -318,7 +318,7 @@ template <class T> XBT_PRIVATE void get_filtered_netzones_recursive(s4u::NetZone
   }
 }
 #endif
-}
-} // namespace simgrid::s4u
+} // namespace s4u
+} // namespace simgrid
 
 #endif /* SIMGRID_S4U_ENGINE_HPP */
index 6ec7fab..beed7e1 100644 (file)
@@ -39,8 +39,8 @@ public:
   Exec& operator=(Exec const&) = delete;
 #endif
 
-  friend simgrid::s4u::ExecSeq;
-  friend simgrid::s4u::ExecPar;
+  friend ExecSeq;
+  friend ExecPar;
   friend XBT_PUBLIC void intrusive_ptr_release(Exec* e);
   friend XBT_PUBLIC void intrusive_ptr_add_ref(Exec* e);
   static xbt::signal<void(ActorPtr)> on_start;
index ffe5016..dd31bcf 100644 (file)
 namespace simgrid {
 
 namespace xbt {
-extern template class XBT_PUBLIC Extendable<simgrid::s4u::Host>;
-}
-namespace s4u {
+extern template class XBT_PUBLIC Extendable<s4u::Host>;
+} // namespace xbt
 
+namespace s4u {
 /** @ingroup s4u_api
  *
  * @tableofcontents
@@ -35,9 +35,9 @@ namespace s4u {
  * and actors can retrieve the host on which they run using @ref simgrid::s4u::Host::current() or
  * @ref simgrid::s4u::this_actor::get_host().
  */
-class XBT_PUBLIC Host : public simgrid::xbt::Extendable<Host> {
-  friend simgrid::vm::VMModel;            // Use the pimpl_cpu to compute the VM sharing
-  friend simgrid::vm::VirtualMachineImpl; // creates the the pimpl_cpu
+class XBT_PUBLIC Host : public xbt::Extendable<Host> {
+  friend vm::VMModel;            // Use the pimpl_cpu to compute the VM sharing
+  friend vm::VirtualMachineImpl; // creates the the pimpl_cpu
 
 public:
   explicit Host(const std::string& name);
@@ -51,14 +51,14 @@ private:
 
 public:
   /*** Called on each newly created host */
-  static simgrid::xbt::signal<void(Host&)> on_creation;
+  static xbt::signal<void(Host&)> on_creation;
   /*** Called just before destructing a host */
-  static simgrid::xbt::signal<void(Host&)> on_destruction;
+  static xbt::signal<void(Host&)> on_destruction;
   /*** Called when the machine is turned on or off (called AFTER the change) */
-  static simgrid::xbt::signal<void(Host&)> on_state_change;
+  static xbt::signal<void(Host&)> on_state_change;
   /*** Called when the speed of the machine is changed (called AFTER the change)
    * (either because of a pstate switch or because of an external load event coming from the profile) */
-  static simgrid::xbt::signal<void(Host&)> on_speed_change;
+  static xbt::signal<void(Host&)> on_speed_change;
 
   virtual void destroy();
   // No copy/move
@@ -68,12 +68,12 @@ public:
   /** Retrieve a host from its name, or return nullptr */
   static Host* by_name_or_null(const std::string& name);
   /** Retrieve a host from its name, or die */
-  static s4u::Host* by_name(const std::string& name);
+  static Host* by_name(const std::string& name);
   /** Retrieves the host on which the running actor is located */
-  static s4u::Host* current();
+  static Host* current();
 
   /** Retrieves the name of that host as a C++ string */
-  simgrid::xbt::string const& get_name() const { return name_; }
+  xbt::string const& get_name() const { return name_; }
   /** Retrieves the name of that host as a C string */
   const char* get_cname() const { return name_.c_str(); }
 
@@ -82,12 +82,12 @@ public:
 
   /** Turns that host on if it was previously off
    *
-   * This call does nothing if the host is already on. If it was off, all actors which were
-   * marked 'autorestart' on that host will be restarted automatically (note that this may differ
-   * from the actors that were initially running on the host).
+   * This call does nothing if the host is already on. If it was off, all actors which were marked 'autorestart' on that
+   * host will be restarted automatically (note that this may differ from the actors that were initially running on the
+   * host).
    *
-   * All other Host's properties are left unchanged; in particular, the pstate is left
-   * unchanged and not reset to its initial value.
+   * All other Host's properties are left unchanged; in particular, the pstate is left unchanged and not reset to its
+   * initial value.
    */
   void turn_on();
   /** Turns that host off. All actors are forcefully stopped. */
@@ -226,7 +226,7 @@ public:
 #endif /* !DOXYGEN */
 
 private:
-  simgrid::xbt::string name_ {"noname"};
+  xbt::string name_{"noname"};
   std::unordered_map<std::string, Storage*>* mounts_ = nullptr; // caching
 
 public:
@@ -239,8 +239,8 @@ public:
   kernel::routing::NetPoint* pimpl_netpoint = nullptr;
 #endif
 };
-}
-} // namespace simgrid::s4u
+} // namespace s4u
+} // namespace simgrid
 
 extern int USER_HOST_LEVEL;
 
index 0a502aa..8ac6040 100644 (file)
@@ -36,7 +36,7 @@ private:
 public:
   friend XBT_PUBLIC void intrusive_ptr_release(simgrid::s4u::Io* i);
   friend XBT_PUBLIC void intrusive_ptr_add_ref(simgrid::s4u::Io* i);
-  friend simgrid::s4u::Storage; // Factory of IOs
+  friend Storage; // Factory of IOs
 
   ~Io() = default;
 
@@ -52,8 +52,8 @@ public:
 #ifndef DOXYGEN
   XBT_ATTRIB_DEPRECATED_v324("Please use Io::wait_for()") void wait(double t) override { wait_for(t); }
 #endif
+};
 
-}; // class
 } // namespace s4u
 } // namespace simgrid
 
index 84fffeb..be6dfb2 100644 (file)
@@ -21,8 +21,8 @@
 namespace simgrid {
 namespace s4u {
 /** @brief A Link represents the network facilities between [hosts](@ref simgrid::s4u::Host) */
-class XBT_PUBLIC Link : public simgrid::xbt::Extendable<Link> {
-  friend simgrid::kernel::resource::LinkImpl;
+class XBT_PUBLIC Link : public xbt::Extendable<Link> {
+  friend kernel::resource::LinkImpl;
 
   // Links are created from the NetZone, and destroyed by their private implementation when the simulation ends
   explicit Link(kernel::resource::LinkImpl* pimpl) : pimpl_(pimpl) {}
@@ -98,22 +98,22 @@ public:
 
   /* The signals */
   /** @brief Callback signal fired when a new Link is created */
-  static simgrid::xbt::signal<void(s4u::Link&)> on_creation;
+  static xbt::signal<void(Link&)> on_creation;
 
   /** @brief Callback signal fired when a Link is destroyed */
-  static simgrid::xbt::signal<void(s4u::Link&)> on_destruction;
+  static xbt::signal<void(Link&)> on_destruction;
 
   /** @brief Callback signal fired when the state of a Link changes (when it is turned on or off) */
-  static simgrid::xbt::signal<void(s4u::Link&)> on_state_change;
+  static xbt::signal<void(Link&)> on_state_change;
 
   /** @brief Callback signal fired when the bandwidth of a Link changes */
-  static simgrid::xbt::signal<void(s4u::Link&)> on_bandwidth_change;
+  static xbt::signal<void(Link&)> on_bandwidth_change;
 
   /** @brief Callback signal fired when a communication starts */
-  static simgrid::xbt::signal<void(kernel::resource::NetworkAction*, s4u::Host* src, s4u::Host* dst)> on_communicate;
+  static xbt::signal<void(kernel::resource::NetworkAction*, Host* src, Host* dst)> on_communicate;
 
   /** @brief Callback signal fired when a communication changes it state (ready/done/cancel) */
-  static simgrid::xbt::signal<void(kernel::resource::NetworkAction*, kernel::resource::Action::State)>
+  static xbt::signal<void(kernel::resource::NetworkAction*, kernel::resource::Action::State)>
       on_communication_state_change;
 
 #ifndef DOXYGEN
@@ -156,16 +156,25 @@ public:
 
   /** @deprecated */
   XBT_ATTRIB_DEPRECATED_v323("Please use Link::get_state_profile()") void setStateTrace(
-      simgrid::kernel::profile::Profile* profile) {set_state_profile(profile); }
+      kernel::profile::Profile* profile)
+  {
+    set_state_profile(profile);
+  }
   /** @deprecated */
   XBT_ATTRIB_DEPRECATED_v323("Please use Link::get_bandwidth_profile()") void setBandwidthTrace(
-      simgrid::kernel::profile::Profile* profile) { set_bandwidth_profile(profile); }
+      kernel::profile::Profile* profile)
+  {
+    set_bandwidth_profile(profile);
+  }
   /** @deprecated */
   XBT_ATTRIB_DEPRECATED_v323("Please use Link::get_latency_profile()") void setLatencyTrace(
-      simgrid::kernel::profile::Profile* profile) { set_latency_profile(profile); }
+      kernel::profile::Profile* profile)
+  {
+    set_latency_profile(profile);
+  }
 #endif
 };
-}
-}
+} // namespace s4u
+} // namespace simgrid
 
 #endif /* SURF_NETWORK_INTERFACE_HPP_ */
index 3f3475a..4b34063 100644 (file)
@@ -16,10 +16,10 @@ namespace s4u {
 
 /** @brief Mailboxes: Network rendez-vous points. */
 class XBT_PUBLIC Mailbox {
-  friend simgrid::s4u::Comm;
-  friend simgrid::kernel::activity::MailboxImpl;
+  friend Comm;
+  friend kernel::activity::MailboxImpl;
 
-  simgrid::kernel::activity::MailboxImpl* const pimpl_;
+  kernel::activity::MailboxImpl* const pimpl_;
 
   explicit Mailbox(kernel::activity::MailboxImpl * mbox) : pimpl_(mbox) {}
 
@@ -28,7 +28,7 @@ public:
   kernel::activity::MailboxImpl* get_impl() { return pimpl_; }
 
   /** @brief Retrieves the name of that mailbox as a C++ string */
-  const simgrid::xbt::string& get_name() const;
+  const xbt::string& get_name() const;
   /** @brief Retrieves the name of that mailbox as a C string */
   const char* get_cname() const;
 
@@ -103,10 +103,7 @@ public:
   /** @deprecated Mailbox::get_receiver() */
   XBT_ATTRIB_DEPRECATED_v323("Please use Mailbox::get_receiver()") ActorPtr getReceiver() { return get_receiver(); }
   /** @deprecated Mailbox::get_name() */
-  XBT_ATTRIB_DEPRECATED_v323("Please use Mailbox::get_name()") const simgrid::xbt::string& getName() const
-  {
-    return get_name();
-  }
+  XBT_ATTRIB_DEPRECATED_v323("Please use Mailbox::get_name()") const xbt::string& getName() const { return get_name(); }
   /** @deprecated Mailbox::get_cname() */
   XBT_ATTRIB_DEPRECATED_v323("Please use Mailbox::get_cname()") const char* getCname() const { return get_cname(); }
   /** @deprecated Mailbox::get_impl() */
@@ -127,6 +124,7 @@ public:
 #endif
 };
 
-}} // namespace simgrid::s4u
+} // namespace s4u
+} // namespace simgrid
 
 #endif /* SIMGRID_S4U_MAILBOX_HPP */
index e1d391b..81b167c 100644 (file)
@@ -27,11 +27,11 @@ namespace s4u {
  *
  */
 class XBT_PUBLIC Mutex {
-  friend simgrid::s4u::ConditionVariable;
-  friend simgrid::kernel::activity::MutexImpl;
+  friend ConditionVariable;
+  friend kernel::activity::MutexImpl;
 
-  simgrid::kernel::activity::MutexImpl* const pimpl_;
-  explicit Mutex(simgrid::kernel::activity::MutexImpl* mutex) : pimpl_(mutex) {}
+  kernel::activity::MutexImpl* const pimpl_;
+  explicit Mutex(kernel::activity::MutexImpl* mutex) : pimpl_(mutex) {}
   /* refcounting */
   friend XBT_PUBLIC void intrusive_ptr_add_ref(Mutex* mutex);
   friend XBT_PUBLIC void intrusive_ptr_release(Mutex* mutex);
@@ -57,6 +57,7 @@ public:
 #endif
 };
 
-}} // namespace simgrid::s4u
+} // namespace s4u
+} // namespace simgrid
 
 #endif /* SIMGRID_S4U_MUTEX_HPP */
index 5329cf4..3855348 100644 (file)
@@ -25,7 +25,7 @@ namespace s4u {
  */
 class XBT_PUBLIC NetZone {
 protected:
-  friend simgrid::kernel::routing::NetZoneImpl;
+  friend kernel::routing::NetZoneImpl;
 
   explicit NetZone(kernel::routing::NetZoneImpl* impl);
   ~NetZone();
@@ -67,12 +67,12 @@ public:
                         std::vector<kernel::resource::LinkImpl*>& link_list, bool symmetrical);
 
   /*** Called on each newly created regular route (not on bypass routes) */
-  static simgrid::xbt::signal<void(bool symmetrical, kernel::routing::NetPoint* src, kernel::routing::NetPoint* dst,
-                                   kernel::routing::NetPoint* gw_src, kernel::routing::NetPoint* gw_dst,
-                                   std::vector<kernel::resource::LinkImpl*>& link_list)>
+  static xbt::signal<void(bool symmetrical, kernel::routing::NetPoint* src, kernel::routing::NetPoint* dst,
+                          kernel::routing::NetPoint* gw_src, kernel::routing::NetPoint* gw_dst,
+                          std::vector<kernel::resource::LinkImpl*>& link_list)>
       on_route_creation;
-  static simgrid::xbt::signal<void(NetZone&)> on_creation;
-  static simgrid::xbt::signal<void(NetZone&)> on_seal;
+  static xbt::signal<void(NetZone&)> on_creation;
+  static xbt::signal<void(NetZone&)> on_seal;
 
 #ifndef DOXYGEN
   // Deprecation wrappers
@@ -85,14 +85,14 @@ public:
   /** @deprecated NetZone::add_route() */
   XBT_ATTRIB_DEPRECATED_v323("Please use NetZone::add_route()") void addRoute(
       kernel::routing::NetPoint* src, kernel::routing::NetPoint* dst, kernel::routing::NetPoint* gw_src,
-      kernel::routing::NetPoint* gw_dst, std::vector<simgrid::kernel::resource::LinkImpl*>& link_list, bool symmetrical)
+      kernel::routing::NetPoint* gw_dst, std::vector<kernel::resource::LinkImpl*>& link_list, bool symmetrical)
   {
     add_route(src, dst, gw_src, gw_dst, link_list, symmetrical);
   }
   /** @deprecated NetZone::add_bypass_route() */
   XBT_ATTRIB_DEPRECATED_v323("Please use NetZone::add_bypass_route()") void addBypassRoute(
       kernel::routing::NetPoint* src, kernel::routing::NetPoint* dst, kernel::routing::NetPoint* gw_src,
-      kernel::routing::NetPoint* gw_dst, std::vector<simgrid::kernel::resource::LinkImpl*>& link_list, bool symmetrical)
+      kernel::routing::NetPoint* gw_dst, std::vector<kernel::resource::LinkImpl*>& link_list, bool symmetrical)
   {
     add_bypass_route(src, dst, gw_src, gw_dst, link_list, symmetrical);
   }
@@ -133,7 +133,8 @@ public:
   }
 #endif
 };
-}
-}; // Namespace simgrid::s4u
+
+} // namespace s4u
+} // namespace simgrid
 
 #endif /* SIMGRID_S4U_NETZONE_HPP */
index c4b7a94..2525e39 100644 (file)
@@ -52,6 +52,7 @@ public:
   int would_block();
 };
 
-}} // namespace simgrid::s4u
+} // namespace s4u
+} // namespace simgrid
 
 #endif /* SIMGRID_S4U_SEMAPHORE_HPP */
index 4ac1666..569a93a 100644 (file)
@@ -25,7 +25,7 @@ namespace s4u {
  * only computes the time taken by the corresponding data movement.
  */
 
-class XBT_PUBLIC Storage : public simgrid::xbt::Extendable<Storage> {
+class XBT_PUBLIC Storage : public xbt::Extendable<Storage> {
   friend Engine;
   friend Io;
   friend kernel::resource::StorageImpl;
@@ -37,11 +37,11 @@ protected:
   virtual ~Storage() = default;
 public:
   /** @brief Callback signal fired when a new Storage is created */
-  static xbt::signal<void(s4u::Storage&)> on_creation;
+  static xbt::signal<void(Storage&)> on_creation;
   /** @brief Callback signal fired when a Storage is destroyed */
-  static xbt::signal<void(s4u::Storage&)> on_destruction;
+  static xbt::signal<void(Storage&)> on_destruction;
   /** @brief Callback signal fired when a Storage's state changes */
-  static xbt::signal<void(s4u::Storage&)> on_state_change;
+  static xbt::signal<void(Storage&)> on_state_change;
 
   /** Retrieve a Storage by its name. It must exist in the platform file */
   static Storage* by_name(const std::string& name);
@@ -120,7 +120,7 @@ private:
   void* userdata_ = nullptr;
 };
 
-} /* namespace s4u */
-} /* namespace simgrid */
+} // namespace s4u
+} // namespace simgrid
 
 #endif /* INCLUDE_SIMGRID_S4U_STORAGE_HPP_ */
index 26a008c..b2bd8aa 100644 (file)
@@ -20,12 +20,12 @@ namespace s4u {
  *
  */
 class XBT_PUBLIC VirtualMachine : public s4u::Host {
-  simgrid::vm::VirtualMachineImpl* const pimpl_vm_;
+  vm::VirtualMachineImpl* const pimpl_vm_;
   virtual ~VirtualMachine();
 
 public:
-  explicit VirtualMachine(const std::string& name, s4u::Host* physical_host, int core_amount);
-  explicit VirtualMachine(const std::string& name, s4u::Host* physical_host, int core_amount, size_t ramsize);
+  explicit VirtualMachine(const std::string& name, Host* physical_host, int core_amount);
+  explicit VirtualMachine(const std::string& name, Host* physical_host, int core_amount, size_t ramsize);
 
   // No copy/move
   VirtualMachine(VirtualMachine const&) = delete;
@@ -38,27 +38,27 @@ public:
     DESTROYED
   };
 
-  simgrid::vm::VirtualMachineImpl* get_impl() { return pimpl_vm_; }
+  vm::VirtualMachineImpl* get_impl() { return pimpl_vm_; }
   void start();
   void suspend();
   void resume();
   void shutdown();
   void destroy();
 
-  simgrid::s4u::Host* get_pm();
-  void set_pm(simgrid::s4u::Host* pm);
+  Host* get_pm();
+  void set_pm(Host* pm);
   size_t get_ramsize();
   void set_ramsize(size_t ramsize);
   void set_bound(double bound);
 
   VirtualMachine::state get_state();
-  static simgrid::xbt::signal<void(VirtualMachine&)> on_start;
-  static simgrid::xbt::signal<void(VirtualMachine&)> on_started;
-  static simgrid::xbt::signal<void(VirtualMachine&)> on_shutdown;
-  static simgrid::xbt::signal<void(VirtualMachine&)> on_suspend;
-  static simgrid::xbt::signal<void(VirtualMachine&)> on_resume;
-  static simgrid::xbt::signal<void(VirtualMachine&)> on_migration_start;
-  static simgrid::xbt::signal<void(VirtualMachine&)> on_migration_end;
+  static xbt::signal<void(VirtualMachine&)> on_start;
+  static xbt::signal<void(VirtualMachine&)> on_started;
+  static xbt::signal<void(VirtualMachine&)> on_shutdown;
+  static xbt::signal<void(VirtualMachine&)> on_suspend;
+  static xbt::signal<void(VirtualMachine&)> on_resume;
+  static xbt::signal<void(VirtualMachine&)> on_migration_start;
+  static xbt::signal<void(VirtualMachine&)> on_migration_end;
 
 #ifndef DOXYGEN
   // Deprecated methods
@@ -68,14 +68,14 @@ public:
     return get_state();
   }
   /** @deprecated See VirtualMachine::get_impl() */
-  XBT_ATTRIB_DEPRECATED_v323("Please use VirtualMachine::get_impl()") simgrid::vm::VirtualMachineImpl* getImpl()
+  XBT_ATTRIB_DEPRECATED_v323("Please use VirtualMachine::get_impl()") vm::VirtualMachineImpl* getImpl()
   {
     return pimpl_vm_;
   }
   /** @deprecated See VirtualMachine::get_pm() */
-  XBT_ATTRIB_DEPRECATED_v323("Please use VirtualMachine::get_pm()") simgrid::s4u::Host* getPm() { return get_pm(); }
+  XBT_ATTRIB_DEPRECATED_v323("Please use VirtualMachine::get_pm()") Host* getPm() { return get_pm(); }
   /** @deprecated See VirtualMachine::set_pm() */
-  XBT_ATTRIB_DEPRECATED_v323("Please use VirtualMachine::set_pm()") void setPm(simgrid::s4u::Host* pm) { set_pm(pm); }
+  XBT_ATTRIB_DEPRECATED_v323("Please use VirtualMachine::set_pm()") void setPm(Host* pm) { set_pm(pm); }
   /** @deprecated See VirtualMachine::get_ramsize() */
   XBT_ATTRIB_DEPRECATED_v323("Please use VirtualMachine::get_ramsize()") size_t getRamsize() { return get_ramsize(); }
   /** @deprecated See VirtualMachine::set_ramsize() */
@@ -87,7 +87,7 @@ public:
   XBT_ATTRIB_DEPRECATED_v323("Please use VirtualMachine::set_bound()") void setBound(double bound) { set_bound(bound); }
 #endif
 };
-}
-} // namespace simgrid::s4u
+} // namespace s4u
+} // namespace simgrid
 
 #endif
index fa4677e..1b45a6a 100644 (file)
@@ -21,21 +21,21 @@ XBT_LOG_NEW_DEFAULT_CATEGORY(s4u_actor, "S4U actors");
 namespace simgrid {
 namespace s4u {
 
-simgrid::xbt::signal<void(simgrid::s4u::ActorPtr)> s4u::Actor::on_creation;
-simgrid::xbt::signal<void(simgrid::s4u::ActorPtr)> s4u::Actor::on_suspend;
-simgrid::xbt::signal<void(simgrid::s4u::ActorPtr)> s4u::Actor::on_resume;
-simgrid::xbt::signal<void(simgrid::s4u::ActorPtr)> s4u::Actor::on_sleep;
-simgrid::xbt::signal<void(simgrid::s4u::ActorPtr)> s4u::Actor::on_wake_up;
-simgrid::xbt::signal<void(simgrid::s4u::ActorPtr)> s4u::Actor::on_migration_start;
-simgrid::xbt::signal<void(simgrid::s4u::ActorPtr)> s4u::Actor::on_migration_end;
-simgrid::xbt::signal<void(simgrid::s4u::ActorPtr)> s4u::Actor::on_destruction;
+xbt::signal<void(ActorPtr)> s4u::Actor::on_creation;
+xbt::signal<void(ActorPtr)> s4u::Actor::on_suspend;
+xbt::signal<void(ActorPtr)> s4u::Actor::on_resume;
+xbt::signal<void(ActorPtr)> s4u::Actor::on_sleep;
+xbt::signal<void(ActorPtr)> s4u::Actor::on_wake_up;
+xbt::signal<void(ActorPtr)> s4u::Actor::on_migration_start;
+xbt::signal<void(ActorPtr)> s4u::Actor::on_migration_end;
+xbt::signal<void(ActorPtr)> s4u::Actor::on_destruction;
 
 // ***** Actor creation *****
 ActorPtr Actor::self()
 {
-  smx_context_t self_context = simgrid::kernel::context::Context::self();
+  smx_context_t self_context = kernel::context::Context::self();
   if (self_context == nullptr)
-    return simgrid::s4u::ActorPtr();
+    return ActorPtr();
 
   return self_context->get_actor()->iface();
 }
@@ -64,7 +64,7 @@ ActorPtr Actor::create(const std::string& name, s4u::Host* host, const std::func
 ActorPtr Actor::create(const std::string& name, s4u::Host* host, const std::string& function,
                        std::vector<std::string> args)
 {
-  simgrid::simix::ActorCodeFactory& factory = SIMIX_get_actor_code_factory(function);
+  simix::ActorCodeFactory& factory = SIMIX_get_actor_code_factory(function);
   return create(name, host, factory(std::move(args)));
 }
 
@@ -91,11 +91,11 @@ void Actor::join(double timeout)
 
 void Actor::set_auto_restart(bool autorestart)
 {
-  simgrid::simix::simcall([this, autorestart]() {
+  simix::simcall([this, autorestart]() {
     xbt_assert(autorestart && not pimpl_->has_to_auto_restart()); // FIXME: handle all cases
     pimpl_->set_auto_restart(autorestart);
 
-    simgrid::kernel::actor::ProcessArg* arg = new simgrid::kernel::actor::ProcessArg(pimpl_->get_host(), pimpl_);
+    kernel::actor::ProcessArg* arg = new kernel::actor::ProcessArg(pimpl_->get_host(), pimpl_);
     XBT_DEBUG("Adding Process %s to the actors_at_boot_ list of Host %s", arg->name.c_str(), arg->host->get_cname());
     pimpl_->get_host()->pimpl_->actors_at_boot_.emplace_back(arg);
   });
@@ -105,7 +105,7 @@ void Actor::on_exit(int_f_pvoid_pvoid_t fun,
                     void* data) /* deprecated: cleanup SIMIX_process_on_exit: change prototype of second parameter and
                                    remove the last one */
 {
-  simgrid::simix::simcall([this, fun, data] { SIMIX_process_on_exit(pimpl_, fun, data); });
+  simix::simcall([this, fun, data] { SIMIX_process_on_exit(pimpl_, fun, data); });
 }
 
 void Actor::on_exit(const std::function<void(int, void*)>& fun, void* data) /* deprecated */
@@ -115,7 +115,7 @@ void Actor::on_exit(const std::function<void(int, void*)>& fun, void* data) /* d
 
 void Actor::on_exit(const std::function<void(bool /*failed*/)>& fun)
 {
-  simgrid::simix::simcall(
+  simix::simcall(
       [this, fun] { SIMIX_process_on_exit(pimpl_, [fun](int a, void* /*data*/) { fun(a != 0); }, nullptr); });
 }
 
@@ -123,12 +123,12 @@ void Actor::migrate(Host* new_host)
 {
   s4u::Actor::on_migration_start(this);
 
-  simgrid::simix::simcall([this, new_host]() {
+  simix::simcall([this, new_host]() {
     if (pimpl_->waiting_synchro != nullptr) {
       // The actor is blocked on an activity. If it's an exec, migrate it too.
       // FIXME: implement the migration of other kind of activities
-      simgrid::kernel::activity::ExecImplPtr exec =
-          boost::dynamic_pointer_cast<simgrid::kernel::activity::ExecImpl>(pimpl_->waiting_synchro);
+      kernel::activity::ExecImplPtr exec =
+          boost::dynamic_pointer_cast<kernel::activity::ExecImpl>(pimpl_->waiting_synchro);
       xbt_assert(exec.get() != nullptr, "We can only migrate blocked actors when they are blocked on executions.");
       exec->migrate(new_host);
     }
@@ -145,7 +145,7 @@ s4u::Host* Actor::get_host()
 
 void Actor::daemonize()
 {
-  simgrid::simix::simcall([this]() { pimpl_->daemonize(); });
+  simix::simcall([this]() { pimpl_->daemonize(); });
 }
 
 bool Actor::is_daemon() const
@@ -181,18 +181,18 @@ void Actor::suspend()
 
 void Actor::resume()
 {
-  simgrid::simix::simcall([this] { pimpl_->resume(); });
+  simix::simcall([this] { pimpl_->resume(); });
   s4u::Actor::on_resume(this);
 }
 
 bool Actor::is_suspended()
 {
-  return simgrid::simix::simcall([this] { return pimpl_->is_suspended(); });
+  return simix::simcall([this] { return pimpl_->is_suspended(); });
 }
 
 void Actor::set_kill_time(double kill_time)
 {
-  simgrid::simix::simcall([this, kill_time] { pimpl_->set_kill_time(kill_time); });
+  simix::simcall([this, kill_time] { pimpl_->set_kill_time(kill_time); });
 }
 
 /** @brief Get the kill time of an actor(or 0 if unset). */
@@ -203,10 +203,10 @@ double Actor::get_kill_time()
 
 void Actor::kill(aid_t pid) // deprecated
 {
-  smx_actor_t killer  = SIMIX_process_self();
-  smx_actor_t victim  = SIMIX_process_from_PID(pid);
+  kernel::actor::ActorImpl* killer = SIMIX_process_self();
+  kernel::actor::ActorImpl* victim = SIMIX_process_from_PID(pid);
   if (victim != nullptr) {
-    simgrid::simix::simcall([killer, victim] { killer->kill(victim); });
+    simix::simcall([killer, victim] { killer->kill(victim); });
   } else {
     std::ostringstream oss;
     oss << "kill: (" << pid << ") - No such actor" << std::endl;
@@ -216,8 +216,8 @@ void Actor::kill(aid_t pid) // deprecated
 
 void Actor::kill()
 {
-  smx_actor_t process = SIMIX_process_self();
-  simgrid::simix::simcall([this, process] {
+  kernel::actor::ActorImpl* process = SIMIX_process_self();
+  simix::simcall([this, process] {
     if (pimpl_ == simix_global->maestro_process)
       pimpl_->exit();
     else
@@ -225,7 +225,7 @@ void Actor::kill()
   });
 }
 
-smx_actor_t Actor::get_impl()
+kernel::actor::ActorImpl* Actor::get_impl()
 {
   return pimpl_;
 }
@@ -234,7 +234,7 @@ smx_actor_t Actor::get_impl()
 
 ActorPtr Actor::by_pid(aid_t pid)
 {
-  smx_actor_t process = SIMIX_process_from_PID(pid);
+  kernel::actor::ActorImpl* process = SIMIX_process_from_PID(pid);
   if (process != nullptr)
     return process->iface();
   else
@@ -243,29 +243,29 @@ ActorPtr Actor::by_pid(aid_t pid)
 
 void Actor::kill_all()
 {
-  smx_actor_t self = SIMIX_process_self();
-  simgrid::simix::simcall([self] { self->kill_all(); });
+  kernel::actor::ActorImpl* self = SIMIX_process_self();
+  simix::simcall([self] { self->kill_all(); });
 }
 
 std::unordered_map<std::string, std::string>* Actor::get_properties()
 {
-  return simgrid::simix::simcall([this] { return this->pimpl_->get_properties(); });
+  return simix::simcall([this] { return this->pimpl_->get_properties(); });
 }
 
 /** Retrieve the property value (or nullptr if not set) */
 const char* Actor::get_property(const std::string& key)
 {
-  return simgrid::simix::simcall([this, &key] { return pimpl_->get_property(key); });
+  return simix::simcall([this, &key] { return pimpl_->get_property(key); });
 }
 
 void Actor::set_property(const std::string& key, const std::string& value)
 {
-  simgrid::simix::simcall([this, &key, &value] { pimpl_->set_property(key, value); });
+  simix::simcall([this, &key, &value] { pimpl_->set_property(key, value); });
 }
 
 Actor* Actor::restart()
 {
-  return simgrid::simix::simcall([this]() { return pimpl_->restart(); });
+  return simix::simcall([this]() { return pimpl_->restart(); });
 }
 
 // ***** this_actor *****
@@ -283,25 +283,25 @@ namespace this_actor {
  */
 bool is_maestro()
 {
-  smx_actor_t process = SIMIX_process_self();
+  kernel::actor::ActorImpl* process = SIMIX_process_self();
   return process == nullptr || process == simix_global->maestro_process;
 }
 
 void sleep_for(double duration)
 {
   if (duration > 0) {
-    smx_actor_t actor = SIMIX_process_self();
-    simgrid::s4u::Actor::on_sleep(actor->iface());
+    kernel::actor::ActorImpl* actor = SIMIX_process_self();
+    Actor::on_sleep(actor->iface());
 
     simcall_process_sleep(duration);
 
-    simgrid::s4u::Actor::on_wake_up(actor->iface());
+    Actor::on_wake_up(actor->iface());
   }
 }
 
 void yield()
 {
-  simgrid::simix::simcall([] { /* do nothing*/ });
+  simix::simcall([] { /* do nothing*/ });
 }
 
 XBT_PUBLIC void sleep_until(double timeout)
@@ -337,10 +337,10 @@ void parallel_execute(const std::vector<s4u::Host*>& hosts, const std::vector<do
              "bytes_amounts must be a matrix of size host_count * host_count (%zu*%zu), but it's of size %zu.",
              hosts.size(), hosts.size(), flops_amounts.size());
   /* Check that we are not mixing VMs and PMs in the parallel task */
-  bool is_a_vm = (nullptr != dynamic_cast<simgrid::s4u::VirtualMachine*>(hosts.front()));
+  bool is_a_vm = (nullptr != dynamic_cast<VirtualMachine*>(hosts.front()));
   xbt_assert(std::all_of(hosts.begin(), hosts.end(),
                          [is_a_vm](s4u::Host* elm) {
-                           bool tmp_is_a_vm = (nullptr != dynamic_cast<simgrid::s4u::VirtualMachine*>(elm));
+                           bool tmp_is_a_vm = (nullptr != dynamic_cast<VirtualMachine*>(elm));
                            return is_a_vm == tmp_is_a_vm;
                          }),
              "parallel_execute: mixing VMs and PMs is not supported (yet).");
@@ -419,23 +419,23 @@ Host* get_host()
 
 void suspend()
 {
-  smx_actor_t actor = SIMIX_process_self();
-  simgrid::s4u::Actor::on_suspend(actor->iface());
+  kernel::actor::ActorImpl* actor = SIMIX_process_self();
+  Actor::on_suspend(actor->iface());
 
   simcall_process_suspend(actor);
 }
 
 void resume()
 {
-  smx_actor_t process = SIMIX_process_self();
-  simgrid::simix::simcall([process] { process->resume(); });
-  simgrid::s4u::Actor::on_resume(process->iface());
+  kernel::actor::ActorImpl* self = SIMIX_process_self();
+  simix::simcall([self] { self->resume(); });
+  Actor::on_resume(self->iface());
 }
 
 void exit()
 {
-  smx_actor_t actor = SIMIX_process_self();
-  simgrid::simix::simcall([actor] { actor->exit(); });
+  kernel::actor::ActorImpl* self = SIMIX_process_self();
+  simgrid::simix::simcall([self] { self->exit(); });
 }
 
 void on_exit(const std::function<void(bool)>& fun)
index 7aa422a..16b1284 100644 (file)
@@ -14,9 +14,9 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(s4u_comm, s4u_activity, "S4U asynchronous commun
 
 namespace simgrid {
 namespace s4u {
-simgrid::xbt::signal<void(simgrid::s4u::ActorPtr)> s4u::Comm::on_sender_start;
-simgrid::xbt::signal<void(simgrid::s4u::ActorPtr)> s4u::Comm::on_receiver_start;
-simgrid::xbt::signal<void(simgrid::s4u::ActorPtr)> s4u::Comm::on_completion;
+xbt::signal<void(ActorPtr)> Comm::on_sender_start;
+xbt::signal<void(ActorPtr)> Comm::on_receiver_start;
+xbt::signal<void(ActorPtr)> Comm::on_completion;
 
 Comm::~Comm()
 {
@@ -32,11 +32,9 @@ Comm::~Comm()
 
 int Comm::wait_any_for(std::vector<CommPtr>* comms, double timeout)
 {
-  std::unique_ptr<simgrid::kernel::activity::CommImpl* []> rcomms(
-      new simgrid::kernel::activity::CommImpl*[comms->size()]);
-  std::transform(begin(*comms), end(*comms), rcomms.get(), [](const CommPtr& comm) {
-    return static_cast<simgrid::kernel::activity::CommImpl*>(comm->pimpl_.get());
-  });
+  std::unique_ptr<kernel::activity::CommImpl* []> rcomms(new kernel::activity::CommImpl*[comms->size()]);
+  std::transform(begin(*comms), end(*comms), rcomms.get(),
+                 [](const CommPtr& comm) { return static_cast<kernel::activity::CommImpl*>(comm->pimpl_.get()); });
   return simcall_comm_waitany(rcomms.get(), comms->size(), timeout);
 }
 
@@ -178,11 +176,9 @@ Comm* Comm::wait_for(double timeout)
 }
 int Comm::test_any(std::vector<CommPtr>* comms)
 {
-  std::unique_ptr<simgrid::kernel::activity::CommImpl* []> rcomms(
-      new simgrid::kernel::activity::CommImpl*[comms->size()]);
-  std::transform(begin(*comms), end(*comms), rcomms.get(), [](const CommPtr& comm) {
-    return static_cast<simgrid::kernel::activity::CommImpl*>(comm->pimpl_.get());
-  });
+  std::unique_ptr<kernel::activity::CommImpl* []> rcomms(new kernel::activity::CommImpl*[comms->size()]);
+  std::transform(begin(*comms), end(*comms), rcomms.get(),
+                 [](const CommPtr& comm) { return static_cast<kernel::activity::CommImpl*>(comm->pimpl_.get()); });
   return simcall_comm_testany(rcomms.get(), comms->size());
 }
 
@@ -197,7 +193,7 @@ Comm* Comm::detach()
 
 Comm* Comm::cancel()
 {
-  simgrid::simix::simcall([this] {
+  simix::simcall([this] {
     if (pimpl_)
       boost::static_pointer_cast<kernel::activity::CommImpl>(pimpl_)->cancel();
   });
index d778b75..141c981 100644 (file)
@@ -38,34 +38,33 @@ Engine* Engine::instance_ = nullptr; /* That singleton is awful, but I don't see
 
 Engine::Engine(int* argc, char** argv) : pimpl(new kernel::EngineImpl())
 {
-  xbt_assert(s4u::Engine::instance_ == nullptr,
-             "It is currently forbidden to create more than one instance of s4u::Engine");
+  xbt_assert(Engine::instance_ == nullptr, "It is currently forbidden to create more than one instance of s4u::Engine");
   TRACE_global_init();
   SIMIX_global_init(argc, argv);
 
-  s4u::Engine::instance_ = this;
+  Engine::instance_ = this;
 }
 
 Engine::~Engine()
 {
   delete pimpl;
-  s4u::Engine::instance_ = nullptr;
+  Engine::instance_ = nullptr;
 }
 
 /** @brief Retrieve the engine singleton */
 Engine* Engine::get_instance()
 {
-  if (s4u::Engine::instance_ == nullptr) {
+  if (Engine::instance_ == nullptr) {
     auto e = new Engine(0, nullptr);
-    xbt_assert(s4u::Engine::instance_ == e);
+    xbt_assert(Engine::instance_ == e);
   }
-  return s4u::Engine::instance_;
+  return Engine::instance_;
 }
 
 void Engine::shutdown()
 {
-  delete s4u::Engine::instance_;
-  s4u::Engine::instance_ = nullptr;
+  delete Engine::instance_;
+  Engine::instance_ = nullptr;
 }
 
 double Engine::get_clock()
@@ -139,7 +138,7 @@ std::vector<Host*> Engine::get_filtered_hosts(const std::function<bool(Host*)>&
   return hosts;
 }
 
-void Engine::host_register(const std::string& name, simgrid::s4u::Host* host)
+void Engine::host_register(const std::string& name, Host* host)
 {
   pimpl->hosts_[name] = host;
 }
@@ -153,7 +152,7 @@ void Engine::host_unregister(const std::string& name)
  *
  *  @throw std::invalid_argument if the searched host does not exist.
  */
-simgrid::s4u::Host* Engine::host_by_name(const std::string& name)
+Host* Engine::host_by_name(const std::string& name)
 {
   if (pimpl->hosts_.find(name) == pimpl->hosts_.end())
     throw std::invalid_argument(std::string("Host not found: '") + name + std::string("'"));
@@ -161,7 +160,7 @@ simgrid::s4u::Host* Engine::host_by_name(const std::string& name)
 }
 
 /** @brief Find a host from its name (or nullptr if that host does not exist) */
-simgrid::s4u::Host* Engine::host_by_name_or_null(const std::string& name)
+Host* Engine::host_by_name_or_null(const std::string& name)
 {
   auto host = pimpl->hosts_.find(name);
   return host == pimpl->hosts_.end() ? nullptr : host->second;
@@ -171,7 +170,7 @@ simgrid::s4u::Host* Engine::host_by_name_or_null(const std::string& name)
  *
  *  @throw std::invalid_argument if the searched link does not exist.
  */
-simgrid::s4u::Link* Engine::link_by_name(const std::string& name)
+Link* Engine::link_by_name(const std::string& name)
 {
   if (pimpl->links_.find(name) == pimpl->links_.end())
     throw std::invalid_argument(std::string("Link not found: ") + name);
@@ -180,13 +179,13 @@ simgrid::s4u::Link* Engine::link_by_name(const std::string& name)
 }
 
 /** @brief Find an link from its name (or nullptr if that link does not exist) */
-simgrid::s4u::Link* Engine::link_by_name_or_null(const std::string& name)
+Link* Engine::link_by_name_or_null(const std::string& name)
 {
   auto link = pimpl->links_.find(name);
   return link == pimpl->links_.end() ? nullptr : link->second;
 }
 
-void Engine::link_register(const std::string& name, simgrid::s4u::Link* link)
+void Engine::link_register(const std::string& name, Link* link)
 {
   pimpl->links_[name] = link;
 }
@@ -215,7 +214,7 @@ std::vector<Storage*> Engine::get_all_storages()
  *
  *  @throw std::invalid_argument if the searched storage does not exist.
  */
-simgrid::s4u::Storage* Engine::storage_by_name(const std::string& name)
+Storage* Engine::storage_by_name(const std::string& name)
 {
   if (pimpl->storages_.find(name) == pimpl->storages_.end())
     throw std::invalid_argument(std::string("Storage not found: ") + name);
@@ -224,13 +223,13 @@ simgrid::s4u::Storage* Engine::storage_by_name(const std::string& name)
 }
 
 /** @brief Find a storage from its name (or nullptr if that storage does not exist) */
-simgrid::s4u::Storage* Engine::storage_by_name_or_null(const std::string& name)
+Storage* Engine::storage_by_name_or_null(const std::string& name)
 {
   auto storage = pimpl->storages_.find(name);
   return storage == pimpl->storages_.end() ? nullptr : storage->second;
 }
 
-void Engine::storage_register(const std::string& name, simgrid::s4u::Storage* storage)
+void Engine::storage_register(const std::string& name, Storage* storage)
 {
   pimpl->storages_[name] = storage;
 }
@@ -314,13 +313,13 @@ void Engine::set_netzone_root(s4u::NetZone* netzone)
   pimpl->netzone_root_ = netzone->get_impl();
 }
 
-static s4u::NetZone* netzone_by_name_recursive(s4u::NetZone* current, const std::string& name)
+static NetZone* netzone_by_name_recursive(NetZone* current, const std::string& name)
 {
   if (current->get_name() == name)
     return current;
 
   for (auto const& elem : current->get_children()) {
-    simgrid::s4u::NetZone* tmp = netzone_by_name_recursive(elem, name);
+    NetZone* tmp = netzone_by_name_recursive(elem, name);
     if (tmp != nullptr) {
       return tmp;
     }
@@ -335,37 +334,38 @@ NetZone* Engine::netzone_by_name_or_null(const std::string& name)
 }
 
 /** @brief Retrieve the netpoint of the given name (or nullptr if not found) */
-simgrid::kernel::routing::NetPoint* Engine::netpoint_by_name_or_null(const std::string& name)
+kernel::routing::NetPoint* Engine::netpoint_by_name_or_null(const std::string& name)
 {
   auto netp = pimpl->netpoints_.find(name);
   return netp == pimpl->netpoints_.end() ? nullptr : netp->second;
 }
 
 /** @brief Fill the provided vector with all existing netpoints */
-void Engine::getNetpointList(std::vector<simgrid::kernel::routing::NetPoint*>* list)
+void Engine::getNetpointList(std::vector<kernel::routing::NetPoint*>* list)
 {
   for (auto const& kv : pimpl->netpoints_)
     list->push_back(kv.second);
 }
-std::vector<simgrid::kernel::routing::NetPoint*> Engine::get_all_netpoints()
+std::vector<kernel::routing::NetPoint*> Engine::get_all_netpoints()
 {
-  std::vector<simgrid::kernel::routing::NetPoint*> res;
+  std::vector<kernel::routing::NetPoint*> res;
   for (auto const& kv : pimpl->netpoints_)
     res.push_back(kv.second);
   return res;
 }
 
 /** @brief Register a new netpoint to the system */
-void Engine::netpoint_register(simgrid::kernel::routing::NetPoint* point)
+void Engine::netpoint_register(kernel::routing::NetPoint* point)
 {
   // simgrid::simix::simcall([&]{ FIXME: this segfaults in set_thread
   pimpl->netpoints_[point->get_name()] = point;
   // });
 }
+
 /** @brief Unregister a given netpoint */
-void Engine::netpoint_unregister(simgrid::kernel::routing::NetPoint* point)
+void Engine::netpoint_unregister(kernel::routing::NetPoint* point)
 {
-  simgrid::simix::simcall([this, point] {
+  simix::simcall([this, point] {
     pimpl->netpoints_.erase(point->get_name());
     delete point;
   });
@@ -377,7 +377,7 @@ bool Engine::is_initialized()
 }
 void Engine::set_config(const std::string& str)
 {
-  simgrid::config::set_parse(str);
+  config::set_parse(str);
 }
 } // namespace s4u
 } // namespace simgrid
index f2516f3..c3431b5 100644 (file)
@@ -12,8 +12,8 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(s4u_exec, s4u_activity, "S4U asynchronous execut
 
 namespace simgrid {
 namespace s4u {
-simgrid::xbt::signal<void(simgrid::s4u::ActorPtr)> s4u::Exec::on_start;
-simgrid::xbt::signal<void(simgrid::s4u::ActorPtr)> s4u::Exec::on_completion;
+xbt::signal<void(ActorPtr)> Exec::on_start;
+xbt::signal<void(ActorPtr)> Exec::on_completion;
 
 Exec::Exec()
 {
@@ -55,7 +55,7 @@ Exec* Exec::wait_for(double)
 
 Exec* Exec::cancel()
 {
-  simgrid::simix::simcall([this] { boost::static_pointer_cast<kernel::activity::ExecImpl>(pimpl_)->cancel(); });
+  simix::simcall([this] { boost::static_pointer_cast<kernel::activity::ExecImpl>(pimpl_)->cancel(); });
   state_ = State::CANCELED;
   return this;
 }
@@ -196,9 +196,8 @@ Exec* ExecPar::start()
 }
 double ExecPar::get_remaining_ratio()
 {
-  return simgrid::simix::simcall([this]() {
-    return boost::static_pointer_cast<simgrid::kernel::activity::ExecImpl>(pimpl_)->get_par_remaining_ratio();
-  });
+  return simix::simcall(
+      [this]() { return boost::static_pointer_cast<kernel::activity::ExecImpl>(pimpl_)->get_par_remaining_ratio(); });
 }
 
 double ExecPar::get_remaining()
index f17edf7..746d4d3 100644 (file)
@@ -18,23 +18,22 @@ XBT_LOG_EXTERNAL_CATEGORY(surf_route);
 int USER_HOST_LEVEL = -1;
 
 namespace simgrid {
-
 namespace xbt {
-template class Extendable<simgrid::s4u::Host>;
-}
+template class Extendable<s4u::Host>;
+} // namespace xbt
 
 namespace s4u {
 
-simgrid::xbt::signal<void(Host&)> Host::on_creation;
-simgrid::xbt::signal<void(Host&)> Host::on_destruction;
-simgrid::xbt::signal<void(Host&)> Host::on_state_change;
-simgrid::xbt::signal<void(Host&)> Host::on_speed_change;
+xbt::signal<void(Host&)> Host::on_creation;
+xbt::signal<void(Host&)> Host::on_destruction;
+xbt::signal<void(Host&)> Host::on_state_change;
+xbt::signal<void(Host&)> Host::on_speed_change;
 
 Host::Host(const std::string& name) : name_(name)
 {
   xbt_assert(Host::by_name_or_null(name_) == nullptr, "Refusing to create a second host named '%s'.", get_cname());
   Engine::get_instance()->host_register(name_, this);
-  new simgrid::surf::HostImpl(this);
+  new surf::HostImpl(this);
 }
 
 Host::~Host()
@@ -43,7 +42,7 @@ Host::~Host()
 
   delete pimpl_;
   if (pimpl_netpoint != nullptr) // not removed yet by a children class
-    simgrid::s4u::Engine::get_instance()->netpoint_unregister(pimpl_netpoint);
+    Engine::get_instance()->netpoint_unregister(pimpl_netpoint);
   delete pimpl_cpu;
   delete mounts_;
 }
@@ -52,9 +51,8 @@ Host::~Host()
  *
  * Don't delete directly a host, call h->destroy() instead.
  *
- * This is cumbersome but this is the simplest solution to ensure that the
- * onDestruction() callback receives a valid object (because of the destructor
- * order in a class hierarchy).
+ * This is cumbersome but this is the simplest solution to ensure that the onDestruction() callback receives a valid
+ * object (because of the destructor order in a class hierarchy).
  */
 void Host::destroy()
 {
@@ -77,7 +75,7 @@ Host* Host::by_name_or_null(const std::string& name)
 
 Host* Host::current()
 {
-  smx_actor_t self = SIMIX_process_self();
+  kernel::actor::ActorImpl* self = SIMIX_process_self();
   if (self == nullptr)
     xbt_die("Cannot call Host::current() from the maestro context");
   return self->get_host();
@@ -86,7 +84,7 @@ Host* Host::current()
 void Host::turn_on()
 {
   if (not is_on()) {
-    simgrid::simix::simcall([this] {
+    simix::simcall([this] {
       this->pimpl_cpu->turn_on();
       this->pimpl_->turn_on();
       on_state_change(*this);
@@ -98,7 +96,7 @@ void Host::turn_on()
 void Host::turn_off()
 {
   if (is_on()) {
-    simgrid::simix::simcall([this] {
+    simix::simcall([this] {
       this->pimpl_cpu->turn_off();
       this->pimpl_->turn_off();
 
@@ -172,7 +170,7 @@ void Host::route_to(Host* dest, std::vector<Link*>& links, double* latency)
 /** @brief Just like Host::routeTo, but filling an array of link implementations */
 void Host::route_to(Host* dest, std::vector<kernel::resource::LinkImpl*>& links, double* latency)
 {
-  simgrid::kernel::routing::NetZoneImpl::get_global_route(pimpl_netpoint, dest->pimpl_netpoint, links, latency);
+  kernel::routing::NetZoneImpl::get_global_route(pimpl_netpoint, dest->pimpl_netpoint, links, latency);
   if (XBT_LOG_ISENABLED(surf_route, xbt_log_priority_debug)) {
     XBT_CDEBUG(surf_route, "Route from '%s' to '%s' (latency: %f):", get_cname(), dest->get_cname(),
                (latency == nullptr ? -1 : *latency));
@@ -184,7 +182,7 @@ void Host::route_to(Host* dest, std::vector<kernel::resource::LinkImpl*>& links,
 /** Get the properties assigned to a host */
 std::unordered_map<std::string, std::string>* Host::get_properties()
 {
-  return simgrid::simix::simcall([this] { return this->pimpl_->get_properties(); });
+  return simix::simcall([this] { return this->pimpl_->get_properties(); });
 }
 
 /** Retrieve the property value (or nullptr if not set) */
@@ -195,13 +193,13 @@ const char* Host::get_property(const std::string& key) const
 
 void Host::set_property(const std::string& key, const std::string& value)
 {
-  simgrid::simix::simcall([this, &key, &value] { this->pimpl_->set_property(key, value); });
+  simix::simcall([this, &key, &value] { this->pimpl_->set_property(key, value); });
 }
 /** Specify a profile turning the host on and off according to a exhaustive list or a stochastic law.
  * The profile must contain boolean values. */
 void Host::set_state_profile(kernel::profile::Profile* p)
 {
-  return simgrid::simix::simcall([this, p] { pimpl_cpu->set_state_profile(p); });
+  return simix::simcall([this, p] { pimpl_cpu->set_state_profile(p); });
 }
 /** Specify a profile modeling the external load according to a exhaustive list or a stochastic law.
  *
@@ -211,13 +209,13 @@ void Host::set_state_profile(kernel::profile::Profile* p)
  */
 void Host::set_speed_profile(kernel::profile::Profile* p)
 {
-  return simgrid::simix::simcall([this, p] { pimpl_cpu->set_speed_profile(p); });
+  return simix::simcall([this, p] { pimpl_cpu->set_speed_profile(p); });
 }
 
 /** @brief Get the peak processor speed (in flops/s), at the specified pstate  */
 double Host::get_pstate_speed(int pstate_index) const
 {
-  return simgrid::simix::simcall([this, pstate_index] { return this->pimpl_cpu->get_pstate_peak_speed(pstate_index); });
+  return simix::simcall([this, pstate_index] { return this->pimpl_cpu->get_pstate_peak_speed(pstate_index); });
 }
 
 /** @brief Get the peak computing speed in flops/s at the current pstate, NOT taking the external load into account.
@@ -266,7 +264,7 @@ int Host::get_core_count() const
 /** @brief Set the pstate at which the host should run */
 void Host::set_pstate(int pstate_index)
 {
-  simgrid::simix::simcall([this, pstate_index] { this->pimpl_cpu->set_pstate(pstate_index); });
+  simix::simcall([this, pstate_index] { this->pimpl_cpu->set_pstate(pstate_index); });
 }
 /** @brief Retrieve the pstate at which the host is currently running */
 int Host::get_pstate() const
@@ -281,13 +279,12 @@ int Host::get_pstate() const
  */
 std::vector<const char*> Host::get_attached_storages() const
 {
-  return simgrid::simix::simcall([this] { return this->pimpl_->get_attached_storages(); });
+  return simix::simcall([this] { return this->pimpl_->get_attached_storages(); });
 }
 
 void Host::getAttachedStorages(std::vector<const char*>* storages)
 {
-  std::vector<const char*> local_storages =
-      simgrid::simix::simcall([this] { return this->pimpl_->get_attached_storages(); });
+  std::vector<const char*> local_storages = simix::simcall([this] { return this->pimpl_->get_attached_storages(); });
   for (auto elm : local_storages)
     storages->push_back(elm);
 }
index 394580b..7945a3a 100644 (file)
@@ -63,13 +63,13 @@ bool Io::test()
 /** @brief Returns the amount of flops that remain to be done */
 double Io::get_remaining()
 {
-  return simgrid::simix::simcall(
+  return simix::simcall(
       [this]() { return boost::static_pointer_cast<kernel::activity::IoImpl>(pimpl_)->get_remaining(); });
 }
 
 sg_size_t Io::get_performed_ioops()
 {
-  return simgrid::simix::simcall(
+  return simix::simcall(
       [this]() { return boost::static_pointer_cast<kernel::activity::IoImpl>(pimpl_)->get_performed_ioops(); });
 }
 
index 99d994e..86f5c31 100644 (file)
@@ -18,12 +18,12 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(s4u_link, s4u, "Logging specific to the S4U link
 namespace simgrid {
 namespace s4u {
 
-simgrid::xbt::signal<void(Link&)> Link::on_creation;
-simgrid::xbt::signal<void(Link&)> Link::on_destruction;
-simgrid::xbt::signal<void(Link&)> Link::on_state_change;
-simgrid::xbt::signal<void(Link&)> Link::on_bandwidth_change;
-simgrid::xbt::signal<void(kernel::resource::NetworkAction*, Host* src, Host* dst)> Link::on_communicate;
-simgrid::xbt::signal<void(kernel::resource::NetworkAction*, kernel::resource::Action::State)>
+xbt::signal<void(Link&)> Link::on_creation;
+xbt::signal<void(Link&)> Link::on_destruction;
+xbt::signal<void(Link&)> Link::on_state_change;
+xbt::signal<void(Link&)> Link::on_bandwidth_change;
+xbt::signal<void(kernel::resource::NetworkAction*, Host* src, Host* dst)> Link::on_communicate;
+xbt::signal<void(kernel::resource::NetworkAction*, kernel::resource::Action::State)>
     Link::on_communication_state_change;
 
 Link* Link::by_name(const std::string& name)
index 1661442..baa91b8 100644 (file)
@@ -15,7 +15,7 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(s4u_channel, s4u, "S4U Communication Mailboxes")
 namespace simgrid {
 namespace s4u {
 
-const simgrid::xbt::string& Mailbox::get_name() const
+const xbt::string& Mailbox::get_name() const
 {
   return pimpl_->get_name();
 }
index 0e3443d..da6c963 100644 (file)
@@ -14,12 +14,12 @@ XBT_LOG_NEW_DEFAULT_CATEGORY(s4u_netzone, "S4U Networking Zones");
 namespace simgrid {
 namespace s4u {
 
-simgrid::xbt::signal<void(bool symmetrical, kernel::routing::NetPoint* src, kernel::routing::NetPoint* dst,
-                          kernel::routing::NetPoint* gw_src, kernel::routing::NetPoint* gw_dst,
-                          std::vector<kernel::resource::LinkImpl*>& link_list)>
+xbt::signal<void(bool symmetrical, kernel::routing::NetPoint* src, kernel::routing::NetPoint* dst,
+                 kernel::routing::NetPoint* gw_src, kernel::routing::NetPoint* gw_dst,
+                 std::vector<kernel::resource::LinkImpl*>& link_list)>
     NetZone::on_route_creation;
-simgrid::xbt::signal<void(NetZone&)> NetZone::on_creation;
-simgrid::xbt::signal<void(NetZone&)> NetZone::on_seal;
+xbt::signal<void(NetZone&)> NetZone::on_creation;
+xbt::signal<void(NetZone&)> NetZone::on_seal;
 
 NetZone::NetZone(kernel::routing::NetZoneImpl* impl) : pimpl_(impl) {}
 
@@ -29,7 +29,7 @@ NetZone::~NetZone()
 
 std::unordered_map<std::string, std::string>* NetZone::get_properties()
 {
-  return simgrid::simix::simcall([this] { return &properties_; });
+  return simix::simcall([this] { return &properties_; });
 }
 
 /** Retrieve the property value (or nullptr if not set) */
@@ -39,7 +39,7 @@ const char* NetZone::get_property(const std::string& key)
 }
 void NetZone::set_property(const std::string& key, const std::string& value)
 {
-  simgrid::simix::simcall([this, &key, &value] { properties_[key] = value; });
+  simix::simcall([this, &key, &value] { properties_[key] = value; });
 }
 
 /** @brief Returns the list of direct children (no grand-children) */
@@ -74,10 +74,10 @@ std::vector<Host*> NetZone::get_all_hosts()
   return pimpl_->get_all_hosts();
 }
 
-void NetZone::getHosts(std::vector<s4u::Host*>* whereto)
+void NetZone::getHosts(std::vector<Host*>* whereto)
 {
   for (auto const& card : pimpl_->get_vertices()) {
-    s4u::Host* host = simgrid::s4u::Host::by_name_or_null(card->get_name());
+    Host* host = Host::by_name_or_null(card->get_name());
     if (host != nullptr)
       whereto->push_back(host);
   }
index 30eaa89..8476633 100644 (file)
@@ -15,7 +15,7 @@ namespace s4u {
 
 Semaphore::Semaphore(unsigned int initial_capacity)
 {
-  sem_ = simgrid::simix::simcall([initial_capacity] { return new kernel::activity::SemaphoreImpl(initial_capacity); });
+  sem_ = simix::simcall([initial_capacity] { return new kernel::activity::SemaphoreImpl(initial_capacity); });
 }
 
 Semaphore::~Semaphore()
@@ -43,17 +43,17 @@ int Semaphore::acquire_timeout(double timeout)
 
 void Semaphore::release()
 {
-  simgrid::simix::simcall([this] { sem_->release(); });
+  simix::simcall([this] { sem_->release(); });
 }
 
 int Semaphore::get_capacity()
 {
-  return simgrid::simix::simcall([this] { return sem_->get_capacity(); });
+  return simix::simcall([this] { return sem_->get_capacity(); });
 }
 
 int Semaphore::would_block()
 {
-  return simgrid::simix::simcall([this] { return sem_->would_block(); });
+  return simix::simcall([this] { return sem_->would_block(); });
 }
 
 void intrusive_ptr_add_ref(Semaphore* sem)
@@ -71,8 +71,9 @@ void intrusive_ptr_release(Semaphore* sem)
   }
 }
 
-}
-}
+} // namespace s4u
+} // namespace simgrid
+
 /* **************************** Public C interface *************************** */
 /** @brief creates a semaphore object of the given initial capacity */
 sg_sem_t sg_sem_init(int initial_value)
index 09fb106..cabbcb0 100644 (file)
@@ -12,7 +12,7 @@
 
 namespace simgrid {
 namespace xbt {
-template class Extendable<simgrid::s4u::Storage>;
+template class Extendable<s4u::Storage>;
 } // namespace xbt
 
 namespace s4u {
@@ -43,7 +43,7 @@ const char* Storage::get_type()
 
 std::unordered_map<std::string, std::string>* Storage::get_properties()
 {
-  return simgrid::simix::simcall([this] { return pimpl_->get_properties(); });
+  return simix::simcall([this] { return pimpl_->get_properties(); });
 }
 
 const char* Storage::get_property(const std::string& key)
@@ -53,7 +53,7 @@ const char* Storage::get_property(const std::string& key)
 
 void Storage::set_property(const std::string& key, const std::string& value)
 {
-  simgrid::simix::simcall([this, &key, &value] { this->pimpl_->set_property(key, value); });
+  simix::simcall([this, &key, &value] { this->pimpl_->set_property(key, value); });
 }
 
 IoPtr Storage::io_init(sg_size_t size, Io::OpType type)