Files
SimCore/include/SimCore/Messages/Track.hpp
2023-01-12 21:41:18 +01:00

115 lines
3.0 KiB
C++

#pragma once
#include "SimCore/Identifier.hpp"
#include "google/protobuf/any.pb.h"
#include <SimCore/Position.hpp>
#include <WHISPER/Messages/Message.hpp>
#include <SimCore/Messages/Protos/Track.pb.h>
#include <Eigen/Core>
#include <cstddef>
#include <cstdint>
#include <memory>
#include <string>
#include <loguru.hpp>
namespace SimCore {
class Track : public WHISPER::Message
{
private:
/// message object from google protobuf
messages::track::Track trackMessage_;
/// position of the track
Position position_;
/// speed the track
double speed_ = 0;
/// course of the track
double course_ = 0;
/// indicates if track is from an external source
bool external_ = false;
/// function that packs all information to a protobuf message
void packToMessage();
/// ID of the object
SimCore::Identifier ID_;
public:
/**
* @brief a cuntructor that builds the object from a received message
* @param std::string the received thring from the line
*/
Track(std::string receivedMessage);
/**
* @brief constructor for building a track which is also the trackmessage to send
* @param uint32_t deviceID the id of the sending device
* @param WHISPER::SourceType sourcetype of the sending device
* @param SimCore::Identifier object identifier
*
* @return
*/
Track(std::uint32_t deviceID, WHISPER::SourceType src,SimCore::Identifier id);
/**
* @brief set the position of the track
* @param Position object of the position class
*
*/
void setPosition(Position pos);
/**
* @brief set the position of the track
* @param 3x double set the x,y,z coordinates direkt which causes that an object of position class is created
*/
void setPosition(double x,double y,double z);
/**
* @brief returns the position
* @return object of position class
*
*/
Position getPostion();
/// sets speed
void setSpeed(double speed);
/// set speed in knots
void setSpeedinKnots(double knots);
/// return sspeed
double getSpeed();
/// returns speed as knots
double getSpeedinKnots();
/// set course
void setCourse(double course);
///returns course
double getCourse();
/// set external indicator
void setExternal(bool val);
/// return true if is external
bool isExternal();
SimCore::Identifier getIdentifier();
};
}