YSTest
PreAlpha_b400_20130424
The YSLib Test Project
首页
相关页面
模块
命名空间
类
文件
文件列表
文件成员
全部
类
命名空间
文件
函数
变量
类型定义
枚举
枚举值
友元
宏定义
组
页
ymsg.cpp
浏览该文件的文档.
1
/*
2
Copyright (C) by Franksoft 2009 - 2012.
3
4
This file is part of the YSLib project, and may only be used,
5
modified, and distributed under the terms of the YSLib project
6
license, LICENSE.TXT. By continuing to use, modify, or distribute
7
this file you indicate that you have read the license and
8
understand and accept it fully.
9
*/
10
28
#include "
YSLib/Core/ymsg.h
"
29
#include <
ystdex/algorithm.hpp
>
30
31
YSL_BEGIN
32
33
YSL_BEGIN_NAMESPACE
(Messaging)
34
35
Message::Message(
ID
m, const ValueObject& c)
36
:
id
(m), content(c)
37
{}
38
Message::Message(
ID
m, ValueObject&& c)
39
: id(m), content(std::move(c))
40
{}
41
42
void
43
Message::Swap(
Message
& msg)
ynothrow
44
{
45
std::swap
(
id
, msg.id),
46
content.Swap(msg.content);
47
}
48
49
bool
50
operator==
(
const
Message& x,
const
Message& y)
51
{
52
return
x.id == y.id && x.content == y.content;
53
}
54
55
56
void
57
MessageQueue::Merge(
MessageQueue
& mq)
58
{
59
std::for_each(mq.begin(), mq.end(), [
this
](decltype(*mq.begin())& pr){
60
if
(pr.second)
61
insert(std::move(pr));
62
});
63
mq.clear();
64
}
65
66
void
67
MessageQueue::Remove(
Priority
p)
68
{
69
erase(upper_bound(p),
end
());
70
}
71
72
YSL_END_NAMESPACE
(Messaging)
73
74
YSL_END
75
YFramework
source
YSLib
Core
ymsg.cpp
生成于 2013年 四月 24日 星期三 18:41:28 , 为 YSTest使用
1.8.2