From 772fbe2c6395ac920d8e7907dc39749d458f02b6 Mon Sep 17 00:00:00 2001 From: Frederic Suter Date: Wed, 8 Mar 2017 08:36:40 +0100 Subject: [PATCH] remove unnecessary access specifiers --- include/simgrid/s4u/Link.hpp | 1 - include/simgrid/s4u/Mutex.hpp | 4 +- include/simgrid/s4u/comm.hpp | 2 - include/simgrid/s4u/host.hpp | 1 - include/simgrid/s4u/storage.hpp | 1 - include/xbt/Extendable.hpp | 1 - src/bindings/java/JavaContext.hpp | 2 +- src/kernel/context/Context.hpp | 2 +- src/kernel/context/ContextBoost.hpp | 2 +- src/kernel/context/ContextRaw.cpp | 2 +- src/kernel/context/ContextThread.hpp | 2 +- src/surf/HostImpl.hpp | 2 - src/surf/cpu_interface.hpp | 2 - src/surf/cpu_ti.hpp | 3 +- src/surf/network_interface.hpp | 392 +++++++++++++-------------- src/surf/surf_interface.hpp | 1 - 16 files changed, 203 insertions(+), 217 deletions(-) diff --git a/include/simgrid/s4u/Link.hpp b/include/simgrid/s4u/Link.hpp index 3fbf185dd2..de05738704 100644 --- a/include/simgrid/s4u/Link.hpp +++ b/include/simgrid/s4u/Link.hpp @@ -26,7 +26,6 @@ XBT_PUBLIC_CLASS Link { friend simgrid::surf::LinkImpl; -private: // Links are created from the NetZone, and destroyed by their private implementation when the simulation ends explicit Link(surf::LinkImpl* pimpl) : pimpl_(pimpl) {} virtual ~Link() = default; diff --git a/include/simgrid/s4u/Mutex.hpp b/include/simgrid/s4u/Mutex.hpp index 93db75ea3f..2188079213 100644 --- a/include/simgrid/s4u/Mutex.hpp +++ b/include/simgrid/s4u/Mutex.hpp @@ -33,8 +33,7 @@ class ConditionVariable; * */ XBT_PUBLIC_CLASS Mutex { -friend ConditionVariable; -private: + friend ConditionVariable; friend simgrid::simix::Mutex; simgrid::simix::Mutex* mutex_; Mutex(simgrid::simix::Mutex* mutex) : mutex_(mutex) {} @@ -62,7 +61,6 @@ public: /** Constructs a new mutex */ static Ptr createMutex(); -public: void lock(); void unlock(); bool try_lock(); diff --git a/include/simgrid/s4u/comm.hpp b/include/simgrid/s4u/comm.hpp index 7ff86151a3..239755eefb 100644 --- a/include/simgrid/s4u/comm.hpp +++ b/include/simgrid/s4u/comm.hpp @@ -26,8 +26,6 @@ XBT_PUBLIC_CLASS Comm : public Activity { public: ~Comm() override; -public: - /*! take a range of s4u::Comm* (last excluded) and return when one of them is finished. The return value is an iterator on the finished Comms. */ template static I wait_any(I first, I last) diff --git a/include/simgrid/s4u/host.hpp b/include/simgrid/s4u/host.hpp index 27a2d0c8bb..77147d3346 100644 --- a/include/simgrid/s4u/host.hpp +++ b/include/simgrid/s4u/host.hpp @@ -117,7 +117,6 @@ public: /** DO NOT USE DIRECTLY (@todo: these should be protected, once our code is clean) */ kernel::routing::NetPoint* pimpl_netpoint = nullptr; -public: /*** Called on each newly created object */ static simgrid::xbt::signal onCreation; /*** Called just before destructing an object */ diff --git a/include/simgrid/s4u/storage.hpp b/include/simgrid/s4u/storage.hpp index 7e9add9612..b99651b339 100644 --- a/include/simgrid/s4u/storage.hpp +++ b/include/simgrid/s4u/storage.hpp @@ -22,7 +22,6 @@ namespace s4u { XBT_PUBLIC_CLASS Storage { friend s4u::Engine; -private: Storage(std::string name, smx_storage_t inferior); virtual ~Storage(); diff --git a/include/xbt/Extendable.hpp b/include/xbt/Extendable.hpp index 99c981d947..f158d50d80 100644 --- a/include/xbt/Extendable.hpp +++ b/include/xbt/Extendable.hpp @@ -111,7 +111,6 @@ public: extension_set(rank.id(), value, use_dtor); } -public: // Convenience extension access when the type has a associated EXTENSION ID: template U* extension() { return extension(U::EXTENSION_ID); } template void extension_set(U* p) { extension_set(U::EXTENSION_ID, p); } diff --git a/src/bindings/java/JavaContext.hpp b/src/bindings/java/JavaContext.hpp index d0d6a4e713..6ebaad4b76 100644 --- a/src/bindings/java/JavaContext.hpp +++ b/src/bindings/java/JavaContext.hpp @@ -35,7 +35,7 @@ public: xbt_os_sem_t begin = nullptr; // Semaphore used to schedule/unschedule the process: xbt_os_sem_t end = nullptr; -public: + friend class JavaContextFactory; JavaContext(std::function code, void_pfn_smxprocess_t cleanup_func, diff --git a/src/kernel/context/Context.hpp b/src/kernel/context/Context.hpp index fec402efdf..8663333dd4 100644 --- a/src/kernel/context/Context.hpp +++ b/src/kernel/context/Context.hpp @@ -83,7 +83,7 @@ namespace context { smx_actor_t process_ = nullptr; public: bool iwannadie; - public: + Context(std::function code, void_pfn_smxprocess_t cleanup_func, smx_actor_t process); diff --git a/src/kernel/context/ContextBoost.hpp b/src/kernel/context/ContextBoost.hpp index 660601489c..578fe10932 100644 --- a/src/kernel/context/ContextBoost.hpp +++ b/src/kernel/context/ContextBoost.hpp @@ -33,7 +33,7 @@ protected: // static static xbt_os_thread_key_t worker_id_key_; static unsigned long process_index_; static BoostContext* maestro_context_; -protected: + #if HAVE_BOOST_CONTEXTS == 1 boost::context::fcontext_t* fc_ = nullptr; #else diff --git a/src/kernel/context/ContextRaw.cpp b/src/kernel/context/ContextRaw.cpp index a49ead0b27..8ad2f1116d 100644 --- a/src/kernel/context/ContextRaw.cpp +++ b/src/kernel/context/ContextRaw.cpp @@ -45,7 +45,7 @@ public: void_pfn_smxprocess_t cleanup_func, smx_actor_t process); ~RawContext() override; -public: + static void wrapper(void* arg); void stop() override; void suspend() override; diff --git a/src/kernel/context/ContextThread.hpp b/src/kernel/context/ContextThread.hpp index 2bfb881543..096a01ccd3 100644 --- a/src/kernel/context/ContextThread.hpp +++ b/src/kernel/context/ContextThread.hpp @@ -37,7 +37,7 @@ private: xbt_os_sem_t begin_ = nullptr; /** Semaphore used to schedule/unschedule */ xbt_os_sem_t end_ = nullptr; -private: + static void* wrapper(void *param); static void* maestro_wrapper(void *param); public: diff --git a/src/surf/HostImpl.hpp b/src/surf/HostImpl.hpp index 1bc9ff9cea..3cf0989c73 100644 --- a/src/surf/HostImpl.hpp +++ b/src/surf/HostImpl.hpp @@ -66,7 +66,6 @@ public: explicit HostImpl(s4u::Host* host); virtual ~HostImpl(); -public: /** @brief Return the storage of corresponding mount point */ virtual simgrid::surf::Storage* findStorageOnMountList(const char* storage); @@ -174,7 +173,6 @@ public: */ virtual int fileMove(surf_file_t fd, const char* fullpath); -public: xbt_dynar_t storage_ = nullptr; simgrid::s4u::Host* piface_ = nullptr; diff --git a/src/surf/cpu_interface.hpp b/src/surf/cpu_interface.hpp index 8d2daffe09..c369f3af86 100644 --- a/src/surf/cpu_interface.hpp +++ b/src/surf/cpu_interface.hpp @@ -114,14 +114,12 @@ public: simgrid::s4u::Host* getHost() { return host_; } -public: int coresAmount_ = 1; simgrid::s4u::Host* host_; std::vector speedPerPstate_; /*< List of supported CPU capacities (pstate related) */ int pstate_ = 0; /*< Current pstate (index in the speedPeakList)*/ -public: virtual void setStateTrace(tmgr_trace_t trace); /*< setup the trace file with states events (ON or OFF). Trace must contain boolean values (0 or 1). */ virtual void setSpeedTrace(tmgr_trace_t trace); /*< setup the trace file with availability events (peak speed changes due to external load). Trace must contain relative values (ratio between 0 and 1) */ diff --git a/src/surf/cpu_ti.hpp b/src/surf/cpu_ti.hpp index 90f93fe1af..6eca45aaa8 100644 --- a/src/surf/cpu_ti.hpp +++ b/src/surf/cpu_ti.hpp @@ -99,7 +99,7 @@ public: CpuTi *cpu_; int indexHeap_ = -1; int suspended_ = 0; -public: + boost::intrusive::list_member_hook<> action_ti_hook; }; @@ -134,7 +134,6 @@ public: double currentFrequency_; -public: boost::intrusive::list_member_hook<> cpu_ti_hook; }; diff --git a/src/surf/network_interface.hpp b/src/surf/network_interface.hpp index 25ec028356..d9a1671a23 100644 --- a/src/surf/network_interface.hpp +++ b/src/surf/network_interface.hpp @@ -18,203 +18,203 @@ ***********/ namespace simgrid { - namespace surf { - /********* - * Model * - *********/ - - /** @ingroup SURF_network_interface - * @brief SURF network model interface class - * @details A model is an object which handles the interactions between its Resources and its Actions - */ - class NetworkModel : public Model { - public: - /** @brief Constructor */ - NetworkModel() : Model() { } - - /** @brief Destructor */ - ~NetworkModel() override; - - /** - * @brief Create a Link - * - * @param name The name of the Link - * @param bandwidth The initial bandwidth of the Link in bytes per second - * @param latency The initial latency of the Link in seconds - * @param policy The sharing policy of the Link - */ - virtual LinkImpl* createLink(const char* name, double bandwidth, double latency, - e_surf_link_sharing_policy_t policy) = 0; - - /** - * @brief Create a communication between two hosts. - * @details It makes calls to the routing part, and execute the communication - * between the two end points. - * - * @param src The source of the communication - * @param dst The destination of the communication - * @param size The size of the communication in bytes - * @param rate Allows to limit the transfer rate. Negative value means - * unlimited. - * @return The action representing the communication - */ - virtual Action* communicate(simgrid::s4u::Host* src, simgrid::s4u::Host* dst, double size, double rate) = 0; - - /** @brief Function pointer to the function to use to solve the lmm_system_t - * - * @param system The lmm_system_t to solve - */ - void (*f_networkSolve)(lmm_system_t) = lmm_solve; - - /** - * @brief Get the right multiplicative factor for the latency. - * @details Depending on the model, the effective latency when sending - * a message might be different from the theoretical latency of the link, - * in function of the message size. In order to account for this, this - * function gets this factor. - * - * @param size The size of the message. - * @return The latency factor. - */ - virtual double latencyFactor(double size); - - /** - * @brief Get the right multiplicative factor for the bandwidth. - * @details Depending on the model, the effective bandwidth when sending - * a message might be different from the theoretical bandwidth of the link, - * in function of the message size. In order to account for this, this - * function gets this factor. - * - * @param size The size of the message. - * @return The bandwidth factor. - */ - virtual double bandwidthFactor(double size); - - /** - * @brief Get definitive bandwidth. - * @details It gives the minimum bandwidth between the one that would - * occur if no limitation was enforced, and the one arbitrary limited. - * @param rate The desired maximum bandwidth. - * @param bound The bandwidth with only the network taken into account. - * @param size The size of the message. - * @return The new bandwidth. - */ - virtual double bandwidthConstraint(double rate, double bound, double size); - double nextOccuringEventFull(double now) override; - - LinkImpl* loopback_ = nullptr; - }; - - /************ - * Resource * - ************/ - /** @ingroup SURF_network_interface - * @brief SURF network link interface class - * @details A Link represents the link between two [hosts](\ref simgrid::surf::HostImpl) - */ - class LinkImpl : public simgrid::surf::Resource, public simgrid::surf::PropertyHolder { - protected: - LinkImpl(simgrid::surf::NetworkModel* model, const char* name, lmm_constraint_t constraint); - ~LinkImpl() override; - public: - void destroy(); // Must be called instead of the destructor - private: - bool currentlyDestroying_ = false; - - public: - /** @brief Public interface */ - s4u::Link piface_; - - /** @brief Get the bandwidth in bytes per second of current Link */ - virtual double bandwidth(); - - /** @brief Update the bandwidth in bytes per second of current Link */ - virtual void setBandwidth(double value) = 0; - - /** @brief Get the latency in seconds of current Link */ - virtual double latency(); - - /** @brief Update the latency in seconds of current Link */ - virtual void setLatency(double value) = 0; - - /** @brief The sharing policy is a @{link e_surf_link_sharing_policy_t::EType} (0: FATPIPE, 1: SHARED, 2: - * FULLDUPLEX) */ - virtual int sharingPolicy(); - - /** @brief Check if the Link is used */ - bool isUsed() override; - - void turnOn() override; - void turnOff() override; - - virtual void setStateTrace(tmgr_trace_t trace); /*< setup the trace file with states events (ON or OFF). +namespace surf { +/********* + * Model * + *********/ + +/** @ingroup SURF_network_interface + * @brief SURF network model interface class + * @details A model is an object which handles the interactions between its Resources and its Actions + */ +class NetworkModel : public Model { +public: + /** @brief Constructor */ + NetworkModel() : Model() {} + + /** @brief Destructor */ + ~NetworkModel() override; + + /** + * @brief Create a Link + * + * @param name The name of the Link + * @param bandwidth The initial bandwidth of the Link in bytes per second + * @param latency The initial latency of the Link in seconds + * @param policy The sharing policy of the Link + */ + virtual LinkImpl* createLink(const char* name, double bandwidth, double latency, + e_surf_link_sharing_policy_t policy) = 0; + + /** + * @brief Create a communication between two hosts. + * @details It makes calls to the routing part, and execute the communication + * between the two end points. + * + * @param src The source of the communication + * @param dst The destination of the communication + * @param size The size of the communication in bytes + * @param rate Allows to limit the transfer rate. Negative value means + * unlimited. + * @return The action representing the communication + */ + virtual Action* communicate(simgrid::s4u::Host* src, simgrid::s4u::Host* dst, double size, double rate) = 0; + + /** @brief Function pointer to the function to use to solve the lmm_system_t + * + * @param system The lmm_system_t to solve + */ + void (*f_networkSolve)(lmm_system_t) = lmm_solve; + + /** + * @brief Get the right multiplicative factor for the latency. + * @details Depending on the model, the effective latency when sending + * a message might be different from the theoretical latency of the link, + * in function of the message size. In order to account for this, this + * function gets this factor. + * + * @param size The size of the message. + * @return The latency factor. + */ + virtual double latencyFactor(double size); + + /** + * @brief Get the right multiplicative factor for the bandwidth. + * @details Depending on the model, the effective bandwidth when sending + * a message might be different from the theoretical bandwidth of the link, + * in function of the message size. In order to account for this, this + * function gets this factor. + * + * @param size The size of the message. + * @return The bandwidth factor. + */ + virtual double bandwidthFactor(double size); + + /** + * @brief Get definitive bandwidth. + * @details It gives the minimum bandwidth between the one that would + * occur if no limitation was enforced, and the one arbitrary limited. + * @param rate The desired maximum bandwidth. + * @param bound The bandwidth with only the network taken into account. + * @param size The size of the message. + * @return The new bandwidth. + */ + virtual double bandwidthConstraint(double rate, double bound, double size); + double nextOccuringEventFull(double now) override; + + LinkImpl* loopback_ = nullptr; +}; + +/************ + * Resource * + ************/ +/** @ingroup SURF_network_interface + * @brief SURF network link interface class + * @details A Link represents the link between two [hosts](\ref simgrid::surf::HostImpl) + */ +class LinkImpl : public simgrid::surf::Resource, public simgrid::surf::PropertyHolder { +protected: + LinkImpl(simgrid::surf::NetworkModel* model, const char* name, lmm_constraint_t constraint); + ~LinkImpl() override; + +public: + void destroy(); // Must be called instead of the destructor +private: + bool currentlyDestroying_ = false; + +public: + /** @brief Public interface */ + s4u::Link piface_; + + /** @brief Get the bandwidth in bytes per second of current Link */ + virtual double bandwidth(); + + /** @brief Update the bandwidth in bytes per second of current Link */ + virtual void setBandwidth(double value) = 0; + + /** @brief Get the latency in seconds of current Link */ + virtual double latency(); + + /** @brief Update the latency in seconds of current Link */ + virtual void setLatency(double value) = 0; + + /** @brief The sharing policy is a @{link e_surf_link_sharing_policy_t::EType} (0: FATPIPE, 1: SHARED, 2: + * FULLDUPLEX) */ + virtual int sharingPolicy(); + + /** @brief Check if the Link is used */ + bool isUsed() override; + + void turnOn() override; + void turnOff() override; + + virtual void setStateTrace(tmgr_trace_t trace); /*< setup the trace file with states events (ON or OFF). Trace must contain boolean values. */ - virtual void setBandwidthTrace(tmgr_trace_t trace); /*< setup the trace file with bandwidth events (peak speed changes due to external load). - Trace must contain percentages (value between 0 and 1). */ - virtual void setLatencyTrace(tmgr_trace_t trace); /*< setup the trace file with latency events (peak latency changes due to external load). - Trace must contain absolute values */ - - tmgr_trace_iterator_t stateEvent_ = nullptr; - s_surf_metric_t latency_ = {1.0, 0, nullptr}; - s_surf_metric_t bandwidth_ = {1.0, 0, nullptr}; - - /* User data */ - public: - void *getData() { return userData;} - void setData(void *d) { userData=d;} - private: - void *userData = nullptr; - - /* List of all links. FIXME: should move to the Engine */ - private: - static std::unordered_map* links; - - public: - static LinkImpl* byName(const char* name); - static int linksCount(); - static LinkImpl** linksList(); - static void linksExit(); - }; - - /********** - * Action * - **********/ - /** @ingroup SURF_network_interface - * @brief SURF network action interface class - * @details A NetworkAction represents a communication between two [hosts](\ref HostImpl) - */ - class NetworkAction : public simgrid::surf::Action { - public: - /** @brief Constructor - * - * @param model The NetworkModel associated to this NetworkAction - * @param cost The cost of this NetworkAction in [TODO] - * @param failed [description] - */ - NetworkAction(simgrid::surf::Model *model, double cost, bool failed) - : simgrid::surf::Action(model, cost, failed) {} - - /** - * @brief NetworkAction constructor - * - * @param model The NetworkModel associated to this NetworkAction - * @param cost The cost of this NetworkAction in [TODO] - * @param failed [description] - * @param var The lmm variable associated to this Action if it is part of a - * LMM component - */ - NetworkAction(simgrid::surf::Model *model, double cost, bool failed, lmm_variable_t var) - : simgrid::surf::Action(model, cost, failed, var) {}; - - void setState(simgrid::surf::Action::State state) override; - std::list links(); - - double latency_; - double latCurrent_; - double weight_; - double rate_; - }; - } + virtual void setBandwidthTrace( + tmgr_trace_t trace); /*< setup the trace file with bandwidth events (peak speed changes due to external load). + Trace must contain percentages (value between 0 and 1). */ + virtual void setLatencyTrace( + tmgr_trace_t trace); /*< setup the trace file with latency events (peak latency changes due to external load). + Trace must contain absolute values */ + + tmgr_trace_iterator_t stateEvent_ = nullptr; + s_surf_metric_t latency_ = {1.0, 0, nullptr}; + s_surf_metric_t bandwidth_ = {1.0, 0, nullptr}; + + /* User data */ + void* getData() { return userData; } + void setData(void* d) { userData = d; } +private: + void* userData = nullptr; + + /* List of all links. FIXME: should move to the Engine */ + static std::unordered_map* links; + +public: + static LinkImpl* byName(const char* name); + static int linksCount(); + static LinkImpl** linksList(); + static void linksExit(); +}; + +/********** + * Action * + **********/ +/** @ingroup SURF_network_interface + * @brief SURF network action interface class + * @details A NetworkAction represents a communication between two [hosts](\ref HostImpl) + */ +class NetworkAction : public simgrid::surf::Action { +public: + /** @brief Constructor + * + * @param model The NetworkModel associated to this NetworkAction + * @param cost The cost of this NetworkAction in [TODO] + * @param failed [description] + */ + NetworkAction(simgrid::surf::Model* model, double cost, bool failed) : simgrid::surf::Action(model, cost, failed) {} + + /** + * @brief NetworkAction constructor + * + * @param model The NetworkModel associated to this NetworkAction + * @param cost The cost of this NetworkAction in [TODO] + * @param failed [description] + * @param var The lmm variable associated to this Action if it is part of a + * LMM component + */ + NetworkAction(simgrid::surf::Model* model, double cost, bool failed, lmm_variable_t var) + : simgrid::surf::Action(model, cost, failed, var){}; + + void setState(simgrid::surf::Action::State state) override; + std::list links(); + + double latency_; + double latCurrent_; + double weight_; + double rate_; +}; +} } #endif /* SURF_NETWORK_INTERFACE_HPP_ */ diff --git a/src/surf/surf_interface.hpp b/src/surf/surf_interface.hpp index ac4897a75d..5a2a7d9bf4 100644 --- a/src/surf/surf_interface.hpp +++ b/src/surf/surf_interface.hpp @@ -108,7 +108,6 @@ public: not_in_the_system /**< Not in the system anymore. Why did you ask ? */ }; -public: /** * @brief Action constructor * -- 2.20.1