Repository navigation
Expand file tree
/
Copy pathStubEvent.cpp
More file actions
75 lines (58 loc) · 1.48 KB
/
Copy pathStubEvent.cpp
File metadata and controls
75 lines (58 loc) · 1.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#include "stdafx.h"
#include "StubEvent.h"
namespace Disruptor
{
namespace Tests
{
void StubEvent::TwoTranslator::translateTo(StubEvent& event, std::int64_t /*sequence*/, const std::int32_t& arg0, const std::string& arg1)
{
event.value(arg0);
event.testString(arg1);
}
StubEvent::StubEvent(int i)
: m_value(i)
{
}
int StubEvent::value() const
{
return m_value;
}
void StubEvent::value(int i)
{
m_value = i;
}
std::string StubEvent::testString() const
{
return m_testString;
}
void StubEvent::testString(std::string x)
{
m_testString = x;
}
void StubEvent::copy(const StubEvent& evt)
{
m_value = evt.m_value;
}
bool StubEvent::operator==(const StubEvent& rhs) const
{
return m_value == rhs.m_value;
}
const std::shared_ptr< StubEvent::TwoTranslator >& StubEvent::translator()
{
static auto result(std::make_shared< TwoTranslator >());
return result;
}
const std::function< StubEvent() >& StubEvent::eventFactory()
{
static std::function< StubEvent() > result([] { return StubEvent(-1); });
return result;
}
} // namespace Tests
} // namespace Disruptor
namespace std
{
ostream& operator<<(ostream& stream, const Disruptor::Tests::StubEvent& event)
{
return stream << "Value: " << event.value() << ", TestString: " << event.testString();
}
} // namespace std