Struct NmeaAisTextFieldParser
Parses a text field such as a ship's name stored in an AIS payload of an NMEA message.
Namespace: Ais.Net
Assembly: Ais.Net.dll
Syntax
public struct NmeaAisTextFieldParser
Constructors
| Improve this Doc View SourceNmeaAisTextFieldParser(NmeaAisBitVectorParser, UInt32, UInt32)
Creates a NmeaAisTextFieldParser.
Declaration
public NmeaAisTextFieldParser(NmeaAisBitVectorParser bits, uint bitLength, uint bitOffset)
Parameters
Type | Name | Description |
---|---|---|
NmeaAisBitVectorParser | bits | The bit vector (in 6-bit ASCII encoding) containing the name. |
System.UInt32 | bitLength | The length of the name field in bits. |
System.UInt32 | bitOffset | The bit offset of the name field within the bit vector. |
Properties
| Improve this Doc View SourceCharacterCount
Gets the number of characters in this field.
Declaration
public uint CharacterCount { get; }
Property Value
Type | Description |
---|---|
System.UInt32 |
Methods
| Improve this Doc View SourceGetAscii(UInt32)
Gets the ASCII value of the character at the specified position.
Declaration
public byte GetAscii(uint index)
Parameters
Type | Name | Description |
---|---|---|
System.UInt32 | index | Character position. |
Returns
Type | Description |
---|---|
System.Byte | The ASCII value of the character at the specified position. |
WriteAsAscii(Span<Byte>)
Writes the characters into a buffer in ASCII format.
Declaration
public void WriteAsAscii(in Span<byte> targetBuffer)
Parameters
Type | Name | Description |
---|---|---|
Span<System.Byte> | targetBuffer | The target buffer, which must be at least as long as CharacterCount. |
Remarks
The reason we don't just provide a simple property that returns a string is that it
would cause a heap allocation, defeating the entire point of using ref struct
.