From 93e82b50e153fb9858da0fd9ca2de72539ae96c8 Mon Sep 17 00:00:00 2001 From: Max Neunhoeffer Date: Thu, 31 Jul 2014 19:32:19 +0200 Subject: [PATCH] Add the forgotten file. splice is only a stub. --- arangod/Aql/Types.cpp | 86 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 arangod/Aql/Types.cpp diff --git a/arangod/Aql/Types.cpp b/arangod/Aql/Types.cpp new file mode 100644 index 0000000000..d4f530a48b --- /dev/null +++ b/arangod/Aql/Types.cpp @@ -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; + 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& blocks) +{ + return nullptr; +} +