|
6 | 6 | Attribute g/r Entry Descriptor Record. |
7 | 7 | Describes a global entry (for global attributes) or rVariable entry (for variable attributes). |
8 | 8 | """ |
9 | | -struct AEDR{A} |
10 | | - header::Header |
11 | | - AEDRnext::Int64 # Offset to next AEDR in chain |
| 9 | +struct AEDR{FST, A} |
| 10 | + # header::Header |
| 11 | + AEDRnext::FST # Offset to next AEDR in chain |
12 | 12 | AttrNum::Int32 # Attribute number |
13 | 13 | DataType::Int32 # CDF data type of the entry |
14 | 14 | Num::Int32 # Entry number |
15 | 15 | NumElems::Int32 # Number of elements in the entry |
16 | 16 | NumStrings::Int32 # Number of strings (for string data) |
17 | | - rfuB::Int32 # Reserved field B |
18 | | - rfuC::Int32 # Reserved field C |
19 | | - rfuD::Int32 # Reserved field D |
20 | | - rfuE::Int32 # Reserved field E |
| 17 | + rfuB::RInt32 # Reserved field B |
| 18 | + rfuC::RInt32 # Reserved field C |
| 19 | + rfuD::RInt32 # Reserved field D |
| 20 | + rfuE::RInt32 # Reserved field E |
21 | 21 | Value::A # This consists of the number of elements (specified by the NumElems field) of the data type (specified by the DataType field). This can be thought of as a 1-dimensional array of values (stored contiguously). The size of this field is the product of the number of elements and the size in bytes of each element. |
22 | 22 | end |
23 | 23 |
|
24 | 24 | @inline function load_aedr_data(buffer::Vector{UInt8}, offset, RecordSizeType, cdf_encoding) |
25 | | - datatype = read_be(buffer, offset + 25, Int32) |
26 | | - NumElems = read_be(buffer, offset + 33, Int32) |
| 25 | + _datatype_offset = 9 + 2 * sizeof(RecordSizeType) |
| 26 | + _numelems_offset = 17 + 2 * sizeof(RecordSizeType) |
| 27 | + _data_offset = 41 + 2 * sizeof(RecordSizeType) |
| 28 | + datatype = read_be(buffer, offset + _datatype_offset, Int32) |
| 29 | + NumElems = read_be(buffer, offset + _numelems_offset, Int32) |
27 | 30 | T = julia_type(datatype, NumElems) |
28 | 31 | return if datatype in (CDF_CHAR, CDF_UCHAR) |
29 | | - load_char_data(buffer, offset + 57, NumElems) |
| 32 | + load_char_data(buffer, offset + _data_offset, NumElems) |
30 | 33 | else |
31 | 34 | needs_byte_swap = is_big_endian_encoding(cdf_encoding) |
32 | | - load_attribute_data(T, buffer, offset + 57, NumElems, needs_byte_swap) |
| 35 | + load_attribute_data(T, buffer, offset + _data_offset, NumElems, needs_byte_swap) |
33 | 36 | end |
34 | 37 | end |
35 | 38 |
|
|
0 commit comments