Boost logo

Boost-Commit :

From: dgregor_at_[hidden]
Date: 2007-08-29 12:00:54


Author: dgregor
Date: 2007-08-29 12:00:53 EDT (Wed, 29 Aug 2007)
New Revision: 39052
URL: http://svn.boost.org/trac/boost/changeset/39052

Log:
Constify status::count and status::cancelled. Fixes #1101

Text files modified:
   trunk/boost/mpi/communicator.hpp | 6 +++---
   trunk/boost/mpi/status.hpp | 12 ++++++------
   trunk/libs/mpi/src/communicator.cpp | 2 +-
   3 files changed, 10 insertions(+), 10 deletions(-)

Modified: trunk/boost/mpi/communicator.hpp
==============================================================================
--- trunk/boost/mpi/communicator.hpp (original)
+++ trunk/boost/mpi/communicator.hpp 2007-08-29 12:00:53 EDT (Wed, 29 Aug 2007)
@@ -1071,13 +1071,13 @@
  ************************************************************************/
 // Count elements in a message
 template<typename T>
-inline optional<int> status::count()
+inline optional<int> status::count() const
 {
   return count_impl<T>(is_mpi_datatype<T>());
 }
 
 template<typename T>
-optional<int> status::count_impl(mpl::true_)
+optional<int> status::count_impl(mpl::true_) const
 {
   if (m_count != -1)
     return m_count;
@@ -1093,7 +1093,7 @@
 }
 
 template<typename T>
-inline optional<int> status::count_impl(mpl::false_)
+inline optional<int> status::count_impl(mpl::false_) const
 {
   if (m_count == -1)
     return optional<int>();

Modified: trunk/boost/mpi/status.hpp
==============================================================================
--- trunk/boost/mpi/status.hpp (original)
+++ trunk/boost/mpi/status.hpp 2007-08-29 12:00:53 EDT (Wed, 29 Aug 2007)
@@ -54,7 +54,7 @@
    * 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 @@
    * @returns the number of @c T elements in the message, if it can be
    * determined.
    */
- template<typename T> optional<int> count();
+ template<typename T> optional<int> count() const;
 
   /**
    * References the underlying @c MPI_Status
@@ -82,18 +82,18 @@
   /**
    * INTERNAL ONLY
    */
- template<typename T> optional<int> count_impl(mpl::true_);
+ template<typename T> optional<int> count_impl(mpl::true_) const;
 
   /**
    * INTERNAL ONLY
    */
- template<typename T> optional<int> count_impl(mpl::false_);
+ template<typename T> optional<int> 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;

Modified: trunk/libs/mpi/src/communicator.cpp
==============================================================================
--- trunk/libs/mpi/src/communicator.cpp (original)
+++ trunk/libs/mpi/src/communicator.cpp 2007-08-29 12:00:53 EDT (Wed, 29 Aug 2007)
@@ -15,7 +15,7 @@
 /***************************************************************************
  * status *
  ***************************************************************************/
-bool status::cancelled()
+bool status::cancelled() const
 {
   int flag = 0;
   BOOST_MPI_CHECK_RESULT(MPI_Test_cancelled, (&m_status, &flag));


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk