Esempio n. 1
0
Operator::GetNextResultT IntGeneratorOp::getNext(unsigned short threadid)
{
	dbgassert(output.at(threadid) != NULL);
	Page* out = output[threadid];
	out->clear();

	while (out->canStoreTuple())
	{
		void* tuple = produceOne(threadid);
		if (tuple == NULL)
			return make_pair(Finished, out);

		void* target = out->allocateTuple();
		dbgassert(target != NULL);

		schema.copyTuple(target, tuple);
	}

	return make_pair(Ready, out);
}
Esempio n. 2
0
Operator::GetNextResultT ConsumeOp::getNext(unsigned short threadid)
{
	CtInt val = 0;
	dbgassert(vec.at(threadid) != NULL);
	Page* out = vec[threadid];
	GetNextResultT result;

	assertaddresslocal(&val);

	const int tupw = nextOp->getOutSchema().getTupleSize();

	do {
		result = nextOp->getNext(threadid);
		dbgassert(result.first != Error);

		Page* in = result.second;
		Page::Iterator it = in->createIterator();

		void* tuple;
		while ( (tuple = it.next()) ) 
		{
			CtInt* casttuple = (CtInt*) tuple;
			for (int i=0; i<(tupw/4); ++i)
			{
				val ^= casttuple[i];
			}
		}
	} while(result.first == Operator::Ready);

	assertaddresslocal(&val);

	void* dest = out->allocateTuple();
	schema.writeData(dest, 0, &val);

	return make_pair(Finished, out);
}