/// Writes the specified string into the AIS message. If the string does not fill /// the entire space within the message, fill characters `@` will be written /// until the specified number of sixbits is reached. /// /// @param[out] bits The AIS message. /// @param[in] ofs The offset at which the string is being written within the message. /// @param[in] count_sixbits Number of sixbits to write into the message. /// @param[in] s The string to be written. /// void binary_data::write_string( raw & bits, raw::size_type ofs, raw::size_type count_sixbits, const std::string & s) { for (raw::size_type i = 0; i < count_sixbits; ++i) { uint8_t value; if (i < s.size()) { value = encode_sixbit_ascii(s[i]); } else { value = encode_sixbit_ascii('@'); } bits.set(value, ofs + i * 6, 6); } }