151 lines
3.4 KiB
C++
151 lines
3.4 KiB
C++
// **************************************************************************
|
|
//
|
|
// (C) Copyright 2009 Swiss SIMTEC AG
|
|
//
|
|
// **************************************************************************
|
|
//
|
|
// $HeadURL$
|
|
// $LastChangedBy$
|
|
// $LastChangedDate$
|
|
// $LastChangedRevision$
|
|
//
|
|
// **************************************************************************
|
|
|
|
#pragma once
|
|
|
|
#include "LogViewXdrElement.hpp"
|
|
|
|
namespace N_LogView
|
|
{
|
|
/**
|
|
* This class represents the standardtypes like int, char, ...
|
|
* It holds the the size of this type and its representation to user
|
|
* (signed/unsigned value or character)
|
|
*
|
|
* @author alois.wismer
|
|
* @version 1.0
|
|
* @created 16-Feb-2010 14:22:20
|
|
*/
|
|
class LogViewXdrStandardType final : public LogViewXdrElement
|
|
{
|
|
public:
|
|
|
|
/**
|
|
* @author alois.wismer
|
|
* @version 1.0
|
|
* @created 16-Feb-2010 14:34:38
|
|
*/
|
|
enum E_ValueKind
|
|
{
|
|
/**
|
|
* An unsigned 32-bit integer
|
|
*/
|
|
e_Unsigned,
|
|
/**
|
|
* An signed 32-bit integer
|
|
*/
|
|
e_Signed,
|
|
/**
|
|
* A floating-point number
|
|
*/
|
|
e_Float,
|
|
/**
|
|
* A character or string
|
|
*/
|
|
e_Character,
|
|
/**
|
|
* A boolean value
|
|
*/
|
|
e_Boolean,
|
|
/**
|
|
* Hex-Data "0000: F7 A5 07 ..."
|
|
*/
|
|
e_Data
|
|
};
|
|
|
|
/**
|
|
* @author alois.wismer
|
|
* @version 1.0
|
|
* @created 31-Mrz-2010 10:27:31
|
|
*/
|
|
enum E_ByteOrder
|
|
{
|
|
e_ByteOrderBigEndian,
|
|
e_ByteOrderLittleEndian
|
|
};
|
|
|
|
/**
|
|
* @author alois.wismer
|
|
* @version 1.0
|
|
* @created 29-Mrz-2010 13:58:44
|
|
*/
|
|
enum E_DynArraySizeMethod
|
|
{
|
|
/**
|
|
* Size of dyn array depends on message-size (size - m_DynArrayOffset) (or no dyn
|
|
* array)
|
|
* The value within <> in struct-element will be used for m_DynArrayOffset.
|
|
*/
|
|
e_DynArrayMsgLength,
|
|
/**
|
|
* Size of dyn array is defined by a field (StandardType must be Unsigned)
|
|
*/
|
|
e_DynArrayIndex,
|
|
/**
|
|
* Size of dyn array is defined by a field, which will be divided by 8 (used for
|
|
* bitfields) (StandardType must be Unsigned)
|
|
*/
|
|
e_DynArrayIndexDiv8
|
|
};
|
|
|
|
/**
|
|
* (a_valueKind must be Unsigned, if a_dynArraySizeMethod is e_DynArray...)
|
|
*
|
|
*/
|
|
LogViewXdrStandardType(const QString &a_name,
|
|
const int a_valueSize,
|
|
const int a_editSize,
|
|
const E_ValueKind a_valueKind,
|
|
const E_DynArraySizeMethod a_dynArraySizeMethod,
|
|
E_ByteOrder a_byteOrder);
|
|
|
|
|
|
uint16_t getValueSize() const;
|
|
|
|
|
|
LogViewXdrStandardType::E_ValueKind getValueKind() const;
|
|
|
|
|
|
void dump() const override;
|
|
|
|
|
|
LogViewXdrStandardType::E_DynArraySizeMethod getDynArraySizeMethod() const;
|
|
|
|
|
|
LogViewXdrStandardType::E_ByteOrder getByteOrder() const;
|
|
|
|
/**
|
|
* The 'real' size of the value, which will be allowd when editing this value
|
|
*/
|
|
uint16_t getEditSize() const;
|
|
|
|
protected:
|
|
|
|
/**
|
|
* The size of this value as stored data. It may be bigger as the real (edit) size.
|
|
*/
|
|
int m_ValueSize;
|
|
/**
|
|
* The 'real' size of the value, which will be allowd when editing this value
|
|
*/
|
|
int m_EditSize;
|
|
E_ValueKind m_ValueKind;
|
|
|
|
E_ByteOrder m_ByteOrder;
|
|
|
|
E_DynArraySizeMethod m_DynArraySizeMethod;
|
|
|
|
};
|
|
|
|
}
|