19 #ifndef ATTRIBUTE_DESCRIPTOR_HPP
20 #define ATTRIBUTE_DESCRIPTOR_HPP
32 static void setType(Uint32 &, Uint32
type);
33 static void setSize(Uint32 &, Uint32
size);
34 static void setArrayType(Uint32 &, Uint32 arrayType);
35 static void setArraySize(Uint32 &, Uint32 arraySize);
36 static void setNullable(Uint32 &, Uint32 nullable);
37 static void setDKey(Uint32 &, Uint32 dkey);
38 static void setPrimaryKey(Uint32 &, Uint32 dkey);
39 static void setDynamic(Uint32 &, Uint32 dynamicInd);
40 static void setDiskBased(Uint32 &, Uint32 val);
42 static Uint32
getType(
const Uint32 &);
43 static Uint32 getSize(
const Uint32 &);
44 static Uint32 getSizeInBytes(
const Uint32 &);
45 static Uint32 getSizeInWords(
const Uint32 &);
46 static Uint32 getArrayType(
const Uint32 &);
47 static Uint32 getArraySize(
const Uint32 &);
48 static Uint32 getNullable(
const Uint32 &);
49 static Uint32 getDKey(
const Uint32 &);
50 static Uint32 getPrimaryKey(
const Uint32 &);
51 static Uint32 getDynamic(
const Uint32 &);
52 static Uint32 getDiskBased(
const Uint32 &);
54 static void clearArrayType(Uint32 &);
84 #define AD_ARRAY_TYPE_SHIFT (0)
85 #define AD_ARRAY_TYPE_MASK (3)
87 #define AD_TYPE_SHIFT (2)
88 #define AD_TYPE_MASK (31)
90 #define AD_SIZE_SHIFT (8)
91 #define AD_SIZE_MASK (7)
93 #define AD_SIZE_IN_BYTES_SHIFT (3)
94 #define AD_SIZE_IN_WORDS_OFFSET (31)
95 #define AD_SIZE_IN_WORDS_SHIFT (5)
97 #define AD_DISK_SHIFT (11)
98 #define AD_NULLABLE_SHIFT (12)
99 #define AD_DISTR_KEY_SHIFT (13)
100 #define AD_PRIMARY_KEY (14)
101 #define AD_DYNAMIC (15)
103 #define AD_ARRAY_SIZE_SHIFT (16)
104 #define AD_ARRAY_SIZE_MASK (65535)
108 AttributeDescriptor::setType(Uint32 & desc, Uint32
type){
109 assert(type <= AD_TYPE_MASK);
110 desc |= (type << AD_TYPE_SHIFT);
115 AttributeDescriptor::setSize(Uint32 & desc, Uint32
size){
116 assert(size <= AD_SIZE_MASK);
117 desc |= (size << AD_SIZE_SHIFT);
122 AttributeDescriptor::setArrayType(Uint32 & desc, Uint32 arrayType){
123 assert(arrayType <= AD_ARRAY_TYPE_MASK);
124 desc |= (arrayType << AD_ARRAY_TYPE_SHIFT);
129 AttributeDescriptor::clearArrayType(Uint32 & desc)
131 desc &= ~Uint32(AD_ARRAY_TYPE_MASK << AD_ARRAY_TYPE_SHIFT);
136 AttributeDescriptor::setArraySize(Uint32 & desc, Uint32 arraySize){
137 assert(arraySize <= AD_ARRAY_SIZE_MASK);
138 desc |= (arraySize << AD_ARRAY_SIZE_SHIFT);
143 AttributeDescriptor::setNullable(Uint32 & desc, Uint32 nullable){
144 assert(nullable <= 1);
145 desc |= (nullable << AD_NULLABLE_SHIFT);
150 AttributeDescriptor::setDKey(Uint32 & desc, Uint32 dkey){
152 desc |= (dkey << AD_DISTR_KEY_SHIFT);
157 AttributeDescriptor::setPrimaryKey(Uint32 & desc, Uint32 dkey){
159 desc |= (dkey << AD_PRIMARY_KEY);
164 AttributeDescriptor::setDynamic(Uint32 & desc, Uint32 dynamic){
165 assert(dynamic <= 1);
166 desc |= (dynamic << AD_DYNAMIC);
171 AttributeDescriptor::setDiskBased(Uint32 & desc, Uint32 val)
174 desc |= (val << AD_DISK_SHIFT);
183 return (desc >> AD_TYPE_SHIFT) & AD_TYPE_MASK;
188 AttributeDescriptor::getSize(
const Uint32 & desc){
189 return (desc >> AD_SIZE_SHIFT) & AD_SIZE_MASK;
194 AttributeDescriptor::getSizeInBytes(
const Uint32 & desc){
195 return (getArraySize(desc) << getSize(desc))
196 >> AD_SIZE_IN_BYTES_SHIFT;
201 AttributeDescriptor::getSizeInWords(
const Uint32 & desc){
202 return ((getArraySize(desc) << getSize(desc))
203 + AD_SIZE_IN_WORDS_OFFSET)
204 >> AD_SIZE_IN_WORDS_SHIFT;
209 AttributeDescriptor::getArrayType(
const Uint32 & desc){
210 return (desc >> AD_ARRAY_TYPE_SHIFT) & AD_ARRAY_TYPE_MASK;
215 AttributeDescriptor::getArraySize(
const Uint32 & desc){
216 return (desc >> AD_ARRAY_SIZE_SHIFT) & AD_ARRAY_SIZE_MASK;
221 AttributeDescriptor::getNullable(
const Uint32 & desc){
222 return (desc >> AD_NULLABLE_SHIFT) & 1;
227 AttributeDescriptor::getDKey(
const Uint32 & desc){
228 return (desc >> AD_DISTR_KEY_SHIFT) & 1;
233 AttributeDescriptor::getPrimaryKey(
const Uint32 & desc){
234 return (desc >> AD_PRIMARY_KEY) & 1;
239 AttributeDescriptor::getDynamic(
const Uint32 & desc){
240 return (desc >> AD_DYNAMIC) & 1;
245 AttributeDescriptor::getDiskBased(
const Uint32 & desc)
247 return (desc >> AD_DISK_SHIFT) & 1;