~ubuntu-branches/ubuntu/precise/mysql-5.1/precise

« back to all changes in this revision

Viewing changes to storage/ndb/include/kernel/signaldata/ListTables.hpp

  • Committer: Bazaar Package Importer
  • Author(s): Norbert Tretkowski
  • Date: 2010-03-17 14:56:02 UTC
  • Revision ID: james.westby@ubuntu.com-20100317145602-x7e30l1b2sb5s6w6
Tags: upstream-5.1.45
ImportĀ upstreamĀ versionĀ 5.1.45

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* Copyright (C) 2003 MySQL AB
 
2
 
 
3
   This program is free software; you can redistribute it and/or modify
 
4
   it under the terms of the GNU General Public License as published by
 
5
   the Free Software Foundation; version 2 of the License.
 
6
 
 
7
   This program is distributed in the hope that it will be useful,
 
8
   but WITHOUT ANY WARRANTY; without even the implied warranty of
 
9
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
10
   GNU General Public License for more details.
 
11
 
 
12
   You should have received a copy of the GNU General Public License
 
13
   along with this program; if not, write to the Free Software
 
14
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
 
15
 
 
16
#ifndef LIST_TABLES_HPP
 
17
#define LIST_TABLES_HPP
 
18
 
 
19
#include <Bitmask.hpp>
 
20
#include "SignalData.hpp"
 
21
 
 
22
/**
 
23
 * It is convenient to pack request/response data per table in one
 
24
 * 32-bit word...
 
25
 */
 
26
class ListTablesData {
 
27
public:
 
28
  static Uint32 getTableId(Uint32 data) {
 
29
    return BitmaskImpl::getField(1, &data, 0, 12);
 
30
  }
 
31
  static void setTableId(Uint32& data, Uint32 val) {
 
32
    BitmaskImpl::setField(1, &data, 0, 12, val);
 
33
  }
 
34
  static Uint32 getTableType(Uint32 data) {
 
35
    return BitmaskImpl::getField(1, &data, 12, 8);
 
36
  }
 
37
  static void setTableType(Uint32& data, Uint32 val) {
 
38
    BitmaskImpl::setField(1, &data, 12, 8, val);
 
39
  }
 
40
  static Uint32 getTableStore(Uint32 data) {
 
41
    return BitmaskImpl::getField(1, &data, 20, 3);
 
42
  }
 
43
  static void setTableStore(Uint32& data, Uint32 val) {
 
44
    BitmaskImpl::setField(1, &data, 20, 3, val);
 
45
  }
 
46
  static Uint32 getTableTemp(Uint32 data) {
 
47
    return BitmaskImpl::getField(1, &data, 23, 1);
 
48
  }
 
49
  static void setTableTemp(Uint32& data, Uint32 val) {
 
50
    BitmaskImpl::setField(1, &data, 23, 1, val);
 
51
  }
 
52
  static Uint32 getTableState(Uint32 data) {
 
53
    return BitmaskImpl::getField(1, &data, 24, 4);
 
54
  }
 
55
  static void setTableState(Uint32& data, Uint32 val) {
 
56
    BitmaskImpl::setField(1, &data, 24, 4, val);
 
57
  }
 
58
  static Uint32 getListNames(Uint32 data) {
 
59
    return BitmaskImpl::getField(1, &data, 28, 1);
 
60
  }
 
61
  static void setListNames(Uint32& data, Uint32 val) {
 
62
    BitmaskImpl::setField(1, &data, 28, 1, val);
 
63
  }
 
64
  static Uint32 getListIndexes(Uint32 data) {
 
65
    return BitmaskImpl::getField(1, &data, 29, 1);
 
66
  }
 
67
  static void setListIndexes(Uint32& data, Uint32 val) {
 
68
    BitmaskImpl::setField(1, &data, 29, 1, val);
 
69
  }
 
70
};
 
