NAVTOR SDK  v.3.0
Software Development Kit for fast and efficient development of ECDIS, ECS and generic marine applications
parameters_interface.h
Go to the documentation of this file.
1 #ifndef SDK_BASE_PARAMETERS_INTERFACE_H_
11 #define SDK_BASE_PARAMETERS_INTERFACE_H_
12 
14 #include <base/inc/base_types.h>
16 #include <base/inc/sdk_ref_ptr.h>
18 
19 namespace sdk {
20 
21 typedef SDKUInt32 SDKParameterID; // Parameter ID
22 
23 // Classes declared in this file.
24 FWD_DECL_INTERFACE(ISDKParameters);
25 FWD_DECL_INTERFACE(ISDKParametersClone);
26 FWD_DECL_INTERFACE(ISDKParametersCollection);
27 FWD_DECL_INTERFACE(IEnumSDKParameter);
28 typedef ISDKParametersSP SDKParametersSP;
29 typedef ISDKParametersSCP SDKParametersSCP;
30 
33 class ISDKParameters : public ISDKComponent {
34  public:
41  virtual SDKResult SDK_CALLTYPE GetParameter(
42  SDKParameterID id,
43  SDKAny& value) const throw() = 0;
44 
51  virtual SDKResult SDK_CALLTYPE SetParameter(
52  SDKParameterID id,
53  const SDKAny& value) throw() = 0;
54 
62  template<typename T>
63  SDKResult GetParameterT(SDKParameterID id, T& out_value) const noexcept {
64  sdk::ScopedAny value;
65  SDKResult res = GetParameter(id, value);
66  if (SDK_FAILED(res))
67  return res;
68  return value.GetAs< T >(out_value) ?
70  }
71 
78  template<typename T>
79  inline SDKResult SetParameterT(SDKParameterID id, T new_value) noexcept {
80  return SetParameter(id, sdk::ScopedAny(new_value));
81  }
82 
83  SDK_IMPLEMENT_IID(ISDKParameters)
84  SDK_END_INTERFACE(ISDKParameters)
85 };
86 SDK_DECLARE_IID(ISDKParameters)
87 
88 class ISDKParametersClone : public ISDKComponent {
91 public:
93  virtual SDKResult SDK_CALLTYPE Clone(
94  ISDKParametersSP& clone) const throw() = 0;
95 
96  SDK_IMPLEMENT_IID(ISDKParametersClone)
97  SDK_END_INTERFACE(ISDKParametersClone)
98 };
99 SDK_DECLARE_IID(ISDKParametersClone)
100 
101 class ISDKParametersCollection : public ISDKComponent {
104 public:
106  virtual SDKResult SDK_CALLTYPE Count(SDKUInt32& count) const throw() = 0;
107 
109  virtual SDKResult SDK_CALLTYPE GetByIndex(SDKUInt32 idx,
110  SDKParameterID& id, SDKAny& value) const throw() = 0;
111 
112  SDK_IMPLEMENT_IID(ISDKParametersCollection)
113  SDK_END_INTERFACE(ISDKParametersCollection)
114 };
115 SDK_DECLARE_IID(ISDKParametersCollection)
116 
117 class IEnumSDKParameter : public ISDKComponent {
120 public:
123  virtual SDKResult SDK_CALLTYPE Next(SDKParameterID& id,
124  SDKAny& value) const throw() = 0;
125 
127  virtual SDKResult SDK_CALLTYPE Reset() throw() = 0;
128 
129  SDK_IMPLEMENT_IID(IEnumSDKParameter)
130  SDK_END_INTERFACE(IEnumSDKParameter)
131 };
132 SDK_DECLARE_IID(IEnumSDKParameter)
133 
134 } // namespace sdk
135 
136 #endif // SDK_BASE_PARAMETERS_INTERFACE_H_
sdk::ISDKParameters::SetParameterT
SDKResult SetParameterT(SDKParameterID id, T new_value) noexcept
Sets the value of the specified parameter.
Definition: parameters_interface.h:79
base_types.h
SDK base types.
sdk::ISDKParametersClone::Clone
virtual SDKResult SDK_CALLTYPE Clone(ISDKParametersSP &clone) const =0
Return the SDK parameters clone.
sdk_ref_ptr.h
Interfaces wrapper with reference count control.
sdk::IEnumSDKParameter::Reset
virtual SDKResult SDK_CALLTYPE Reset()=0
Resets the enumeration sequence to the beginning.
sdk::ISDKParametersCollection::Count
virtual SDKResult SDK_CALLTYPE Count(SDKUInt32 &count) const =0
Retrieves the number of the parameters in the container.
sdk::ISDKParameters::GetParameter
virtual SDKResult SDK_CALLTYPE GetParameter(SDKParameterID id, SDKAny &value) const =0
Returns the value of the specified parameter.
kSDKResult_Succeeded
static const SDKResult kSDKResult_Succeeded
Operation completed successfully.
Definition: sdk_results.h:22
sdk::ISDKParameters::GetParameterT
SDKResult GetParameterT(SDKParameterID id, T &out_value) const noexcept
Returns the value of the specified parameter.
Definition: parameters_interface.h:63
sdk::ISDKParametersCollection::GetByIndex
virtual SDKResult SDK_CALLTYPE GetByIndex(SDKUInt32 idx, SDKParameterID &id, SDKAny &value) const =0
Retrieves the parameter id and parameter value by index.
sdk::ISDKParameters
Provides access to members that manage parameters of an object.
Definition: parameters_interface.h:33
SDKResult
SDKInt32 SDKResult
Type of all error or return codes which SDK functions can end with.
Definition: sdk_results.h:17
sdk::ISDKParameters::SetParameter
virtual SDKResult SDK_CALLTYPE SetParameter(SDKParameterID id, const SDKAny &value)=0
Sets the value of the specified parameter.
sdk::IEnumSDKParameter::Next
virtual SDKResult SDK_CALLTYPE Next(SDKParameterID &id, SDKAny &value) const =0
Retrieves the next parameter id and parameter value in the enumeration sequence.
sdk_component_interface.h
Common base SDK interfaces.
SDK_FAILED
#define SDK_FAILED(res)
Checks failed result.
Definition: sdk_results_enum.h:69
ISDKComponent
Base interface for all SDK interfaces.
Definition: sdk_component_interface.h:41
sdk::SDKAnyHandler
This class wraps the SDKAny type.
Definition: sdk_any_handler.h:32
kSDKResult_InvalidArgument
static const SDKResult kSDKResult_InvalidArgument
Wrong argument passed to function.
Definition: sdk_results.h:55
sdk_results_enum.h
SDK return values synonyms in the sdk namespace.
FWD_DECL_INTERFACE
FWD_DECL_INTERFACE(ILWEParserWrapper)
Provides a wrapper around the message parser to get, add or remove the.
sdk_any_handler.h
Wrappers for work with SDKAny instance.