Chapter 6
NI-FBUS Function Reference
NI-FBUS Hardware and Software User Manual
6-42
ni.com
For example, the following fragment of pseudocode gets the type information for a variable
list object and does something with the type information for each variable:
nifObjTypeList_t typeInfo, varTypeInfo;
nifDesc_t aiBlock;
int loop;
...
nifGetObjectType(aiBlock, "VIEW_1", &typeInfo);
if (typeinfo.objectCode == ODT_VARLIST)
{
for (loop=0; loop < typeInfo.numElems; loop++)
{
nifGetObjectType(aiBlock,
NIFB_INDEX(typeInfo.allElems[loop].objTypeIndex),
&varTypeInfo);
doSomethingWithVariable(varTypeInfo);
}
}
For all successful calls to
nifGetObjectType
, you must call
nifFreeObjectType
to
clean up memory allocated within these structures.
For objects with the object codes
ODT_DOMAIN
,
ODT_PI
,
ODT_EVENT
, and
ODT_SIMPLETYPE
, only the object type is returned, and the list of elements
allElems
in the
structure
nifObjTypeList_t
is empty. The list of standard data types for an object which
has the object code
ODT_SIMPLETYPE
also is as specified in the
FMS Specifications
section
of the
Fieldbus Foundation Specifications
document.
Table 6-4.
Object Codes for the
nifObjTypeList_t
Data Structure
Data Type
objTypeIndex
in
fbtypes.h
Number of Octets (Size)
Boolean
FF_BOOLEAN
1
Integer8
FF_INTEGER8
1
Integer16
FF_INTEGER16
2
Integer32
FF_INTEGER32
4
Unsigned8
FF_UNSIGNED8
1
Unsigned16
FF_UNSIGNED16
2
Unsigned32
FF_UNSIGNED32
4
Floating Point
FF_FLOAT
4