Main Page | Namespace List | Class Hierarchy | Class List | File List | Class Members | File Members

CPStorage.h

Go to the documentation of this file.
00001 #ifndef CPSTORAGE_H 00002 #define CPSTORAGE_H 00003 00004 #include <vector> 00005 #include <Expression.h> 00006 #include "common.h" 00007 #include "Tuple.h" 00008 00009 #include "FieldExt.h" 00010 00011 BOREALIS_NAMESPACE_BEGIN; 00012 00013 class CPStorage 00014 { 00015 public: 00016 00017 // constructor 00018 CPStorage(); 00019 00020 // desctructor 00021 ~CPStorage(); 00022 00023 00024 // enqueue tuple 00025 void enqueue(char *tuple); 00026 00027 // return tuples between first and last pointers 00028 vector<char*> extract(char* first, char* last); 00029 00030 // extracts tuples between start_tuple_id and end_tuple_id 00031 vector<char*> extract(int start_tuple_id, int end_tuple_id); 00032 00033 // extracts tuple with given tuple_id 00034 char* extract(int tuple_id); 00035 00038 vector<char*> extract(int start_order_by, int end_order_by, ptr<Expression> order_by_field, bool revisions); 00039 00040 00041 vector<char*> extract(char* first, char* last, vector<ptr<Expression> > keys); 00042 // extract this one tuple with given key 00043 char* extract(string tuple_key, vector<ptr<Expression> > keys); 00044 00045 00046 // returns the first tuple with val in the order_by field 00047 char* findFirstValue(int val, ptr<Expression> order_by); 00048 00049 // returns the last tuple with val in the order_by field 00050 char* findLastValue(int val, ptr<Expression> order_by); 00051 00052 //returns a pointer to last tuple 00053 char* getLastTuple(); 00054 00055 //returns a pointer to the tuple that is on the n'th position from the end of storage 00056 char* getAtPositionFromEnd(int n); 00057 00058 // returns the number of tuples in storage 00059 int getNumTuples(); 00060 00061 //eliminates all tuples with order_by value less than min_val or greater than max_val 00062 void discardTuples(int32 min_val, int32 max_val, ptr<Expression> order_by); 00063 00064 vector<char*> getallstuff() { return _storage; } 00065 00066 00067 00068 static char* modifyTuple(char *tuple, int tuple_size, TupleType type, int revision_id); 00069 static string concatenateKeys(char *tuple, vector<ptr<Expression> > keys); 00070 00071 /*************** STATIC METHOD TO EXTRACT FROM TUPLE *******************/ 00072 static int getKey(char *tuple); 00073 static int getType(char *tuple); 00074 static int getRevisionId(char *tuple); 00075 00076 private: 00077 00078 // extract the key values from the tuples and put it together 00079 00080 // using a vector to store tuples for now. 00081 // WHAT IS A BETTER STORAGE???? BDB? 00082 vector<char*> _storage; 00083 }; 00084 00085 BOREALIS_NAMESPACE_END; 00086 00087 #endif // CPSTORAGE_H

Generated on Fri Nov 12 15:15:20 2004 for Borealis by doxygen 1.3.8