S2OPC OPCUA Toolkit
|
EncodeableType and services on encodeable object. More...
Go to the source code of this file.
Data Structures | |
struct | SOPC_EncodeableType_FieldDescriptor |
struct | SOPC_EncodeableType_Struct |
Encodeable object type structure definition. It provides all the services functions associated with the encodeable object for encoding needs. More... | |
Typedefs | |
typedef void() | SOPC_EncodeableObject_PfnInitialize(void *value) |
Initialization function generic signature for an encodeable object. More... | |
typedef void() | SOPC_EncodeableObject_PfnClear(void *value) |
Clear function generic signature for an encodeable object. More... | |
typedef SOPC_ReturnStatus() | SOPC_EncodeableObject_PfnEncode(const void *value, SOPC_Buffer *buffer, uint32_t nestedStructLevel) |
Encoding function generic signature for an encodeable object *. More... | |
typedef SOPC_ReturnStatus() | SOPC_EncodeableObject_PfnDecode(void *value, SOPC_Buffer *msgBuffer, uint32_t nestedStructLevel) |
Decoding function generic signature for an encodeable object. More... | |
typedef SOPC_ReturnStatus() | SOPC_EncodeableObject_PfnCopy(void *dest, const void *src) |
Copy function generic signature for an encodeable object. More... | |
typedef SOPC_ReturnStatus() | SOPC_EncodeableObject_PfnComp(const void *left, const void *right, int32_t *comp) |
Compare function generic signature for an encodeable object. More... | |
typedef struct SOPC_EncodeableType_FieldDescriptor | SOPC_EncodeableType_FieldDescriptor |
typedef const struct SOPC_EncodeableType_Struct | SOPC_EncodeableType |
Encodeable object type structure definition. It provides all the services functions associated with the encodeable object for encoding needs. More... | |
Functions | |
SOPC_ReturnStatus | SOPC_EncodeableType_AddUserType (SOPC_EncodeableType *encoder) |
Registers a user-defined encodeable type. further calls to SOPC_EncodeableType_GetEncodeableType will successfully identify the registered encodeable type. More... | |
SOPC_ReturnStatus | SOPC_EncodeableType_RemoveUserType (SOPC_EncodeableType *encoder) |
Removes a user-defined encodeable type previously created by SOPC_EncodeableType_AddUserType. More... | |
SOPC_EncodeableType * | SOPC_EncodeableType_GetUserType (uint16_t nsIndex, uint32_t typeId) |
Retrieve a user-defined encodeable type with the given type Id. More... | |
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-defined type. More... | |
const char * | SOPC_EncodeableType_GetName (SOPC_EncodeableType *encType) |
Get the name of the given encodeable type. More... | |
void | SOPC_EncodeableObject_Initialize (SOPC_EncodeableType *type, void *pValue) |
Initialize an encodeable object of the given encodeable type. More... | |
void | SOPC_EncodeableObject_Clear (SOPC_EncodeableType *type, void *pValue) |
Clear an encodeable object of the given encodeable type. More... | |
SOPC_ReturnStatus | SOPC_EncodeableObject_Create (SOPC_EncodeableType *encTyp, void **encObject) |
Instantiate and initialize an encodeable object of the given encodeable type. More... | |
SOPC_ReturnStatus | SOPC_EncodeableObject_Delete (SOPC_EncodeableType *encTyp, void **encObject) |
Clear and deallocate an encodeable object of the given encodeable type. More... | |
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. More... | |
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. More... | |
SOPC_ReturnStatus | SOPC_EncodeableObject_Copy (SOPC_EncodeableType *type, void *destValue, const void *srcValue) |
Copy an encodeable object of the given encodeable type. More... | |
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 . Both parameters shall be EncodeableObject with same SOPC_EncodeableType. More... | |
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. More... | |
EncodeableType and services on encodeable object.
An SOPC_EncodeableType is the description uniquely identified OPC UA type which is composed of an ordered list of type fields which can be either SOPC_EncodeableType or OPC UA built-in types (see sopc_builtintypes.h).
An instance of an SOPC_EncodeableType type is a C structure which contains as first field a pointer to its SOPC_EncodeableType and then the fields of expected types described by its SOPC_EncodeableType (see sopc_types.h, e.g. OpcUa_ReadRequest is the C structure instance of encodeable type OpcUa_ReadRequest_EncodeableType).
An encodeable object is either an instance of an OPC UA built-in type or an instance of an SOPC_EncodeableType. Each encodeable object has several services functions:
Encodeable object types are defined in sopc_builtintypes.h for built-in types and sopc_types.h for internally defined SOPC_EncodeableType types.
typedef void() SOPC_EncodeableObject_PfnInitialize(void *value) |
Initialization function generic signature for an encodeable object.
typedef void() SOPC_EncodeableObject_PfnClear(void *value) |
Clear function generic signature for an encodeable object.
typedef SOPC_ReturnStatus() SOPC_EncodeableObject_PfnEncode(const void *value, SOPC_Buffer *buffer, uint32_t nestedStructLevel) |
Encoding function generic signature for an encodeable object *.
value | The encodeable object instance to encode into buffer . it might be either of encodeable type object with SOPC_EncodeableType* as first field or a built-in type object. |
buffer | The buffer in which the encodeable object will be encoded |
nestedStructLevel | The number of structure levels encoded until then |
typedef SOPC_ReturnStatus() SOPC_EncodeableObject_PfnDecode(void *value, SOPC_Buffer *msgBuffer, uint32_t nestedStructLevel) |
Decoding function generic signature for an encodeable object.
value | The encodeable object instance in which buffer will be decoded, it might be either of encodeable type object with SOPC_EncodeableType* as first field or a built-in type object. |
buffer | The buffer to decode to fill the encodeable object content |
nestedStructLevel | The number of structure levels decoded until then |
typedef SOPC_ReturnStatus() SOPC_EncodeableObject_PfnCopy(void *dest, const void *src) |
Copy function generic signature for an encodeable object.
dest | The encodeable object instance in which copy will be done It shall be either an encodeable type object with SOPC_EncodeableType* as first field or a built-in type object. |
src | The encodeable object instance copied into dest . It shall be either an encodeable type object with SOPC_EncodeableType* as first field or a built-in type object. |
typedef SOPC_ReturnStatus() SOPC_EncodeableObject_PfnComp(const void *left, const void *right, int32_t *comp) |
Compare function generic signature for an encodeable object.
left | The left operand encodeable object instance to be compared. It shall be either an encodeable type object with SOPC_EncodeableType* as first field or a built-in type object. | |
right | The right operand encodeable object instance to be compared. It shall be either an encodeable type object with SOPC_EncodeableType* as first field or a built-in type object. | |
[out] | comp | Pointer to an integer that will store the comparison result when returned status is SOPC_STATUS_OK. In this latter case:
|
typedef const struct SOPC_EncodeableType_Struct SOPC_EncodeableType |
Encodeable object type structure definition. It provides all the services functions associated with the encodeable object for encoding needs.
The namespaceTypeArray
is the internal namespace types array for the current encodeable type.
SOPC_ReturnStatus SOPC_EncodeableType_AddUserType | ( | SOPC_EncodeableType * | encoder | ) |
Registers a user-defined encodeable type. further calls to SOPC_EncodeableType_GetEncodeableType will successfully identify the registered encodeable type.
encoder | The encoder definition to register |
SOPC_ReturnStatus SOPC_EncodeableType_RemoveUserType | ( | SOPC_EncodeableType * | encoder | ) |
Removes a user-defined encodeable type previously created by SOPC_EncodeableType_AddUserType.
encoder | The encoder definition to register |
SOPC_EncodeableType* SOPC_EncodeableType_GetUserType | ( | uint16_t | nsIndex, |
uint32_t | typeId | ||
) |
Retrieve a user-defined encodeable type with the given type Id.
nsIndex | Namespace index of the typeId |
typeId | Type identifier for which corresponding encodeable type must be returned |
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-defined type.
nsIndex | Namespace index of the typeId |
typeId | Type identifier for which corresponding encodeable type must be returned |
const char* SOPC_EncodeableType_GetName | ( | SOPC_EncodeableType * | encType | ) |
Get the name of the given encodeable type.
encType | The encodeable type for which name is requested |
void SOPC_EncodeableObject_Initialize | ( | SOPC_EncodeableType * | type, |
void * | pValue | ||
) |
Initialize an encodeable object of the given encodeable type.
type | The encodeable type of the object instance to initialize. |
pValue | An object instance of the appropriate encodeable type. It shall at least have allocation size described in the encodeable type and is expected to be the C structure corresponding to an instance of the encodeable type (The first field of the structure shall be a SOPC_EncodeableType* which value will be set to type . The following fields shall have types described by type ) |
void SOPC_EncodeableObject_Clear | ( | SOPC_EncodeableType * | type, |
void * | pValue | ||
) |
Clear an encodeable object of the given encodeable type.
type | The encodeable type of the object instance to clear. |
pValue | An object instance of the appropriate encodeable type. It shall at least have allocation size described in the encodeable type and is expected to be the C structure corresponding to an instance of the encodeable type (The first field of the structure shall be a SOPC_EncodeableType* which value shall be type . The following fields shall have types described by type ) |
SOPC_ReturnStatus SOPC_EncodeableObject_Create | ( | SOPC_EncodeableType * | encTyp, |
void ** | encObject | ||
) |
Instantiate and initialize an encodeable object of the given encodeable type.
encTyp | Encodeable type of the encodeable object to instantiate and initialize |
encObject | Pointer to be set with the address of the newly created encodeable object |
SOPC_ReturnStatus SOPC_EncodeableObject_Delete | ( | SOPC_EncodeableType * | encTyp, |
void ** | encObject | ||
) |
Clear and deallocate an encodeable object of the given encodeable type.
encTyp | Encodeable type of the encodeable object to deallocate |
encObject | Pointer to the address of the encodeable object to delete (set to NULL if operation succeded) |
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.
type | The encodeable type of the object instance to encode. |
pValue | The object instance of the appropriate encodeable type to encode. It shall at least have allocation size described in the encodeable type and shall be the C structure corresponding to an instance of the encodeable type (The first field of the structure shall be a SOPC_EncodeableType* which value shall be type . The following fields shall have types described by type ) |
buf | The buffer in which the encodeable object will be encoded |
nestedStructLevel | The number of structure levels encoded until then. Value 0 shall be used for first call. |
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.
type | The encodeable type of the object instance to decode. |
pValue | An initialized object instance of the appropriate encodeable type to decode. It shall at least have allocation size described in the encodeable type and shall be the C structure corresponding to an instance of the encodeable type (The first field of the structure shall be a SOPC_EncodeableType* which value shall be type . The following fields shall have types described by type ) |
buf | The buffer to decode to fill the encodeable object content |
nestedStructLevel | The number of structure levels decoded until then Value 0 shall be used for first call. |
SOPC_ReturnStatus SOPC_EncodeableObject_Copy | ( | SOPC_EncodeableType * | type, |
void * | destValue, | ||
const void * | srcValue | ||
) |
Copy an encodeable object of the given encodeable type.
type | The encodeableType of destValue and srcValue . |
destValue | The destination encodeable object instance of the given encodeable type in which the content copy will be done. It shall have been initialized SOPC_EncodeableObject_Initialize and cleared SOPC_EncodeableObject_Clear if necessary with type as encodeable type. |
srcValue | The source encodeable object instance of the given encodeable type from which the content copy will be done. It shall at least have allocation size described in the encodeable type and shall be the C structure corresponding to an instance of the encodeable type (The first field of the structure shall be a SOPC_EncodeableType* which value shall be type . The following fields shall have types described by type ) |
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
. Both parameters shall be EncodeableObject with same SOPC_EncodeableType.
destObj | Empty and initialized encodeable object in which content of srcObj will be copied. |
srcObj | Source encodeable object from which content will be copied into destObj and then reset. |
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.
type | The encodeableType of leftValue and rightValue . | |
leftValue | The left encodeable object of the given encodeable type operand to compare. It shall at least have allocation size described in the encodeable type and shall be the C structure corresponding to an instance of the encodeable type (The first field of the structure shall be a SOPC_EncodeableType* which value shall be type . The following fields shall have types described by type ) | |
rightValue | The right encodeable object of the given encodeable type operand to compare. It shall at least have allocation size described in the encodeable type and shall be the C structure corresponding to an instance of the encodeable type (The first field of the structure shall be a SOPC_EncodeableType* which value shall be type . The following fields shall have types described by type ) | |
[out] | comp | Pointer to an integer that will store the comparison result when returned status is SOPC_STATUS_OK. In this latter case:
|