summaryrefslogtreecommitdiffstats
path: root/lib/CommLayer/CommLayerInner.h
blob: 2cca93573d19dd6850334f7ae81c355cdaf7983f (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
58
59
60
61
62
63
#ifndef COMMLAYERINNER_H_
#define COMMLAYERINNER_H_

#include <iostream>
#include "Observer.h"

class CDebug
{
    private:
        CObserver *m_pObs;
    public:
        CDebug(CObserver *pObs){ m_pObs = pObs; }
        
        void operator << (const std::string& pMsg)
            {
                if(m_pObs)
                    m_pObs->Debug(pMsg);
            }
};

class CWarning
{
    private:
        CObserver *m_pObs;
    public:
        CWarning(CObserver *pObs){ m_pObs = pObs; }
        
        void operator << (const std::string& pMsg)
            {
                if(m_pObs)
                    m_pObs->Warning(pMsg);
            }
};

class CStatusUpdate
{
    private:
        CObserver *m_pObs;
    public:
        CStatusUpdate(CObserver *pObs){ m_pObs = pObs; }
        
        void operator << (const std::string& pMsg)
            {
                if(m_pObs)
                    m_pObs->StatusUpdate(pMsg);
            }
};

class CCommLayerInner{
    private:
        CObserver *m_pObs;
    public:
        CDebug DEBUGINFO;
        CWarning WARNING;
        CStatusUpdate STATUS;
        CCommLayerInner(CObserver *pObs);
        ~CCommLayerInner();
        CDebug& Debug();
        CWarning& Warning();
        CStatusUpdate& Status();
};

#endif /* COMMLAYERINNER_H_ */