MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
LongSignal.hpp
1 /*
2  Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
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 St, Fifth Floor, Boston, MA 02110-1301 USA
16 */
17 
18 #ifndef LONG_SIGNAL_HPP
19 #define LONG_SIGNAL_HPP
20 
21 #include "pc.hpp"
22 #include <ArrayPool.hpp>
23 
28 
29  STATIC_CONST( DataLength = NDB_SECTION_SEGMENT_SZ );
30 
31  union {
32  Uint32 m_sz;
33  Uint32 chunkSize;
34  };
35  union {
36  Uint32 m_ownerRef;
37  Uint32 nextChunk;
38  };
39  union {
40  Uint32 m_lastSegment;
41  Uint32 lastChunk; //
42  };
43  union {
44  Uint32 m_nextSegment;
45  Uint32 nextPool;
46  };
47  Uint32 theData[DataLength];
48 };
49 
53 class SectionSegmentPool : public ArrayPool<SectionSegment> {};
54 
58 extern SectionSegmentPool g_sectionSegmentPool;
59 
63 void print(SegmentedSectionPtr ptr, FILE* out);
64 void copy(Uint32 * dst, SegmentedSectionPtr src);
65 void copy(Uint32 * dst, Uint32 srcFirstIVal);
66 
67 extern class SectionSegmentPool g_sectionSegmentPool;
68 
69 /* Defined in SimulatedBlock.cpp */
70 void getSection(SegmentedSectionPtr & ptr, Uint32 id);
71 void getSections(Uint32 secCount, SegmentedSectionPtr ptr[3]);
72 Uint32 getSectionSz(Uint32 id);
73 Uint32* getLastWordPtr(Uint32 id);
74 
75 /* Internal verification */
76 bool verifySection(Uint32 firstIVal,
77  SectionSegmentPool& thePool= g_sectionSegmentPool);
78 
79 #include "DataBuffer.hpp"
80 
81 template<Uint32 sz>
82 void
84  Uint32 len = ptr.sz;
85  while(len > SectionSegment::DataLength){
86  dst.append(ptr.p->theData, SectionSegment::DataLength);
87  ptr.p = pool.getPtr(ptr.p->m_nextSegment);
88  len -= SectionSegment::DataLength;
89  }
90  dst.append(ptr.p->theData, len);
91 }
92 
93 #endif