Skip to content

Commit

Permalink
fix gcc build
Browse files Browse the repository at this point in the history
  • Loading branch information
jlblancoc committed Jan 26, 2016
1 parent ec27f8f commit e6948bb
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
12 changes: 6 additions & 6 deletions libs/obs/include/mrpt/obs/CObservationGPS.h
Expand Up @@ -71,12 +71,12 @@ namespace obs
* Valid message classes are those derived from mrpt::obs::gnss::gnss_message. If another message of the same type exists, it is overwritten. */
template <class MSG_CLASS>
void setMsg(const MSG_CLASS &msg) {
messages[MSG_CLASS::msg_type].set(new MSG_CLASS(msg));
messages[static_cast<gnss::gnss_message_type_t>(MSG_CLASS::msg_type)].set(new MSG_CLASS(msg));
}
/** Returns true if the list \a CObservationGPS::messages contains one of the requested type. \sa mrpt::obs::gnss::gnss_message_type_t, CObservationGPS::getMsgByType() */
bool hasMsgType(const gnss::gnss_message_type_t type_id) const;
/** Like \a hasMsgType() but allows querying for message classes, from any of those derived from mrpt::obs::gnss::gnss_message \sa CObservationGPS::hasMsgType(), */
template <class MSG_CLASS> bool hasMsgClass() const { return hasMsgType(MSG_CLASS::msg_type); }
template <class MSG_CLASS> bool hasMsgClass() const { return hasMsgType(static_cast<gnss::gnss_message_type_t>(MSG_CLASS::msg_type)); }
/** Returns a pointer to the message in the list CObservationGPS::messages of the requested type. Users normally would prefer using CObservationGPS::getMsgByClass()
* to avoid having to perform a dynamic_cast<>() on the returned pointer.
* \exception std::runtime_error If there is no such a message in the list. Please, check existence before calling this method with CObservationGPS::hasMsgType()
Expand All @@ -90,15 +90,15 @@ namespace obs
* \sa mrpt::obs::gnss::gnss_message_type_t, CObservationGPS::getMsgByType(), CObservationGPS::hasMsgType() */
template <class MSG_CLASS>
MSG_CLASS & getMsgByClass() {
message_list_t::iterator it = messages.find(MSG_CLASS::msg_type);
message_list_t::iterator it = messages.find(static_cast<gnss::gnss_message_type_t>(MSG_CLASS::msg_type));
ASSERTMSG_(it!=messages.end(), mrpt::format("[CObservationGPS::getMsgByClass] Cannot find any observation of type `%s`",typeid(MSG_CLASS).name()));
ASSERT_(it->second.get());
return *dynamic_cast<MSG_CLASS*>(it->second.get());
}
/** \overload */
template <class MSG_CLASS>
const MSG_CLASS & getMsgByClass() const {
message_list_t::const_iterator it = messages.find(MSG_CLASS::msg_type);
message_list_t::const_iterator it = messages.find(static_cast<gnss::gnss_message_type_t>(MSG_CLASS::msg_type));
ASSERTMSG_(it!=messages.end(), mrpt::format("[CObservationGPS::getMsgByClass] Cannot find any observation of type `%s`",typeid(MSG_CLASS).name()));
ASSERT_(it->second.get());
return *dynamic_cast<const MSG_CLASS*>(it->second.get());
Expand All @@ -107,13 +107,13 @@ namespace obs
/** Like CObservationGPS::getMsgByClass() but returns a NULL pointer if message is not found, instead of launching an exception */
template <class MSG_CLASS>
MSG_CLASS * getMsgByClassPtr() {
message_list_t::iterator it = messages.find(MSG_CLASS::msg_type);
message_list_t::iterator it = messages.find(static_cast<gnss::gnss_message_type_t>(MSG_CLASS::msg_type));
return it==messages.end() ? dynamic_cast<MSG_CLASS*>(NULL) : dynamic_cast<MSG_CLASS*>(it->second.get());
}
/** \overload */
template <class MSG_CLASS>
const MSG_CLASS * getMsgByClassPtr() const {
message_list_t::const_iterator it = messages.find(MSG_CLASS::msg_type);
message_list_t::const_iterator it = messages.find(static_cast<gnss::gnss_message_type_t>(MSG_CLASS::msg_type));
return it==messages.end() ? dynamic_cast<MSG_CLASS*>(NULL) : dynamic_cast<MSG_CLASS*>(it->second.get());
}

Expand Down
8 changes: 4 additions & 4 deletions libs/obs/include/mrpt/obs/gnss_messages_ascii_nmea.h
Expand Up @@ -20,9 +20,9 @@ namespace gnss {
/** NMEA datum: GGA. \sa mrpt::obs::CObservationGPS */
struct OBS_IMPEXP Message_NMEA_GGA : public gnss_message_binary_block
{
static const gnss_message_type_t msg_type = NMEA_GGA; //!< Static msg type (member expected by templates)
enum { msg_type = NMEA_GGA }; //!< Static msg type (member expected by templates)

Message_NMEA_GGA() : gnss_message_binary_block(msg_type,sizeof(fields),&fields)
Message_NMEA_GGA() : gnss_message_binary_block((gnss_message_type_t)msg_type,sizeof(fields),&fields)
{}

struct OBS_IMPEXP content_t
Expand Down Expand Up @@ -69,8 +69,8 @@ struct OBS_IMPEXP Message_NMEA_GGA : public gnss_message_binary_block
/** NMEA datum: RMC. \sa mrpt::obs::CObservationGPS */
struct OBS_IMPEXP Message_NMEA_RMC : public gnss_message_binary_block
{
static const gnss_message_type_t msg_type = NMEA_RMC; //!< Static msg type (member expected by templates)
Message_NMEA_RMC() : gnss_message_binary_block(msg_type,sizeof(fields),&fields)
enum { msg_type = NMEA_RMC }; //!< Static msg type (member expected by templates)
Message_NMEA_RMC() : gnss_message_binary_block((gnss_message_type_t)msg_type,sizeof(fields),&fields)
{}

struct OBS_IMPEXP content_t
Expand Down
1 change: 1 addition & 0 deletions libs/obs/include/mrpt/obs/gnss_messages_common.h
Expand Up @@ -36,6 +36,7 @@ struct OBS_IMPEXP gnss_message {

virtual void dumpToStream( mrpt::utils::CStream &out ) const = 0; //!< Dumps the contents of the observation in a human-readable form to a given output stream \sa dumpToConsole()
void dumpToConsole(std::ostream &o = std::cout) const; //!< Dumps the contents of the observation in a human-readable form to an std::ostream (default=console)
virtual ~gnss_message() {}
protected:
virtual void internal_writeToStream(mrpt::utils::CStream &out) const = 0; //!< Save to binary stream. Launches an exception upon error
virtual void internal_readFromStream(mrpt::utils::CStream &in) = 0; //!< Save to binary stream. Launches an exception upon error
Expand Down

0 comments on commit e6948bb

Please sign in to comment.