Ticket #4695: iprimitive_position.diff
File iprimitive_position.diff, 2.2 KB (added by , 12 years ago) |
---|
-
boost/mpi/detail/packed_iprimitive.hpp
old new 34 34 packed_iprimitive(buffer_type & b, MPI_Comm const & comm, int position = 0) 35 35 : buffer_(b), 36 36 comm(comm), 37 position (position)37 position_(position) 38 38 { 39 39 } 40 40 … … 53 53 return size_ = buffer_.size(); 54 54 } 55 55 56 int position() const 57 { 58 return position_; 59 } 60 56 61 void resize(std::size_t s) 57 62 { 58 63 buffer_.resize(s); … … 105 110 void load_impl(void * p, MPI_Datatype t, int l) 106 111 { 107 112 BOOST_MPI_CHECK_RESULT(MPI_Unpack, 108 (const_cast<char*>(boost::serialization::detail::get_data(buffer_)), buffer_.size(), &position , p, l, t, comm));113 (const_cast<char*>(boost::serialization::detail::get_data(buffer_)), buffer_.size(), &position_, p, l, t, comm)); 109 114 } 110 115 111 116 buffer_type & buffer_; 112 117 mutable std::size_t size_; 113 118 MPI_Comm comm; 114 int position ;119 int position_; 115 120 }; 116 121 117 122 } } // end namespace boost::mpi -
boost/mpi/detail/binary_buffer_iprimitive.hpp
old new 34 34 35 35 binary_buffer_iprimitive(buffer_type & b, MPI_Comm const &, int position = 0) 36 36 : buffer_(b), 37 position (position)37 position_(position) 38 38 { 39 39 } 40 40 … … 53 53 return size_ = buffer_.size(); 54 54 } 55 55 56 int position() const 57 { 58 return position_; 59 } 60 56 61 void resize(std::size_t s) 57 62 { 58 63 buffer_.resize(s); … … 106 111 107 112 void load_impl(void * p, int l) 108 113 { 109 assert(position +l<=static_cast<int>(buffer_.size()));110 std::memcpy(p,&buffer_[position ],l);111 position += l;114 assert(position_+l<=static_cast<int>(buffer_.size())); 115 std::memcpy(p,&buffer_[position_],l); 116 position_ += l; 112 117 } 113 118 114 119 buffer_type & buffer_; 115 120 mutable std::size_t size_; 116 int position ;121 int position_; 117 122 }; 118 123 119 124 } } // end namespace boost::mpi