BTreeAccessBase.h

Go to the documentation of this file.
00001 /*
00002 // $Id: //open/dev/fennel/btree/BTreeAccessBase.h#11 $
00003 // Fennel is a library of data storage and processing components.
00004 // Copyright (C) 2005-2009 The Eigenbase Project
00005 // Copyright (C) 2005-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_BTreeAccessBase_Included
00025 #define Fennel_BTreeAccessBase_Included
00026 
00027 #include "fennel/btree/BTreeDescriptor.h"
00028 #include "fennel/tuple/TupleProjectionAccessor.h"
00029 #include "fennel/tuple/AttributeAccessor.h"
00030 
00031 #include <boost/utility.hpp>
00032 #include <boost/scoped_ptr.hpp>
00033 
00034 FENNEL_BEGIN_NAMESPACE
00035 
00036 class AttributeAccessor;
00037 class BTreeNode;
00038 class BTreeNodeAccessor;
00039 
00044 class FENNEL_BTREE_EXPORT BTreeAccessBase
00045     : public boost::noncopyable
00046 {
00047 protected:
00051     BTreeDescriptor treeDescriptor;
00052 
00056     TupleDescriptor keyDescriptor;
00057 
00062     AttributeAccessor const *pChildAccessor;
00063 
00067     TupleProjectionAccessor leafKeyAccessor;
00068 
00072     boost::scoped_ptr<BTreeNodeAccessor> pNonLeafNodeAccessor;
00073 
00077     boost::scoped_ptr<BTreeNodeAccessor> pLeafNodeAccessor;
00078 
00082     uint cbTupleMax;
00083 
00084     // ----------------------------------------------------------------------
00085     // protected inlines below are defined in BTreeAccessBaseImpl.h
00086     // ----------------------------------------------------------------------
00087 
00096     inline BTreeNodeAccessor &getLeafNodeAccessor(BTreeNode const &node);
00097 
00106     inline BTreeNodeAccessor &getNonLeafNodeAccessor(BTreeNode const &node);
00107 
00118     inline BTreeNodeAccessor &getNodeAccessor(BTreeNode const &node);
00119 
00127     inline PageId getChildForCurrent();
00128 
00138     inline PageId getChild(BTreeNode const &node,uint iChild);
00139 
00150     inline PageId getRightSibling(PageId pageId);
00151 
00161     inline void setRightSibling(
00162         BTreeNode &leftNode,PageId leftPageId,PageId rightPageId);
00163 
00171     PageId getFirstChild(PageId pageId);
00172 
00173     explicit BTreeAccessBase(BTreeDescriptor const &descriptor);
00174     virtual ~BTreeAccessBase();
00175 
00176 public:
00177 
00181     inline SharedSegment getSegment() const;
00182 
00186     inline SharedCacheAccessor getCacheAccessor() const;
00187 
00191     inline PageId getRootPageId() const;
00192 
00196     void setRootPageId(PageId rootPageId);
00197 
00201     inline SegmentId getSegmentId() const;
00202 
00206     inline PageOwnerId getPageOwnerId() const;
00207 
00211     inline TupleDescriptor const &getTupleDescriptor() const;
00212 
00216     inline TupleDescriptor const &getKeyDescriptor() const;
00217 
00221     inline TupleProjection const &getKeyProjection() const;
00222 
00230     void validateTupleSize(
00231         TupleAccessor const &tupleAccessor);
00232 };
00233 
00234 inline SharedSegment BTreeAccessBase::getSegment() const
00235 {
00236     return treeDescriptor.segmentAccessor.pSegment;
00237 }
00238 
00239 inline SharedCacheAccessor BTreeAccessBase::getCacheAccessor() const
00240 {
00241     return treeDescriptor.segmentAccessor.pCacheAccessor;
00242 }
00243 
00244 inline PageId BTreeAccessBase::getRootPageId() const
00245 {
00246     return treeDescriptor.rootPageId;
00247 }
00248 
00249 inline SegmentId BTreeAccessBase::getSegmentId() const
00250 {
00251     return treeDescriptor.segmentId;
00252 }
00253 
00254 inline PageOwnerId BTreeAccessBase::getPageOwnerId() const
00255 {
00256     return treeDescriptor.pageOwnerId;
00257 }
00258 
00259 inline TupleDescriptor const &BTreeAccessBase::getTupleDescriptor() const
00260 {
00261     return treeDescriptor.tupleDescriptor;
00262 }
00263 
00264 inline TupleDescriptor const &BTreeAccessBase::getKeyDescriptor() const
00265 {
00266     return keyDescriptor;
00267 }
00268 
00269 inline TupleProjection const &BTreeAccessBase::getKeyProjection() const
00270 {
00271     return treeDescriptor.keyProjection;
00272 }
00273 
00274 FENNEL_END_NAMESPACE
00275 
00276 #endif
00277 
00278 // End BTreeAccessBase.h

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