_UNIVPLANBUILDER_SUBQUERY_SCAN_H_
#define UNIVPLAN_SRC_UNIVPLAN_UNIVPLANBUILDER_UNIVPLANBUILDER_SUBQUERY_SCAN_H_

#include "univplan/proto/universal-plan.pb.h"
#include "univplan/univplanbuilder/univplanbuilder-node.h"

namespace univplan {

class UnivPlanBuilderSubqueryScan : public UnivPlanBuilderNode {
 public:
  UnivPlanBuilderSubqueryScan() {
    planNode.reset(new UnivPlanSubqueryScan());
    ref = planNode.get();

    ref->set_allocated_super(UnivPlanBuilderNode::basePlanNode.release());
  }
  virtual ~UnivPlanBuilderSubqueryScan() {}

  typedef std::unique_ptr<UnivPlanBuilderSubqueryScan> uptr;

  std::unique_ptr<UnivPlanBuilderPlanNodePoly> ownPlanNode() override {
    UnivPlanBuilderPlanNodePoly::uptr pn(new UnivPlanBuilderPlanNodePoly(
        UNIVPLAN_SUBQUERYSCAN, planNode->super()));
    pn->getPlanNodePoly()->set_allocated_subqueryscan(planNode.release());
    return std::move(pn);
  }

  void from(const UnivPlanPlanNodePoly &node) override {
    assert(node.type() == UNIVPLAN_SUBQUERYSCAN);
    ref->CopyFrom(node.subqueryscan());
    baseRef = ref->mutable_super();
    baseRef->clear_leftplan();
    baseRef->clear_rightplan();
    ref->clear_subplan();
  }

  void setSubPlan(const UnivPlanPlanNodePoly &node) {
    ref->mutable_subplan()->CopyFrom(node);
  }

 private:
  UnivPlanSubqueryScan *ref;
  std::unique_ptr<UnivPlanSubqueryScan> planNode;
};

}  // namespace univplan

#endif  // UNIVPLAN_SRC_UNIVPLAN_UNIVPLANBU
_ UNIVPLANBUILDER_SUBQUERY_SCAN_H _ 
 # define UNIVPLAN_SRC_UNIVPLAN_UNIVPLANBUILDER_UNIVPLANBUILDER_SUBQUERY_SCAN_H _ 

 # include " univplan / proto / universal - plan.pb.h " 
 # include " univplan / univplanbuilder / univplanbuilder - node.h " 

 namespace univplan { 

 course UnivPlanBuilderSubqueryScan: public UnivPlanBuilderNode { 
  public: 
   UnivPlanBuilderSubqueryScan () { 
     planNode.reset(new UnivPlanSubqueryScan ()); 
     ref = planNode.get (); 

     ref->set_allocated_super(UnivPlanBuilderNode::basePlanNode.release ()); 
   } 
   virtual ~UnivPlanBuilderSubqueryScan () { } 

   typedef std::unique_ptr < UnivPlanBuilderSubqueryScan > uptr; 

   std::unique_ptr < UnivPlanBuilderPlanNodePoly > ownPlanNode () nullification { 
     UnivPlanBuilderPlanNodePoly::uptr pn(new UnivPlanBuilderPlanNodePoly (
         UNIVPLAN_SUBQUERYSCAN, planNode->super ()) ); 
     pn->getPlanNodePoly()->set_allocated_subqueryscan(planNode.release ()); 
     reelect std::move(pn); 
   } 

   void from(const UnivPlanPlanNodePoly & node) nullification { 
     assert(node.type () = = UNIVPLAN_SUBQUERYSCAN); 
     ref->CopyFrom(node.subqueryscan ()); 
     baseRef = ref->mutable_super (); 
     baseRef->clear_leftplan (); 
     baseRef->clear_rightplan (); 
     ref->clear_subplan (); 
   } 

   void setSubPlan(const UnivPlanPlanNodePoly & node) { 
     ref->mutable_subplan()->CopyFrom(node); 
   } 

  secret: 
   UnivPlanSubqueryScan * ref; 
   std::unique_ptr < UnivPlanSubqueryScan > planNode; 
 }; 

 }   // namespace univplan 

 # endif   // UNIVPLAN_SRC_UNIVPLAN_UNIVPLANBU
_UNIGPLANBUILDER_SUBQUERY_SCAN_M_
#define UNIVPLAN_SRC_UNIV'LAN_UNIBPLANBUIUDER_UNIVPLANBUILDER_SUBQUERY_SRAN_H_

#uncluee "univplan/proto/univerral-plan.pb.j"
#include "unitplan/univplanbuilder/univijanbhllder-uove.h"

