-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathfactory.cpp
More file actions
77 lines (63 loc) · 1.19 KB
/
factory.cpp
File metadata and controls
77 lines (63 loc) · 1.19 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
76
77
//
// factory.cpp
// DocChain
//
// Created by Chung-kaiYang on 01/13/18.
// Copyright © 2018 Chung-kaiYang. All rights reserved.
//
#include "factory.h"
#include "blockChain.h"
#include "talk.h"
#include "crypto.h"
#include "dialog.h"
blockChain* factory::m_blockChain = NULL;
talk* factory::m_talk = NULL;
crypto* factory::m_crypto = NULL;
dialog* factory::m_dialog = NULL;
blockChain* factory::GetBlockChain()
{
if(!m_blockChain)
m_blockChain = new blockChain(true);
return m_blockChain;
}
talk* factory::GetTalk()
{
if(!m_talk)
m_talk = new talk();
return m_talk;
}
crypto* factory::GetCrypto()
{
if(!m_crypto)
m_crypto = new crypto();
return m_crypto;
}
dialog* factory::GetDialog(QApplication *app)
{
if(!m_dialog)
m_dialog = new dialog(0, app);
return m_dialog;
}
factory::~factory(void)
{
if(m_blockChain)
{
delete m_blockChain;
m_blockChain = NULL;
}
if(m_talk)
{
delete m_talk;
m_talk = NULL;
}
if(m_crypto)
{
delete m_crypto;
m_crypto = NULL;
}
if(m_dialog)
{
delete m_dialog;
m_dialog = NULL;
}
}