simplify xdr type mapping

This commit is contained in:
andreas 2023-10-24 16:19:00 +02:00
parent 0e10fcfee2
commit 4b3c6f13b4
1 changed files with 7 additions and 8 deletions

View File

@ -55,20 +55,19 @@ GwXDRType *types[] = {
new GwXDRType(GwXDRType::GENERIC, "G", ""),
new GwXDRType(GwXDRType::DISPLACEMENT, "A", "P"),
new GwXDRType(GwXDRType::DISPLACEMENTD, "A", "D",DegToRad,RadToDeg,"rd"),
new GwXDRType(GwXDRType::RPM,"T","R"),
//important to have 2x NULL!
NULL,
NULL};
new GwXDRType(GwXDRType::RPM,"T","R")
};
template<typename T, int size>
int GetArrLength(T(&)[size]){return size;}
static GwXDRType *findType(GwXDRType::TypeCode type, int *start = NULL)
{
int len=GetArrLength(types);
int from = 0;
if (start != NULL)
from = *start;
if (types[from] == NULL)
return NULL;
if (from < 0 || from >= len) return NULL;
int i = from;
for (; types[i] != NULL; i++)
for (; i< len; i++)
{
if (types[i]->code == type)
{