From 940de22d7f2af82d58be3e886e6bc22608b4d8ec Mon Sep 17 00:00:00 2001 From: Arnaud Giersch Date: Tue, 13 Mar 2018 15:37:00 +0100 Subject: [PATCH 1/1] Replace "XBT_PUBLIC_CLASS" with "class XBT_PUBLIC". --- doc/Doxyfile.in | 1 - include/simgrid/jedule/jedule.hpp | 5 +- include/simgrid/jedule/jedule_events.hpp | 38 ++--- include/simgrid/jedule/jedule_platform.hpp | 6 +- include/simgrid/s4u/Activity.hpp | 2 +- include/simgrid/s4u/Actor.hpp | 3 +- include/simgrid/s4u/Comm.hpp | 3 +- include/simgrid/s4u/ConditionVariable.hpp | 3 +- include/simgrid/s4u/Engine.hpp | 3 +- include/simgrid/s4u/Exec.hpp | 3 +- include/simgrid/s4u/Host.hpp | 3 +- include/simgrid/s4u/Link.hpp | 5 +- include/simgrid/s4u/Mailbox.hpp | 4 +- include/simgrid/s4u/Mutex.hpp | 4 +- include/simgrid/s4u/NetZone.hpp | 5 +- include/simgrid/s4u/Storage.hpp | 3 +- include/simgrid/s4u/VirtualMachine.hpp | 5 +- include/xbt/base.h | 4 - include/xbt/config.hpp | 2 +- include/xbt/exception.hpp | 4 +- include/xbt/string.hpp | 2 +- src/kernel/activity/ActivityImpl.hpp | 38 ++--- src/kernel/activity/CommImpl.hpp | 5 +- src/kernel/activity/ExecImpl.hpp | 3 +- src/kernel/activity/SleepImpl.hpp | 5 +- src/kernel/activity/SynchroIo.hpp | 5 +- src/kernel/activity/SynchroRaw.hpp | 5 +- src/kernel/context/Context.hpp | 161 +++++++++------------ src/kernel/lmm/maxmin.hpp | 12 +- src/kernel/resource/Action.hpp | 3 +- src/kernel/resource/Model.hpp | 3 +- src/kernel/resource/Resource.hpp | 3 +- src/kernel/routing/DragonflyZone.hpp | 2 +- src/kernel/routing/NetZoneImpl.hpp | 3 +- src/mc/mc_exit.hpp | 11 +- src/plugins/file_system/FileSystem.hpp | 10 +- src/plugins/vm/VirtualMachineImpl.hpp | 3 +- src/surf/cpu_interface.hpp | 9 +- src/surf/trace_mgr.hpp | 10 +- 39 files changed, 173 insertions(+), 226 deletions(-) diff --git a/doc/Doxyfile.in b/doc/Doxyfile.in index 07d802a65e..301509a68c 100644 --- a/doc/Doxyfile.in +++ b/doc/Doxyfile.in @@ -1457,7 +1457,6 @@ PREDEFINED = XBT_PUBLIC= \ XBT_EXPORT_NO_IMPORT(type)=type \ XBT_IMPORT_NO_EXPORT(type)=type \ XBT_PUBLIC_DATA(type)="extern type" \ - XBT_PUBLIC_CLASS=class \ XBT_INLINE= \ XBT_PRIVATE= diff --git a/include/simgrid/jedule/jedule.hpp b/include/simgrid/jedule/jedule.hpp index eb25b52fbe..6a19881333 100644 --- a/include/simgrid/jedule/jedule.hpp +++ b/include/simgrid/jedule/jedule.hpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2010-2012, 2014-2017. The SimGrid Team. +/* Copyright (c) 2010-2012, 2014-2018. The SimGrid Team. * All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it @@ -17,8 +17,7 @@ namespace simgrid { namespace jedule{ - -XBT_PUBLIC_CLASS Jedule { +class XBT_PUBLIC Jedule { public: Jedule()=default; ~Jedule(); diff --git a/include/simgrid/jedule/jedule_events.hpp b/include/simgrid/jedule/jedule_events.hpp index 704d4f6d22..6f57c01c8c 100644 --- a/include/simgrid/jedule/jedule_events.hpp +++ b/include/simgrid/jedule/jedule_events.hpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2010-2012, 2014-2017. The SimGrid Team. +/* Copyright (c) 2010-2012, 2014-2018. The SimGrid Team. * All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it @@ -19,29 +19,29 @@ namespace simgrid { namespace jedule{ -XBT_PUBLIC_CLASS Event{ - public: - Event(std::string name, double start_time, double end_time, std::string type); - ~Event(); - void addCharacteristic(char *characteristic); - void addResources(std::vector *host_selection); - void addInfo(char *key, char *value); - void print(FILE *file); - - private: - std::string name; - double start_time; - double end_time; - std::string type; - std::vector *resource_subsets; - std::vector characteristics_list; /* just a list of names (strings) */ - std::unordered_map info_map; /* key/value pairs */ +class XBT_PUBLIC Event { +public: + Event(std::string name, double start_time, double end_time, std::string type); + ~Event(); + void addCharacteristic(char* characteristic); + void addResources(std::vector* host_selection); + void addInfo(char* key, char* value); + void print(FILE* file); + +private: + std::string name; + double start_time; + double end_time; + std::string type; + std::vector* resource_subsets; + std::vector characteristics_list; /* just a list of names (strings) */ + std::unordered_map info_map; /* key/value pairs */ }; } } extern "C" { -typedef simgrid::jedule::Event * jed_event_t; +typedef simgrid::jedule::Event* jed_event_t; } #endif diff --git a/include/simgrid/jedule/jedule_platform.hpp b/include/simgrid/jedule/jedule_platform.hpp index 9510ad01b0..d7a7b4c91f 100644 --- a/include/simgrid/jedule/jedule_platform.hpp +++ b/include/simgrid/jedule/jedule_platform.hpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2010-2012, 2014-2017. The SimGrid Team. +/* Copyright (c) 2010-2012, 2014-2018. The SimGrid Team. * All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it @@ -17,7 +17,7 @@ namespace simgrid { namespace jedule{ -XBT_PUBLIC_CLASS Container { +class XBT_PUBLIC Container { public: Container(std::string name); virtual ~Container(); @@ -39,7 +39,7 @@ public: void printResources(FILE *file); }; -XBT_PUBLIC_CLASS Subset { +class XBT_PUBLIC Subset { public: Subset(int s, int n, Container* p); virtual ~Subset()=default; diff --git a/include/simgrid/s4u/Activity.hpp b/include/simgrid/s4u/Activity.hpp index 905daa334a..b5ef0b4cd7 100644 --- a/include/simgrid/s4u/Activity.hpp +++ b/include/simgrid/s4u/Activity.hpp @@ -18,7 +18,7 @@ namespace s4u { * * 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 Activity { +class XBT_PUBLIC Activity { friend Comm; friend XBT_PUBLIC void intrusive_ptr_release(Comm * c); friend XBT_PUBLIC void intrusive_ptr_add_ref(Comm * c); diff --git a/include/simgrid/s4u/Actor.hpp b/include/simgrid/s4u/Actor.hpp index b4cdc75136..598721c0d4 100644 --- a/include/simgrid/s4u/Actor.hpp +++ b/include/simgrid/s4u/Actor.hpp @@ -129,8 +129,7 @@ namespace s4u { */ /** @brief Simulation Agent */ -XBT_PUBLIC_CLASS Actor : public simgrid::xbt::Extendable -{ +class XBT_PUBLIC Actor : public simgrid::xbt::Extendable { friend Exec; friend Mailbox; friend simgrid::simix::ActorImpl; diff --git a/include/simgrid/s4u/Comm.hpp b/include/simgrid/s4u/Comm.hpp index 36a4308b44..230e30efdc 100644 --- a/include/simgrid/s4u/Comm.hpp +++ b/include/simgrid/s4u/Comm.hpp @@ -21,8 +21,7 @@ namespace s4u { * * Represents all asynchronous communications, that you can test or wait onto. */ -XBT_PUBLIC_CLASS Comm : public Activity -{ +class XBT_PUBLIC Comm : public Activity { Comm() : Activity() {} public: friend XBT_PUBLIC void intrusive_ptr_release(simgrid::s4u::Comm * c); diff --git a/include/simgrid/s4u/ConditionVariable.hpp b/include/simgrid/s4u/ConditionVariable.hpp index 5efc7f9bc8..1bd6e119eb 100644 --- a/include/simgrid/s4u/ConditionVariable.hpp +++ b/include/simgrid/s4u/ConditionVariable.hpp @@ -30,8 +30,7 @@ namespace s4u { * semantic. But we currently use (only) double for both durations and * timestamp timeouts. */ -XBT_PUBLIC_CLASS ConditionVariable -{ +class XBT_PUBLIC ConditionVariable { private: friend s_smx_cond_t; smx_cond_t cond_; diff --git a/include/simgrid/s4u/Engine.hpp b/include/simgrid/s4u/Engine.hpp index 570900a43a..232f0f0ea6 100644 --- a/include/simgrid/s4u/Engine.hpp +++ b/include/simgrid/s4u/Engine.hpp @@ -24,8 +24,7 @@ namespace s4u { * * This class is an interface to the simulation engine. */ -XBT_PUBLIC_CLASS Engine -{ +class XBT_PUBLIC Engine { public: /** Constructor, taking the command line parameters of your main function */ Engine(int* argc, char** argv); diff --git a/include/simgrid/s4u/Exec.hpp b/include/simgrid/s4u/Exec.hpp index 9566d53c85..43a0031d57 100644 --- a/include/simgrid/s4u/Exec.hpp +++ b/include/simgrid/s4u/Exec.hpp @@ -15,8 +15,7 @@ namespace simgrid { namespace s4u { -XBT_PUBLIC_CLASS Exec : public Activity -{ +class XBT_PUBLIC Exec : public Activity { Exec() : Activity() {} public: friend XBT_PUBLIC void intrusive_ptr_release(simgrid::s4u::Exec * e); diff --git a/include/simgrid/s4u/Host.hpp b/include/simgrid/s4u/Host.hpp index d1b329b634..092908e408 100644 --- a/include/simgrid/s4u/Host.hpp +++ b/include/simgrid/s4u/Host.hpp @@ -37,8 +37,7 @@ namespace s4u { * You can retrieve a particular host using simgrid::s4u::Host::byName() * and actors can retrieve the host on which they run using simgrid::s4u::Host::current(). */ -XBT_PUBLIC_CLASS Host : public simgrid::xbt::Extendable -{ +class XBT_PUBLIC Host : public simgrid::xbt::Extendable { public: explicit Host(const char* name); diff --git a/include/simgrid/s4u/Link.hpp b/include/simgrid/s4u/Link.hpp index 13619bc2d5..83763044c9 100644 --- a/include/simgrid/s4u/Link.hpp +++ b/include/simgrid/s4u/Link.hpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2004-2017. The SimGrid Team. All rights reserved. */ +/* Copyright (c) 2004-2018. The SimGrid Team. All rights reserved. */ /* 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. */ @@ -23,8 +23,7 @@ class NetworkAction; }; namespace s4u { /** @brief A Link represents the network facilities between [hosts](\ref simgrid::s4u::Host) */ -XBT_PUBLIC_CLASS Link : public simgrid::xbt::Extendable -{ +class XBT_PUBLIC Link : public simgrid::xbt::Extendable { friend simgrid::surf::LinkImpl; // Links are created from the NetZone, and destroyed by their private implementation when the simulation ends diff --git a/include/simgrid/s4u/Mailbox.hpp b/include/simgrid/s4u/Mailbox.hpp index 4b6a905236..642ce4a386 100644 --- a/include/simgrid/s4u/Mailbox.hpp +++ b/include/simgrid/s4u/Mailbox.hpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2006-2017. The SimGrid Team. All rights reserved. */ +/* Copyright (c) 2006-2018. The SimGrid Team. All rights reserved. */ /* 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. */ @@ -104,7 +104,7 @@ namespace s4u { * * @section s4u_mb_api The API */ -XBT_PUBLIC_CLASS Mailbox { +class XBT_PUBLIC Mailbox { friend Comm; friend simgrid::kernel::activity::MailboxImpl; diff --git a/include/simgrid/s4u/Mutex.hpp b/include/simgrid/s4u/Mutex.hpp index 81263d9abc..6d589881c0 100644 --- a/include/simgrid/s4u/Mutex.hpp +++ b/include/simgrid/s4u/Mutex.hpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2006-2015. The SimGrid Team. All rights reserved. */ +/* Copyright (c) 2006-2018. The SimGrid Team. All rights reserved. */ /* 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. */ @@ -33,7 +33,7 @@ class ConditionVariable; * Use createMutex() to get a ::MutexPtr to a newly created mutex and only manipulate ::MutexPtr. * */ -XBT_PUBLIC_CLASS Mutex { +class XBT_PUBLIC Mutex { friend ConditionVariable; friend simgrid::kernel::activity::MutexImpl; simgrid::kernel::activity::MutexImpl* mutex_; diff --git a/include/simgrid/s4u/NetZone.hpp b/include/simgrid/s4u/NetZone.hpp index 778d179a45..a1935b7b62 100644 --- a/include/simgrid/s4u/NetZone.hpp +++ b/include/simgrid/s4u/NetZone.hpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016-2017. The SimGrid Team. All rights reserved. */ +/* Copyright (c) 2016-2018. The SimGrid Team. All rights reserved. */ /* 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. */ @@ -28,8 +28,7 @@ namespace s4u { * netzones. In SimGrid, there is a hierarchy of netzones, with a unique root zone (that you can retrieve from the * s4u::Engine). */ -XBT_PUBLIC_CLASS NetZone -{ +class XBT_PUBLIC NetZone { protected: friend simgrid::kernel::routing::NetZoneImpl; diff --git a/include/simgrid/s4u/Storage.hpp b/include/simgrid/s4u/Storage.hpp index 7dd83dbe20..5366365c08 100644 --- a/include/simgrid/s4u/Storage.hpp +++ b/include/simgrid/s4u/Storage.hpp @@ -23,8 +23,7 @@ namespace s4u { XBT_PUBLIC void getStorageList(std::map* whereTo); -XBT_PUBLIC_CLASS Storage : public simgrid::xbt::Extendable -{ +class XBT_PUBLIC Storage : public simgrid::xbt::Extendable { friend s4u::Engine; friend simgrid::surf::StorageImpl; diff --git a/include/simgrid/s4u/VirtualMachine.hpp b/include/simgrid/s4u/VirtualMachine.hpp index 2ec81c7a18..ea9aff0bb2 100644 --- a/include/simgrid/s4u/VirtualMachine.hpp +++ b/include/simgrid/s4u/VirtualMachine.hpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2015-2017. The SimGrid Team. All rights reserved. */ +/* Copyright (c) 2015-2018. The SimGrid Team. All rights reserved. */ /* 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. */ @@ -31,8 +31,7 @@ namespace s4u { * The total computing power that the contained actors can get is constrained to the virtual machine size. * */ -XBT_PUBLIC_CLASS VirtualMachine : public s4u::Host -{ +class XBT_PUBLIC VirtualMachine : public s4u::Host { simgrid::vm::VirtualMachineImpl* pimpl_vm_ = nullptr; virtual ~VirtualMachine(); diff --git a/include/xbt/base.h b/include/xbt/base.h index e0ab2066df..644917ad75 100644 --- a/include/xbt/base.h +++ b/include/xbt/base.h @@ -160,7 +160,6 @@ # define XBT_EXPORT_NO_IMPORT(type) __declspec(dllexport) type # define XBT_IMPORT_NO_EXPORT(type) type # define XBT_PUBLIC_DATA(type) extern __declspec(dllexport) type -# define XBT_PUBLIC_CLASS class __declspec(dllexport) # define XBT_PRIVATE /* Link against the DLL */ @@ -169,7 +168,6 @@ # define XBT_EXPORT_NO_IMPORT(type) type # define XBT_IMPORT_NO_EXPORT(type) __declspec(dllimport) type # define XBT_PUBLIC_DATA(type) extern __declspec(dllimport) type -# define XBT_PUBLIC_CLASS class __declspec(dllimport) # define XBT_PRIVATE #elif defined(__ELF__) @@ -177,7 +175,6 @@ # define XBT_EXPORT_NO_IMPORT(type) __attribute__((visibility("default"))) type # define XBT_IMPORT_NO_EXPORT(type) __attribute__((visibility("default"))) type # define XBT_PUBLIC_DATA(type) extern __attribute__((visibility("default"))) type -# define XBT_PUBLIC_CLASS class __attribute__((visibility("default"))) # define XBT_PRIVATE __attribute__((visibility("hidden"))) #else @@ -185,7 +182,6 @@ # define XBT_EXPORT_NO_IMPORT(type) type # define XBT_IMPORT_NO_EXPORT(type) type # define XBT_PUBLIC_DATA(type) extern type -# define XBT_PUBLIC_CLASS class # define XBT_PRIVATE /** @private */ #endif diff --git a/include/xbt/config.hpp b/include/xbt/config.hpp index 5585106c7b..a4e7517287 100644 --- a/include/xbt/config.hpp +++ b/include/xbt/config.hpp @@ -23,7 +23,7 @@ namespace simgrid { namespace config { -XBT_PUBLIC_CLASS missing_key_error : public std::runtime_error { +class XBT_PUBLIC missing_key_error : public std::runtime_error { public: explicit missing_key_error(const std::string& what) : std::runtime_error(what) {} diff --git a/include/xbt/exception.hpp b/include/xbt/exception.hpp index 3d648a1b65..8fa032d966 100644 --- a/include/xbt/exception.hpp +++ b/include/xbt/exception.hpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2005-2017. The SimGrid Team.All rights reserved. */ +/* Copyright (c) 2005-2018. The SimGrid Team.All rights reserved. */ /* 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. */ @@ -65,7 +65,7 @@ class ThrowPoint { * However, you can try `dynamic_cast` an exception to this type in order to * get contextual information about the exception. */ -XBT_PUBLIC_CLASS WithContextException { +class XBT_PUBLIC WithContextException { public: WithContextException() : backtrace_(simgrid::xbt::backtrace()), diff --git a/include/xbt/string.hpp b/include/xbt/string.hpp index 15bf86d824..bb237f03de 100644 --- a/include/xbt/string.hpp +++ b/include/xbt/string.hpp @@ -54,7 +54,7 @@ struct string_data { * * the [C++11-conforming implementation](https://gcc.gnu.org/gcc-5/changes.html) * does not use refcouting/COW but has a small string optimization. */ -XBT_PUBLIC_CLASS string : private string_data { +class XBT_PUBLIC string : private string_data { static char NUL; public: diff --git a/src/kernel/activity/ActivityImpl.hpp b/src/kernel/activity/ActivityImpl.hpp index 21192104a5..dba9a7af7f 100644 --- a/src/kernel/activity/ActivityImpl.hpp +++ b/src/kernel/activity/ActivityImpl.hpp @@ -19,25 +19,25 @@ namespace simgrid { namespace kernel { namespace activity { - XBT_PUBLIC_CLASS ActivityImpl { - public: - ActivityImpl(); - virtual ~ActivityImpl(); - e_smx_state_t state = SIMIX_WAITING; /* State of the activity */ - std::string name; /* Activity name if any */ - std::list simcalls; /* List of simcalls waiting for this activity */ - - virtual void suspend()=0; - virtual void resume()=0; - virtual void post() =0; // What to do when a simcall terminates - - // boost::intrusive_ptr support: - friend XBT_PUBLIC void intrusive_ptr_add_ref(ActivityImpl * activity); - friend XBT_PUBLIC void intrusive_ptr_release(ActivityImpl * activity); - - private: - std::atomic_int_fast32_t refcount_{0}; - }; +class XBT_PUBLIC ActivityImpl { +public: + ActivityImpl(); + virtual ~ActivityImpl(); + e_smx_state_t state = SIMIX_WAITING; /* State of the activity */ + std::string name; /* Activity name if any */ + std::list simcalls; /* List of simcalls waiting for this activity */ + + virtual void suspend() = 0; + virtual void resume() = 0; + virtual void post() = 0; // What to do when a simcall terminates + + // boost::intrusive_ptr support: + friend XBT_PUBLIC void intrusive_ptr_add_ref(ActivityImpl* activity); + friend XBT_PUBLIC void intrusive_ptr_release(ActivityImpl* activity); + +private: + std::atomic_int_fast32_t refcount_{0}; +}; }}} // namespace simgrid::kernel::activity #endif /* SIMGRID_KERNEL_ACTIVITY_ACTIVITYIMPL_HPP */ diff --git a/src/kernel/activity/CommImpl.hpp b/src/kernel/activity/CommImpl.hpp index 86e44d1f72..849f605785 100644 --- a/src/kernel/activity/CommImpl.hpp +++ b/src/kernel/activity/CommImpl.hpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2007-2017. The SimGrid Team. All rights reserved. */ +/* Copyright (c) 2007-2018. The SimGrid Team. All rights reserved. */ /* 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. */ @@ -15,8 +15,7 @@ namespace simgrid { namespace kernel { namespace activity { -XBT_PUBLIC_CLASS CommImpl : public ActivityImpl -{ +class XBT_PUBLIC CommImpl : public ActivityImpl { ~CommImpl() override; public: diff --git a/src/kernel/activity/ExecImpl.hpp b/src/kernel/activity/ExecImpl.hpp index 4b114476be..17f82aec32 100644 --- a/src/kernel/activity/ExecImpl.hpp +++ b/src/kernel/activity/ExecImpl.hpp @@ -13,8 +13,7 @@ namespace simgrid { namespace kernel { namespace activity { -XBT_PUBLIC_CLASS ExecImpl : public ActivityImpl -{ +class XBT_PUBLIC ExecImpl : public ActivityImpl { ~ExecImpl() override; public: diff --git a/src/kernel/activity/SleepImpl.hpp b/src/kernel/activity/SleepImpl.hpp index 38c781f208..2713736353 100644 --- a/src/kernel/activity/SleepImpl.hpp +++ b/src/kernel/activity/SleepImpl.hpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2007-2017. The SimGrid Team. All rights reserved. */ +/* Copyright (c) 2007-2018. The SimGrid Team. All rights reserved. */ /* 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. */ @@ -13,8 +13,7 @@ namespace simgrid { namespace kernel { namespace activity { -XBT_PUBLIC_CLASS SleepImpl : public ActivityImpl -{ +class XBT_PUBLIC SleepImpl : public ActivityImpl { public: void suspend() override; void resume() override; diff --git a/src/kernel/activity/SynchroIo.hpp b/src/kernel/activity/SynchroIo.hpp index b7f7e1b2ec..03efd48fc0 100644 --- a/src/kernel/activity/SynchroIo.hpp +++ b/src/kernel/activity/SynchroIo.hpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2007-2017. The SimGrid Team. All rights reserved. */ +/* Copyright (c) 2007-2018. The SimGrid Team. All rights reserved. */ /* 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. */ @@ -13,8 +13,7 @@ namespace simgrid { namespace kernel { namespace activity { -XBT_PUBLIC_CLASS IoImpl : public ActivityImpl -{ +class XBT_PUBLIC IoImpl : public ActivityImpl { public: void suspend() override; void resume() override; diff --git a/src/kernel/activity/SynchroRaw.hpp b/src/kernel/activity/SynchroRaw.hpp index eaa8e9c8a6..40b388795e 100644 --- a/src/kernel/activity/SynchroRaw.hpp +++ b/src/kernel/activity/SynchroRaw.hpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2007-2017. The SimGrid Team. All rights reserved. */ +/* Copyright (c) 2007-2018. The SimGrid Team. All rights reserved. */ /* 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. */ @@ -14,8 +14,7 @@ namespace kernel { namespace activity { /** Used to implement mutexes, semaphores and conditions */ -XBT_PUBLIC_CLASS RawImpl : public ActivityImpl -{ +class XBT_PUBLIC RawImpl : public ActivityImpl { public: ~RawImpl() override; void suspend() override; diff --git a/src/kernel/context/Context.hpp b/src/kernel/context/Context.hpp index 96997034f7..d33af391de 100644 --- a/src/kernel/context/Context.hpp +++ b/src/kernel/context/Context.hpp @@ -37,103 +37,84 @@ namespace simgrid { namespace kernel { namespace context { - XBT_PUBLIC_CLASS ContextFactory { - private: - std::string name_; - public: - - explicit ContextFactory(std::string name) : name_(std::move(name)) {} - virtual ~ContextFactory(); - virtual Context* create_context(std::function code, - void_pfn_smxprocess_t cleanup, smx_actor_t process) = 0; - - // Optional methods for attaching main() as a context: - - /** Creates a context from the current context of execution +class XBT_PUBLIC ContextFactory { +private: + std::string name_; + +public: + explicit ContextFactory(std::string name) : name_(std::move(name)) {} + virtual ~ContextFactory(); + virtual Context* create_context(std::function code, void_pfn_smxprocess_t cleanup, smx_actor_t process) = 0; + + // Optional methods for attaching main() as a context: + + /** Creates a context from the current context of execution + * + * This will not work on all implementation of `ContextFactory`. + */ + virtual Context* attach(void_pfn_smxprocess_t cleanup_func, smx_actor_t process); + virtual Context* create_maestro(std::function code, smx_actor_t process); + + virtual void run_all() = 0; + virtual Context* self(); + std::string const& name() const { return name_; } +private: + void declare_context(void* T, std::size_t size); + +protected: + template T* new_context(Args&&... args) + { + T* context = new T(std::forward(args)...); + this->declare_context(context, sizeof(T)); + return context; + } +}; + +class XBT_PUBLIC Context { +private: + std::function code_; + void_pfn_smxprocess_t cleanup_func_ = nullptr; + smx_actor_t process_ = nullptr; + +public: + class StopRequest { + /** @brief Exception launched to kill a process, in order to properly unwind its stack and release RAII stuff * - * This will not work on all implementation of `ContextFactory`. + * Nope, Sonar, this should not inherit of std::exception. + * Otherwise, users may accidentally catch it with a try {} catch (std::exception) */ - virtual Context* attach(void_pfn_smxprocess_t cleanup_func, smx_actor_t process); - virtual Context* create_maestro(std::function code, smx_actor_t process); - - virtual void run_all() = 0; - virtual Context* self(); - std::string const& name() const - { - return name_; - } - private: - void declare_context(void* T, std::size_t size); - protected: - template - T* new_context(Args&&... args) - { - T* context = new T(std::forward(args)...); - this->declare_context(context, sizeof(T)); - return context; - } - }; - - XBT_PUBLIC_CLASS Context { - private: - std::function code_; - void_pfn_smxprocess_t cleanup_func_ = nullptr; - smx_actor_t process_ = nullptr; - public: - class StopRequest { - /** @brief Exception launched to kill a process, in order to properly unwind its stack and release RAII stuff - * - * Nope, Sonar, this should not inherit of std::exception. - * Otherwise, users may accidentally catch it with a try {} catch (std::exception) - */ - }; - bool iwannadie; - - Context(std::function code, - void_pfn_smxprocess_t cleanup_func, - smx_actor_t process); - void operator()() - { - code_(); - } - bool has_code() const - { - return static_cast(code_); - } - smx_actor_t process() - { - return this->process_; - } - void set_cleanup(void_pfn_smxprocess_t cleanup) - { - cleanup_func_ = cleanup; - } - - // Virtual methods - virtual ~Context(); - virtual void stop(); - virtual void suspend() = 0; }; - - XBT_PUBLIC_CLASS AttachContext : public Context { - public: - - AttachContext(std::function code, - void_pfn_smxprocess_t cleanup_func, - smx_actor_t process) + bool iwannadie; + + Context(std::function code, void_pfn_smxprocess_t cleanup_func, smx_actor_t process); + void operator()() { code_(); } + bool has_code() const { return static_cast(code_); } + smx_actor_t process() { return this->process_; } + void set_cleanup(void_pfn_smxprocess_t cleanup) { cleanup_func_ = cleanup; } + + // Virtual methods + virtual ~Context(); + virtual void stop(); + virtual void suspend() = 0; +}; + +class XBT_PUBLIC AttachContext : public Context { +public: + AttachContext(std::function code, void_pfn_smxprocess_t cleanup_func, smx_actor_t process) : Context(std::move(code), cleanup_func, process) - {} + { + } - ~AttachContext() override; + ~AttachContext() override; - /** Called by the context when it is ready to give control - * to the maestro. - */ - virtual void attach_start() = 0; + /** Called by the context when it is ready to give control + * to the maestro. + */ + virtual void attach_start() = 0; - /** Called by the context when it has finished its job */ - virtual void attach_stop() = 0; - }; + /** Called by the context when it has finished its job */ + virtual void attach_stop() = 0; +}; /* This allows Java to hijack the context factory (Java induces factories of factory :) */ typedef ContextFactory* (*ContextFactoryInitializer)(); diff --git a/src/kernel/lmm/maxmin.hpp b/src/kernel/lmm/maxmin.hpp index db0a09805d..c64d4d68c3 100644 --- a/src/kernel/lmm/maxmin.hpp +++ b/src/kernel/lmm/maxmin.hpp @@ -168,8 +168,7 @@ XBT_PUBLIC double func_vegas_fpi(const Variable& var, double x); * Then, it is used to list all variables involved in constraint through constraint's xxx_element_set lists, or * vice-versa list all constraints for a given variable. */ -XBT_PUBLIC_CLASS Element -{ +class XBT_PUBLIC Element { public: int get_concurrency() const; void decrease_concurrency(); @@ -206,8 +205,7 @@ struct ConstraintLight { * \li Active elements which variable's weight is non-zero (i.e. it is enabled) AND its element value is non-zero. * LMM_solve iterates over active elements during resolution, dynamically making them active or unactive. */ -XBT_PUBLIC_CLASS Constraint -{ +class XBT_PUBLIC Constraint { public: Constraint() = delete; Constraint(void* id_value, double bound_value); @@ -333,8 +331,7 @@ private: * When something prevents us from enabling a variable, we "stage" the weight that we would have like to set, so that as * soon as possible we enable the variable with desired weight */ -XBT_PUBLIC_CLASS Variable -{ +class XBT_PUBLIC Variable { public: void initialize(simgrid::kernel::resource::Action * id_value, double sharing_weight_value, double bound_value, int number_of_constraints, unsigned visited_value); @@ -442,8 +439,7 @@ inline void Element::make_inactive() /** * @brief LMM system */ -XBT_PUBLIC_CLASS System -{ +class XBT_PUBLIC System { public: /** * @brief Create a new Linear MaxMim system diff --git a/src/kernel/resource/Action.hpp b/src/kernel/resource/Action.hpp index 827fccf4a0..ef60eae716 100644 --- a/src/kernel/resource/Action.hpp +++ b/src/kernel/resource/Action.hpp @@ -21,8 +21,7 @@ typedef boost::heap::pairing_heap modifiedSetHook_; /* Used by the lazy update to list the actions to track */ bool isLinkedModifiedSet() const { return modifiedSetHook_.is_linked(); } diff --git a/src/kernel/resource/Model.hpp b/src/kernel/resource/Model.hpp index e947ad33a3..f1123d6684 100644 --- a/src/kernel/resource/Model.hpp +++ b/src/kernel/resource/Model.hpp @@ -16,8 +16,7 @@ namespace resource { * @brief SURF model interface class * @details A model is an object which handle the interactions between its Resources and its Actions */ -XBT_PUBLIC_CLASS Model -{ +class XBT_PUBLIC Model { public: Model(); virtual ~Model(); diff --git a/src/kernel/resource/Resource.hpp b/src/kernel/resource/Resource.hpp index 8bf9885b85..c8eb5c6c0e 100644 --- a/src/kernel/resource/Resource.hpp +++ b/src/kernel/resource/Resource.hpp @@ -16,8 +16,7 @@ namespace resource { * @brief SURF resource interface class * @details This is the ancestor class of every resources in SimGrid, such as links, CPU or storage */ -XBT_PUBLIC_CLASS Resource -{ +class XBT_PUBLIC Resource { public: /** * @brief Constructor of LMM Resources diff --git a/src/kernel/routing/DragonflyZone.hpp b/src/kernel/routing/DragonflyZone.hpp index f676e410b6..492613b54a 100644 --- a/src/kernel/routing/DragonflyZone.hpp +++ b/src/kernel/routing/DragonflyZone.hpp @@ -58,7 +58,7 @@ public: * is also not realistic, as blue level can use more links than a single * Aries can handle, thus it should use several routers. */ -XBT_PUBLIC_CLASS DragonflyZone : public ClusterZone { +class XBT_PUBLIC DragonflyZone : public ClusterZone { public: explicit DragonflyZone(NetZone* father, std::string name); ~DragonflyZone() override; diff --git a/src/kernel/routing/NetZoneImpl.hpp b/src/kernel/routing/NetZoneImpl.hpp index 9e0b013d06..acfb8d343a 100644 --- a/src/kernel/routing/NetZoneImpl.hpp +++ b/src/kernel/routing/NetZoneImpl.hpp @@ -48,8 +48,7 @@ class BypassRoute; * called Autonomous Systems in this article). * */ -XBT_PUBLIC_CLASS NetZoneImpl : public s4u::NetZone -{ +class XBT_PUBLIC NetZoneImpl : public s4u::NetZone { friend simgrid::kernel::EngineImpl; // it destroys netRoot_ protected: diff --git a/src/mc/mc_exit.hpp b/src/mc/mc_exit.hpp index cede412ee8..23d2626041 100644 --- a/src/mc/mc_exit.hpp +++ b/src/mc/mc_exit.hpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2015-2017. The SimGrid Team. All rights reserved. */ +/* Copyright (c) 2015-2018. The SimGrid Team. All rights reserved. */ /* 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. */ @@ -19,9 +19,12 @@ namespace simgrid { namespace mc { -XBT_PUBLIC_CLASS DeadlockError{}; -XBT_PUBLIC_CLASS TerminationError{}; -XBT_PUBLIC_CLASS LivenessError{}; +class XBT_PUBLIC DeadlockError { +}; +class XBT_PUBLIC TerminationError { +}; +class XBT_PUBLIC LivenessError { +}; } } diff --git a/src/plugins/file_system/FileSystem.hpp b/src/plugins/file_system/FileSystem.hpp index 6535c3d848..d2e742dad0 100644 --- a/src/plugins/file_system/FileSystem.hpp +++ b/src/plugins/file_system/FileSystem.hpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2006-2015. The SimGrid Team. All rights reserved. */ +/* Copyright (c) 2006-2018. The SimGrid Team. All rights reserved. */ /* 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. */ @@ -24,8 +24,7 @@ namespace s4u { * mountpoints. * For now, you cannot change the mountpoints programatically, and must declare them from your platform file. */ -XBT_PUBLIC_CLASS File -{ +class XBT_PUBLIC File { public: File(std::string fullpath, void* userdata); File(std::string fullpath, sg_host_t host, void* userdata); @@ -70,7 +69,7 @@ private: void* userdata_ = nullptr; }; -XBT_PUBLIC_CLASS FileSystemStorageExt { +class XBT_PUBLIC FileSystemStorageExt { public: static simgrid::xbt::Extension EXTENSION_ID; explicit FileSystemStorageExt(Storage* ptr); @@ -87,8 +86,7 @@ private: sg_size_t size_ = 0; }; -XBT_PUBLIC_CLASS FileDescriptorHostExt -{ +class XBT_PUBLIC FileDescriptorHostExt { public: static simgrid::xbt::Extension EXTENSION_ID; FileDescriptorHostExt() = default; diff --git a/src/plugins/vm/VirtualMachineImpl.hpp b/src/plugins/vm/VirtualMachineImpl.hpp index 3ffbfde581..95255c5288 100644 --- a/src/plugins/vm/VirtualMachineImpl.hpp +++ b/src/plugins/vm/VirtualMachineImpl.hpp @@ -27,8 +27,7 @@ namespace vm { * @brief SURF VM interface class * @details A VM represent a virtual machine */ -XBT_PUBLIC_CLASS VirtualMachineImpl : public surf::HostImpl, public simgrid::xbt::Extendable -{ +class XBT_PUBLIC VirtualMachineImpl : public surf::HostImpl, public simgrid::xbt::Extendable { friend simgrid::s4u::VirtualMachine; public: diff --git a/src/surf/cpu_interface.hpp b/src/surf/cpu_interface.hpp index fb3f15528b..47ad57ffe2 100644 --- a/src/surf/cpu_interface.hpp +++ b/src/surf/cpu_interface.hpp @@ -24,8 +24,7 @@ namespace surf { * @brief SURF cpu model interface class * @details A model is an object which handle the interactions between its Resources and its Actions */ -XBT_PUBLIC_CLASS CpuModel : public kernel::resource::Model -{ +class XBT_PUBLIC CpuModel : public kernel::resource::Model { public: /** * @brief Create a Cpu @@ -48,8 +47,7 @@ public: * @brief SURF cpu resource interface class * @details A Cpu represent a cpu associated to a host */ -XBT_PUBLIC_CLASS Cpu : public simgrid::kernel::resource::Resource -{ +class XBT_PUBLIC Cpu : public simgrid::kernel::resource::Resource { public: /** * @brief Cpu constructor @@ -144,8 +142,7 @@ public: /** @ingroup SURF_cpu_interface * @brief A CpuAction represents the execution of code on one or several Cpus */ -XBT_PUBLIC_CLASS CpuAction : public simgrid::kernel::resource::Action -{ +class XBT_PUBLIC CpuAction : public simgrid::kernel::resource::Action { friend XBT_PUBLIC Cpu* getActionCpu(CpuAction * action); public: diff --git a/src/surf/trace_mgr.hpp b/src/surf/trace_mgr.hpp index acac83b815..28cf31937d 100644 --- a/src/surf/trace_mgr.hpp +++ b/src/surf/trace_mgr.hpp @@ -49,8 +49,7 @@ namespace simgrid { * - #future_evt_set: makes it easy to find the next occuring event of all traces */ namespace trace_mgr { -XBT_PUBLIC_CLASS DatedValue -{ +class XBT_PUBLIC DatedValue { public: double date_ = 0; double value_ = 0; @@ -62,8 +61,7 @@ public: std::ostream& operator<<(std::ostream& out, const DatedValue& e); /** @brief A trace_iterator links a trace to a resource */ -XBT_PUBLIC_CLASS trace_event{ - +class XBT_PUBLIC trace_event { }; /** @brief A trace is a set of timed values, encoding the value that a variable takes at what time * @@ -71,7 +69,7 @@ XBT_PUBLIC_CLASS trace_event{ * It is useful to model dynamic platforms, where an external load that makes the resource availability change over time. * To model that, you have to set several traces per resource: one for the on/off state and one for each numerical value (computational speed, bandwidth and latency). */ -XBT_PUBLIC_CLASS trace { +class XBT_PUBLIC trace { public: /** Creates an empty trace */ explicit trace(); @@ -82,7 +80,7 @@ public: /** @brief Future Event Set (collection of iterators over the traces) * That's useful to quickly know which is the next occurring event in a set of traces. */ -XBT_PUBLIC_CLASS future_evt_set { +class XBT_PUBLIC future_evt_set { public: future_evt_set(); virtual ~future_evt_set(); -- 2.20.1