X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/4ee4759a51cf944de103eb73a654ec00ccb3664d..1345c0a23da2a0dc0bbeb6a91783abef1b235fbe:/include/stg/message.h?ds=sidebyside diff --git a/include/stg/message.h b/include/stg/message.h index 5a0e918e..e5710271 100644 --- a/include/stg/message.h +++ b/include/stg/message.h @@ -1,56 +1,60 @@ -#ifndef STG_MESSAGES_H -#define STG_MESSAGES_H - /* * Author : Boris Mikhailenko */ - /* - $Revision: 1.3 $ - $Date: 2010/03/04 11:49:52 $ - */ +#pragma once -#include #include +#include +#include -#include "os_int.h" - -//----------------------------------------------------------------------------- -struct STG_MSG_HDR +namespace STG { -STG_MSG_HDR() - : id(0), - ver(0), - type(0), - lastSendTime(0), - creationTime(0), - showTime(0), - repeat(0), - repeatPeriod(0) -{} - -uint64_t id; -unsigned ver; -unsigned type; -unsigned lastSendTime; -unsigned creationTime; -unsigned showTime; -int repeat; -unsigned repeatPeriod; -}; -//----------------------------------------------------------------------------- -struct STG_MSG -{ -STG_MSG() : header(), text() {} -time_t GetNextSendTime() const +struct Message { -return header.lastSendTime + header.repeat * 60; -} - -STG_MSG_HDR header; -std::string text; + struct Header + { + Header() noexcept + : id(0), + ver(0), + type(0), + lastSendTime(0), + creationTime(0), + showTime(0), + repeat(0), + repeatPeriod(0) + {} + + Header(const Header&) = default; + Header& operator=(const Header&) = default; + Header(Header&&) = default; + Header& operator=(Header&&) = default; + + uint64_t id; + unsigned ver; + unsigned type; + unsigned lastSendTime; + unsigned creationTime; + unsigned showTime; + int repeat; + unsigned repeatPeriod; + }; + + Message() = default; + + Message(const Message&) = default; + Message& operator=(const Message&) = default; + Message(Message&&) = default; + Message& operator=(Message&&) = default; + + time_t GetNextSendTime() const + { + return header.lastSendTime + header.repeat * 60; + } + + Header header; + std::string text; }; -//----------------------------------------------------------------------------- -#endif +}