From 38e585a302e8e5dc144422a11fc901e23dc2f58e Mon Sep 17 00:00:00 2001 From: Douglas Gregor Date: Wed, 29 Aug 2007 16:00:53 +0000 Subject: [PATCH] Constify status::count and status::cancelled. Fixes #1101 [SVN r39052] --- include/boost/mpi/communicator.hpp | 6 +++--- include/boost/mpi/status.hpp | 12 ++++++------ src/communicator.cpp | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/include/boost/mpi/communicator.hpp b/include/boost/mpi/communicator.hpp index c86684d..2bd8ec9 100644 --- a/include/boost/mpi/communicator.hpp +++ b/include/boost/mpi/communicator.hpp @@ -1071,13 +1071,13 @@ inline bool operator!=(const communicator& comm1, const communicator& comm2) ************************************************************************/ // Count elements in a message template -inline optional status::count() +inline optional status::count() const { return count_impl(is_mpi_datatype()); } template -optional status::count_impl(mpl::true_) +optional status::count_impl(mpl::true_) const { if (m_count != -1) return m_count; @@ -1093,7 +1093,7 @@ optional status::count_impl(mpl::true_) } template -inline optional status::count_impl(mpl::false_) +inline optional status::count_impl(mpl::false_) const { if (m_count == -1) return optional(); diff --git a/include/boost/mpi/status.hpp b/include/boost/mpi/status.hpp index 0bc99dc..734f075 100644 --- a/include/boost/mpi/status.hpp +++ b/include/boost/mpi/status.hpp @@ -54,7 +54,7 @@ class BOOST_MPI_DECL status * Determine whether the communication associated with this object * has been successfully cancelled. */ - bool cancelled(); + bool cancelled() const; /** * Determines the number of elements of type @c T contained in the @@ -66,7 +66,7 @@ class BOOST_MPI_DECL status * @returns the number of @c T elements in the message, if it can be * determined. */ - template optional count(); + template optional count() const; /** * References the underlying @c MPI_Status @@ -82,18 +82,18 @@ class BOOST_MPI_DECL status /** * INTERNAL ONLY */ - template optional count_impl(mpl::true_); + template optional count_impl(mpl::true_) const; /** * INTERNAL ONLY */ - template optional count_impl(mpl::false_); + template optional count_impl(mpl::false_) const; public: // friend templates are not portable /// INTERNAL ONLY - MPI_Status m_status; - int m_count; + mutable MPI_Status m_status; + mutable int m_count; friend class communicator; friend class request; diff --git a/src/communicator.cpp b/src/communicator.cpp index a93b856..c1e145c 100644 --- a/src/communicator.cpp +++ b/src/communicator.cpp @@ -15,7 +15,7 @@ namespace boost { namespace mpi { /*************************************************************************** * status * ***************************************************************************/ -bool status::cancelled() +bool status::cancelled() const { int flag = 0; BOOST_MPI_CHECK_RESULT(MPI_Test_cancelled, (&m_status, &flag));