| 1 |
/*========================== begin_copyright_notice ============================ |
| 2 |
|
| 3 |
Copyright (C) 2017-2021 Intel Corporation |
| 4 |
|
| 5 |
SPDX-License-Identifier: MIT |
| 6 |
|
| 7 |
============================= end_copyright_notice ===========================*/ |
| 8 |
|
| 9 |
#ifndef GED_POSITION_INTERPRETER_H |
| 10 |
#define GED_POSITION_INTERPRETER_H |
| 11 |
|
| 12 |
#include "common/ged_ins_decoding_table.h" |
| 13 |
#include "xcoder/ged_ins.h" |
| 14 |
|
| 15 |
|
| 16 |
class GEDInterpreter |
| 17 |
{ |
| 18 |
public: |
| 19 |
// STATIC FUNCTIONS |
| 20 |
|
| 21 |
inline static uint32_t InterpretPositionRaw(uint32_t value, /* GED_PSEUDO_FIELD */ const uint32_t interpId, |
| 22 |
const /* GED_MODEL */ uint8_t modelId, GED_RETURN_VALUE& ret) |
| 23 |
{ return (uint32_t)InterpretPositionInternal(value, interpId, modelId, GED_VALUE_TYPE_ENCODED, ret); } |
| 24 |
|
| 25 |
|
| 26 |
inline static uint32_t InterpretPosition(uint32_t value, /* GED_PSEUDO_FIELD */ const uint32_t interpId, |
| 27 |
const /* GED_MODEL */ uint8_t modelId, GED_RETURN_VALUE& ret) |
| 28 |
{ return (uint32_t)InterpretPositionInternal(value, interpId, modelId, GED_VALUE_TYPE_PROCESSED, ret); } |
| 29 |
|
| 30 |
inline static uint64_t InterpretPosition(uint64_t value, /* GED_PSEUDO_FIELD */ const uint32_t interpId, |
| 31 |
const /* GED_MODEL */ uint8_t modelId, GED_RETURN_VALUE& ret) |
| 32 |
{ return InterpretPositionInternal(value, interpId, modelId, GED_VALUE_TYPE_PROCESSED, ret); } |
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
static uint32_t ReinterpretEnum(uint32_t value, /* GED_REINTERPRETED_ENUM */ const uint32_t interpId, |
| 37 |
const /* GED_MODEL */ uint8_t modelId, GED_RETURN_VALUE& ret); |
| 38 |
|
| 39 |
|
| 40 |
static uint32_t CollectFields(GEDIns& ins, /* GED_COLLECTOR */ const uint32_t interpId, GED_RETURN_VALUE& ret); |
| 41 |
|
| 42 |
|
| 43 |
inline static GED_RETURN_VALUE SetInterpretedPosition(uint32_t& writeTo, /* GED_PSEUDO_FIELD */ const uint32_t interpId, |
| 44 |
const /* GED_MODEL */ uint8_t modelId, uint32_t valueToWrite) |
| 45 |
{ |
| 46 |
uint64_t writeTo64 = writeTo, valueToWrite64 = valueToWrite; |
| 47 |
GED_RETURN_VALUE rv = SetInterpretedPositionInternal(writeTo64, interpId, modelId, GED_VALUE_TYPE_PROCESSED, valueToWrite64); |
| 48 |
writeTo = (uint32_t)writeTo64; |
| 49 |
return rv; |
| 50 |
} |
| 51 |
|
| 52 |
inline static GED_RETURN_VALUE SetInterpretedPosition(uint64_t& writeTo, /* GED_PSEUDO_FIELD */ const uint32_t interpId, |
| 53 |
const /* GED_MODEL */ uint8_t modelId, uint64_t valueToWrite) |
| 54 |
{ |
| 55 |
return SetInterpretedPositionInternal(writeTo, interpId, modelId, GED_VALUE_TYPE_PROCESSED, valueToWrite); |
| 56 |
} |
| 57 |
|
| 58 |
private: |
| 59 |
// PRIVATE MEMBER FUNCTIONS |
| 60 |
|
| 61 |
static uint64_t InterpretPositionInternal(uint64_t value, /* GED_PSEUDO_FIELD */ const uint32_t interpId, |
| 62 |
const /* GED_MODEL */ uint8_t modelId, const GED_VALUE_TYPE valueType, |
| 63 |
GED_RETURN_VALUE& ret); |
| 64 |
|
| 65 |
static GED_RETURN_VALUE SetInterpretedPositionInternal(uint64_t& writeTo, /* GED_PSEUDO_FIELD */ const uint32_t interpId, |
| 66 |
const /* GED_MODEL */ uint8_t modelId, const GED_VALUE_TYPE valueType, |
| 67 |
uint64_t valueToWrite); |
| 68 |
}; |
| 69 |
|
| 70 |
#endif // GED_POSITION_INTERPRETER_H |