00001 #ifndef WAITFOR_QBOX_H 00002 #define WAITFOR_QBOX_H 00003 00004 #include "QBox.h" 00005 #include "Timestamp.h" 00006 #include "Expression.h" 00007 00008 BOREALIS_NAMESPACE_BEGIN; 00009 00010 class WaitForQBox : public QBox { 00011 00012 private: 00013 00014 class TimestampTuple { 00015 public: 00016 TimestampTuple(Timestamp timestamp, const char* tuple, size_t size) : 00017 _timestamp(timestamp) 00018 { 00019 00020 _tuple = new char[size]; 00021 memcpy(_tuple, tuple, size); 00022 } 00023 Timestamp getTimestamp() { return _timestamp; } 00024 char* getTuple() { return _tuple; } 00025 ~TimestampTuple() { delete _tuple; } 00026 private: 00027 Timestamp _timestamp; 00028 char* _tuple; 00029 }; 00030 00031 ptr<EvalContext> _ctxt; 00032 ptr<Expression> _predicate; 00033 00034 unsigned int _output_tuple_size; 00035 Timestamp _timeout; // sec, usec 00036 00037 // Oldest tuple will be at the front 00038 list<ptr<TimestampTuple> > _buffer; 00039 00040 protected: 00041 void setupImpl() throw (AuroraException); 00042 void initImpl() throw (AuroraException); 00043 void runImpl(QBoxInvocation&) throw (AuroraException); 00044 00045 AURORA_DECLARE_QBOX(WaitForQBox, "waitfor"); 00046 }; 00047 00048 BOREALIS_NAMESPACE_END; 00049 00050 #endif