NAVTOR SDK  v.3.0
Software Development Kit for fast and efficient development of ECDIS, ECS and generic marine applications
gdb_attribute.h
Go to the documentation of this file.
1 
9 #ifndef SDK_GDB_ATTRIBUTE_INTERFACE_H_
10 #define SDK_GDB_ATTRIBUTE_INTERFACE_H_
11 #pragma once
12 
13 #include <base/inc/base_types.h>
17 #include <datalayer/inc/senc/senc_feature_dataset_s101.h>
18 
19 SDK_GDB_BEGIN_NAMESPACE
20 
21 // Classes declared in other files.
22 class IObject;
23 
24 // Classes declared in this file.
29 
32 typedef enum AttributeType {
33  kAT_Simple = 0,
36 
39 typedef enum DateTimeFlags {
40  kDTF_VALID_YEAR = 0x01,
42  kDTF_VALID_DAY = 0x04,
43  kDTF_VALID_HOUR = 0x08,
47 
50 typedef enum AttributeValueType {
51  kAVT_UChar = senc::ATTY_UINT1,
52  kAVT_UShort = senc::ATTY_UINT2,
53  kAVT_UInt = senc::ATTY_UINT4,
54  kAVT_UInt64 = senc::ATTY_UINT8,
55  kAVT_Char = senc::ATTY_SINT1,
56  kAVT_Short = senc::ATTY_SINT2,
57  kAVT_Int = senc::ATTY_SINT4,
58  kAVT_Int64 = senc::ATTY_SINT8,
59  kAVT_Single = senc::ATTY_FLOAT4,
60  kAVT_Double = senc::ATTY_FLOAT8,
61  kAVT_String = senc::ATTY_TYPE_STRING,
62  kAVT_StringASCII = senc::ATTY_STR_ASCII,
63  kAVT_StringUTF8 = senc::ATTY_STR_UTF8,
64  kAVT_StringUTF16 = senc::ATTY_STR_UTF16,
65  kAVT_StringUTF32 = senc::ATTY_STR_UTF32,
66  kAVT_DateTime = senc::ATTY_DATETIME_DOUBLE,
67  kAVT_DateTimeStruct = senc::ATTY_DATETIME_STRUCT,
68  kAVT_DateStruct = senc::ATTY_DATE_STRUCT,
69  kAVT_TimeStruct = senc::ATTY_TIME_STRUCT,
70  kAVT_Vector = senc::ATTY_TYPE_VECTOR,
72 
77 public:
82  virtual GDBResult SDK_CALLTYPE GetAttributeCount(
83  SDKUInt32& count) const throw() = 0;
84 
93  virtual GDBResult SDK_CALLTYPE GetAttribute(
94  SDKUInt32 index,
95  IAttribute** attribute) throw() = 0;
96 
104  virtual GDBResult SDK_CALLTYPE FindAttribute(
105  AttributeClassCode class_code,
106  IAttribute** attribute) throw() = 0;
107 
113  virtual GDBResult SDK_CALLTYPE GetAttributeValue(
114  AttributeClassCode class_code,
115  SDKAny& value) throw() = 0;
116 
117  template< typename T >
118  GDBResult GetAttributeValueT(AttributeClassCode class_code, T& out) throw() {
119  sdk::ScopedAny value;
120  GDBResult res = GetAttributeValue(class_code, value);
121  if (SDK_FAILED(res))
122  return res;
123  return value.GetAs< T >(out) ? sdk::Ok : sdk::Err_InvalidArg;
124  }
125 
126  SDK_IMPLEMENT_IID(IAttributeCollection)
127  SDK_END_INTERFACE(IAttributeCollection)
128 };
129 SDK_DECLARE_IID(IAttributeCollection)
130 
131 class IAttribute : public IGDBObject {
135 public:
141  virtual GDBResult SDK_CALLTYPE GetOwner(
142  IObject** owner) const throw() = 0;
143 
148  virtual GDBResult SDK_CALLTYPE GetAttributeClassCode(
149  AttributeClassCode& class_code) const throw() = 0;
150 
155  virtual GDBResult SDK_CALLTYPE GetType(
156  AttributeType& attribute_type) const throw() = 0;
157 
162  virtual GDBResult SDK_CALLTYPE GetValueType(
163  AttributeValueType& value_type) const throw() = 0;
164 
170  virtual GDBResult SDK_CALLTYPE GetValue(
171  SDKAny& value) const throw() = 0;
172 
178  virtual GDBResult SDK_CALLTYPE GetAttributeValueRef(
179  IAttributeValueRef** value_ref) throw() = 0;
180 
185  virtual GDBResult SDK_CALLTYPE GetFlags(
186  SDKUInt64& flags) throw() = 0;
187 
188  template< typename T >
189  GDBResult GetValueT(T& out) const throw() {
190  sdk::ScopedAny value;
191  GDBResult res = GetValue(value);
192  if (SDK_FAILED(res))
193  return res;
194  return value.GetAs< T >(out) ? sdk::Ok : sdk::Err_InvalidArg;
195  }
196 
197  SDK_IMPLEMENT_IID(IAttribute)
198  SDK_END_INTERFACE(IAttribute)
199 };
200 SDK_DECLARE_IID(IAttribute)
201 
202 class IAttributeValueRef : public ISDKComponent {
206 public:
210  virtual GDBResult SDK_CALLTYPE GetValueLength(
211  SDKUInt32& length) const throw() = 0;
212 
219  virtual GDBResult SDK_CALLTYPE CopyValue(
220  SDKUInt32 length,
221  SDKUInt8* buffer) const throw() = 0;
222 
231  virtual GDBResult SDK_CALLTYPE GetValueRef(
232  SDKUInt32* length,
233  SDKUInt8** value_ref) const throw() = 0;
234 
235  SDK_IMPLEMENT_IID(IAttributeValueRef)
236  SDK_END_INTERFACE(IAttributeValueRef)
237 };
238 SDK_DECLARE_IID(IAttributeValueRef)
239 
240 class IAttributeNode : public ISDKComponent {
244 public:
251  virtual GDBResult SDK_CALLTYPE GetParent(
252  IAttributeNode** parent) const throw() = 0;
253 
262  virtual GDBResult SDK_CALLTYPE GetFirstChild(
263  ClassCode class_code,
264  IAttributeNode** node) const throw() = 0;
265 
275  virtual GDBResult SDK_CALLTYPE GetNextChild(
276  ClassCode class_code,
277  IAttributeNode** node) const throw() = 0;
278 
283  virtual GDBResult SDK_CALLTYPE ResetChildIterator() throw() = 0;
284 
285  SDK_IMPLEMENT_IID(IAttributeNode)
286  SDK_END_INTERFACE(IAttributeNode)
287 };
288 SDK_DECLARE_IID(IAttributeNode)
289 
290 inline void SDKTimeStructToSDKPackedTime(const SDKTimeStruct& ti,
291  SDKUInt64 flags, SDKAny& ti_packed) {
292  ANY_TYPE(&ti_packed) = kSDKAnyType_SDKTimePacked;
293  ANY_TIME_PACKED(&ti_packed) = 0;
294  ANY_TIME_PACKED_YEAR(&ti_packed) = flags & kDTF_VALID_YEAR ?
296  ANY_TIME_PACKED_MONTH(&ti_packed) = flags & kDTF_VALID_MONTH ?
297  ti.month : kSDK_PACKED_TIME_INVALID_MONTH;
298  ANY_TIME_PACKED_MDAY(&ti_packed) = flags & kDTF_VALID_DAY ?
299  ti.mday : kSDK_PACKED_TIME_INVALID_MDAY;
300  ANY_TIME_PACKED_HOUR(&ti_packed) = flags & kDTF_VALID_HOUR ?
301  ti.hour : kSDK_PACKED_TIME_INVALID_HOUR;
302  ANY_TIME_PACKED_MINUTE(&ti_packed) = flags & kDTF_VALID_MINUTE ?
303  ti.minute : kSDK_PACKED_TIME_INVALID_MINUTE;
304  ANY_TIME_PACKED_SECOND(&ti_packed) = flags & kDTF_VALID_SECOND ?
305  ti.second : kSDK_PACKED_TIME_INVALID_SECOND;
306 }
307 
308 SDK_GDB_END_NAMESPACE
309 
310 #endif // SDK_GDB_ATTRIBUTE_INTERFACE_H_
kAVT_Vector
@ kAVT_Vector
Vector of elements.
Definition: gdb_attribute.h:70
kDTF_VALID_HOUR
@ kDTF_VALID_HOUR
Hour.
Definition: gdb_attribute.h:43
IAttribute::GetValueType
virtual GDBResult SDK_CALLTYPE GetValueType(AttributeValueType &value_type) const =0
Returns the type of the attribute value.
kAVT_DateStruct
@ kAVT_DateStruct
Date structure.
Definition: gdb_attribute.h:68
kAVT_Char
@ kAVT_Char
1 byte signed integer.
Definition: gdb_attribute.h:55
IAttributeCollection::GetAttribute
virtual GDBResult SDK_CALLTYPE GetAttribute(SDKUInt32 index, IAttribute **attribute)=0
Returns the attribute from the attribute collection specified by index. The first attribute has index...
kDTF_VALID_SECOND
@ kDTF_VALID_SECOND
Second.
Definition: gdb_attribute.h:45
base_types.h
SDK base types.
IAttributeCollection::GetAttributeCount
virtual GDBResult SDK_CALLTYPE GetAttributeCount(SDKUInt32 &count) const =0
Returns the number of attributes in the attribute collection.
kAVT_Int
@ kAVT_Int
4 bytes signed integer.
Definition: gdb_attribute.h:57
kAVT_Int64
@ kAVT_Int64
8 bytes signed integer.
Definition: gdb_attribute.h:58
kAVT_UChar
@ kAVT_UChar
1 byte unsigned integer.
Definition: gdb_attribute.h:51
IAttributeValueRef::GetValueRef
virtual GDBResult SDK_CALLTYPE GetValueRef(SDKUInt32 *length, SDKUInt8 **value_ref) const =0
Returns the reference to the attribute value. Locks dataset data until the AttributeValueRef is relea...
IAttribute
Provides access to members that return information for an Object attribute.
Definition: gdb_attribute.h:134
IAttribute::GetAttributeClassCode
virtual GDBResult SDK_CALLTYPE GetAttributeClassCode(AttributeClassCode &class_code) const =0
Returns the class code of the attribute.
IAttributeCollection::FindAttribute
virtual GDBResult SDK_CALLTYPE FindAttribute(AttributeClassCode class_code, IAttribute **attribute)=0
Finds an attribute specified by the attribute class code.
kAVT_StringUTF32
@ kAVT_StringUTF32
UTF-16 character string.
Definition: gdb_attribute.h:65
IObject
Object is a basic entity of a geodatabase dataset. Every object in the geodatabase is uniquely identi...
Definition: gdb_feature.h:130
kAVT_Short
@ kAVT_Short
2 bytes signed integer.
Definition: gdb_attribute.h:56
kAVT_UInt
@ kAVT_UInt
4 bytes unsigned integer.
Definition: gdb_attribute.h:53
kAVT_StringASCII
@ kAVT_StringASCII
ASCII character string.
Definition: gdb_attribute.h:62
kAVT_Double
@ kAVT_Double
8 bytes double-precision floating-point number.
Definition: gdb_attribute.h:60
DateTimeFlags
DateTimeFlags
Specifies a valid part of the date/time type attribute.
Definition: gdb_attribute.h:39
kAVT_DateTimeStruct
@ kAVT_DateTimeStruct
Date Time structure.
Definition: gdb_attribute.h:67
IAttribute::GetType
virtual GDBResult SDK_CALLTYPE GetType(AttributeType &attribute_type) const =0
Returns the type of the attribute.
IAttribute::GetAttributeValueRef
virtual GDBResult SDK_CALLTYPE GetAttributeValueRef(IAttributeValueRef **value_ref)=0
Gives direct access to the attribute value in the SENC data.
kAVT_UInt64
@ kAVT_UInt64
8 bytes unsigned integer.
Definition: gdb_attribute.h:54
kAVT_TimeStruct
@ kAVT_TimeStruct
Time structure.
Definition: gdb_attribute.h:69
IAttributeNode::ResetChildIterator
virtual GDBResult SDK_CALLTYPE ResetChildIterator()=0
Resets child iterator.
sdk::Ok
@ Ok
Operation completed successfully.
Definition: sdk_results_enum.h:22
AttributeValueType
AttributeValueType
Specifies an attribute value type.
Definition: gdb_attribute.h:50
IAttributeCollection
Provides access to members that can be used to access the individual attributes of a geometry,...
Definition: gdb_attribute.h:76
IAttributeNode::GetParent
virtual GDBResult SDK_CALLTYPE GetParent(IAttributeNode **parent) const =0
Returns the parent node.
IAttribute::GetFlags
virtual GDBResult SDK_CALLTYPE GetFlags(SDKUInt64 &flags)=0
Returns an attribute flags. Returns DateTimeFlags for the date/time types attribute value.
kDTF_VALID_YEAR
@ kDTF_VALID_YEAR
Year.
Definition: gdb_attribute.h:40
kDTF_VALID_DAY
@ kDTF_VALID_DAY
Day.
Definition: gdb_attribute.h:42
gdb_const.h
Geo database constants and structures.
sdk::Err_InvalidArg
@ Err_InvalidArg
Wrong argument passed to function.
Definition: sdk_results_enum.h:27
ClassCode
SDKUInt32 ClassCode
Definition of the ClassCode types.
Definition: gdb_const.h:229
IAttributeValueRef::CopyValue
virtual GDBResult SDK_CALLTYPE CopyValue(SDKUInt32 length, SDKUInt8 *buffer) const =0
Copies an attribute value to the buffer.
kAVT_DateTime
@ kAVT_DateTime
Microsoft's variant time data type.
Definition: gdb_attribute.h:66
IAttributeNode::GetFirstChild
virtual GDBResult SDK_CALLTYPE GetFirstChild(ClassCode class_code, IAttributeNode **node) const =0
Returns the first child for the node.
kAVT_UShort
@ kAVT_UShort
2 bytes unsigned integer.
Definition: gdb_attribute.h:52
kDTF_VALID_MINUTE
@ kDTF_VALID_MINUTE
Minute.
Definition: gdb_attribute.h:44
SDK_FAILED
#define SDK_FAILED(res)
Checks failed result.
Definition: sdk_results_enum.h:69
IAttribute::GetValue
virtual GDBResult SDK_CALLTYPE GetValue(SDKAny &value) const =0
Returns the value of the attribute.
IAttributeNode::GetNextChild
virtual GDBResult SDK_CALLTYPE GetNextChild(ClassCode class_code, IAttributeNode **node) const =0
Returns the next child for the node.
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
IAttributeCollection::GetAttributeValue
virtual GDBResult SDK_CALLTYPE GetAttributeValue(AttributeClassCode class_code, SDKAny &value)=0
Method to return the value of an attribute specified by class.
IAttribute::GetOwner
virtual GDBResult SDK_CALLTYPE GetOwner(IObject **owner) const =0
Returns the owner of the attribute.
kAT_Complex
@ kAT_Complex
Complex attribute.
Definition: gdb_attribute.h:34
kSDK_PACKED_TIME_INVALID_YEAR
#define kSDK_PACKED_TIME_INVALID_YEAR
Date data type validity checks.
Definition: base_types.h:313
kSDKAnyType_SDKTimePacked
@ kSDKAnyType_SDKTimePacked
SDKTime packed structure.
Definition: base_types.h:158
AttributeClassCode
ClassCode AttributeClassCode
Attribute class code type.
Definition: gdb_const.h:247
kDTF_VALID_MONTH
@ kDTF_VALID_MONTH
Month.
Definition: gdb_attribute.h:41
kAT_Simple
@ kAT_Simple
Simple attribute.
Definition: gdb_attribute.h:33
gdb_feature.h
Describes interfaces that manages a geodatabase feature object.
IAttributeNode
Provides access to members that return information for the attribute tree.
Definition: gdb_attribute.h:243
kAVT_Single
@ kAVT_Single
4 bytes single-precision floating-point number.
Definition: gdb_attribute.h:59
IAttributeValueRef::GetValueLength
virtual GDBResult SDK_CALLTYPE GetValueLength(SDKUInt32 &length) const =0
Returns the length of the attribute value in bytes.
kAVT_StringUTF16
@ kAVT_StringUTF16
UTF-16 character string.
Definition: gdb_attribute.h:64
AttributeType
AttributeType
Specifies an attribute type.
Definition: gdb_attribute.h:32
kAVT_String
@ kAVT_String
String type.
Definition: gdb_attribute.h:61
FWD_DECL_INTERFACE
FWD_DECL_INTERFACE(ILWEParserWrapper)
Provides a wrapper around the message parser to get, add or remove the.
IAttributeValueRef
Provides direct access to the attribute value in the SENC. The data is locked in memory until the att...
Definition: gdb_attribute.h:205
kAVT_StringUTF8
@ kAVT_StringUTF8
UTF-8 character string.
Definition: gdb_attribute.h:63
sdk_any_handler.h
Wrappers for work with SDKAny instance.