00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef Fennel_TupleDescriptor_Included
00025 #define Fennel_TupleDescriptor_Included
00026
00027 #include <vector>
00028
00029 FENNEL_BEGIN_NAMESPACE
00030
00031 class StoredTypeDescriptor;
00032 class StoredTypeDescriptorFactory;
00033 class TupleData;
00034 class ByteOutputStream;
00035 class ByteInputStream;
00036 class DataVisitor;
00037
00042 struct FENNEL_TUPLE_EXPORT TupleAttributeDescriptor
00043 {
00044 StoredTypeDescriptor const *pTypeDescriptor;
00045 bool isNullable;
00046 TupleStorageByteLength cbStorage;
00047
00048 explicit TupleAttributeDescriptor();
00049
00050 explicit TupleAttributeDescriptor(
00051 StoredTypeDescriptor const &typeDescriptor,
00052 bool isNullable = false,
00053 TupleStorageByteLength cbStorage = 0);
00054
00055 bool operator == (TupleAttributeDescriptor const &other) const;
00056 };
00057
00062 class FENNEL_TUPLE_EXPORT TupleProjection
00063 : public VectorOfUint
00064 {
00065 public:
00066 void writePersistent(
00067 ByteOutputStream &) const;
00068
00069 void readPersistent(
00070 ByteInputStream &);
00071
00072 void projectFrom(
00073 TupleProjection const &sourceProjection,
00074 TupleProjection const &tupleProjection);
00075 };
00076
00089 class FENNEL_TUPLE_EXPORT TupleDescriptor
00090 : public std::vector<TupleAttributeDescriptor>
00091 {
00092 public:
00093 void projectFrom(
00094 TupleDescriptor const &tupleDescriptor,
00095 TupleProjection const &tupleProjection);
00096
00097
00098 int compareTuplesKey(
00099 TupleData const &tuple1,
00100 TupleData const &tuple2,
00101 uint keyCount) const;
00102
00103 int compareTuples(
00104 TupleData const &tuple1,
00105 TupleData const &tuple2) const;
00106
00107 int compareTuples(
00108 TupleData const &tuple1, TupleProjection const &proj1,
00109 TupleData const &tuple2, TupleProjection const &proj2,
00110 bool *containsNullKey = NULL) const;
00111
00112 void writePersistent(
00113 ByteOutputStream &) const;
00114
00115 void readPersistent(
00116 ByteInputStream &,
00117 StoredTypeDescriptorFactory const &);
00118
00119 void visit(
00120 TupleData const &tuple,
00121 DataVisitor &dataVisitor,
00122 bool visitLengths) const;
00123
00124 bool containsNullable() const;
00125
00127 bool storageEqual(
00128 TupleDescriptor const &other) const;
00129 TupleStorageByteLength getMaxByteCount() const;
00130 };
00131
00132 FENNEL_TUPLE_EXPORT std::ostream & operator<< (
00133 std::ostream &str,TupleDescriptor const &);
00134
00135 FENNEL_TUPLE_EXPORT std::ostream & operator<< (
00136 std::ostream &str,TupleAttributeDescriptor const &);
00137
00138 FENNEL_END_NAMESPACE
00139
00140 #endif
00141
00142