1 /* Copyright (c) 2003-2005 MySQL AB
2    Use is subject to license terms
3 
4    This program is free software; you can redistribute it and/or modify
5    it under the terms of the GNU General Public License as published by
6    the Free Software Foundation; version 2 of the License.
7 
8    This program is distributed in the hope that it will be useful,
9    but WITHOUT ANY WARRANTY; without even the implied warranty of
10    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11    GNU General Public License for more details.
12 
13    You should have received a copy of the GNU General Public License
14    along with this program; if not, write to the Free Software
15    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA */
16 
17 #ifndef SECTION_READER_HPP
18 #define SECTION_READER_HPP
19 
20 #include <ndb_types.h>
21 
22 class SectionReader {
23 public:
24   SectionReader(struct SegmentedSectionPtr &,
25 		class SectionSegmentPool &);
26 
27   void reset();
28   bool step(Uint32 len);
29   bool getWord(Uint32 * dst);
30   bool peekWord(Uint32 * dst) const ;
31   bool peekWords(Uint32 * dst, Uint32 len) const;
32   Uint32 getSize() const;
33   bool getWords(Uint32 * dst, Uint32 len);
34 
35 private:
36   Uint32 m_pos;
37   Uint32 m_len;
38   class SectionSegmentPool & m_pool;
39   class SectionSegment * m_head;
40   class SectionSegment * m_currentSegment;
41 };
42 
43 inline
getSize() const44 Uint32 SectionReader::getSize() const
45 {
46   return m_len;
47 }
48 
49 #endif
50