summaryrefslogtreecommitdiffstats
path: root/lib/CommLayer/CommLayerInner.cpp
blob: a7c5123d255fc604a91ef890b41987715d16848d (plain)
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
#include "CommLayerInner.h"

namespace CommLayerInner
{

    static CDebug* g_pDebug = NULL;
    static CWarning* g_pWarning = NULL;
    static CStatus* g_pStatus = NULL;


    void init_debug(CObserver* pObserver)
    {
        if (!g_pDebug)
        {
            g_pDebug = new CDebug(pObserver);
        }
    }

    void init_warning(CObserver* pObserver)
    {
        if (!g_pWarning)
        {
            g_pWarning = new CWarning(pObserver);
        }
    }

    void init_status(CObserver* pObserver)
    {
        if (!g_pStatus)
        {
            g_pStatus = new CStatus(pObserver);
        }
    }

    void debug(const std::string& pMessage)
    {
        if (g_pDebug)
        {
            g_pDebug->Message(pMessage);
        }
    }
    void warning(const std::string& pMessage)
    {
        if (g_pWarning)
        {
            g_pWarning->Message(pMessage);
        }
    }

    void status(const std::string& pMessage)
    {
        if (g_pStatus)
        {
            g_pStatus->Message(pMessage);
        }
    }
}