| 553 | } |
| 554 | |
| 555 | void BitFieldsBuffer::copyDataToBuffer(PointRef& point, size_t index) |
| 556 | { |
| 557 | // Get bit field data. Set to zero if bit field does not exist in table. |
| 558 | std::array<uint8_t, 6> unpacked{}; |
| 559 | if (m_ids[0].has_value()) |
| 560 | unpacked[0] = point.getFieldAs<uint8_t>(m_ids[0].value()) & 0x0F; |
| 561 | if (m_ids[1].has_value()) |
| 562 | unpacked[1] = (point.getFieldAs<uint8_t>(m_ids[1].value()) & 0x0F) << 4; |
| 563 | if (m_ids[2].has_value()) |
| 564 | unpacked[2] = point.getFieldAs<uint8_t>(m_ids[2].value()) & 0x0F; |
| 565 | if (m_ids[3].has_value()) |
| 566 | unpacked[3] = (point.getFieldAs<uint8_t>(m_ids[3].value()) & 0x03) << 4; |
| 567 | if (m_ids[4].has_value()) |
| 568 | unpacked[4] = (point.getFieldAs<uint8_t>(m_ids[4].value()) & 0x01) << 6; |
| 569 | if (m_ids[5].has_value()) |
| 570 | unpacked[5] = (point.getFieldAs<uint8_t>(m_ids[5].value()) & 0x01) << 7; |
| 571 | |
| 572 | // Set the 2 bytes of data in the buffer. |
| 573 | auto value1 = static_cast<uint16_t>(unpacked[0] | unpacked[1]) << 8; |
| 574 | auto value2 = static_cast<uint16_t>(unpacked[2] | unpacked[3] | |
| 575 | unpacked[4] | unpacked[5]); |
| 576 | m_data[index] = value1 | value2; |
| 577 | } |
| 578 | |
| 579 | void BitFieldsBuffer::copyDataToPoint(PointRef& point, size_t index) |
| 580 | { |