/** * Pack a signed 32-bit int into the dashboard data structure. * @param value Data to be packed into the structure. */ void Dashboard::AddI32(INT32 value) { if (!ValidateAdd(sizeof(INT32))) return; memcpy(m_packPtr, (char*)&value, sizeof(value)); m_packPtr += sizeof(value); AddedElement(kI32); }
/** * Pack an unsigned 8-bit int into the dashboard data structure. * @param value Data to be packed into the structure. */ void Dashboard::AddU8(UINT8 value) { if (!ValidateAdd(sizeof(UINT8))) return; memcpy(m_packPtr, (char*)&value, sizeof(value)); m_packPtr += sizeof(value); AddedElement(kU8); }
/** * Pack a boolean into the dashboard data structure. * @param value Data to be packed into the structure. */ void Dashboard::AddBoolean(bool value) { if (!ValidateAdd(sizeof(char))) return; *m_packPtr = value ? 1 : 0; m_packPtr += sizeof(char); AddedElement(kBoolean); }
/** * Pack a 64-bit floating point number into the dashboard data structure. * @param value Data to be packed into the structure. */ void Dashboard::AddDouble(double value) { if (!ValidateAdd(sizeof(double))) return; memcpy(m_packPtr, (char*)&value, sizeof(value)); m_packPtr += sizeof(value); AddedElement(kDouble); }
/** * Pack a 32-bit floating point number into the dashboard data structure. * @param value Data to be packed into the structure. */ void Dashboard::AddFloat(float value) { if (!ValidateAdd(sizeof(float))) return; memcpy(m_packPtr, (char*)&value, sizeof(value)); m_packPtr += sizeof(value); AddedElement(kFloat); }
/** * Pack a signed 16-bit int into the dashboard data structure. * @param value Data to be packed into the structure. */ void Dashboard::AddI16(int16_t value) { if (!ValidateAdd(sizeof(int16_t))) return; memcpy(m_packPtr, (char*)&value, sizeof(value)); m_packPtr += sizeof(value); AddedElement(kI16); }
/** * Pack an unsigned 32-bit int into the dashboard data structure. * @param value Data to be packed into the structure. */ void Dashboard::AddU32(uint32_t value) { if (!ValidateAdd(sizeof(uint32_t))) return; memcpy(m_packPtr, (char*)&value, sizeof(value)); m_packPtr += sizeof(value); AddedElement(kU32); }
/** * Start an array in the packed dashboard data structure. * * After calling AddArray(), call the appropriate Add method for each element of the array. * Make sure you call the same add each time. An array must contain elements of the same type. * You can use clusters inside of arrays to make each element of the array contain a structure of values. * You can also nest arrays inside of other arrays. * Every call to AddArray() must have a matching call to FinalizeArray(). */ void Dashboard::AddArray() { if (!ValidateAdd(sizeof(INT32))) return; m_complexTypeStack.push(kArray); m_arrayElementCount.push_back(0); m_arraySizePtr.push_back((INT32*)m_packPtr); m_packPtr += sizeof(INT32); }
/** * Pack a string of 8-bit characters of specified length into the dashboard data structure. * @param value Data to be packed into the structure. * @param length The number of bytes in the string to pack. */ void Dashboard::AddString(char* value, INT32 length) { if (!ValidateAdd(length + sizeof(length))) return; memcpy(m_packPtr, (char*)&length, sizeof(length)); m_packPtr += sizeof(length); memcpy(m_packPtr, value, length); m_packPtr += length; AddedElement(kString); }