hqlcppds.hpp 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. /*##############################################################################
  2. HPCC SYSTEMS software Copyright (C) 2012 HPCC Systems.
  3. Licensed under the Apache License, Version 2.0 (the "License");
  4. you may not use this file except in compliance with the License.
  5. You may obtain a copy of the License at
  6. http://www.apache.org/licenses/LICENSE-2.0
  7. Unless required by applicable law or agreed to in writing, software
  8. distributed under the License is distributed on an "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. See the License for the specific language governing permissions and
  11. limitations under the License.
  12. ############################################################################## */
  13. #ifndef __HQLCPPDS_HPP_
  14. #define __HQLCPPDS_HPP_
  15. //---------------------------------------------------------------------------------------------------------------------
  16. class ChildGraphExprBuilder : public CInterface
  17. {
  18. public:
  19. ChildGraphExprBuilder(unsigned _numInputs);
  20. IHqlExpression * addDataset(IHqlExpression * expr);
  21. void addAction(IHqlExpression * expr);
  22. unsigned addInput();
  23. IHqlExpression * getGraph(_ATOM extraAttrName = NULL);
  24. inline IHqlExpression * queryRepresents() const { return represents; }
  25. inline unsigned numResults() const { return numInputs + numOutputs; }
  26. public:
  27. HqlExprArray results;
  28. OwnedHqlExpr represents;
  29. OwnedHqlExpr resultsExpr;
  30. unsigned numInputs;
  31. unsigned numOutputs;
  32. };
  33. //===========================================================================
  34. class ChildGraphBuilder : public CInterface
  35. {
  36. public:
  37. ChildGraphBuilder(HqlCppTranslator & _translator, IHqlExpression * subgraph);
  38. unique_id_t buildGraphLoopBody(BuildCtx & ctx, bool multiInstance);
  39. unique_id_t buildLoopBody(BuildCtx & ctx, bool multiInstance);
  40. unique_id_t buildRemoteGraph(BuildCtx & ctx);
  41. void generateGraph(BuildCtx & ctx);
  42. void generatePrefetchGraph(BuildCtx & _ctx, OwnedHqlExpr * retGraphExpr);
  43. protected:
  44. void createBuilderAlias(BuildCtx & ctx, ParentExtract * extractBuilder);
  45. protected:
  46. HqlCppTranslator & translator;
  47. unsigned id;
  48. StringBuffer instanceName;
  49. LinkedHqlExpr childQuery;
  50. OwnedHqlExpr instanceExpr;
  51. OwnedHqlExpr resultInstanceExpr;
  52. OwnedHqlExpr represents;
  53. OwnedHqlExpr resultsExpr;
  54. unsigned numResults;
  55. };
  56. IHqlExpression * createCounterAsGraphResult(IHqlExpression * counter, IHqlExpression * represents, unsigned seq);
  57. //===========================================================================
  58. void addGraphIdAttribute(ActivityInstance * instance, BuildCtx & ctx, IHqlExpression * graphId);
  59. #endif