NAVTOR SDK  v.3.0
Software Development Kit for fast and efficient development of ECDIS, ECS and generic marine applications
route_data_interface.h
Go to the documentation of this file.
1 #ifndef SDK_ECDIS_NMEA_PARSER_ROUTE_DATA_INTERFACE_H_
11 #define SDK_ECDIS_NMEA_PARSER_ROUTE_DATA_INTERFACE_H_
12 #pragma once
13 
14 #include <base/inc/platform.h>
15 #include <base/inc/sdk_results.h>
16 #include <base/inc/base_types.h>
17 #include <base/inc/forward_declarations.h>
21 
22 SDK_ECDISLAYER_BEGIN_NAMESPACE
23 
24 namespace nmea {
25 
26 FWD_DECL_INTERFACE(IWaypointData)
27 FWD_DECL_INTERFACE(IRouteData);
28 
32 {
34  kWaypointDataFieldID_Name = 0, // kSDKAnyType_SDKStringPtr
36  kWaypointDataFieldID_Lat = 1, // kSDKAnyType_Double
38  kWaypointDataFieldID_Lon = 2, // kSDKAnyType_Double
39 };
40 
44 {
46  kRouteDataFieldID_Name = 100, // kSDKAnyType_SDKStringPtr
48  kRouteDataFieldID_CompleteRoute = 101, // kSDKAnyType_Bool
49 };
50 
54 {
55 public:
57  virtual SDKResult SDK_CALLTYPE SetWaypointFieldValue(
58  const WaypointDataFieldID& id, const SDKAny& value) throw() = 0;
59 
61  virtual SDKResult SDK_CALLTYPE GetWaypointFieldValue(
62  const WaypointDataFieldID& id, SDKAny& value) const throw() = 0;
63 
64  template< typename T >
65  SDKResult GetWaypointFieldValueT(
66  const WaypointDataFieldID& id, T& out) const throw()
67  {
68  try
69  {
70  SDK_NAMESPACE::ScopedAny value;
71  SDKResult res = GetWaypointFieldValue(id, value);
72  if (SDK_FAILED(res))
73  return res;
74  if (ANY_IS_EMPTY(&value) || ANY_IS_NULL(&value))
75  return Err_NotExist;
76  return value.GetAs<T>(out) ? Ok : Err_InvalidArg;
77  }
78  catch (...) {}
79 
80  return Err_UnknownError;
81  }
82 
83  SDK_IMPLEMENT_IID(IWaypointData)
84  SDK_END_INTERFACE(IWaypointData)
85 };
86 SDK_DECLARE_IID(IWaypointData)
87 
88 class IRouteData : public ISDKComponent
91 {
92 public:
94  virtual SDKResult SDK_CALLTYPE SetRouteFieldValue(
95  const RouteDataFieldID& id, const SDKAny& value) throw() = 0;
96 
98  virtual SDKResult SDK_CALLTYPE GetRouteFieldValue(
99  const RouteDataFieldID& id, SDKAny& value) const throw() = 0;
100 
102  virtual SDKUInt32 SDK_CALLTYPE GetWaypointsCount() const throw() = 0;
103 
105  virtual IWaypointDataSP SDK_CALLTYPE GetWaypoint(
106  const SDKUInt32& idx) const throw() = 0;
107 
109  virtual SDKResult SDK_CALLTYPE SetWaypointFieldValue(const SDKUInt32& idx,
110  const WaypointDataFieldID& id, const SDKAny& value) throw() = 0;
111 
113  virtual SDKResult SDK_CALLTYPE GetWaypointFieldValue(const SDKUInt32& idx,
114  const WaypointDataFieldID& id, SDKAny& value) const throw() = 0;
115 
116  template< typename T >
117  SDKResult GetRouteFieldValueT(
118  const RouteDataFieldID& id, T& out) const throw()
119  {
120  try
121  {
122  SDK_NAMESPACE::ScopedAny value;
123  SDKResult res = GetRouteFieldValue(id, value);
124  if (SDK_FAILED(res))
125  return res;
126  if (ANY_IS_EMPTY(&value) || ANY_IS_NULL(&value))
127  return Err_NotExist;
128  return value.GetAs<T>(out) ? Ok : Err_InvalidArg;
129  }
130  catch (...) {}
131 
132  return Err_UnknownError;
133  }
134 
135  template< typename T >
136  SDKResult GetWaypointFieldValueT(
137  const SDKUInt32& idx, const WaypointDataFieldID& id, T& out) const throw()
138  {
139  try
140  {
141  SDK_NAMESPACE::ScopedAny value;
142  SDKResult res = GetWaypointFieldValue(idx, id, value);
143  if (SDK_FAILED(res))
144  return res;
145  if (ANY_IS_EMPTY(&value) || ANY_IS_NULL(&value))
146  return Err_NotExist;
147  return value.GetAs<T>(out) ? Ok : Err_InvalidArg;
148  }
149  catch (...) {}
150 
151  return Err_UnknownError;
152  }
153 
154  SDK_IMPLEMENT_IID(IRouteData)
155  SDK_END_INTERFACE(IRouteData)
156 };
157 SDK_DECLARE_IID(IRouteData)
158 
159 } // namespace nmea
160 
161 SDK_ECDISLAYER_END_NAMESPACE
162 
163 #endif // SDK_ECDIS_NMEA_PARSER_ROUTE_DATA_INTERFACE_H_
nmea::kRouteDataFieldID_Name
@ kRouteDataFieldID_Name
Route name.
Definition: route_data_interface.h:46
sdk_results.h
A list of SDK error/return results.
nmea::IRouteData::SetWaypointFieldValue
virtual SDKResult SDK_CALLTYPE SetWaypointFieldValue(const SDKUInt32 &idx, const WaypointDataFieldID &id, const SDKAny &value)=0
Sets new value for Waypoint data field.
base_types.h
SDK base types.
nmea::WaypointDataFieldID
WaypointDataFieldID
List of available waypoint data field IDs.
Definition: route_data_interface.h:31
nmea::kWaypointDataFieldID_Name
@ kWaypointDataFieldID_Name
Waypoint name.
Definition: route_data_interface.h:34
nmea::kRouteDataFieldID_CompleteRoute
@ kRouteDataFieldID_CompleteRoute
Complete route flag.
Definition: route_data_interface.h:48
sdk::Ok
@ Ok
Operation completed successfully.
Definition: sdk_results_enum.h:22
nmea::IRouteData
Single route data.
Definition: route_data_interface.h:90
ecdislayer_const.h
The ecdislayer constants.
SDKResult
SDKInt32 SDKResult
Type of all error or return codes which SDK functions can end with.
Definition: sdk_results.h:17
sdk::Err_InvalidArg
@ Err_InvalidArg
Wrong argument passed to function.
Definition: sdk_results_enum.h:27
nmea::IRouteData::SetRouteFieldValue
virtual SDKResult SDK_CALLTYPE SetRouteFieldValue(const RouteDataFieldID &id, const SDKAny &value)=0
Sets new value for Route data field.
sdk::Err_UnknownError
@ Err_UnknownError
Unknown error.
Definition: sdk_results_enum.h:52
sdk_component_interface.h
Common base SDK interfaces.
SDK_FAILED
#define SDK_FAILED(res)
Checks failed result.
Definition: sdk_results_enum.h:69
platform.h
Describes the platform constants.
ISDKComponent
Base interface for all SDK interfaces.
Definition: sdk_component_interface.h:41
sdk::Err_NotExist
@ Err_NotExist
Not exist.
Definition: sdk_results_enum.h:26
nmea::IWaypointData
Single route waypoint data.
Definition: route_data_interface.h:53
nmea::IRouteData::GetRouteFieldValue
virtual SDKResult SDK_CALLTYPE GetRouteFieldValue(const RouteDataFieldID &id, SDKAny &value) const =0
Returns appropriate Route data field value, if exists.
nmea::RouteDataFieldID
RouteDataFieldID
List of available route data field IDs.
Definition: route_data_interface.h:43
nmea::kWaypointDataFieldID_Lat
@ kWaypointDataFieldID_Lat
Waypoint latitude.
Definition: route_data_interface.h:36
nmea::IWaypointData::GetWaypointFieldValue
virtual SDKResult SDK_CALLTYPE GetWaypointFieldValue(const WaypointDataFieldID &id, SDKAny &value) const =0
Returns appropriate Waypoint data field value, if exists.
nmea::kWaypointDataFieldID_Lon
@ kWaypointDataFieldID_Lon
Waypoint longitude.
Definition: route_data_interface.h:38
FWD_DECL_INTERFACE
FWD_DECL_INTERFACE(ILWEParserWrapper)
Provides a wrapper around the message parser to get, add or remove the.
nmea::IWaypointData::SetWaypointFieldValue
virtual SDKResult SDK_CALLTYPE SetWaypointFieldValue(const WaypointDataFieldID &id, const SDKAny &value)=0
Sets new value for Waypoint data field.
nmea::IRouteData::GetWaypoint
virtual IWaypointDataSP SDK_CALLTYPE GetWaypoint(const SDKUInt32 &idx) const =0
Returns appropriate Waypoint value, if exists.
nmea::IRouteData::GetWaypointFieldValue
virtual SDKResult SDK_CALLTYPE GetWaypointFieldValue(const SDKUInt32 &idx, const WaypointDataFieldID &id, SDKAny &value) const =0
Returns appropriate Waypoint data field value, if exists.
nmea::IRouteData::GetWaypointsCount
virtual SDKUInt32 SDK_CALLTYPE GetWaypointsCount() const =0
Returns appropriate number of waypoints.
sdk_any_handler.h
Wrappers for work with SDKAny instance.