-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFlyweight.cpp
48 lines (36 loc) · 836 Bytes
/
Flyweight.cpp
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
#include"BaseLib/Policy/Flyweight.h"
namespace BaseLib { namespace Policy {
Flyweight::Flyweight(FlyweightKind kind)
: Templates::ComparableImmutableType<FlyweightKind>(kind)
{ }
Flyweight::~Flyweight()
{ }
FlyweightKind Flyweight::Kind() const
{
return this->Clone();
}
bool Flyweight::IsCopyOnWrite() const
{
return FlyweightKind::COPY_ON_WRITE == this->delegate();
}
bool Flyweight::IsCopyOnRead() const
{
return FlyweightKind::COPY_ON_READ == this->delegate();
}
bool Flyweight::IsNoCopy() const
{
return FlyweightKind::NO == this->delegate();
}
Flyweight Flyweight::CopyOnWrite()
{
return Flyweight(FlyweightKind::COPY_ON_WRITE);
}
Flyweight Flyweight::CopyOnRead()
{
return Flyweight(FlyweightKind::COPY_ON_READ);
}
Flyweight Flyweight::No()
{
return Flyweight(FlyweightKind::NO);
}
}}