diff options
| author | Zdenek Prikryl <zdeny@dhcp-lab-218.englab.brq.redhat.com> | 2009-04-28 17:08:09 +0200 |
|---|---|---|
| committer | Zdenek Prikryl <zdeny@dhcp-lab-218.englab.brq.redhat.com> | 2009-04-28 17:08:09 +0200 |
| commit | 2e6a6e8aed825e456600d01c8a805b6f6fd24c3a (patch) | |
| tree | c58cba2913350fed9674813b3fe0a27e6639fbd2 /lib/CommLayer | |
| parent | b08d5c2cf630ecb89d2f22b985dcdfcf25494258 (diff) | |
| download | abrt-2e6a6e8aed825e456600d01c8a805b6f6fd24c3a.tar.gz abrt-2e6a6e8aed825e456600d01c8a805b6f6fd24c3a.tar.xz abrt-2e6a6e8aed825e456600d01c8a805b6f6fd24c3a.zip | |
new commlayerinner interface
Diffstat (limited to 'lib/CommLayer')
| -rw-r--r-- | lib/CommLayer/CommLayerInner.h | 132 | ||||
| -rw-r--r-- | lib/CommLayer/Makefile.am | 6 | ||||
| -rw-r--r-- | lib/CommLayer/Observer.h | 1 |
3 files changed, 90 insertions, 49 deletions
diff --git a/lib/CommLayer/CommLayerInner.h b/lib/CommLayer/CommLayerInner.h index 7edd257..70e1c30 100644 --- a/lib/CommLayer/CommLayerInner.h +++ b/lib/CommLayer/CommLayerInner.h @@ -4,62 +4,102 @@ #include <iostream> #include "Observer.h" -namespace CommLayerInner +class CDebugCommLayer { - - class CDebug - { - private: - CObserver *m_pObs; - public: - CDebug(CObserver *pObs) : - m_pObs(pObs) - {} - void Message(const std::string& pMsg) + private: + CObserver *m_pObserver; + public: + CDebugCommLayer(CObserver *pObs) : + m_pObserver(pObs) + {} + void Message(const std::string& pMsg) + { + if(m_pObserver) { - if(m_pObs) - m_pObs->Debug(pMsg); + m_pObserver->Debug(pMsg); } - }; + } +}; - class CWarning - { - private: - CObserver *m_pObs; - public: - CWarning(CObserver *pObs) : - m_pObs(pObs) - {} - void Message(const std::string& pMsg) +class CWarningCommLayer +{ + private: + CObserver *m_pObserver; + public: + CWarningCommLayer(CObserver *pObs) : + m_pObserver(pObs) + {} + void Message(const std::string& pMsg) + { + if(m_pObserver) { - if(m_pObs) - m_pObs->Warning(pMsg); + m_pObserver->Warning(pMsg); } - }; + } +}; - class CStatus - { - private: - CObserver *m_pObs; - public: - CStatus(CObserver *pObs) : - m_pObs(pObs) - {} - void Message(const std::string& pMsg) +class CStatusCommLayer +{ + private: + CObserver *m_pObserver; + public: + CStatusCommLayer(CObserver *pObs) : + m_pObserver(pObs) + {} + void Message(const std::string& pMsg) + { + if(m_pObserver) { - if(m_pObs) - m_pObs->Status(pMsg); + m_pObserver->Status(pMsg); } - }; - - - void init_debug(CObserver* pObserver); - void init_warning(CObserver* pObserver); - void init_status(CObserver* pObserver); + } +}; - void debug(const std::string& pMessage); - void warning(const std::string& pMessage); - void status(const std::string& pMessage); +class CCommLayerInner +{ + private: + CDebugCommLayer* m_pDebugCommLayer; + CWarningCommLayer* m_pWarningCommLayer; + CStatusCommLayer* m_pStatusCommLayer; + public: + CDebugCommLayer* GetDebugCommLayer() + { + return m_pDebugCommLayer; + } + CWarningCommLayer* GetWarningCommLayer() + { + return m_pWarningCommLayer; + } + CStatusCommLayer* GetStatusCommLayer() + { + return m_pStatusCommLayer; + } + CCommLayerInner(CObserver *pObs, const bool& pDebug, const bool pWarning) + { + m_pDebugCommLayer = NULL; + m_pWarningCommLayer = NULL; + if (pDebug) + { + m_pDebugCommLayer = new CDebugCommLayer(pObs); + } + if (pWarning) + { + m_pWarningCommLayer = new CWarningCommLayer(pObs); + } + m_pStatusCommLayer = new CStatusCommLayer(pObs); + } + ~CCommLayerInner() + { + if (m_pDebugCommLayer) + { + delete m_pDebugCommLayer; + } + if (m_pWarningCommLayer) + { + delete m_pWarningCommLayer; + } + delete m_pStatusCommLayer; + } }; #endif /* COMMLAYERINNER_H_ */ diff --git a/lib/CommLayer/Makefile.am b/lib/CommLayer/Makefile.am index d17cdc8..c9cd748 100644 --- a/lib/CommLayer/Makefile.am +++ b/lib/CommLayer/Makefile.am @@ -3,12 +3,12 @@ libABRTCommLayer_la_SOURCES = CommLayerServer.h CommLayerServer.cpp \ CommLayerServerSocket.h CommLayerServerSocket.cpp \ CommLayerServerDBus.h CommLayerServerDBus.cpp \ DBusServerProxy.h Observer.h DBusCommon.h \ - CommLayerInner.h CommLayerInner.cpp + CommLayerInner.h libABRTCommLayer_la_LIBADD = ../../lib/MiddleWare/libABRTMiddleWare.la $(DL_LIBS) $(DBUSCPP_LIBS) libABRTCommLayer_la_LDFLAGS = -version-info 0:1:0 -libABRTCommLayer_la_CPPFLAGS = -Wall -Werror -I../../lib/MiddleWare\ - -I../../lib/DBus \ +libABRTCommLayer_la_CPPFLAGS = -Wall -Werror -I$(srcdir)/../../lib/MiddleWare\ + -I$(srcdir)/../../lib/DBus -I$(srcdir)/../../inc\ -DDEBUG_DUMPS_DIR=\"$(DEBUG_DUMPS_DIR)\" $(GLIB_CFLAGS) $(DBUSCPP_CFLAGS) \ -DPLUGINS_LIB_DIR=\"$(PLUGINS_LIB_DIR)\" \ -DPLUGINS_CONF_DIR=\"$(PLUGINS_CONF_DIR)\" \ diff --git a/lib/CommLayer/Observer.h b/lib/CommLayer/Observer.h index a26b7b7..d691bca 100644 --- a/lib/CommLayer/Observer.h +++ b/lib/CommLayer/Observer.h @@ -2,6 +2,7 @@ #define OBSERVER_H_ #include "CrashTypes.h" +#include <string> class CObserver { public: |
