⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 location.hpp

📁 RFID reader 语 tag 模拟器
💻 HPP
字号:
 #ifndef LOCATION_H #define LOCATION_H #include <iostream> using namespace std; #include <math.h> #include <boost/shared_ptr.hpp> class Location { public:    typedef boost::shared_ptr<Location> LocationPtr;    Location();    Location(float x, float y, float z);    static inline float distance(const Location& loc1,       const Location& loc2);    inline void setCoordinates(float x, float y, float z);    inline float getX() const;    inline float getY() const;    inline float getZ() const; private:    float m_xCoordinate;    float m_yCoordinate;    float m_zCoordinate; }; typedef boost::shared_ptr<Location> LocationPtr; // Inline Functions inline float Location::distance(const Location& loc1, const Location& loc2) {    float xDiff = loc1.getX() - loc2.getX();    float yDiff = loc1.getY() - loc2.getY();    float zDiff = loc1.getZ() - loc2.getZ();    return sqrt(pow(xDiff, 2) + pow(yDiff, 2) + pow(zDiff, 2)); } inline void Location::setCoordinates(float x, float y, float z) {    m_xCoordinate = x;    m_yCoordinate = y;    m_zCoordinate = z; } inline float Location::getX() const {    return m_xCoordinate; } inline float Location::getY() const {    return m_yCoordinate; } inline float Location::getZ() const {    return m_zCoordinate; } // Overloaded Operators inline ostream& operator<< (ostream& s, const Location& location) {    return s << "(x=" << location.getX() << ", y=" <<       location.getY() << ", z=" << location.getZ() << ")"; } #endif // LOCATION_H

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -