void Ecppll::onHtml(const std::string& html) { if (inLang) { std::ostringstream msg; std::transform( html.begin(), html.end(), std::ostream_iterator<const char*>(msg), tnt::stringescaper(false)); bool found = true; if (next == replacetokens.end() || next->first != msg.str()) { // nächster Token passt nicht (oder kommt keiner mehr) - suche, ob wir ihn // noch finden replacetokens_type::const_iterator it; for (it = next; it != replacetokens.end() && it->first != msg.str(); ++it) ; if (it == replacetokens.end()) { std::cerr << "warning: replacement-text \"" << html << "\" not found (" << data.size() << ')' << std::endl; warn(); found = false; } else { for (replacetokens_type::const_iterator it2 = next; it2 != it; ++it2) std::cerr << "warning: replacement-text \"" << it2->first << "\" skipped (" << data.size() << ')' << std::endl; next = it; warn(); } } if (found) { data.push_back(next->second); ++next; } else data.push_back(html); } else { data.push_back(html); } }
void task4_5::solution::start(const data_type& data) const { if (data.size()==0) { min=max=0; return; } boost::thread_group t; for (int i=0;i<data.size();i++) t.create_thread( boost::bind(&task4_5::solution::solve,this,boost::ref(data[i]))); t.join_all(); }
void datastructure::data_write(std::string const& symbolic_name , std::size_t num_instances, std::size_t my_cardinality , data_type client_data) { // get_config(gid_component); implement? //distributed::config_comp config_data = get_config(); if(config_data_.my_cardinality_ != my_cardinality) config_data_.my_cardinality_ = my_cardinality; if(data_.size() != client_data.size()) data_.resize(client_data.size()); data_ = client_data; for (data_type::iterator itr = data_.begin(); itr != data_.end(); ++itr) std::cout << "Data:" << *itr << std::endl; std::cout<< "Write Data Part for component:" << my_cardinality << std::endl; }
/// Copy the value of \a val for the elements at positions \a pos in /// the partition_unordered_map container. /// /// \param pos Positions of the elements in the partition_unordered_map /// /// \param val The value to be copied /// void set_values(std::vector<Key> const& keys, std::vector<T> const& val) { HPX_ASSERT(keys.size() == val.size()); HPX_ASSERT(keys.size() <= partition_unordered_map_.size()); for (std::size_t i = 0; i != keys.size(); ++i) partition_unordered_map_[keys[i]] = val[i]; }
/// Copy the value of \a val for the elements at positions \a pos in /// the partition_vector container. /// /// \param pos Positions of the elements in the partition_vector /// /// \param val The value to be copied /// void set_values(std::vector<size_type> const& pos, std::vector<T> const& val) { HPX_ASSERT(pos.size() == val.size()); HPX_ASSERT(pos.size() <= partition_vector_.size()); for (std::size_t i = 0; i != pos.size(); ++i) partition_vector_[pos[i]] = val[i]; }
void task4_5:: solution:: create_thr( const data_type& data) { boost::thread_group tg; for( size_t i = 1; i < data.size(); ++i ) tg.create_thread( boost::bind( &solution::process, this , boost::ref(data[i]) ) ); tg.join_all(); }
// Обязателен вызов перед формированием ответа адвайсом пользователя void reserve(size_t s) { /*if ( _data.size() < s + 128 ) {*/ _data.resize(s + 16635, 0); char* beg = &(_data[0]); char* end = beg + _data.size(); _outgoing = amj::json_pack( beg, end ); // } }
task4_5::solution::solution( const data_type& data ) { if(data.size() == 0) { max_=min_=0; return; } min_ = std::numeric_limits< int >().max(); max_ = std::numeric_limits< int >().min(); create_thr( data); }
task4_5::solution::solution( const data_type& data ) { if(!data.empty()) { m_max = data[0][0]; m_min = data[0][0]; m_current_vector = data.size(); calculate_result(data); } else { m_max = 0; m_min = 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(); }
task4_5::solution::solution(const data_type& data) : min(std::numeric_limits< int >().max()), max(std::numeric_limits< int >().min()) { boost::thread_group threads; if (!data.empty()) { for (size_t i = 0; i < data.size(); i++) { threads.create_thread(boost::bind(&task4_5::solution::search_min, this, boost::ref(data[i]))); threads.create_thread(boost::bind(&task4_5::solution::search_max, this, boost::ref(data[i]))); } threads.join_all(); } else { min = 0; max = 0; } }
task4_5::solution::solution(const data_type& data) : min_(0), max_(0) { std::vector<std::future<std::pair<int, int>>> futures; if (data.empty()) { min_ = 0; max_ = 0; } else { min_ = std::numeric_limits<int>().max(); max_ = std::numeric_limits<int>().min(); } for (size_t i = 0; i < data.size(); ++i) futures.push_back(std::async(&VectMinMaxFindingFunc, std::cref(data[i]))); for (auto & ftr : futures) { const auto ftrAns = ftr.get(); min_ = std::min(min_, ftrAns.first); max_ = std::max(max_, ftrAns.second); } }
/// Returns the number of elements size_type size() const { return partition_vector_.size(); }
virtual size_type get( data_type & value_param, size_type const& position_param )const { auto const& data = ((*m_pointer).* m_traitor)(); // TODO range check std::copy( data.begin() + position_param, data.begin() + position_param + value_param.size(), value_param.begin() ); return size(); }
size_type size() const noexcept { return data_.size(); }
/// Returns the number of elements size_type size() const { return partition_unordered_map_.size(); }
size_type size() const { return data_.size(); }