NAVTOR SDK  v.3.0
Software Development Kit for fast and efficient development of ECDIS, ECS and generic marine applications
properties_interface.h
Go to the documentation of this file.
1 #ifndef SDK_BASE_PROPERTIES_INTERFACE_H_
11 #define SDK_BASE_PROPERTIES_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 SDKPropertyID; // Property ID
22 
23 // Classes declared in this file.
24 FWD_DECL_INTERFACE(ISDKProperties);
25 FWD_DECL_INTERFACE(ISDKPropertiesClone);
26 FWD_DECL_INTERFACE(IEnumSDKProperty);
27 typedef ISDKPropertiesSP SDKPropertiesSP;
28 typedef ISDKPropertiesSCP SDKPropertiesSCP;
29 
32 class ISDKProperties : public ISDKComponent {
33  public:
35  virtual SDKResult SDK_CALLTYPE SetProperty(const SDKPropertyID& id,
36  const SDKAny& value) throw() = 0;
38  virtual SDKResult SDK_CALLTYPE GetProperty(const SDKPropertyID& id,
39  SDKAny& value) const throw() = 0;
40 
41  template<typename T>
42  inline SDKResult GetPropertyT(const SDKPropertyID& id,
43  T& out_value) const noexcept {
44  sdk::ScopedAny value;
45  SDKResult res = GetProperty(id, value);
46  if (SDK_FAILED(res))
47  return res;
48  return value.GetAs< T >(out_value) ?
50  }
51 
52  template<typename T>
53  inline SDKResult SetPropertyT(const SDKPropertyID& id, T new_value) noexcept {
54  return SetProperty(id, sdk::ScopedAny(new_value));
55  }
56 
57  SDK_IMPLEMENT_IID(ISDKProperties)
58  SDK_END_INTERFACE(ISDKProperties)
59 };
60 SDK_DECLARE_IID(ISDKProperties)
61 
62 class ISDKPropertiesClone : public ISDKComponent {
65 public:
67  virtual SDKResult SDK_CALLTYPE Clone(
68  ISDKPropertiesSP& clone) const throw() = 0;
69 
70  SDK_IMPLEMENT_IID(ISDKPropertiesClone)
71  SDK_END_INTERFACE(ISDKPropertiesClone)
72 };
73 SDK_DECLARE_IID(ISDKPropertiesClone)
74 
75 class IEnumSDKProperty : public ISDKComponent {
78  public:
81  virtual SDKResult SDK_CALLTYPE Next(SDKPropertyID& id,
82  SDKAny& value) const throw() = 0;
83 
85  virtual SDKResult SDK_CALLTYPE Reset() throw() = 0;
86 
87  SDK_IMPLEMENT_IID(IEnumSDKProperty)
88  SDK_END_INTERFACE(IEnumSDKProperty)
89 };
90 SDK_DECLARE_IID(IEnumSDKProperty)
91 
92 } // namespace sdk
93 
94 #endif // SDK_BASE_PROPERTIES_INTERFACE_H_
base_types.h
SDK base types.
sdk_ref_ptr.h
Interfaces wrapper with reference count control.
sdk::IEnumSDKProperty::Reset
virtual SDKResult SDK_CALLTYPE Reset()=0
Resets the enumeration sequence to the beginning.
sdk::IEnumSDKProperty::Next
virtual SDKResult SDK_CALLTYPE Next(SDKPropertyID &id, SDKAny &value) const =0
Retrieves the next property id and property value in the enumeration sequence.
kSDKResult_Succeeded
static const SDKResult kSDKResult_Succeeded
Operation completed successfully.
Definition: sdk_results.h:22
SDKResult
SDKInt32 SDKResult
Type of all error or return codes which SDK functions can end with.
Definition: sdk_results.h:17
sdk::ISDKProperties
Provides access to members that control the properties.
Definition: properties_interface.h:32
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::ISDKProperties::SetProperty
virtual SDKResult SDK_CALLTYPE SetProperty(const SDKPropertyID &id, const SDKAny &value)=0
Sets a property value.
sdk::SDKAnyHandler
This class wraps the SDKAny type.
Definition: sdk_any_handler.h:32
sdk::ISDKPropertiesClone::Clone
virtual SDKResult SDK_CALLTYPE Clone(ISDKPropertiesSP &clone) const =0
Return the SDK properties clone.
sdk::ISDKProperties::GetProperty
virtual SDKResult SDK_CALLTYPE GetProperty(const SDKPropertyID &id, SDKAny &value) const =0
Retrieves a property value.
sdk::ISDKPropertiesClone
Return the SDK properties clone.
Definition: properties_interface.h:64
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.