struct mrpt::obs::gnss::gnss_message

Overview

Pure virtual base for all message types.

See also:

mrpt::obs::CObservationGPS

#include <mrpt/obs/gnss_messages_common.h>

struct gnss_message
{
    // fields

    gnss_message_type_t message_type;

    // construction

    gnss_message(gnss_message_type_t msg_type_id);

    // methods

    void writeToStream(mrpt::serialization::CArchive& out) const;
    void readFromStream(mrpt::serialization::CArchive& in);
    virtual void dumpToStream(std::ostream& out) const = 0;
    virtual void fixEndianness();
    virtual void dumpToConsole(std::ostream& o) const;
    virtual bool getAllFieldDescriptions(] std::ostream& o) const;
    virtual bool getAllFieldValues(] std::ostream& o) const;
    const std::string& getMessageTypeAsString() const;
    static gnss_message* readAndBuildFromStream(mrpt::serialization::CArchive& in);
    static gnss_message* Factory(const gnss_message_type_t msg_id);
    static bool FactoryKnowsMsgType(const gnss_message_type_t msg_id);
};

// direct descendants

struct Message_NMEA_GGA;
struct Message_NMEA_GLL;
struct Message_NMEA_GSA;
struct Message_NMEA_RMC;
struct Message_NMEA_VTG;
struct Message_NMEA_ZDA;
struct Message_NV_OEM6_GENERIC_FRAME;
struct Message_NV_OEM6_GENERIC_SHORT_FRAME;
struct Message_NV_OEM6_RANGECMP;
struct Message_NV_OEM6_VERSION;
struct Message_TOPCON_PZS;
struct Message_TOPCON_SATS;

Fields

gnss_message_type_t message_type

Type of GNSS message.

Methods

void writeToStream(mrpt::serialization::CArchive& out) const

Save to binary stream.

Launches an exception upon error

void readFromStream(mrpt::serialization::CArchive& in)

Load from binary stream into this existing object.

Launches an exception upon error.

virtual void dumpToStream(std::ostream& out) const = 0

Dumps the contents of the observation in a human-readable form to a given output stream.

See also:

dumpToConsole()

virtual void fixEndianness()

If we are in a big endian system, reverse all fields >1 byte to fix its representation.

Only in binary frames, text-based derived classes obviously do not need to reimplement this one.

virtual void dumpToConsole(std::ostream& o) const

Dumps the contents of the observation in a human-readable form to an std::ostream (set to std::cout to print to console)

virtual bool getAllFieldDescriptions(] std::ostream& o) const

Dumps a header for getAllFieldValues()

Returns:

false if not implemented for this message type

virtual bool getAllFieldValues(] std::ostream& o) const

Dumps a line with the sequence of all field values (without a line feed at the end).

Returns:

false if not implemented for this message type

See also:

getAllFieldDescriptions()

const std::string& getMessageTypeAsString() const

Returns “NMEA_GGA”, etc.

static gnss_message* readAndBuildFromStream(mrpt::serialization::CArchive& in)

Load from binary stream and creates object detecting its type (class factory).

Launches an exception upon error

static gnss_message* Factory(const gnss_message_type_t msg_id)

Creates message.

Returns:

nullptr on unknown msg type

static bool FactoryKnowsMsgType(const gnss_message_type_t msg_id)

Returns true if Factory() has a registered constructor for this msg type.