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

Registry for message type creators. More...

#include <messageRegistry.hpp>

Public Member Functions

std::unique_ptr< Message0183create (const std::string &sentenceType, std::unique_ptr< Message0183 > baseMessage)
 Create a typed message from a generic Message0183.
 

Static Public Member Functions

static MessageRegistryinstance ()
 Get the singleton instance of the MessageRegistry.
 

Friends

class DBT
 
class DPT
 
class GGA
 
class GLL
 
class GSA
 
class GSV
 
class HDG
 
class HDM
 
class MTW
 
class MWV
 
class RMA
 
class RMC
 
class VHW
 
class VLW
 
class VTG
 
class VWR
 
class XDR
 
class ZDA
 

Detailed Description

Registry for message type creators.

The MessageRegistry implements the factory pattern for NMEA 0183 message types. Instead of hard-coding a dispatch if-else chain in the factory, message types register themselves with the registry at library initialization time.

This design scales efficiently for 50+ message types without compilation overhead.

Definition at line 20 of file messageRegistry.hpp.

Member Function Documentation

◆ create()

std::unique_ptr< Message0183 > nmealib::nmea0183::MessageRegistry::create ( const std::string &  sentenceType,
std::unique_ptr< Message0183 baseMessage 
)

Create a typed message from a generic Message0183.

Dispatches to the appropriate creator method for the sentence type. If the sentence type is not supported, returns the base Message0183 unchanged.

Parameters
sentenceTypeThe three-character sentence type code.
baseMessageThe generic Message0183 to convert.
Returns
std::unique_ptr<Message0183> The typed message, or baseMessage if type not registered.

Definition at line 32 of file messageRegistry.cpp.

◆ instance()

MessageRegistry & nmealib::nmea0183::MessageRegistry::instance ( )
static

Get the singleton instance of the MessageRegistry.

Returns
MessageRegistry& The global message registry instance.

Definition at line 27 of file messageRegistry.cpp.

Friends And Related Symbol Documentation

◆ DBT

friend class DBT
friend

Definition at line 49 of file messageRegistry.hpp.

◆ DPT

friend class DPT
friend

Definition at line 50 of file messageRegistry.hpp.

◆ GGA

friend class GGA
friend

Definition at line 51 of file messageRegistry.hpp.

◆ GLL

friend class GLL
friend

Definition at line 52 of file messageRegistry.hpp.

◆ GSA

friend class GSA
friend

Definition at line 53 of file messageRegistry.hpp.

◆ GSV

friend class GSV
friend

Definition at line 54 of file messageRegistry.hpp.

◆ HDG

friend class HDG
friend

Definition at line 55 of file messageRegistry.hpp.

◆ HDM

friend class HDM
friend

Definition at line 56 of file messageRegistry.hpp.

◆ MTW

friend class MTW
friend

Definition at line 57 of file messageRegistry.hpp.

◆ MWV

friend class MWV
friend

Definition at line 58 of file messageRegistry.hpp.

◆ RMA

friend class RMA
friend

Definition at line 59 of file messageRegistry.hpp.

◆ RMC

friend class RMC
friend

Definition at line 60 of file messageRegistry.hpp.

◆ VHW

friend class VHW
friend

Definition at line 61 of file messageRegistry.hpp.

◆ VLW

friend class VLW
friend

Definition at line 62 of file messageRegistry.hpp.

◆ VTG

friend class VTG
friend

Definition at line 63 of file messageRegistry.hpp.

◆ VWR

friend class VWR
friend

Definition at line 64 of file messageRegistry.hpp.

◆ XDR

friend class XDR
friend

Definition at line 65 of file messageRegistry.hpp.

◆ ZDA

friend class ZDA
friend

Definition at line 66 of file messageRegistry.hpp.


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