71
 
 
72
class ListTablesReq {
 
73
  /**
 
74
   * Sender(s)
 
75
   */
 
76
  friend class Backup;
 
77
  friend class Table;
 
78
  friend class Suma;
 
79
  
 
80
  /**
 
81
   * Reciver(s)
 
82
   */
 
83
  friend class Dbdict;
 
84
 
 
85
public:
 
86
  STATIC_CONST( SignalLength = 3 );
 
87
 
 
88
public:  
 
89
  Uint32 senderData;
 
90
  Uint32 senderRef;
 
91
  Uint32 requestData;
 
92
 
 
93
  Uint32 getTableId() {
 
94
    return ListTablesData::getTableId(requestData);
 
95
  }
 
96
  void setTableId(Uint32 val) {
 
97
    ListTablesData::setTableId(requestData, val);
 
98
  }
 
99
  Uint32 getTableType() const {
 
100
    return ListTablesData::getTableType(requestData);
 
101
  }
 
102
  void setTableType(Uint32 val) {
 
103
    ListTablesData::setTableType(requestData, val);
 
104
  }
 
105
  Uint32 getListNames() const {
 
106
    return ListTablesData::getListNames(requestData);
 
107
  }
 
108
  void setListNames(Uint32 val) {
 
109
    ListTablesData::setListNames(requestData, val);
 
110
  }
 
111
  Uint32 getListIndexes() const {
 
112
    return ListTablesData::getListIndexes(requestData);
 
113
  }
 
114
  void setListIndexes(Uint32 val) {
 
115
    ListTablesData::setListIndexes(requestData, val);
 
116
  }
 
117
};
 
118
 
 
119
class ListTablesConf {
 
120
  /**
 
121
   * Sender(s)
 
122
   */
 
123
  friend class Dbdict;
 
124
  
 
125
  /**
 
126
   * Reciver(s)
 
127
   */
 
128
  friend class Backup;
 
129
  friend class Table;
 
130
  friend class Suma;
 
131
 
 
132
public:
 
133
  /**
 
134
   * Note: last signal is indicated by having length < 25
 
135
   */
 
136
  STATIC_CONST( SignalLength = 25 );
 
137
  STATIC_CONST( HeaderLength = 2  );
 
138
  STATIC_CONST( DataLength   = 23 );
 
139
 
 
140
public:  
 
141
  Uint32 senderData;
 
142
  Uint32 counter;
 
143
  Uint32 tableData[DataLength];
 
144
 
 
145
  static Uint32 getTableId(Uint32 data) {
 
146
    return ListTablesData::getTableId(data);
 
147
  }
 
148
  void setTableId(unsigned pos, Uint32 val) {
 
149
    ListTablesData::setTableId(tableData[pos], val);
 
150
  }
 
151
  static Uint32 getTableType(Uint32 data) {
 
152
    return ListTablesData::getTableType(data);
 
153
  }
 
154
  void setTableType(unsigned pos, Uint32 val) {
 
155
    ListTablesData::setTableType(tableData[pos], val);
 
156
  }
 
157
  static Uint32 getTableStore(Uint32 data) {
 
158
    return ListTablesData::getTableStore(data);
 
159
  }
 
160
  void setTableStore(unsigned pos, Uint32 val) {
 
161
    ListTablesData::setTableStore(tableData[pos], val);
 
162
  }
 
163
  static Uint32 getTableState(Uint32 data) {
 
164
    return ListTablesData::getTableState(data);
 
165
  }
 
166
  void setTableState(unsigned pos, Uint32 val) {
 
167
    ListTablesData::setTableState(tableData[pos], val);
 
168
  }
 
169
  static Uint32 getTableTemp(Uint32 data) {
 
170
    return ListTablesData::getTableTemp(data);
 
171
  }
 
172
  void setTableTemp(unsigned pos, Uint32 val) {
 
173
    ListTablesData::setTableTemp(tableData[pos], val);
 
174
  }
 
175
};
 
176
 
 
177
#endif