00001 /* 00002 // $Id: //open/dev/fennel/lucidera/colstore/LcsClusterAccessBase.cpp#4 $ 00003 // Fennel is a library of data storage and processing components. 00004 // Copyright (C) 2005-2009 LucidEra, Inc. 00005 // Copyright (C) 2005-2009 The Eigenbase Project 00006 // 00007 // This program is free software; you can redistribute it and/or modify it 00008 // under the terms of the GNU General Public License as published by the Free 00009 // Software Foundation; either version 2 of the License, or (at your option) 00010 // any later version approved by The Eigenbase Project. 00011 // 00012 // This program is distributed in the hope that it will be useful, 00013 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 // GNU General Public License for more details. 00016 // 00017 // You should have received a copy of the GNU General Public License 00018 // along with this program; if not, write to the Free Software 00019 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00020 */ 00021 00022 #include "fennel/common/CommonPreamble.h" 00023 #include "fennel/lucidera/colstore/LcsClusterAccessBase.h" 00024 #include "fennel/btree/BTreeWriter.h" 00025 #include "fennel/tuple/TupleAccessor.h" 00026 00027 FENNEL_BEGIN_CPPFILE("$Id: //open/dev/fennel/lucidera/colstore/LcsClusterAccessBase.cpp#4 $"); 00028 00029 LcsClusterAccessBase::LcsClusterAccessBase( 00030 BTreeDescriptor const &treeDescriptor) 00031 { 00032 segmentAccessor = treeDescriptor.segmentAccessor; 00033 clusterLock.accessSegment(segmentAccessor); 00034 bTreeTupleData.compute(treeDescriptor.tupleDescriptor); 00035 } 00036 00037 LcsRid LcsClusterAccessBase::readRid() 00038 { 00039 return *reinterpret_cast<LcsRid const *> (bTreeTupleData[0].pData); 00040 } 00041 00042 PageId LcsClusterAccessBase::readClusterPageId() 00043 { 00044 return *reinterpret_cast<PageId const *> (bTreeTupleData[1].pData); 00045 } 00046 00047 void LcsClusterAccessBase::setHdrOffsets(PConstLcsClusterNode pHdr) 00048 { 00049 PBuffer p = (PBuffer) pHdr; 00050 00051 lastVal = (uint16_t *) (p += sizeof(LcsClusterNode)); 00052 firstVal = (uint16_t *) (p += sizeof(uint16_t) * nClusterCols); 00053 nVal = (uint *) (p += sizeof(uint16_t) * nClusterCols); 00054 delta = (uint16_t *) (p += sizeof(uint) * nClusterCols); 00055 } 00056 00057 void LcsClusterAccessBase::unlockClusterPage() 00058 { 00059 clusterLock.unlock(); 00060 } 00061 00062 FENNEL_END_CPPFILE("$Id: //open/dev/fennel/lucidera/colstore/LcsClusterAccessBase.cpp#4 $"); 00063 00064 // End LcsClusterAccessBase.cpp