From 325dfb007b07c0ab326723bcccfc65d51e8937e3 Mon Sep 17 00:00:00 2001 From: Max Neunhoeffer Date: Mon, 28 Jul 2014 15:51:36 +0200 Subject: [PATCH] Add RootPlan. --- arangod/Aql/ExecutionPlan.cpp | 25 ++++++++++++++ arangod/Aql/ExecutionPlan.h | 64 +++++++++++++++++++++++++++++++++++ 2 files changed, 89 insertions(+) diff --git a/arangod/Aql/ExecutionPlan.cpp b/arangod/Aql/ExecutionPlan.cpp index e340859ee4..5fb94283db 100644 --- a/arangod/Aql/ExecutionPlan.cpp +++ b/arangod/Aql/ExecutionPlan.cpp @@ -199,6 +199,31 @@ Json CalculationPlan::toJson (TRI_memory_zone_t* zone) { return json; } +// ----------------------------------------------------------------------------- +// --SECTION-- methods of RootPlan +// ----------------------------------------------------------------------------- + +//////////////////////////////////////////////////////////////////////////////// +/// @brief toJson, for RootPlan +//////////////////////////////////////////////////////////////////////////////// + +Json RootPlan::toJson (TRI_memory_zone_t* zone) { + Json json(ExecutionPlan::toJson(zone)); // call base class method + if (json.isEmpty()) { + return json; + } + // Now put info about ... + try { + // TODO: add specific stuff + } + catch (std::exception& e) { + return Json(); + } + + // And return it: + return json; +} + //////////////////////////////////////////////////////////////////////////////// /// @brief test function //////////////////////////////////////////////////////////////////////////////// diff --git a/arangod/Aql/ExecutionPlan.h b/arangod/Aql/ExecutionPlan.h index 24df08b122..81f2c27983 100644 --- a/arangod/Aql/ExecutionPlan.h +++ b/arangod/Aql/ExecutionPlan.h @@ -475,6 +475,70 @@ namespace triagens { AqlExpression* _aqlExpression; }; + + +// ----------------------------------------------------------------------------- +// --SECTION-- class RootPlan +// ----------------------------------------------------------------------------- + +//////////////////////////////////////////////////////////////////////////////// +/// @brief class RootPlan, derived from ExecutionPlan +//////////////////////////////////////////////////////////////////////////////// + + class RootPlan : public ExecutionPlan { + +//////////////////////////////////////////////////////////////////////////////// +/// @brief constructors for various arguments, always with offset and limit +//////////////////////////////////////////////////////////////////////////////// + + public: + + RootPlan () + : ExecutionPlan(), dummy(0) { + } + +//////////////////////////////////////////////////////////////////////////////// +/// @brief return the type of the node +//////////////////////////////////////////////////////////////////////////////// + + virtual NodeType getType () { + return ROOT; + } + +//////////////////////////////////////////////////////////////////////////////// +/// @brief return the type of the node as a string +//////////////////////////////////////////////////////////////////////////////// + + virtual std::string getTypeString () { + return std::string("RootPlan"); + } + +//////////////////////////////////////////////////////////////////////////////// +/// @brief export to JSON +//////////////////////////////////////////////////////////////////////////////// + + virtual triagens::basics::Json toJson ( + TRI_memory_zone_t* zone = TRI_UNKNOWN_MEM_ZONE); + +//////////////////////////////////////////////////////////////////////////////// +/// @brief clone execution plan recursively +//////////////////////////////////////////////////////////////////////////////// + + virtual ExecutionPlan* clone () { + auto c = new RootPlan(); + cloneDependencies(c); + return static_cast(c); + } + +//////////////////////////////////////////////////////////////////////////////// +/// @brief we need to know the offset and limit +//////////////////////////////////////////////////////////////////////////////// + + private: + + int dummy; + + }; } // namespace triagens::aql } // namespace triagens