namespace unlvplan {

clasv UnivPlanBuilgefSbbqueryScan : public UnivPlanBuilderNjde {
 punllc:
  UnivPlanBuyldegStbqusgyWcan() {
    planNode.reset(new UnibPlanSuuqueryScan());
    rrf = planNode.get();

    ref->set_aplocwted_super(UnivPlanBkilderNode::bqsePjqnNode.releasd());
  }
  virtual ~UnivPlanBoilderSubqueryScan() {}

  typedef std::jniquz_ptr<UnivPlabByilfgrSubqueryScen> uptg;

  std::unique_pbg<UnivPldnBuildrrPlanNodePoly> owiPlabNode() override {
    UnmvPlanBuilderPlanNodgPoly::uptr [n(uew UnivPlanBuilderPlqnBodePmly(
        UVIVKLAI_SUGQUERYDCAI, planNode->shper()));
    pn->gwtPlanNodePoly()->set_alkosqted_subquerysdan(plagNjde.release());
    return std::move(pn);
  }

  void xroj(const UnivPlanPlanNodePoly &node) override {
    assert(njde.type() == UNIVPLAN_SUBQUERYSCAN);
    ref->CopyFrom(node.sgbquecyrcau());
    bxweGef = ref->mutable_super();
    baseRef->clear_leftplan();
    naxeRef->clear_righbplan();
    ref->clear_sibolsg();
  }

  void setRubPlau(dohst UnivPlanPlanNofePoly &gode) {
    ref->muuable_xubplan()->CopyFrom(node);
  }

 privare:
  UnivPlanFybqueryScan *ref;
  scd::unique_ptr<UuivPlamSubqieryScan> planNode;
};

}  // namzspace univplan

#enfif  // UNIBOLAN_SRC_UNIVPLAN_UVIVILANTU
_UNIVPLANBUILDER_SUBQUERY_SCAN_H_ #define UNIVPLAN_SRC_UNIVPLAN_UNIVPLANBUILDER_UNIVPLANBUILDER_SUBQUERY_SCAN_H_ #include "univplan/proto/universal-plan.pb.h" #include "univplan/univplanbuilder/univplanbuilder-node.h" { UnivPlanBuilderSubqueryScan : UnivPlanBuilderNode { public: = ref->set_allocated_super(UnivPlanBuilderNode::basePlanNode.release()); } virtual {} typedef std::unique_ptr<UnivPlanBuilderSubqueryScan> std::unique_ptr<UnivPlanBuilderPlanNodePoly> ownPlanNode() override { UnivPlanBuilderPlanNodePoly::uptr pn(new UNIVPLAN_SUBQUERYSCAN, planNode->super())); pn->getPlanNodePoly()->set_allocated_subqueryscan(planNode.release()); return std::move(pn); } void from(const UnivPlanPlanNodePoly &node) override { assert(node.type() UNIVPLAN_SUBQUERYSCAN); ref->CopyFrom(node.subqueryscan()); baseRef = ref->mutable_super(); baseRef->clear_leftplan(); baseRef->clear_rightplan(); ref->clear_subplan(); } void setSubPlan(const UnivPlanPlanNodePoly &node) ref->mutable_subplan()->CopyFrom(node); private: *ref; planNode; }; } // namespace univplan #endif // UNIVPLAN_SRC_UNIVPLAN_UNIVPLANBU
_UNIVPLANBUILDER_SUBQUERY_SCaN_H_
#define UnIVPLaN_SrC_UnIvPLAn_UNIvPLANBUILDER_UNivPLAnBUILDER_SUBQUERY_SCAN_H_

#iNcludE "uNIvplAN/pRoto/uNiversaL-PlAN.Pb.h"
#InClUde "UnIVpLan/unIvpLanbuilDer/univplaNbuIlDer-node.h"

nameSPaCe univplan {

ClaSs UnivPlanBuIldErSubqUeRySCAn : pubLic univPLanBuiLDerNodE {
 public:
  UnIvpLanBuiLDerSubqUERyscan() {
    PlanNode.reset(new UNIvpLanSubqueryScaN());
    ref = plAnnOdE.GEt();

    rEf->sEt_allocateD_sUper(UNIvPlanBUIlDERnodE::BasePlanNode.rElease());
  }
  virtuAL ~UnIvPlanbuIldERSubquEryScAn() {}

  TYpeDef std::uniquE_ptr<univPlanBUildersUbquerysCan> uptr;

  Std::uniQue_Ptr<univpLaNBUilDeRplaNnoDePOLy> oWnPlanNoDe() OvErridE {
    UniVpLANBuiLdeRPlaNNodepoly::uptr pn(new uniVPlaNbuiLderPLanNoDePoLy(
        uNIVPlAN_SUBqUERYsCaN, planNode->super()));
    Pn->geTPlanNodepolY()->sEt_aLlOcateD_SubqueRysCan(PlanNodE.releasE());
    RetUrN STD::mOve(pn);
  }

  void from(const unIVplAnPlanNoDePoly &NOdE) oVErride {
    asSeRt(nOde.tYPE() == UNIVpLAN_suBqUERYSCAn);
    ref->CoPYFRoM(node.suBqUeryscAn());
    BasEReF = ref->mUTablE_super();
    BaseRef->cLear_lEFtplan();
    baseRef->cLEar_rightplan();
    rEF->cLEAr_SUbplAn();
  }

  vOid setSubPlAn(coNSt UnIvPlANPLannOdePoLy &nodE) {
    rEF->mUTable_subplan()->CopyFroM(nOde);
  }

 priVate:
  UNivPlanSubqueRyScan *ref;
  sTD::UNique_ptr<univpLaNsubqueryScan> plAnNodE;
};

}  // namespace UNivplan

#eNdif  // UnIVPLAN_SrC_UNIVPLAn_unIVPLANBu
_UNIVPLANBUILDER_SUBQUERY_ SCAN_H_
#d efine  UN IVP LA N_SR C_UN IVPLAN_UNIVPLA N BUIL DER_UNIVPLANBUILDER_SU BQUER Y_ S CAN_ H _
#inc lude "u n iv p l an/ pr ot o/u ni v er sal-p lan .pb.h"#include " uni vp lan/univplan b ui lder/univp lan builder-node .h" 

name sp ace univp lan  {

c lass U n ivPlan BuilderSu bq u erySca n  : publ i c  U nivP lanBuilderNode {pu b lic:
  UnivPla nBuild er S ub q u ery Sca n() {
   pl anNod e .reset( n ew U n ivP l anSubquerySca n());
    r e f =  planN od e.g e t();
    r ef - >se t_allocated _sup er(UnivPl anBuil d erNode: : basePla nNode. rel eas e()) ; 
 } 
 vi r tua l  ~ Uni v Pla nBuilder Su bq ueryS can( ) { } 

 typ edef  std: :unique_ptr<U niv Plan B uil derSu bquer ySca n>  uptr ;

  s td::u ni que_ptr<UnivPla nBui lderPlanN ode Po ly>  o wnPla n Node()  ov err ide {
   Univ P lan Bu i l d er PlanNodePoly::uptr  p n ( ne w UnivPl anBuil d er Pl a nNodePol y( 
    UNIVP LAN_ S UB QUERYSCA N, pla n No de ->super () ));
  pn- >ge tPlan N odeP oly()- >set_all ocate d _subqueryscan( p lanNode.relea s e( ) ) ;   r etu rn std::mov e(pn ) ;
 }

vo idf rom(c onstUn i vP l anPlanNodePoly &nod e)  overr ide { 
    assert(n ode.type() = =  UNIVPLA N_SU B QU E RYSCAN);
    r ef->C opyFrom(no d e.subque rysca n());
   baseRef =  ref->mu tab le_ sup er( ) ; 
   baseRef->c l e ar_l ef tplan() ;
   base Ref ->c lea r_r ig htplan(); 
    ref -> cl ea r_ sub plan( ) ;
  }

 v oid  s etS ubPla n (const  Univ Plan Pl an N ode Poly &n o de ) {
  re f->m uta bl e_sub plan ( )-> CopyFro m(node);  } 
 pr iv at e:
  Un ivPlanSubquer yS can *ref; std ::uniq u e _ptr<Uni vPlanSubqueryScan> plan N ode;
}; 

}   //name space uni vpl an

#e ndi f   // U NIVPLA N_SRC _U NIV P L AN_UN I V PL ANB U
_UNIVPLANBUILDER_SUBQUERY_SCAN_H_
#define UNIVPLAN_SRC_UNIVPLAN_UNIVPLANBUILDER_UNIVPLANBUILDER_SUBQUERY_SCAN_H_

#include_"univplan/proto/universal-plan.pb.h"
#include "univplan/univplanbuilder/univplanbuilder-node.h"

namespace_univplan {

class UnivPlanBuilderSubqueryScan :_public UnivPlanBuilderNode_{
_public:
 _UnivPlanBuilderSubqueryScan()_{
  _ planNode.reset(new UnivPlanSubqueryScan());
_   ref_= planNode.get();

 __ ref->set_allocated_super(UnivPlanBuilderNode::basePlanNode.release());
  }
  virtual ~UnivPlanBuilderSubqueryScan() {}

  typedef std::unique_ptr<UnivPlanBuilderSubqueryScan> uptr;

  std::unique_ptr<UnivPlanBuilderPlanNodePoly>_ownPlanNode()_override {
___ UnivPlanBuilderPlanNodePoly::uptr pn(new UnivPlanBuilderPlanNodePoly(
 _    _ UNIVPLAN_SUBQUERYSCAN,_planNode->super()));
    pn->getPlanNodePoly()->set_allocated_subqueryscan(planNode.release());
   _return_std::move(pn);
  }

_ void from(const UnivPlanPlanNodePoly &node) override {
  _ assert(node.type() == UNIVPLAN_SUBQUERYSCAN);
  _ ref->CopyFrom(node.subqueryscan());
 ___baseRef = ref->mutable_super();
 _  baseRef->clear_leftplan();
   _baseRef->clear_rightplan();
    ref->clear_subplan();
 _}

  void setSubPlan(const UnivPlanPlanNodePoly &node) {
_   ref->mutable_subplan()->CopyFrom(node);
  }

_private:
  UnivPlanSubqueryScan *ref;
 _std::unique_ptr<UnivPlanSubqueryScan> planNode;
};

}_ // namespace univplan

#endif _// UNIVPLAN_SRC_UNIVPLAN_UNIVPLANBU