OpenCPN Partial API docs
Loading...
Searching...
No Matches
senc_manager.h
Go to the documentation of this file.
1
/***************************************************************************
2
* Copyright (C) 2010 by David S. Register *
3
* *
4
* This program is free software; you can redistribute it and/or modify *
5
* it under the terms of the GNU General Public License as published by *
6
* the Free Software Foundation; either version 2 of the License, or *
7
* (at your option) any later version. *
8
* *
9
* This program is distributed in the hope that it will be useful, *
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12
* GNU General Public License for more details. *
13
* *
14
* You should have received a copy of the GNU General Public License *
15
* along with this program; if not, see <https://www.gnu.org/licenses/>. *
16
**************************************************************************/
17
23
24
#ifndef SENCMGR_H_
25
#define SENCMGR_H_
26
27
#include <vector>
28
29
#include <wx/event.h>
30
#include <wx/string.h>
31
#include <wx/thread.h>
32
33
#include "
s57chart.h
"
34
35
class
SENCThreadManager
;
// forward
36
extern
SENCThreadManager
*
g_SencThreadManager
;
37
38
extern
const
wxEventType
wxEVT_OCPN_BUILDSENCTHREAD
;
39
40
class
SENCBuildThread
;
// forward
41
42
typedef
enum
{
43
THREAD_INACTIVE = 0,
44
THREAD_PENDING,
45
THREAD_STARTED,
46
THREAD_FINISHED
47
} SENCThreadStatus;
48
49
typedef
enum
{
50
SENC_BUILD_INACTIVE = 0,
51
SENC_BUILD_PENDING,
52
SENC_BUILD_STARTED,
53
SENC_BUILD_DONE_NOERROR,
54
SENC_BUILD_DONE_ERROR,
55
} EVENTSENCResult;
56
57
//----------------------------------------------------------------------------
58
// s57 Chart Thread based SENC job ticket
59
//----------------------------------------------------------------------------
60
class
SENCJobTicket {
61
public
:
62
SENCJobTicket();
63
~SENCJobTicket() {}
64
65
s57chart
*m_chart;
66
wxString m_FullPath000;
67
wxString m_SENCFileName;
68
double
ref_lat, ref_lon;
69
double
m_LOD_meters;
70
71
SENCThreadStatus m_status;
72
EVENTSENCResult m_SENCResult;
73
bool
m_completion_posted;
74
};
75
76
//----------------------------------------------------------------------------
77
// s57 Chart Thread based SENC creator status message
78
//----------------------------------------------------------------------------
79
class
OCPN_BUILDSENC_ThreadEvent :
public
wxEvent {
80
public
:
81
OCPN_BUILDSENC_ThreadEvent(wxEventType commandType = wxEVT_NULL,
int
id
= 0);
82
~OCPN_BUILDSENC_ThreadEvent();
83
84
// required for sending with wxPostEvent()
85
wxEvent *Clone()
const
;
86
87
int
stat;
88
EVENTSENCResult type;
89
SENCJobTicket
*m_ticket;
90
91
private
:
92
};
93
104
class
SENCThreadManager :
public
wxEvtHandler {
105
public
:
106
SENCThreadManager();
107
~SENCThreadManager();
108
109
void
OnEvtThread(
OCPN_BUILDSENC_ThreadEvent
&event);
110
111
SENCThreadStatus ScheduleJob(
SENCJobTicket
*ticket);
112
void
FinishJob(
SENCJobTicket
*ticket);
113
void
StartTopJob();
114
bool
IsChartInTicketlist(
s57chart
*chart);
115
bool
SetChartPointer(
s57chart
*chart,
void
*new_ptr);
116
void
InvalidateChartPointer(
s57chart
*chart);
117
void
ReleaseCompletedTicket(
SENCJobTicket
*ticket);
118
void
ClearJobList();
119
int
GetJobCount();
120
int
GetRunningJobCount();
121
bool
IsShuttingDown()
const
;
122
123
int
m_max_jobs;
124
125
std::vector<SENCJobTicket *> ticket_list;
126
127
private
:
128
void
UpdateAlertString();
129
void
NotifyFrame(
OCPN_BUILDSENC_ThreadEvent
&event);
130
131
std::vector<SENCJobTicket *> completing_list;
132
wxCriticalSection m_list_mutex;
133
bool
m_shutting_down;
134
};
135
136
//----------------------------------------------------------------------------
137
// s57 Chart Thread based SENC creator
138
//----------------------------------------------------------------------------
139
class
SENCBuildThread :
public
wxThread {
140
public
:
141
SENCBuildThread(
SENCJobTicket
*ticket,
SENCThreadManager
*manager);
142
void
*Entry();
143
144
wxString m_FullPath000;
145
wxString m_SENCFileName;
146
SENCThreadManager
*m_manager;
147
SENCJobTicket
*m_ticket;
148
};
149
150
#endif
// SENCMGR_H_
OCPN_BUILDSENC_ThreadEvent
Definition
senc_manager.h:79
SENCBuildThread
Definition
senc_manager.h:139
SENCJobTicket
Definition
senc_manager.h:60
SENCThreadManager
Manager for S57 chart SENC creation threads.
Definition
senc_manager.h:104
s57chart
Represents an S57 format electronic navigational chart in OpenCPN.
Definition
s57chart.h:90
s57chart.h
S57 Chart Object.
wxEVT_OCPN_BUILDSENCTHREAD
const wxEventType wxEVT_OCPN_BUILDSENCTHREAD
Global instance.
Definition
senc_manager.cpp:57
g_SencThreadManager
SENCThreadManager * g_SencThreadManager
Global instance.
Definition
senc_manager.cpp:41
gui
include
gui
senc_manager.h
Generated on
for OpenCPN Partial API docs by
1.15.0