示例#1
0
	virtual void go() override {
		while (uh->can_read()) {
			dest.push(uh->read());
			step();
		}
		while (!lh->empty()) {
			dest.push(lh->pop());
			step();
		}
	}
示例#2
0
	void push(int item) {
		int difference = 0;
		for(std::multiset<int>::iterator i = m_set->begin(); i != m_set->end(); ++i) {
			difference += (*i - item);
		}
		dest.push(difference);
	}
示例#3
0
文件: unique.cpp 项目: Tyilo/tpie
	void push(const item_type & item) {
		if(last_value != std::numeric_limits<int>::max() && item.first == last_value) // if first component of the last pair is equal to the current one do nothing
			return;

		// otherwise update last_value and push the pair to the destination node.
		last_value = item.first;
		dest.push(item);
	}
	virtual void go() override {
		std::mt19937 rng(std::time(0));
		for (stream_size_type i = 0; i < n; ++i) {
			size_t length = rng() % 10;
			std::string s(length, '\0');
			for (size_t j = 0; j < length; ++j) s[j] = 'a' + (rng() % 26);
			dest.push(s);
		}
	}
示例#5
0
	void push(int item) {
		// insert the item into the set and delete the now smallest item from the set.
		m_set->insert(item);
		if(m_set->size() > set_size)	
			m_set->erase(m_set->begin());

		// push the item to the next node.
		dest.push(item);
	}
示例#6
0
	void push(item_type coord) {
		if (!flag) {
			buffer.x = coord;
			flag = true;
		} else {
			buffer.y = coord;
			dest.push(buffer);
			flag = false;
		}
	}
	virtual void go() override {
		using namespace boost::posix_time;
		uint32_t seed = static_cast<uint32_t>
			(boost::posix_time::microsec_clock::local_time().time_of_day().fractional_seconds());
		boost::mt19937 rng(seed);
		for (stream_size_type i = 0; i < n; ++i) {
			size_t length = rng() % 10;
			std::string s(length, '\0');
			for (size_t j = 0; j < length; ++j) s[j] = 'a' + (rng() % 26);
			dest.push(s);
		}
	}
示例#8
0
文件: unique.cpp 项目: Tyilo/tpie
	void push(item_type item) {
		dest.push(std::make_pair(item, i++)); // assign an index to each integer, starting at 0.
	}
示例#9
0
文件: unique.cpp 项目: Tyilo/tpie
	void push(const item_type &item) {
		dest.push(item.first); // only push the first component of the pair.
	}