TupleDescriptor.h

Go to the documentation of this file.
00001 /*
00002 // $Id: //open/dev/fennel/tuple/TupleDescriptor.h#23 $
00003 // Fennel is a library of data storage and processing components.
00004 // Copyright (C) 2005-2009 The Eigenbase Project
00005 // Copyright (C) 2003-2009 SQLstream, Inc.
00006 // Copyright (C) 2005-2009 LucidEra, Inc.
00007 // Portions Copyright (C) 1999-2009 John V. Sichi
00008 //
00009 // This program is free software; you can redistribute it and/or modify it
00010 // under the terms of the GNU General Public License as published by the Free
00011 // Software Foundation; either version 2 of the License, or (at your option)
00012 // any later version approved by The Eigenbase Project.
00013 //
00014 // This program is distributed in the hope that it will be useful,
00015 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00016 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017 // GNU General Public License for more details.
00018 //
00019 // You should have received a copy of the GNU General Public License
00020 // along with this program; if not, write to the Free Software
00021 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
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     // Utility function to compare the prefixes of two tuples up to keyCount.
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 // End TupleDescriptor.h

Generated on Mon Jun 22 04:00:21 2009 for Fennel by  doxygen 1.5.1