nmealib 0.0.4
NMEA 0183/NMEA 2000 parsing library
Loading...
Searching...
No Matches
Static Public Member Functions | List of all members
nmealib::nmea0183::Nmea0183Factory Class Reference

Factory for creating typed NMEA 0183 message objects from raw sentence strings. More...

#include <nmea0183Factory.h>

Static Public Member Functions

static std::unique_ptr< Message0183create (const std::string &raw, Message::TimePoint ts=std::chrono::system_clock::now())
 Creates a typed NMEA 0183 message from a raw sentence string.
 

Detailed Description

Factory for creating typed NMEA 0183 message objects from raw sentence strings.

The factory parses the sentence type field of the raw input and returns the most specific concrete type available (e.g., GGA, RMC, GLL ...). If no specific type matches, a base Message0183 is returned.

Definition at line 18 of file nmea0183Factory.h.

Member Function Documentation

◆ create()

std::unique_ptr< Message0183 > nmealib::nmea0183::Nmea0183Factory::create ( const std::string &  raw,
Message::TimePoint  ts = std::chrono::system_clock::now() 
)
static

Creates a typed NMEA 0183 message from a raw sentence string.

Parameters
rawThe raw NMEA 0183 sentence string to parse.
tsOptional timestamp to associate with the message; defaults to the current system time.
Returns
std::unique_ptr<Message0183> A unique pointer to the most specific message type for the sentence. When the library is compiled with NMEALIB_NO_EXCEPTIONS, returns nullptr on failure.
Exceptions
TooLongSentenceExceptionIf the input string exceeds the maximum allowed length of 82 characters.
InvalidStartCharacterExceptionIf the input string does not start with either '$' or '!'.

Definition at line 7 of file nmea0183Factory.cpp.


The documentation for this class was generated from the following files: