00001 #ifndef BSORT_QBOX_H 00002 #define BSORT_QBOX_H 00003 00004 #include "QBox.h" 00005 00006 #include "BufferList.h" 00007 #include "FieldExt.h" 00008 #include "HashForBufferList.h" 00009 00010 BOREALIS_NAMESPACE_BEGIN; 00011 00012 class BSortQBox : public QBox 00013 { 00014 private: 00015 00016 void addToBuffer( char *tuple ); 00017 void addSingleToBuffer( char *att_value, BufferList::node new_node ); 00018 void addDoubleToBuffer( char *att_value, BufferList::node new_node ); 00019 void addInt32ToBuffer( char *att_value, BufferList::node new_node ); 00020 void addInt64ToBuffer( char *att_value, BufferList::node new_node ); 00021 void addStringToBuffer( char *att_value, BufferList::node new_node ); 00022 00023 // something has to be passed to this method that will initialize everything 00024 00025 void emitLowest(BufferList *buffer,EnqIterator); 00026 void emitTuple(char *tuple,EnqIterator); 00027 00028 void parseGroupBy(char *atts); 00029 00030 HashForBufferList *_buffer_hash; 00031 BufferList *_buffer; // this should be called "currentBuffer or something" 00032 char *_group_by_atts; 00033 int _slack; 00034 00035 FieldExt *_field_att; 00036 FieldExt **_field_group; 00037 int _num_group_by_atts; 00038 // This (nul-terminated) string is a concatenation (0x01 delimited) 00039 //of the group by attribute values from the current tuple. 00040 char *_group_by_values_str; 00041 00042 int _num_tuples_emitted; 00043 int _output_tuple_size; 00044 char *_curr_tuple; 00045 char *_output_tuple_ptr; 00046 00047 protected: 00048 void setupImpl() throw (AuroraException); 00049 void initImpl() throw (AuroraException); 00050 void runImpl(QBoxInvocation&) throw (AuroraException); 00051 00052 AURORA_DECLARE_QBOX(BSortQBox, "bsort"); 00053 }; 00054 00055 BOREALIS_NAMESPACE_END; 00056 00057 #endif