1
0
Fork 0

Add the forgotten file. splice is only a stub.

This commit is contained in:
Max Neunhoeffer 2014-07-31 19:32:19 +02:00
parent 2574982771
commit 93e82b50e1
1 changed files with 86 additions and 0 deletions

86
arangod/Aql/Types.cpp Normal file
View File

@ -0,0 +1,86 @@
////////////////////////////////////////////////////////////////////////////////
/// @brief fundamental types for the optimisation and execution of AQL
///
/// @file arangod/Aql/Types.cpp
///
/// DISCLAIMER
///
/// Copyright 2010-2014 triagens GmbH, Cologne, Germany
///
/// Licensed under the Apache License, Version 2.0 (the "License");
/// you may not use this file except in compliance with the License.
/// You may obtain a copy of the License at
///
/// http://www.apache.org/licenses/LICENSE-2.0
///
/// Unless required by applicable law or agreed to in writing, software
/// distributed under the License is distributed on an "AS IS" BASIS,
/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
/// See the License for the specific language governing permissions and
/// limitations under the License.
///
/// Copyright holder is triAGENS GmbH, Cologne, Germany
///
/// @author Max Neunhoeffer
/// @author Copyright 2014, triagens GmbH, Cologne, Germany
////////////////////////////////////////////////////////////////////////////////
#include "Aql/Types.h"
using namespace triagens::aql;
using Json = triagens::basics::Json;
AqlValue::~AqlValue () {
switch (_type) {
case JSON: {
delete _json;
return;
}
case DOCVEC: {
for (auto it = _vector->begin(); it != _vector->end(); ++it) {
delete *it;
}
delete _vector;
return;
}
case RANGE: {
return;
}
default:
return;
}
}
AqlValue* AqlValue::clone () const {
switch (_type) {
case JSON: {
return new AqlValue(new Json(_json->copy()));
}
case DOCVEC: {
auto c = new vector<AqlItemBlock*>;
c->reserve(_vector->size());
for (auto it = _vector->begin(); it != _vector->end(); ++it) {
c->push_back((*it)->slice(0, (*it)->size()));
}
return new AqlValue(c);
}
case RANGE: {
return new AqlValue(_range._low, _range._high);
}
default:
return nullptr;
}
}
////////////////////////////////////////////////////////////////////////////////
/// @brief splice multiple blocks, note that the new block now owns all
/// AqlValue pointers in the old blocks, therefore, the latter are all
/// set to nullptr, just to be sure.
////////////////////////////////////////////////////////////////////////////////
AqlItemBlock* AqlItemBlock::splice(std::vector<AqlItemBlock*>& blocks)
{
return nullptr;
}