Browse Source

refactored UA_VTable.Id to UA_VTable.ns0Id

Leon Urbas 11 years ago
parent
commit
bc39ea00a6
3 changed files with 16 additions and 16 deletions
  1. 4 4
      include/ua_basictypes.h
  2. 11 11
      src/ua_basictypes.c
  3. 1 1
      src/ua_services_attribute.c

+ 4 - 4
include/ua_basictypes.h

@@ -75,9 +75,9 @@ UA_Int32 UA_memcpy(void *dst, void const *src, int size);
 UA_Int32 _UA_alloc(void ** dst, int size,char*,char*,char*,int);
 UA_Int32 _UA_alloc(void ** dst, int size,char*,char*,char*,int);
 
 
 /* Array operations */
 /* Array operations */
-UA_Int32 UA_Array_calcSize(UA_Int32 noElements, UA_Int32 type, void const ** const ptr);
-UA_Int32 UA_Array_encodeBinary(void const **src, UA_Int32 noElements, UA_Int32 type, UA_Int32* pos, UA_ByteString * dst);
-UA_Int32 UA_Array_decodeBinary(UA_ByteString const * src,UA_Int32 noElements, UA_Int32 type, UA_Int32* pos, void ** const dst);
+UA_Int32 UA_Array_calcSize(UA_Int32 noElements, UA_Int32 type, void const * const * ptr);
+UA_Int32 UA_Array_encodeBinary(void const * const *src, UA_Int32 noElements, UA_Int32 type, UA_Int32* pos, UA_ByteString * dst);
+UA_Int32 UA_Array_decodeBinary(UA_ByteString const * src,UA_Int32 noElements, UA_Int32 type, UA_Int32* pos, void ** dst);
 UA_Int32 UA_Array_delete(void **p,UA_Int32 noElements, UA_Int32 type);
 UA_Int32 UA_Array_delete(void **p,UA_Int32 noElements, UA_Int32 type);
 UA_Int32 UA_Array_init(void **p,UA_Int32 noElements, UA_Int32 type);
 UA_Int32 UA_Array_init(void **p,UA_Int32 noElements, UA_Int32 type);
 UA_Int32 UA_Array_new(void **p,UA_Int32 noElements, UA_Int32 type);
 UA_Int32 UA_Array_new(void **p,UA_Int32 noElements, UA_Int32 type);
