Exemple #1
0
void session_interface::save_data(data_type const &data,std::string &s)
{
	s.clear();
	data_type::const_iterator p;
	for(p=data.begin();p!=data.end();++p) {
		packed header(p->first.size(),p->second.exposed,p->second.value.size());
		char *ptr=(char *)&header;
		s.append(ptr,ptr+sizeof(header));
		s.append(p->first.begin(),p->first.end());
		s.append(p->second.value.begin(),p->second.value.end());
	}
}
Exemple #2
0
task4_5::solution::solution( const data_type& data )
{
	
	min_of_min = INT32_MAX;
	max_of_max = INT32_MIN;
	curr_vector = data.begin();
	end_of_data = data.end();
	data_size = data.size();
	
	for( size_t i = 0; i < threads_count; i++ )
	{
		threads.create_thread( boost::bind( &task4_5::solution::solve, this  ) );
	}

	threads.join_all();

}
        T get_value(Key const& key, bool erase)
        {
            typename data_type::iterator it = partition_unordered_map_.find(key);
            if (it == partition_unordered_map_.end())
            {
                HPX_THROW_EXCEPTION(bad_parameter,
                    "partition_unordered_map::get_value",
                    "unable to find requested key in this partition of the "
                    "unordered_map");
            }

            if (!erase)
                return it->second;

            erase_on_exit t(partition_unordered_map_, it);
            return it->second;
        }
        /// Return the element at the position \a pos in the partition_unordered_map
        /// container.
        ///
        /// \param pos Positions of the elements in the partition_unordered_map
        ///
        /// \return Return the values of the elements at position represented
        ///         by \a pos.
        ///
        std::vector<T> get_values(std::vector<Key> const& keys)
        {
            std::vector<T> result;
            result.reserve(keys.size());

            for (std::size_t i = 0; i != keys.size(); ++i)
            {
                typename data_type::iterator it =
                    partition_unordered_map_.find(keys[i]);
                if (it == partition_unordered_map_.end())
                {
                    HPX_THROW_EXCEPTION(bad_parameter,
                        "partition_unordered_map::get_values",
                        "unable to find requested key in this partition of the "
                        "unordered_map");
                    break;
                }
                result.push_back(it->second);
            }
            return result;
        }
 const_iterator_type end() const
 {
     return partition_vector_.end();
 }
 iterator_type end()
 {
     return partition_vector_.end();
 }
 const_iterator_type end() const
 {
     return partition_unordered_map_.end();
 }
 const_iterator end() const { return data_.end(); }
 iterator end() { return data_.end(); }
 const_iterator end() const noexcept { return data_.end(); }
 iterator end() noexcept { return data_.end(); }
Exemple #12
0
void Ecppll::print(std::ostream& out)
{
  tnt::DatachunksCreator dc;
  std::copy(data.begin(), data.end(), std::back_inserter(dc));
  out.write(dc.ptr(), dc.size());
}