~ubuntu-branches/ubuntu/utopic/pgadmin3/utopic-proposed

« back to all changes in this revision

Viewing changes to pgadmin/include/debugger/dbgModel.h

  • Committer: Package Import Robot
  • Author(s): Christoph Berg
  • Date: 2013-09-10 16:16:38 UTC
  • mfrom: (1.3.4)
  • Revision ID: package-import@ubuntu.com-20130910161638-wwup1q553ylww7dr
Tags: 1.18.0-1
* New upstream release.
* Don't install /usr/bin/png2c anymore.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
//////////////////////////////////////////////////////////////////////////
 
2
//
 
3
// pgAdmin III - PostgreSQL Tools
 
4
//
 
5
// Copyright (C) 2002 - 2013, The pgAdmin Development Team
 
6
// This software is released under the PostgreSQL Licence
 
7
//
 
8
// dbgModel.h - Debugger Model
 
9
//
 
10
//////////////////////////////////////////////////////////////////////////
 
11
 
 
12
#ifndef DBGMODEL_H
 
13
#define DBGMODEL_H
 
14
 
 
15
#include <wx/wx.h>
 
16
 
 
17
#include "debugger/dbgBreakPoint.h"
 
18
#include "debugger/dbgTargetInfo.h"
 
19
 
 
20
class dbgCachedStack
 
21
{
 
22
public:
 
23
        dbgCachedStack() {}
 
24
        dbgCachedStack(const wxString &_pkg, const wxString &_func,
 
25
                       const wxString &_target, const wxString &_arg, const wxString &_src)
 
26
                : m_func(_func), m_pkg(_pkg), m_source(_src),
 
27
                  m_target(_target), m_arg(_arg) {}
 
28
 
 
29
        dbgCachedStack(const dbgCachedStack &_src)
 
30
                : m_func(_src.m_func), m_pkg(_src.m_pkg), m_source(_src.m_source),
 
31
                  m_target(_src.m_target), m_arg(_src.m_arg) {}
 
32
 
 
33
        dbgCachedStack &operator =(const dbgCachedStack &_src)
 
34
        {
 
35
                m_func   = _src.m_func;
 
36
                m_pkg    = _src.m_pkg;
 
37
                m_source = _src.m_source;
 
38
                m_target = _src.m_target;
 
39
                m_arg    = _src.m_arg;
 
40
 
 
41
                return *this;
 
42
        }
 
43
 
 
44
private:
 
45
        wxString    m_pkg;    // Package OID
 
46
        wxString    m_func;   // Function OID
 
47
        wxString    m_target; // Target Name
 
48
        wxString        m_arg;    // Argument passed to the target
 
49
        wxString        m_source;  // Source code for this function
 
50
 
 
51
        friend class frmDebugger;
 
52
};
 
53
 
 
54
WX_DECLARE_STRING_HASH_MAP(dbgCachedStack, dbgSourceHash);
 
55
 
 
56
class dbgModel
 
57
{
 
58
public:
 
59
        dbgModel(Oid _target, pgConn *_conn);
 
60
 
 
61
        dbgTargetInfo *GetTarget()
 
62
        {
 
63
                return m_target;
 
64
        }
 
65
        dbgBreakPointList &GetBreakPoints()
 
66
        {
 
67
                return m_breakpoints;
 
68
        }
 
69
 
 
70
        wxString &GetPort()
 
71
        {
 
72
                return m_port;
 
73
        }
 
74
        wxString &GetSession()
 
75
        {
 
76
                return m_session;
 
77
        }
 
78
        wxString &GetTargetPid()
 
79
        {
 
80
                return m_targetPid;
 
81
        }
 
82
 
 
83
        bool GetSource(const wxString &_funcOid, dbgCachedStack *_cached = NULL);
 
84
        void ClearCachedSource();
 
85
        void AddSource(const wxString &_funcOid, const dbgCachedStack &cached);
 
86
 
 
87
        bool RequireDisplayUpdate()
 
88
        {
 
89
                return (m_focusedFuncOid != m_displayedFuncOid ||
 
90
                        m_displayedPkgOid != m_focusedPkgOid);
 
91
        }
 
92
 
 
93
        wxString &GetFocusedPackage()
 
94
        {
 
95
                return m_focusedPkgOid;
 
96
        }
 
97
        wxString &GetDisplayedPackage()
 
98
        {
 
99
                return m_displayedPkgOid;
 
100
        }
 
101
        wxString &GetFocusedFunction()
 
102
        {
 
103
                return m_focusedFuncOid;
 
104
        }
 
105
        wxString &GetDisplayedFunction()
 
106
        {
 
107
                return m_displayedFuncOid;
 
108
        }
 
109
 
 
110
        int      &GetCurrLineNo()
 
111
        {
 
112
                return m_currLineNo;
 
113
        }
 
114
 
 
115
private:
 
116
        // Target Information
 
117
        dbgTargetInfo     *m_target;
 
118
 
 
119
        // Break-Points
 
120
        dbgBreakPointList  m_breakpoints;
 
121
 
 
122
        // Debugging Port, session-handle & target-backend pid
 
123
        wxString           m_port;
 
124
        wxString           m_session;
 
125
        wxString           m_targetPid;
 
126
 
 
127
        // Cached source-code for the stacked functions
 
128
        dbgSourceHash      m_sourceMap;
 
129
 
 
130
        // Current focused function-information
 
131
        wxString           m_focusedFuncOid;
 
132
        wxString           m_focusedPkgOid;
 
133
 
 
134
        // Current displayed function-information
 
135
        wxString           m_displayedFuncOid;
 
136
        wxString           m_displayedPkgOid;
 
137
 
 
138
        // Current Line number
 
139
        int                m_currLineNo;
 
140
};
 
141
 
 
142
#endif