123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115 |
- #ifndef sync_time_message_h
- #define sync_time_message_h
- #include <iostream>
- #include <fstream>
- using namespace std;
- namespace host_server{
- class sync_time_message
- {
- private:
- unsigned long long m_local_id; // 本节点的id码
- unsigned long long m_upper_id; // 上一级同步节点的id码
- unsigned long long m_root_id; // 根节点的id码
- unsigned short m_sync_num; // 时间同步号
- unsigned short m_sync_level; // 同步层级
- unsigned long long m_local_send_time; // 本分站的发送时间
- unsigned long long m_local_receive_time; // 本分站的接收时间
- public:
- sync_time_message():m_local_id(0),
- m_upper_id(0),
- m_root_id(0),
- m_sync_num(0),
- m_sync_level(0),
- m_local_send_time(0),
- m_local_receive_time(0)
- {}
- sync_time_message(unsigned long long local_id, unsigned long long upper_id, unsigned long long root_id, unsigned short sync_num, unsigned short sync_level, unsigned long long send_time, unsigned long long rec_time):
- m_local_id(local_id),
- m_upper_id(upper_id),
- m_root_id(root_id),
- m_sync_num(sync_num),
- m_sync_level(sync_level),
- m_local_send_time(send_time),
- m_local_receive_time(rec_time)
- {}
- unsigned long long get_local_id() const
- {
- return m_local_id;
- }
- void set_local_id(unsigned long long val)
- {
- if(val == 14757395258967641292){
- val = 0;
- }
- m_local_id = val;
- }
- unsigned long long get_upper_id() const
- {
- return m_upper_id;
- }
- void set_upper_id(const unsigned long long& val)
- {
- m_upper_id = val;
- }
- unsigned long long get_root_id() const
- {
- return m_root_id;
- }
- void set_root_id(const unsigned long long& val)
- {
- m_root_id = val;
- }
- unsigned short get_sync_num() const
- {
- return m_sync_num;
- }
-
- void set_sync_num(const unsigned short& val)
- {
- m_sync_num = val;
- }
-
- unsigned short get_sync_level() const
- {
- return m_sync_level;
- }
-
- void set_sync_level(const unsigned short& val)
- {
- m_sync_level = val;
- }
- unsigned long long get_local_send_time() const
- {
- return m_local_send_time;
- }
- void set_local_send_time(const unsigned long long& val)
- {
- m_local_send_time = val;
- }
-
- unsigned long long get_local_receive_time() const
- {
- return m_local_receive_time;
- }
-
- void set_local_receive_time(const unsigned long long& val)
- {
- m_local_receive_time = val;
- }
- };
- }
- #endif
|