From 17e66beb16f52e6ed5191e24b8220a2694805007 Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Wed, 11 May 2016 10:06:33 +0200 Subject: [PATCH] rename s4u Async to Activities --- include/simgrid/s4u.h | 2 +- .../simgrid/s4u/{async.hpp => Activity.hpp} | 44 +++++++++---------- include/simgrid/s4u/comm.hpp | 6 +-- include/simgrid/s4u/forward.hpp | 2 +- src/s4u/{s4u_async.cpp => s4u_activity.cpp} | 12 ++--- src/s4u/s4u_comm.cpp | 2 +- tools/cmake/DefinePackages.cmake | 4 +- 7 files changed, 36 insertions(+), 36 deletions(-) rename include/simgrid/s4u/{async.hpp => Activity.hpp} (51%) rename src/s4u/{s4u_async.cpp => s4u_activity.cpp} (65%) diff --git a/include/simgrid/s4u.h b/include/simgrid/s4u.h index e58b845e6e..42cb73b837 100644 --- a/include/simgrid/s4u.h +++ b/include/simgrid/s4u.h @@ -11,7 +11,7 @@ #include "s4u/engine.hpp" #include "s4u/host.hpp" -#include "s4u/async.hpp" +#include "s4u/Activity.hpp" #include "s4u/comm.hpp" #include "s4u/storage.hpp" diff --git a/include/simgrid/s4u/async.hpp b/include/simgrid/s4u/Activity.hpp similarity index 51% rename from include/simgrid/s4u/async.hpp rename to include/simgrid/s4u/Activity.hpp index 2f12e795ee..533a92d1f0 100644 --- a/include/simgrid/s4u/async.hpp +++ b/include/simgrid/s4u/Activity.hpp @@ -4,8 +4,8 @@ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ -#ifndef SIMGRID_S4U_ASYNC_HPP -#define SIMGRID_S4U_ASYNC_HPP +#ifndef SIMGRID_S4U_ACTIVITY_HPP +#define SIMGRID_S4U_ACTIVITY_HPP #include #include @@ -17,64 +17,64 @@ SG_BEGIN_DECL(); typedef enum { inited, started, finished -} e_s4u_async_state_t; +} e_s4u_activity_state_t; SG_END_DECL(); namespace simgrid { namespace s4u { -/** @brief Asynchronous Actions +/** @brief Activities * - * This class is the ancestor of every asynchronous actions, that is, of actions that do take time in the simulated world. + * This class is the ancestor of every activities that an actor can undertake, that is, of the actions that do take time in the simulated world. */ -XBT_PUBLIC_CLASS Async { +XBT_PUBLIC_CLASS Activity { friend Comm; protected: - Async(); - virtual ~Async(); + Activity(); + virtual ~Activity(); private: simgrid::simix::Synchro *pimpl_ = NULL; private: - e_s4u_async_state_t state_ = inited; + e_s4u_activity_state_t state_ = inited; public: - /** Starts a previously created async. + /** Starts a previously created activity. * * This function is optional: you can call wait() even if you didn't call start() */ virtual void start()=0; - /** Tests whether the given async is terminated yet */ + /** Tests whether the given activity is terminated yet. This is a pure function. */ //virtual bool test()=0; - /** Blocks until the async is terminated */ + /** Blocks until the activity is terminated */ virtual void wait()=0; - /** Blocks until the async is terminated, or until the timeout is elapsed + /** Blocks until the activity is terminated, or until the timeout is elapsed * Raises: timeout exception.*/ virtual void wait(double timeout)=0; - /** Cancel that async */ + /** Cancel that activity */ //virtual void cancel(); - /** Retrieve the current state of the async */ - e_s4u_async_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 Async entails. When it's 0, it's done. */ + /** 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 Async will entail + /** Set the [remaining] amount of work that this Activity will entail * - * It is forbidden to change the amount of work once the Async is started */ + * 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 Async */ + /** Put some user data onto the Activity */ void setUserData(void *data) {userData_=data;} - /** Retrieve the user data of the Async */ + /** Retrieve the user data of the Activity */ void *getUserData() { return userData_; } }; // class }}; // Namespace simgrid::s4u -#endif /* SIMGRID_S4U_ASYNC_HPP */ +#endif /* SIMGRID_S4U_ACTIVITY_HPP */ diff --git a/include/simgrid/s4u/comm.hpp b/include/simgrid/s4u/comm.hpp index b56e2727e6..c9d615c8bf 100644 --- a/include/simgrid/s4u/comm.hpp +++ b/include/simgrid/s4u/comm.hpp @@ -8,8 +8,8 @@ #define SIMGRID_S4U_COMM_HPP #include +#include #include -#include #include namespace simgrid { @@ -19,8 +19,8 @@ namespace s4u { * * Represents all asynchronous communications, that you can test or wait onto. */ -XBT_PUBLIC_CLASS Comm : public Async { - Comm() : Async() {} +XBT_PUBLIC_CLASS Comm : public Activity { + Comm() : Activity() {} public: virtual ~Comm(); diff --git a/include/simgrid/s4u/forward.hpp b/include/simgrid/s4u/forward.hpp index 12a789486d..b8f6b4263d 100644 --- a/include/simgrid/s4u/forward.hpp +++ b/include/simgrid/s4u/forward.hpp @@ -9,7 +9,7 @@ namespace simgrid { namespace s4u { -class Async; +class Activity; class Comm; class Engine; class Host; diff --git a/src/s4u/s4u_async.cpp b/src/s4u/s4u_activity.cpp similarity index 65% rename from src/s4u/s4u_async.cpp rename to src/s4u/s4u_activity.cpp index bf2f951d49..c49e2c4b93 100644 --- a/src/s4u/s4u_async.cpp +++ b/src/s4u/s4u_activity.cpp @@ -7,21 +7,21 @@ #include "xbt/log.h" #include "src/msg/msg_private.h" -#include "simgrid/s4u/async.hpp" +#include "simgrid/s4u/Activity.hpp" XBT_LOG_EXTERNAL_CATEGORY(s4u); -XBT_LOG_NEW_DEFAULT_SUBCATEGORY(s4u_async,s4u,"S4U asynchronous actions"); +XBT_LOG_NEW_DEFAULT_SUBCATEGORY(s4u_activity,s4u,"S4U activities"); using namespace simgrid; -s4u::Async::Async() { +s4u::Activity::Activity() { } -s4u::Async::~Async() { +s4u::Activity::~Activity() { } -void s4u::Async::setRemains(double remains) { - xbt_assert(state_ == inited, "Cannot change the remaining amount of work once the Async is started"); +void s4u::Activity::setRemains(double remains) { + xbt_assert(state_ == inited, "Cannot change the remaining amount of work once the Activity is started"); remains_ = remains; } diff --git a/src/s4u/s4u_comm.cpp b/src/s4u/s4u_comm.cpp index 1415742844..fb272f4961 100644 --- a/src/s4u/s4u_comm.cpp +++ b/src/s4u/s4u_comm.cpp @@ -9,7 +9,7 @@ #include "simgrid/s4u/comm.hpp" -XBT_LOG_NEW_DEFAULT_SUBCATEGORY(s4u_comm,s4u_async,"S4U asynchronous communications"); +XBT_LOG_NEW_DEFAULT_SUBCATEGORY(s4u_comm,s4u_activity,"S4U asynchronous communications"); using namespace simgrid; s4u::Comm::~Comm() { diff --git a/tools/cmake/DefinePackages.cmake b/tools/cmake/DefinePackages.cmake index 2a9c547d4e..61bd33b91e 100644 --- a/tools/cmake/DefinePackages.cmake +++ b/tools/cmake/DefinePackages.cmake @@ -372,7 +372,7 @@ endif() set(S4U_SRC src/s4u/s4u_actor.cpp src/s4u/s4u_as.cpp - src/s4u/s4u_async.cpp + src/s4u/s4u_activity.cpp src/s4u/s4u_comm.cpp src/s4u/s4u_engine.cpp src/s4u/s4u_file.cpp @@ -634,7 +634,7 @@ set(headers_to_install include/simgrid/s4u/forward.hpp include/simgrid/s4u/actor.hpp include/simgrid/s4u/As.hpp - include/simgrid/s4u/async.hpp + include/simgrid/s4u/Activity.hpp include/simgrid/s4u/comm.hpp include/simgrid/s4u/engine.hpp include/simgrid/s4u/file.hpp -- 2.20.1