NAVTOR SDK  v.3.0
Software Development Kit for fast and efficient development of ECDIS, ECS and generic marine applications
port_info_interface_impl.h
Go to the documentation of this file.
1 
10 #ifndef SDK_NAVBOX_CLIENT_PORT_INFO_INTERFACE_IMPL_H_
11 #define SDK_NAVBOX_CLIENT_PORT_INFO_INTERFACE_IMPL_H_
12 #pragma once
13 
14 #include <string>
15 #include <base/inc/platform.h>
17 #include <base/inc/sdk_component_base.h>
19 #include <base/inc/exception.h>
23 
24 SDK_NAVBOX_CLIENT_BEGIN_NAMESPACE
25 
27 class PortInfo : public SDKComponentBaseI< IPortInfo > {
28 public:
29  explicit PortInfo(const std::wstring& name,
30  const std::wstring& country = std::wstring(),
31  const std::wstring& vhf_channel_port_control = std::wstring(),
32  const std::wstring& vhf_channel_pilots = std::wstring(),
33  const std::wstring& pre_departure_notice_to = std::wstring(),
34  const std::wstring& vhf_channel = std::wstring(),
35  const std::wstring& draught_restrictions = std::wstring(),
36  const std::wstring& air_draught_restrictions = std::wstring(),
37  const std::wstring& other_restrictions = std::wstring(),
38  const std::wstring& guide_to_port_entry = std::wstring(),
39  const std::wstring& extra_info = std::wstring(),
40  SDKTimeDelta tz = 0,
41  const std::wstring& tz_display_name = std::wstring(),
42  const GeoPoint& position = GeoPoint(),
43  const std::wstring& name_of_berth = std::wstring())
44  : m_name(name),
45  m_country(country),
46  m_vhf_channel_port_control(vhf_channel_port_control),
47  m_vhf_channel_pilots(vhf_channel_pilots),
48  m_pre_departure_notice_to(pre_departure_notice_to),
49  m_vhf_channel(vhf_channel),
50  m_draught_restrictions(draught_restrictions),
51  m_air_draught_restrictions(air_draught_restrictions),
52  m_other_restrictions(other_restrictions),
53  m_guide_to_port_entry(guide_to_port_entry),
54  m_extra_info(extra_info),
55  m_tz(tz),
56  m_tz_display_name(tz_display_name),
57  m_position(position),
58  m_name_of_berth(name_of_berth) {
59  }
60 
61  virtual ~PortInfo() {
62  }
63 
65  virtual SDKResult SDK_CALLTYPE GetName(SDKString& port_name) const throw() {
66  try
67  {
68  port_name = ScopedString(m_name).Detach();
69  return m_name.empty() ? Err_NotExist : Ok;
70  } SDK_CATCH_RET(Err_Unexpected)
71  }
72 
73  virtual SDKResult SDK_CALLTYPE GetCountry(
74  SDKString& port_country) const throw() {
75  try
76  {
77  port_country = ScopedString(m_country).Detach();
78  return m_country.empty() ? Err_NotExist : Ok;
79  } SDK_CATCH_RET(Err_Unexpected)
80  }
81 
82  virtual SDKResult SDK_CALLTYPE GetVHFChannelPortControl(
83  SDKString& channel) const throw() {
84  try
85  {
86  channel = ScopedString(m_vhf_channel_port_control).Detach();
87  return m_vhf_channel_port_control.empty() ? Err_NotExist : Ok;
88  } SDK_CATCH_RET(Err_Unexpected)
89  }
90 
91  virtual SDKResult SDK_CALLTYPE GetVHFChannelPilots(
92  SDKString& channel) const throw() {
93  try
94  {
95  channel = ScopedString(m_vhf_channel_pilots).Detach();
96  return m_vhf_channel_pilots.empty() ? Err_NotExist : Ok;
97  } SDK_CATCH_RET(Err_Unexpected)
98  }
99 
100  virtual SDKResult SDK_CALLTYPE GetPreDepartureNoticeTo(
101  SDKString& channel) const throw() {
102  try
103  {
104  channel = ScopedString(m_pre_departure_notice_to).Detach();
105  return m_pre_departure_notice_to.empty() ? Err_NotExist : Ok;
106  } SDK_CATCH_RET(Err_Unexpected)
107  }
108 
109  virtual SDKResult SDK_CALLTYPE GetVHFChannel(
110  SDKString& channel) const throw() {
111  try
112  {
113  channel = ScopedString(m_vhf_channel).Detach();
114  return m_vhf_channel.empty() ? Err_NotExist : Ok;
115  } SDK_CATCH_RET(Err_Unexpected)
116  }
117 
118  virtual SDKResult SDK_CALLTYPE GetDraughtRestrictions(
119  SDKString& draught_restrictions) const throw() {
120  try
121  {
122  draught_restrictions = ScopedString(m_draught_restrictions).Detach();
123  return m_draught_restrictions.empty() ? Err_NotExist : Ok;
124  } SDK_CATCH_RET(Err_Unexpected)
125  }
126 
127  virtual SDKResult SDK_CALLTYPE GetAirDraughtRestrictions(
128  SDKString& air_draught_restrictions) const throw() {
129  try
130  {
131  air_draught_restrictions = ScopedString(m_air_draught_restrictions).Detach();
132  return m_air_draught_restrictions.empty() ? Err_NotExist : Ok;
133  }
134  SDK_CATCH_RET(Err_Unexpected)
135  }
136 
137  virtual SDKResult SDK_CALLTYPE GetOtherRestrictions(
138  SDKString& other_restrictions) const throw() {
139  try
140  {
141  other_restrictions = ScopedString(m_other_restrictions).Detach();
142  return m_other_restrictions.empty() ? Err_NotExist : Ok;
143  }
144  SDK_CATCH_RET(Err_Unexpected)
145  }
146 
147  virtual SDKResult SDK_CALLTYPE GetGuideToPortEntry(
148  SDKString& guide_to_port_entry) const throw() {
149  try
150  {
151  guide_to_port_entry = ScopedString(m_guide_to_port_entry).Detach();
152  return m_guide_to_port_entry.empty() ? Err_NotExist : Ok;
153  } SDK_CATCH_RET(Err_Unexpected)
154  }
155 
156  virtual SDKResult SDK_CALLTYPE GetExtraInfo(
157  SDKString& extra_info) const throw() {
158  try
159  {
160  extra_info = ScopedString(m_extra_info).Detach();
161  return m_extra_info.empty() ? Err_NotExist : Ok;
162  } SDK_CATCH_RET(Err_Unexpected)
163  }
164 
165  virtual SDKResult SDK_CALLTYPE GetTimeZone(SDKTimeDelta& tz) const throw() {
166  try
167  {
168  tz = m_tz;
169  return Ok;
170  } SDK_CATCH_RET(Err_Unexpected)
171  }
172 
173  virtual SDKResult SDK_CALLTYPE GetTimeZoneDisplayName(
174  SDKString& tz_display_name) const throw() {
175  try
176  {
177  if (m_tz_display_name.empty())
178  return Err_NotExist;
179  tz_display_name = ScopedString(m_tz_display_name).Detach();
180  return Ok;
181  } SDK_CATCH_RET(Err_Unexpected)
182  }
183 
184  virtual SDKResult SDK_CALLTYPE GetPosition(
185  SDKGeoPoint& position) const throw() {
186  try
187  {
188  position = GeoPoint();
189  if (!m_position.IsValid())
190  return Err_NotExist;
191  position = m_position;
192  return Ok;
193  } SDK_CATCH_RET(Err_Unexpected)
194  }
195 
196  virtual SDKResult SDK_CALLTYPE GetNameOfBerth(
197  SDKString& name_of_berth) const throw() {
198  try
199  {
200  name_of_berth = ScopedString(m_name_of_berth).Detach();
201  return m_name_of_berth.empty() ? Err_NotExist : Ok;
202  } SDK_CATCH_RET(Err_Unexpected)
203  }
204 
205 private:
207  PortInfo(const PortInfo&);
208  void operator=(const PortInfo&);
209 
210 protected:
211  const std::wstring m_name;
212  const std::wstring m_country;
213  const std::wstring m_vhf_channel_port_control;
214  const std::wstring m_vhf_channel_pilots;
215  const std::wstring m_pre_departure_notice_to;
216  const std::wstring m_vhf_channel;
217  const std::wstring m_draught_restrictions;
218  const std::wstring m_air_draught_restrictions;
219  const std::wstring m_other_restrictions;
220  const std::wstring m_guide_to_port_entry;
221  const std::wstring m_extra_info;
222  const SDKTimeDelta m_tz;
223  const std::wstring m_tz_display_name;
224  const GeoPoint m_position;
225  const std::wstring m_name_of_berth;
226 };
227 
228 SDK_NAVBOX_CLIENT_END_NAMESPACE
229 
230 #endif // SDK_NAVBOX_CLIENT_PORT_INFO_INTERFACE_IMPL_H_
geometry_base_types_helpers.h
Geometry types.
navbox_client_interfaces.h
NavBox client interfaces.
PortInfo
Implementation of the IPortInfo interface.
Definition: port_info_interface_impl.h:27
sdk::Ok
@ Ok
Operation completed successfully.
Definition: sdk_results_enum.h:22
sdk_string_handler.h
Wrappers and helper functions for SDKString.
SDKResult
SDKInt32 SDKResult
Type of all error or return codes which SDK functions can end with.
Definition: sdk_results.h:17
SDKTimeDelta
SDKInt64 SDKTimeDelta
Time delta in Milliseconds.
Definition: base_types.h:63
SDKGeoPoint
Geo point in degree units.
Definition: geometry_base_types.h:1727
sdk::Err_Unexpected
@ Err_Unexpected
Not implemented.
Definition: sdk_results_enum.h:29
PortInfo::GetName
virtual SDKResult SDK_CALLTYPE GetName(SDKString &port_name) const
IPortInfo interface implementation.
Definition: port_info_interface_impl.h:65
platform.h
Describes the platform constants.
sdk::ScopedString
sdk::SDKStringHandler ScopedString
Synonym for the SDKStringHandler.
Definition: sdk_string_handler.h:347
sdk::Err_NotExist
@ Err_NotExist
Not exist.
Definition: sdk_results_enum.h:26
sdk::SDKStringHandler::Detach
SDKString Detach()
Detaches existing value.
Definition: sdk_string_handler.h:282
navbox_client_const.h
Defines NavBox client constants.
sdk_results_enum.h
SDK return values synonyms in the sdk namespace.