Exemplo n.º 1
0
JausBoolean jausByteFromBuffer(JausByte *jByte, unsigned char *buf, unsigned int bufferSizeBytes)
{
	if(bufferSizeBytes < JAUS_BYTE_SIZE_BYTES)
	{
		return JAUS_FALSE; // not enough data in buffer
	}
	else
	{
		*jByte = newJausByte((unsigned char)buf[0]);
		return JAUS_TRUE;
	}	
}
Exemplo n.º 2
0
JausByte jausByteFromDouble(double value, double min, double max)
{
	// BUG: What to do when max < min
	double scaleFactor = (max-min)/JAUS_BYTE_RANGE;
	double bias = min;
	
	// limit real number between min and max
	if(value < min) value = min;
	if(value > max) value = max;
		
	// return rounded integer value
	return newJausByte((unsigned char)((value - bias)/scaleFactor + 0.5));
}
// JausWorldModelFeatureClassAttribute Constructor
JausWorldModelFeatureClassAttribute featureClassAttributeCreate(void)
{
	JausWorldModelFeatureClassAttribute attribute;
	attribute = (JausWorldModelFeatureClassAttribute) malloc(sizeof(JausWorldModelFeatureClassAttributeStruct));
	if(attribute)
	{
		memset(attribute, 0, sizeof(JausWorldModelFeatureClassAttributeStruct));
		attribute->dataType = newJausByte(JAUS_WM_OBJECT_DEFAULT_DATA);
		return attribute;
	}
	else
	{
		return NULL;
	}
}