12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697 |
- #ifndef __BASE_DATA__
- #define __BASE_DATA__
- #include <map>
- #include <list>
- #include <deque>
- #include <vector>
- #include "boost\shared_ptr.hpp"
- #include "ProcessRemodule.h"
- typedef unsigned long long uint64_t;
- typedef unsigned short int uint16_t;
- struct context
- {
- };
- //--------------------------------
- struct point_2
- {
- double x_;
- double y_;
- //缺省构造一个系统不会使用的无效坐标
- point_2()
- :x_(0x12345678)
- ,y_(0x87654321)
- {
- }
- point_2(double x,double y)
- :x_(x),y_(y)
- {}
- void setX(double x)
- {
- x_ = x;
- }
- void setY(double y)
- {
- y_ = y;
- }
- static inline bool is_valid(const point_2&p)
- {
- const point_2 &pt=invalid_point();
- return pt.x_!=p.x_ || pt.y_!=p.y_;
- }
- static inline const point_2& invalid_point()
- {
- static const point_2 pt;
- return pt;
- }
- static inline double sqr(double x)
- {
- return x*x;
- }
- //计算this到(x,y)的距离
- double dist_to(double x,double y)
- {
- return sqrt(sqr(x-x_)+sqr(y-y_));
- }
- double dist_to(const point_2&pt)
- {
- return dist_to(pt.x_,pt.y_);
- }
- };
- struct st_coord :point_2
- {
- uint64_t gen_time_; //精确到毫秒的测距时间
- uint16_t m_ct;//ct
- void clear()
- {
- gen_time_ = 0;
- m_ct = 0;
- x_ = 0;
- y_ = 0;
- }
- void setTime(uint64_t t)
- {
- gen_time_ = t;
- }
- void setCT(uint16_t t)
- {
- m_ct = t;
- }
- };
- #endif
|