// JausWorldModelFeatureClassAttribute Constructor (from Buffer) JausWorldModelFeatureClassAttribute featureClassAttributeFromBuffer(unsigned char *buffer, unsigned int bufferSizeBytes) { unsigned int index = 0; JausWorldModelFeatureClassAttribute attribute; attribute = (JausWorldModelFeatureClassAttribute) malloc(sizeof(JausWorldModelFeatureClassAttributeStruct)); if(attribute) { // Data Type if(!jausByteFromBuffer(&attribute->dataType, buffer+index, bufferSizeBytes-index)) { free(attribute); return NULL; } index += JAUS_BYTE_SIZE_BYTES; switch(attribute->dataType) { case JAUS_WM_OBJECT_BYTE_DATA: if(!jausByteFromBuffer(&attribute->data.byteValue, buffer+index, bufferSizeBytes-index)) { free(attribute); return NULL; } return attribute; case JAUS_WM_OBJECT_SHORT_DATA: if(!jausShortFromBuffer(&attribute->data.shortValue, buffer+index, bufferSizeBytes-index)) { free(attribute); return NULL; } return attribute; case JAUS_WM_OBJECT_INTEGER_DATA: if(!jausIntegerFromBuffer(&attribute->data.integerValue, buffer+index, bufferSizeBytes-index)) { free(attribute); return NULL; } return attribute; case JAUS_WM_OBJECT_LONG_DATA: if(!jausLongFromBuffer(&attribute->data.longValue, buffer+index, bufferSizeBytes-index)) { free(attribute); return NULL; } return attribute; case JAUS_WM_OBJECT_UNSIGNED_SHORT_DATA: if(!jausUnsignedShortFromBuffer(&attribute->data.unsignedShortValue, buffer+index, bufferSizeBytes-index)) { free(attribute); return NULL; } return attribute; case JAUS_WM_OBJECT_UNSIGNED_INTEGER_DATA: if(!jausUnsignedIntegerFromBuffer(&attribute->data.unsignedIntegerValue, buffer+index, bufferSizeBytes-index)) { free(attribute); return NULL; } return attribute; case JAUS_WM_OBJECT_UNSIGNED_LONG_DATA: if(!jausUnsignedLongFromBuffer(&attribute->data.unsignedLongValue, buffer+index, bufferSizeBytes-index)) { free(attribute); return NULL; } return attribute; case JAUS_WM_OBJECT_FLOAT_DATA: if(!jausFloatFromBuffer(&attribute->data.floatValue, buffer+index, bufferSizeBytes-index)) { free(attribute); return NULL; } return attribute; case JAUS_WM_OBJECT_DOUBLE_DATA: if(!jausDoubleFromBuffer(&attribute->data.doubleValue, buffer+index, bufferSizeBytes-index)) { free(attribute); return NULL; } return attribute; break; case JAUS_WM_OBJECT_RGB_DATA: if(!jausByteFromBuffer(&attribute->data.rgb.redValue, buffer+index, bufferSizeBytes-index)) { free(attribute); return NULL; } index += JAUS_BYTE_SIZE_BYTES; if(!jausByteFromBuffer(&attribute->data.rgb.greenValue, buffer+index, bufferSizeBytes-index)) { free(attribute); return NULL; } index += JAUS_BYTE_SIZE_BYTES; if(!jausByteFromBuffer(&attribute->data.rgb.blueValue, buffer+index, bufferSizeBytes-index)) { free(attribute); return NULL; } index += JAUS_BYTE_SIZE_BYTES; return attribute; default: free(attribute); return NULL; } } else { return NULL; } }
// JausEventLimit Constructor (from Buffer) JausBoolean jausEventLimitFromBuffer(JausEventLimit *limitPointer, unsigned char *buffer, unsigned int bufferSizeBytes) { JausEventLimit limit; JausByte tempByte; int index = 0; limit = (JausEventLimit) malloc(sizeof(JausEventLimitStruct)); *limitPointer = limit; if(limit) { memset(limit, 0, sizeof(JausEventLimitStruct)); if(!jausByteFromBuffer(&tempByte, buffer+index, bufferSizeBytes-index)) { *limitPointer = NULL; return JAUS_FALSE; } limit->dataType = tempByte; index += JAUS_BYTE_SIZE_BYTES; switch(limit->dataType) { case EVENT_LIMIT_BYTE_TYPE: if(!jausByteFromBuffer(&limit->value.byteValue, buffer+index, bufferSizeBytes-index)) { *limitPointer = NULL; } break; case EVENT_LIMIT_SHORT_TYPE: if(!jausShortFromBuffer(&limit->value.shortValue, buffer+index, bufferSizeBytes-index)) { *limitPointer = NULL; } break; case EVENT_LIMIT_INTEGER_TYPE: if(!jausIntegerFromBuffer(&limit->value.integerValue, buffer+index, bufferSizeBytes-index)) { *limitPointer = NULL; } break; case EVENT_LIMIT_LONG_TYPE: if(!jausLongFromBuffer(&limit->value.longValue, buffer+index, bufferSizeBytes-index)) { *limitPointer = NULL; } break; case EVENT_LIMIT_UNSIGNED_SHORT_TYPE: if(!jausUnsignedShortFromBuffer(&limit->value.unsignedShortValue, buffer+index, bufferSizeBytes-index)) { *limitPointer = NULL; } break; case EVENT_LIMIT_UNSIGNED_INTEGER_TYPE: if(!jausUnsignedIntegerFromBuffer(&limit->value.unsignedIntegerValue, buffer+index, bufferSizeBytes-index)) { *limitPointer = NULL; } break; case EVENT_LIMIT_UNSIGNED_LONG_TYPE: if(!jausUnsignedLongFromBuffer(&limit->value.unsignedLongValue, buffer+index, bufferSizeBytes-index)) { *limitPointer = NULL; } break; case EVENT_LIMIT_FLOAT_TYPE: if(!jausFloatFromBuffer(&limit->value.floatValue, buffer+index, bufferSizeBytes-index)) { *limitPointer = NULL; } break; case EVENT_LIMIT_DOUBLE_TYPE: if(!jausDoubleFromBuffer(&limit->value.doubleValue, buffer+index, bufferSizeBytes-index)) { *limitPointer = NULL; } break; case EVENT_LIMIT_RGB_TYPE: if(!jausByteFromBuffer(&limit->value.rgb.redValue, buffer+index, bufferSizeBytes-index)) { *limitPointer = NULL; } index += JAUS_BYTE_SIZE_BYTES; if(!jausByteFromBuffer(&limit->value.rgb.greenValue, buffer+index, bufferSizeBytes-index)) { *limitPointer = NULL; } index += JAUS_BYTE_SIZE_BYTES; if(!jausByteFromBuffer(&limit->value.rgb.blueValue, buffer+index, bufferSizeBytes-index)) { *limitPointer = NULL; } index += JAUS_BYTE_SIZE_BYTES; break; default: *limitPointer = NULL; break; } } if(*limitPointer) { return JAUS_TRUE; } return JAUS_FALSE; }