|
nmealib 0.0.4
NMEA 0183/NMEA 2000 parsing library
|
Defines a base class for NMEA messages, encapsulating common properties and behaviors. More...
#include <message.h>

Public Types | |
| enum class | Type { Unknown , NMEA0183 , NMEA2000 } |
| Defines the type of NMEA message, allowing for differentiation between various standards. More... | |
| using | TimePoint = std::chrono::system_clock::time_point |
Public Member Functions | |
| Message () | |
| Message (std::string raw, Type type=Type::Unknown, TimePoint ts=std::chrono::system_clock::now()) noexcept | |
| virtual | ~Message () |
| Message (const Message &)=default | |
| Message & | operator= (const Message &)=default |
| Message (Message &&) noexcept=default | |
| Message & | operator= (Message &&) noexcept=default |
| Type | getType () const noexcept |
| Returns the message type. | |
| const std::string & | getRawData () const noexcept |
| Returns the raw, unmodified data string as received. | |
| TimePoint | getTimestamp () const noexcept |
| Returns the timestamp associated with this message. | |
| virtual std::unique_ptr< Message > | clone () const =0 |
| Creates a polymorphic deep copy of this message. | |
| virtual std::string | serialize () const =0 |
| Produces the wire-format representation of this message. | |
| virtual bool | validate () const =0 |
| Validates the message contents (e.g., checksum, length). | |
| bool | operator== (const Message &other) const noexcept |
| Compares two Message objects for equality based on their content. | |
Static Public Member Functions | |
| static std::string | typeToString (Type t) |
| Converts a Message::Type enum value to its string representation. | |
Protected Member Functions | |
| void | setType (Type t) noexcept |
| Sets the message type. | |
| void | setRaw (std::string r) noexcept |
| Sets the raw data string. | |
| void | setTimestamp (TimePoint ts) noexcept |
| Sets the message timestamp. | |
Protected Attributes | |
| std::string | rawData_ |
| Type | type_ {Type::Unknown} |
| TimePoint | timestamp_ {} |
Defines a base class for NMEA messages, encapsulating common properties and behaviors.
This class serves as an abstract interface for specific NMEA message types (e.g., NMEA0183, NMEA2000),
| using nmealib::Message::TimePoint = std::chrono::system_clock::time_point |
|
strong |
|
default |
|
explicitnoexcept |
Definition at line 16 of file message.cpp.
|
virtualdefault |
|
default |
|
defaultnoexcept |
|
pure virtual |
Creates a polymorphic deep copy of this message.
Implemented in nmealib::nmea0183::Message0183, nmealib::nmea0183::APB, nmealib::nmea0183::DBT, nmealib::nmea0183::DPT, nmealib::nmea0183::GGA, nmealib::nmea0183::GLL, nmealib::nmea0183::GSA, nmealib::nmea0183::GSV, nmealib::nmea0183::HDG, nmealib::nmea0183::HDM, nmealib::nmea0183::MTW, nmealib::nmea0183::MWV, nmealib::nmea0183::RMA, nmealib::nmea0183::RMB, nmealib::nmea0183::RMC, nmealib::nmea0183::VHW, nmealib::nmea0183::VLW, nmealib::nmea0183::VTG, nmealib::nmea0183::VWR, nmealib::nmea0183::XDR, nmealib::nmea0183::XTE, nmealib::nmea0183::ZDA, nmealib::nmea2000::Message2000, nmealib::nmea2000::PGN127245, nmealib::nmea2000::PGN127250, nmealib::nmea2000::PGN127251, nmealib::nmea2000::PGN127257, nmealib::nmea2000::PGN128001, nmealib::nmea2000::PGN128259, nmealib::nmea2000::PGN129025, nmealib::nmea2000::PGN129026, and nmealib::nmea2000::PGN130306.
|
noexcept |
Returns the raw, unmodified data string as received.
Definition at line 25 of file message.cpp.
|
noexcept |
Returns the timestamp associated with this message.
Definition at line 29 of file message.cpp.
|
noexcept |
Returns the message type.
Definition at line 21 of file message.cpp.
|
noexcept |
Compares two Message objects for equality based on their content.
| other | The other Message to compare against. |
Definition at line 33 of file message.cpp.
|
pure virtual |
Produces the wire-format representation of this message.
Implemented in nmealib::nmea0183::Message0183, and nmealib::nmea2000::Message2000.
|
protectednoexcept |
Sets the raw data string.
| r | The new raw data string. |
Definition at line 42 of file message.cpp.
|
protectednoexcept |
Sets the message timestamp.
| ts | The new timestamp. |
Definition at line 46 of file message.cpp.
|
protectednoexcept |
|
static |
Converts a Message::Type enum value to its string representation.
| t | The message type to convert. |
Definition at line 5 of file message.cpp.
|
pure virtual |
Validates the message contents (e.g., checksum, length).
Implemented in nmealib::nmea0183::Message0183, and nmealib::nmea2000::Message2000.
|
protected |