1
0
Fork 0

Finish Types.cpp, the forgotten file. Now splice should work.

This commit is contained in:
Max Neunhoeffer 2014-07-31 22:31:28 +02:00
parent 93e82b50e1
commit 000664db6e
1 changed files with 26 additions and 1 deletions

View File

@ -81,6 +81,31 @@ AqlValue* AqlValue::clone () const {
AqlItemBlock* AqlItemBlock::splice(std::vector<AqlItemBlock*>& blocks)
{
return nullptr;
TRI_ASSERT(blocks.size() != 0);
auto it = blocks.begin();
size_t totalsize = (*it)->size();
VariableId nrVars = (*it)->getNrVars();
while (true) {
if (++it == blocks.end()) {
break;
}
totalsize += (*it)->size();
TRI_ASSERT((*it)->getNrVars() == nrVars);
}
auto res = new AqlItemBlock(totalsize, nrVars);
size_t pos = 0;
for (it = blocks.begin(); it != blocks.end(); ++it) {
for (size_t row = 0; row < (*it)->size(); ++row) {
for (VariableId col = 0; col < nrVars; ++col) {
res->setValue(pos+row, col, (*it)->getValue(row, col));
(*it)->setValue(row, col, nullptr);
}
}
pos += (*it)->size();
}
return res;
}