Move Protocol's derived classes commons in Protocol
authorAlexander Aksenov <a.aksenov@samsung.com>
Fri, 27 Apr 2018 17:07:03 +0000 (20:07 +0300)
committerAlexander Aksenov <a.aksenov@samsung.com>
Fri, 27 Apr 2018 17:07:03 +0000 (20:07 +0300)
Signed-off-by: Alexander Aksenov <a.aksenov@samsung.com>
src/debug/netcoredbg/debugger.h
src/debug/netcoredbg/miprotocol.h
src/debug/netcoredbg/vscodeprotocol.h

index 45e90cb..b5b2a01 100644 (file)
@@ -57,7 +57,14 @@ public:
 
 class Protocol
 {
+protected:
+    bool m_exit;
+    Debugger *m_debugger;
+
 public:
+    Protocol() : m_exit(false), m_debugger(nullptr) {}
+    void SetDebugger(Debugger *debugger) { m_debugger = debugger; }
+
     virtual void EmitInitializedEvent() = 0;
     virtual void EmitStoppedEvent(StoppedEvent event) = 0;
     virtual void EmitExitedEvent(ExitedEvent event) = 0;
index 6d40340..e349915 100644 (file)
@@ -15,8 +15,6 @@
 class MIProtocol : public Protocol
 {
     static std::mutex m_outMutex;
-    bool m_exit;
-    Debugger *m_debugger;
 
     std::string m_fileExec;
     std::vector<std::string> m_execArgs;
@@ -25,10 +23,9 @@ class MIProtocol : public Protocol
     std::unordered_map<std::string, Variable> m_vars;
     std::unordered_map<std::string, std::unordered_map<int32_t, int> > m_breakpoints;
 public:
-    void SetDebugger(Debugger *debugger) { m_debugger = debugger; }
     static std::string EscapeMIValue(const std::string &str);
 
-    MIProtocol() : m_exit(false), m_debugger(nullptr), m_varCounter(0) {}
+    MIProtocol() : Protocol(), m_varCounter(0) {}
     void EmitInitializedEvent() override {}
     void EmitStoppedEvent(StoppedEvent event) override;
     void EmitExitedEvent(ExitedEvent event) override;
index 2f2e7de..7801a08 100644 (file)
@@ -27,8 +27,6 @@ class VSCodeProtocol : public Protocol
         LogFile
     } m_engineLogOutput;
     std::ofstream m_engineLog;
-    bool m_exit;
-    Debugger *m_debugger;
 
     uint64_t m_seqCounter;
 
@@ -41,8 +39,7 @@ class VSCodeProtocol : public Protocol
 
 public:
 
-    VSCodeProtocol() : m_engineLogOutput(LogNone), m_exit(false), m_debugger(nullptr), m_seqCounter(1) {}
-    void SetDebugger(Debugger *debugger) { m_debugger = debugger; }
+    VSCodeProtocol() : Protocol(), m_engineLogOutput(LogNone), m_seqCounter(1) {}
     void EngineLogging(const std::string &path);
 
     void EmitInitializedEvent() override;