Skip to content

Commit

Permalink
Add code to create attributes of all numeric data types for testing
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkRivers committed Nov 14, 2024
1 parent 9d01565 commit b675fb4
Showing 1 changed file with 111 additions and 1 deletion.
112 changes: 111 additions & 1 deletion ADApp/ADSrc/myAttributeFunctions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,17 @@ typedef enum {
functE,
functTen,
functGettysburg,
functTime64
functTime64,
functInt8,
functUInt8,
functInt16,
functUInt16,
functInt32,
functUInt32,
functInt64,
functUInt64,
functFloat32,
functFloat64
} myFunct_t;

static int myAttrFunct1(const char *paramString, void **functionPvt, functAttribute *pAttribute)
Expand Down Expand Up @@ -55,6 +65,46 @@ static int myAttrFunct1(const char *paramString, void **functionPvt, functAttrib
pAttribute->setDataType(NDAttrUInt64);
*paramIndex = functTime64;
}
else if (!strcmp(paramString, "INT8")) {
pAttribute->setDataType(NDAttrInt8);
*paramIndex = functInt8;
}
else if (!strcmp(paramString, "UINT8")) {
pAttribute->setDataType(NDAttrUInt8);
*paramIndex = functUInt8;
}
else if (!strcmp(paramString, "INT16")) {
pAttribute->setDataType(NDAttrInt16);
*paramIndex = functInt16;
}
else if (!strcmp(paramString, "UINT16")) {
pAttribute->setDataType(NDAttrUInt16);
*paramIndex = functUInt16;
}
else if (!strcmp(paramString, "INT32")) {
pAttribute->setDataType(NDAttrInt32);
*paramIndex = functInt32;
}
else if (!strcmp(paramString, "UINT32")) {
pAttribute->setDataType(NDAttrUInt32);
*paramIndex = functUInt32;
}
else if (!strcmp(paramString, "INT64")) {
pAttribute->setDataType(NDAttrInt64);
*paramIndex = functInt64;
}
else if (!strcmp(paramString, "UINT64")) {
pAttribute->setDataType(NDAttrUInt64);
*paramIndex = functUInt64;
}
else if (!strcmp(paramString, "FLOAT32")) {
pAttribute->setDataType(NDAttrFloat32);
*paramIndex = functFloat32;
}
else if (!strcmp(paramString, "FLOAT64")) {
pAttribute->setDataType(NDAttrFloat64);
*paramIndex = functFloat64;
}
else {
printf("Error, unknown parameter string = %s\n", paramString);
free(paramIndex);
Expand Down Expand Up @@ -90,6 +140,66 @@ static int myAttrFunct1(const char *paramString, void **functionPvt, functAttrib
break;
}

case functInt8: {
epicsInt8 val=-8;
pAttribute->setValue(&val);
break;
}

case functUInt8: {
epicsUInt8 val=8;
pAttribute->setValue(&val);
break;
}

case functInt16: {
epicsInt16 val=-16;
pAttribute->setValue(&val);
break;
}

case functUInt16: {
epicsUInt16 val=16;
pAttribute->setValue(&val);
break;
}

case functInt32: {
epicsInt32 val=-32;
pAttribute->setValue(&val);
break;
}

case functUInt32: {
epicsUInt32 val=32;
pAttribute->setValue(&val);
break;
}

case functInt64: {
epicsInt64 val=-64;
pAttribute->setValue(&val);
break;
}

case functUInt64: {
epicsUInt64 val=64;
pAttribute->setValue(&val);
break;
}

case functFloat32: {
epicsFloat32 val=32.0;
pAttribute->setValue(&val);
break;
}

case functFloat64: {
epicsFloat64 val=64.0;
pAttribute->setValue(&val);
break;
}

default:
return ND_ERROR;
}
Expand Down

0 comments on commit b675fb4

Please sign in to comment.