@@ -188,7 +188,7 @@ typedef float UA_IntegerId;
 UA_TYPE_METHOD_PROTOTYPES (UA_IntegerId)
 UA_TYPE_METHOD_PROTOTYPES (UA_IntegerId)
 
 
 typedef struct T_UA_VTable {
 typedef struct T_UA_VTable {
-	UA_UInt32 Id;
+	UA_UInt32 ns0Id;
 	UA_Int32 (*calcSize)(void const * ptr);
 	UA_Int32 (*calcSize)(void const * ptr);
 	UA_Int32 (*decodeBinary)(UA_ByteString const * src, UA_Int32* pos, void* dst);
 	UA_Int32 (*decodeBinary)(UA_ByteString const * src, UA_Int32* pos, void* dst);
 	UA_Int32 (*encodeBinary)(void const * src, UA_Int32* pos, UA_ByteString* dst);
 	UA_Int32 (*encodeBinary)(void const * src, UA_Int32* pos, UA_ByteString* dst);

+ 11 - 11
src/ua_basictypes.c

@@ -6,19 +6,19 @@
 #include "opcua.h"
 #include "opcua.h"
 #include "ua_basictypes.h"
 #include "ua_basictypes.h"
 
 
-UA_Int32 UA_encodeBinary(void* const data, UA_Int32 *pos, UA_Int32 type, UA_ByteString* dst) {
+UA_Int32 UA_encodeBinary(void const * data, UA_Int32 *pos, UA_Int32 type, UA_ByteString* dst) {
 	return UA_[type].encodeBinary(data,pos,dst);
 	return UA_[type].encodeBinary(data,pos,dst);
 }
 }
 
 
-UA_Int32 UA_decodeBinary(UA_ByteString* const data, UA_Int32* pos, UA_Int32 type, void* dst){
+UA_Int32 UA_decodeBinary(UA_ByteString const * data, UA_Int32* pos, UA_Int32 type, void* dst){
 	return UA_[type].decodeBinary(data,pos,dst);
 	return UA_[type].decodeBinary(data,pos,dst);
 }
 }
 
 
-UA_Int32 UA_calcSize(void* const data, UA_UInt32 type) {
+UA_Int32 UA_calcSize(void const * data, UA_UInt32 type) {
 	return (UA_[type].calcSize)(data);
 	return (UA_[type].calcSize)(data);
 }
 }
 
 
-UA_Int32 UA_Array_calcSize(UA_Int32 nElements, UA_Int32 type, void const ** const data) {
+UA_Int32 UA_Array_calcSize(UA_Int32 nElements, UA_Int32 type, void const * const * data) {
 	int length = sizeof(UA_Int32);
 	int length = sizeof(UA_Int32);
 	int i;
 	int i;
 
 
@@ -30,7 +30,7 @@ UA_Int32 UA_Array_calcSize(UA_Int32 nElements, UA_Int32 type, void const ** cons
 	return length;
 	return length;
 }
 }
 
 
-UA_Int32 UA_Array_encodeBinary(void const **src, UA_Int32 noElements, UA_Int32 type, UA_Int32* pos, UA_ByteString* dst) {
+UA_Int32 UA_Array_encodeBinary(void const * const *src, UA_Int32 noElements, UA_Int32 type, UA_Int32* pos, UA_ByteString* dst) {
 	UA_Int32 retval = UA_SUCCESS;
 	UA_Int32 retval = UA_SUCCESS;
 	UA_Int32 i = 0;
 	UA_Int32 i = 0;
 
 
@@ -42,7 +42,7 @@ UA_Int32 UA_Array_encodeBinary(void const **src, UA_Int32 noElements, UA_Int32 t
 	return retval;
 	return retval;
 }
 }
 
 
-UA_Int32 UA_Array_decodeBinary(UA_ByteString const * src, UA_Int32 noElements, UA_Int32 type, UA_Int32* pos, void ** const dst) {
+UA_Int32 UA_Array_decodeBinary(UA_ByteString const * src, UA_Int32 noElements, UA_Int32 type, UA_Int32* pos, void ** dst) {
 	UA_Int32 retval = UA_SUCCESS;
 	UA_Int32 retval = UA_SUCCESS;
 	UA_Int32 i = 0;
 	UA_Int32 i = 0;
 
 
@@ -1254,7 +1254,7 @@ UA_Int32 UA_Variant_calcSize(UA_Variant const * p) {
 	UA_Boolean hasDimensions = p->encodingMask & (0x01 << 6); // Bit 6
 	UA_Boolean hasDimensions = p->encodingMask & (0x01 << 6); // Bit 6
 	int i;
 	int i;
 
 
-	if (p->vt == UA_NULL || ns0Id != p->vt->Id) {
+	if (p->vt == UA_NULL || ns0Id != p->vt->ns0Id) {
 		return UA_ERR_INCONSISTENT;
 		return UA_ERR_INCONSISTENT;
 	}
 	}
 	length += sizeof(UA_Byte); //p->encodingMask
 	length += sizeof(UA_Byte); //p->encodingMask
@@ -1272,7 +1272,7 @@ UA_Int32 UA_Variant_calcSize(UA_Variant const * p) {
 		}
 		}
 	} else { //single value to encode
 	} else { //single value to encode
 		if (p->data == UA_NULL) {
 		if (p->data == UA_NULL) {
-			if (p->vt->Id != UA_INVALIDTYPE_NS0) {
+			if (p->vt->ns0Id != UA_INVALIDTYPE_NS0) {
 				length += p->vt->calcSize(UA_NULL);
 				length += p->vt->calcSize(UA_NULL);
 			} else {
 			} else {
 				length += 0;
 				length += 0;
@@ -1289,7 +1289,7 @@ UA_Int32 UA_Variant_calcSize(UA_Variant const * p) {
 UA_TYPE_START_ENCODEBINARY(UA_Variant)
 UA_TYPE_START_ENCODEBINARY(UA_Variant)
 	int i = 0;
 	int i = 0;
 
 
-	if (src->vt == UA_NULL || ( src->encodingMask & UA_VARIANT_ENCODINGMASKTYPE_TYPEID_MASK) != src->vt->Id) {
+	if (src->vt == UA_NULL || ( src->encodingMask & UA_VARIANT_ENCODINGMASKTYPE_TYPEID_MASK) != src->vt->ns0Id) {
 		return UA_ERR_INCONSISTENT;
 		return UA_ERR_INCONSISTENT;
 	}
 	}
 
 
@@ -1304,7 +1304,7 @@ UA_TYPE_START_ENCODEBINARY(UA_Variant)
 		}
 		}
 	} else {
 	} else {
 		if (src->data == UA_NULL) {
 		if (src->data == UA_NULL) {
-			if (src->vt->Id == UA_INVALIDTYPE_NS0) {
+			if (src->vt->ns0Id == UA_INVALIDTYPE_NS0) {
 				retval = UA_SUCCESS;
 				retval = UA_SUCCESS;
 			} else {
 			} else {
 				retval = UA_ERR_NO_MEMORY;
 				retval = UA_ERR_NO_MEMORY;
@@ -1359,7 +1359,7 @@ UA_Int32 UA_Variant_decodeBinary(UA_ByteString const * src, UA_Int32 *pos, UA_Va
 UA_TYPE_METHOD_DELETE_STRUCT(UA_Variant)
 UA_TYPE_METHOD_DELETE_STRUCT(UA_Variant)
 UA_Int32 UA_Variant_deleteMembers(UA_Variant  * p) {
 UA_Int32 UA_Variant_deleteMembers(UA_Variant  * p) {
 	UA_Int32 retval = UA_SUCCESS;
 	UA_Int32 retval = UA_SUCCESS;
-	retval |= UA_Array_delete(p->data,p->arrayLength,UA_toIndex(p->vt->Id));
+	retval |= UA_Array_delete(p->data,p->arrayLength,UA_toIndex(p->vt->ns0Id));
 	return retval;
 	return retval;
 }
 }
 UA_Int32 UA_Variant_init(UA_Variant * p){
 UA_Int32 UA_Variant_init(UA_Variant * p){

+ 1 - 1
src/ua_services_attribute.c

@@ -120,7 +120,7 @@ static UA_DataValue * service_read_node(Application *app, const UA_ReadValueId *
 		// FIXME: mockup code - we know that for 2255 we simply need to copy the array
 		// FIXME: mockup code - we know that for 2255 we simply need to copy the array
 		if (node->nodeId.identifier.numeric == 2255) {
 		if (node->nodeId.identifier.numeric == 2255) {
 			v->value = vn->value;
 			v->value = vn->value;
-			UA_Array_copy((void const*const*)&(vn->value.data),vn->value.arrayLength,UA_toIndex(vn->value.vt->Id),(void**)&(v->value.data));
+			UA_Array_copy((void const*const*)&(vn->value.data),vn->value.arrayLength,UA_toIndex(vn->value.vt->ns0Id),(void**)&(v->value.data));
 		} else {
 		} else {
 			v->encodingMask = UA_DATAVALUE_ENCODINGMASK_STATUSCODE;
 			v->encodingMask = UA_DATAVALUE_ENCODINGMASK_STATUSCODE;
 			v->status = UA_STATUSCODE_BADNOTREADABLE;
 			v->status = UA_STATUSCODE_BADNOTREADABLE;