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
00018
CPStorage();
00019
00020
00021
~CPStorage();
00022
00023
00024
00025
void enqueue(
char *tuple);
00026
00027
00028 vector<char*>
extract(
char* first,
char* last);
00029
00030
00031 vector<char*>
extract(
int start_tuple_id,
int end_tuple_id);
00032
00033
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
00043
char*
extract(string tuple_key, vector<ptr<Expression> > keys);
00044
00045
00046
00047
char*
findFirstValue(
int val, ptr<Expression> order_by);
00048
00049
00050
char*
findLastValue(
int val, ptr<Expression> order_by);
00051
00052
00053
char*
getLastTuple();
00054
00055
00056
char*
getAtPositionFromEnd(
int n);
00057
00058
00059
int getNumTuples();
00060
00061
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
00072
static int getKey(
char *tuple);
00073
static int getType(
char *tuple);
00074
static int getRevisionId(
char *tuple);
00075
00076
private:
00077
00078
00079
00080
00081
00082 vector<char*> _storage;
00083 };
00084
00085 BOREALIS_NAMESPACE_END;
00086
00087
#endif // CPSTORAGE_H