S2OPC OPCUA Toolkit
Loading...
Searching...
No Matches
sopc_encodeabletype.h
Go to the documentation of this file.
1/*
2 * Licensed to Systerel under one or more contributor license
3 * agreements. See the NOTICE file distributed with this work
4 * for additional information regarding copyright ownership.
5 * Systerel licenses this file to you under the Apache
6 * License, Version 2.0 (the "License"); you may not use this
7 * file except in compliance with the License. You may obtain
8 * a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 */
19
44#ifndef SOPC_ENCODEABLETYPE_H_
45#define SOPC_ENCODEABLETYPE_H_
46
47#include <stddef.h>
48#include <stdint.h>
49
50#include "sopc_buffer.h"
51#include "sopc_enums.h"
52
56typedef void(SOPC_EncodeableObject_PfnInitialize)(void* value);
57
61typedef void(SOPC_EncodeableObject_PfnClear)(void* value);
62
75 SOPC_Buffer* buffer,
76 uint32_t nestedStructLevel);
77
90 SOPC_Buffer* buffer,
91 uint32_t nestedStructLevel);
92
104typedef SOPC_ReturnStatus(SOPC_EncodeableObject_PfnCopy)(void* dest, const void* src);
105
122typedef SOPC_ReturnStatus(SOPC_EncodeableObject_PfnComp)(const void* left, const void* right, int32_t* comp);
123
124/*
125 * \brief Description of an encodeable type field.
126 *
127 * This structure has been designed to be very compact and fit into 8 bytes.
128 * The \c isBuiltIn field indicates whether the field type is built-in or
129 * defined in the address space. In the first case, the type index is a member
130 * of the \c SOPC_BuiltinId enumeration. In the second case, it is a member of
131 * the \c SOPC_TypeInternalIndex enumeration.
132 *
133 * The \c isArrayLength field indicates whether this field contains the length
134 * of an array. When true, the field must be of built-in type \c Int32, and the
135 * array is described by the next field.
136 *
137 * The \c isToEncode field indicates whether this field shall be encoded and
138 * decoded. When false, the field is only initialized and cleared.
139 *
140 * The \c isSameNs field indicates whether the referenced type is in the same
141 * namespace than the type containing the field. When false, the \c nsIndex shall
142 * be used to resolve the referenced type.
143 *
144 * The \c nsIndex field indicates the namespace index of the referenced type.
145 * In order to could be resolved, the namespace shall have been recorded by
146 * the
147 * in the
148 * It shall be a valid value of ::SOPC_TypeInternalIndex enum type.
149 * Note: fields can only be of internal defined types for user-defined types.
150 *
151 * The \c typeIndex field indicates the index of type in internal types array
152 * (namespaceTypesArray of encodeable type containing the field descriptor)
153 * It shall be a valid value of ::SOPC_TypeInternalIndex enum type.
154 * Note: fields can only be of internal defined types for user-defined types.
155 *
156 * Finally, the \c offset field gives the offset in bytes of the field in the
157 * object structure.
158 */
169
193
206
215
221
229SOPC_EncodeableType* SOPC_EncodeableType_GetUserType(uint16_t nsIndex, uint32_t typeId);
230
249
259
269
277
290
303
312
321
339 const void* pValue,
340 SOPC_Buffer* buf,
341 uint32_t nestedStructLevel);
342
360 void* pValue,
361 SOPC_Buffer* buf,
362 uint32_t nestedStructLevel);
363
382SOPC_ReturnStatus SOPC_EncodeableObject_Copy(SOPC_EncodeableType* type, void* destValue, const void* srcValue);
383
393
417 const void* leftValue,
418 const void* rightValue,
419 int32_t* comp);
420
421#endif /* SOPC_ENCODEABLETYPE_H_ */
A buffer of bytes with a maximum size, length and position.
SOPC_ReturnStatus SOPC_EncodeableObject_Encode(SOPC_EncodeableType *type, const void *pValue, SOPC_Buffer *buf, uint32_t nestedStructLevel)
Encode an encodeable object of the given encodeable type into a bytes buffer.
void SOPC_EncodeableType_RemoveAllUserTypes(void)
Removes all user-defined encodeable types previously added by SOPC_EncodeableType_AddUserType or SOPC...
SOPC_ReturnStatus SOPC_EncodeableType_RegisterTypesArray(size_t nsTypesArrayLen, SOPC_EncodeableType **nsTypesArray)
Registers an encodeable types array. Further calls to SOPC_EncodeableType_GetEncodeableType will succ...
SOPC_ReturnStatus SOPC_EncodeableObject_Create(SOPC_EncodeableType *encTyp, void **encObject)
Instantiate and initialize an encodeable object of the given encodeable type.
SOPC_ReturnStatus SOPC_EncodeableObject_Copy(SOPC_EncodeableType *type, void *destValue, const void *srcValue)
Copy an encodeable object of the given encodeable type.
SOPC_ReturnStatus SOPC_EncodeableObject_PfnEncode(const void *value, SOPC_Buffer *buffer, uint32_t nestedStructLevel)
Encoding function generic signature for an encodeable object *.
Definition sopc_encodeabletype.h:74
SOPC_ReturnStatus SOPC_EncodeableObject_PfnComp(const void *left, const void *right, int32_t *comp)
Compare function generic signature for an encodeable object.
Definition sopc_encodeabletype.h:122
SOPC_EncodeableType * SOPC_EncodeableType_GetEncodeableType(uint16_t nsIndex, uint32_t typeId)
Retrieve a defined encodeable type with the given type Id. It can be a internal defined type or user-...
void SOPC_EncodeableObject_Initialize(SOPC_EncodeableType *type, void *pValue)
Initialize an encodeable object of the given encodeable type.
void SOPC_EncodeableObject_Clear(SOPC_EncodeableType *type, void *pValue)
Clear an encodeable object of the given encodeable type.
void SOPC_EncodeableObject_PfnInitialize(void *value)
Initialization function generic signature for an encodeable object.
Definition sopc_encodeabletype.h:56
void SOPC_EncodeableObject_PfnClear(void *value)
Clear function generic signature for an encodeable object.
Definition sopc_encodeabletype.h:61
const char * SOPC_EncodeableType_GetName(SOPC_EncodeableType *encType)
Get the name of the given encodeable type.
SOPC_ReturnStatus SOPC_EncodeableType_RemoveUserType(SOPC_EncodeableType *encoder)
Removes a user-defined encodeable type previously created by SOPC_EncodeableType_AddUserType.
SOPC_ReturnStatus SOPC_EncodeableObject_Move(void *destObj, void *srcObj)
Moves content of srcObj to destObj, i.e. copy srcObj structure content to destObj and reset srcObj....
const struct SOPC_EncodeableType_Struct SOPC_EncodeableType
Encodeable object type structure definition. It provides all the services functions associated with t...
struct SOPC_EncodeableType_FieldDescriptor SOPC_EncodeableType_FieldDescriptor
SOPC_ReturnStatus SOPC_EncodeableType_UnRegisterTypesArray(size_t nsTypesArrayLen, SOPC_EncodeableType **nsTypesArray)
UnRegisters an encodeable types array.
SOPC_ReturnStatus SOPC_EncodeableObject_Compare(SOPC_EncodeableType *type, const void *leftValue, const void *rightValue, int32_t *comp)
Compare 2 encodeable objects of the given encodeable type.
SOPC_ReturnStatus SOPC_EncodeableType_AddUserType(SOPC_EncodeableType *encoder)
Registers a user-defined encodeable type. further calls to SOPC_EncodeableType_GetEncodeableType will...
SOPC_ReturnStatus SOPC_EncodeableObject_PfnCopy(void *dest, const void *src)
Copy function generic signature for an encodeable object.
Definition sopc_encodeabletype.h:104
SOPC_ReturnStatus SOPC_EncodeableObject_Delete(SOPC_EncodeableType *encTyp, void **encObject)
Clear and deallocate an encodeable object of the given encodeable type.
SOPC_EncodeableType * SOPC_EncodeableType_GetUserType(uint16_t nsIndex, uint32_t typeId)
Retrieve a user-defined encodeable type with the given type Id.
SOPC_ReturnStatus SOPC_EncodeableObject_PfnDecode(void *value, SOPC_Buffer *buffer, uint32_t nestedStructLevel)
Decoding function generic signature for an encodeable object.
Definition sopc_encodeabletype.h:89
SOPC_ReturnStatus SOPC_EncodeableObject_Decode(SOPC_EncodeableType *type, void *pValue, SOPC_Buffer *buf, uint32_t nestedStructLevel)
Decode an encodeable object of the given encodeable type from a bytes buffer.
enum _SOPC_ReturnStatus SOPC_ReturnStatus
Common enumerations for S2OPC.
Bytes buffer structure.
Definition sopc_buffer.h:38
Definition sopc_encodeabletype.h:160
bool isToEncode
Definition sopc_encodeabletype.h:163
bool isBuiltIn
Definition sopc_encodeabletype.h:161
bool isArrayLength
Definition sopc_encodeabletype.h:162
uint32_t offset
Definition sopc_encodeabletype.h:167
bool isSameNs
Definition sopc_encodeabletype.h:164
uint32_t typeIndex
Definition sopc_encodeabletype.h:166
uint16_t nsIndex
Definition sopc_encodeabletype.h:165
Encodeable object type structure definition. It provides all the services functions associated with t...
Definition sopc_encodeabletype.h:177
SOPC_EncodeableObject_PfnInitialize * Initialize
Definition sopc_encodeabletype.h:186
char * NamespaceUri
Definition sopc_encodeabletype.h:182
size_t AllocationSize
Definition sopc_encodeabletype.h:185
uint32_t BinaryEncodingTypeId
Definition sopc_encodeabletype.h:180
uint16_t NamespaceIndex
Definition sopc_encodeabletype.h:184
uint32_t XmlEncodingTypeId
Definition sopc_encodeabletype.h:181
const struct SOPC_EncodeableType_Struct ** namespaceTypesArray
Definition sopc_encodeabletype.h:191
int32_t NoOfFields
Definition sopc_encodeabletype.h:188
char * TypeName
Definition sopc_encodeabletype.h:178
SOPC_EncodeableObject_PfnClear * Clear
Definition sopc_encodeabletype.h:187
const SOPC_EncodeableType_FieldDescriptor * Fields
Definition sopc_encodeabletype.h:189
uint32_t TypeId
Definition sopc_encodeabletype.h:179