diff --git a/src/utils/Messenger.hpp b/src/utils/Messenger.hpp index 275840eefd04bd049a7e99ec92ab6505012ae349..94e551c9a9c618fa4b8f5d5c20358767ba3cc640 100644 --- a/src/utils/Messenger.hpp +++ b/src/utils/Messenger.hpp @@ -2,6 +2,7 @@ #define MESSENGER_HPP #include <PastisMacros.hpp> +#include <PastisAssert.hpp> class Messenger { @@ -15,6 +16,13 @@ class Messenger static void create(int& argc, char* argv[]); static void destroy(); + PASTIS_INLINE + static Messenger& getInstance() + { + Assert(m_instance != nullptr); + return *m_instance; + } + PASTIS_INLINE const int& rank() const { @@ -31,4 +39,25 @@ class Messenger ~Messenger(); }; +PASTIS_INLINE +const Messenger& messenger() +{ + return Messenger::getInstance(); +} + +[[deprecated("use better name")]] +PASTIS_INLINE +const int& commRank() +{ + return messenger().rank(); +} + +[[deprecated("use better name")]] +PASTIS_INLINE +const int& commSize() +{ + return messenger().size(); +} + + #endif // MESSENGER_HPP