1 #ifndef _CEGOORDERSPACE_H_INCLUDED_
2 #define _CEGOORDERSPACE_H_INCLUDED_
3 ///////////////////////////////////////////////////////////////////////////////
4 //
5 // CegoOrderSpace.h
6 // ----------------
7 // Cego order space class definition
8 //
9 // Design and Implementation by Bjoern Lemke
10 //
11 // (C)opyright 2000-2019 Bjoern Lemke
12 //
13 // INTERFACE MODULE
14 //
15 // Class: CegoOrderSpace
16 //
17 // Description: Utility class for tuple sorting
18 //
19 // Status: CLEAN
20 //
21 ///////////////////////////////////////////////////////////////////////////////
22 
23 // LFC INCLUDES
24 #include <lfcbase/Chain.h>
25 
26 // CEGO INCLUDES
27 #include "CegoDefs.h"
28 #include "CegoAttrDesc.h"
29 #include "CegoOrderNode.h"
30 #include "CegoOrderCursor.h"
31 #include "CegoQueryHelper.h"
32 
33 // forward declaration
34 class CegoTableManager;
35 
36 class CegoOrderSpace {
37 
38  public:
39 
40     CegoOrderSpace();
41     ~CegoOrderSpace();
42 
43     void initOrderSpace(ListT<CegoExpr*> *pOrderList, ListT<CegoOrderNode::Ordering> *pOrderOptList, unsigned long long maxOrderSize);
44     void insertTuple(ListT<CegoField>& orderKey, ListT<CegoField>& orderTuple);
45 
46     void resetOrderSpace();
47 
48     CegoOrderCursor* getCursor();
49 
50     unsigned long long numAllocated() const;
51 
52  private:
53 
54     AVLTreeT<CegoOrderNode>* _pAVL;
55 
56     void setAggregationValue(CegoExpr *pExpr, ListT<CegoField>& fl);
57 
58     ListT<CegoExpr*>* _pOrderList;
59     ListT<CegoOrderNode::Ordering>* _pOrderOptList;
60 
61     bool _schemaSet;
62     ListT<CegoField> _selectSchema;
63     ListT<CegoField> _orderSchema;
64 
65     unsigned long long _maxOrderSize;
66     unsigned long long _orderSize;
67 
68 };
69 
70 #endif
71