|
|
(3 intermediate revisions by the same user not shown) |
Line 1: |
Line 1: |
| == Examples of Generated Header Files ==
| | This document is now obsolete |
| | |
| May 25 2005
| |
| | |
| <center>
| |
| | |
| == Overview ==
| |
| | |
| </center>
| |
| | |
| | |
| Tools are provided to generate header files from the following dbd definitions:
| |
| *menu
| |
| *struct
| |
| *record
| |
| | |
| === menu example ===
| |
| | |
| <tt>menuAlarmSevr.dbd</tt> contains:
| |
| menu(menuAlarmSevr) {
| |
| choice(menuAlarmSevrNO_ALARM,"NO_ALARM")
| |
| choice(menuAlarmSevrMINOR,"MINOR")
| |
| choice(menuAlarmSevrMAJOR,"MAJOR")
| |
| choice(menuAlarmSevrINVALID,"INVALID")
| |
| }
| |
| | |
| <tt>menuAlarmSevr.h</tt> is generated from <tt>menuAlarmSevr.dbd</tt>
| |
| enum menuAlarmSevr {
| |
| menuAlarmSevrNO_ALARM,
| |
| menuAlarmSevrMINOR,
| |
| menuAlarmSevrMAJOR,
| |
| menuAlarmSevrINVALID
| |
| };
| |
| | |
| No interfaces, i.e. code, will be generated for menus.
| |
| | |
| === simple struct example ===
| |
| | |
| This is an example of a struct that only has fields with a known epicsType.
| |
| | |
| <tt>displayLimit.dbd</tt> contains:
| |
| struct(displayLimit) {
| |
| field(low,float64)
| |
| field(high,float64)
| |
| }
| |
| | |
| <tt>displayLimit.h</tt> is generated from <tt>displayLimit.dbd</tt>
| |
| class displayLimit {
| |
| public:
| |
| epicsFloat64 low;
| |
| epicsFloat64 high;
| |
| };
| |
| const epicsInt16 displayLimit_firstIndex = 1
| |
| const epicsInt16 displayLimit_low = 1
| |
| const epicsInt16 displayLimit_high = 2
| |
| const epicsInt16 displayLimit_lastIndex =displayLimit_high
| |
| | |
| In addition an implementation of interface EpicsStructLifetime will be generated.
| |
| | |
| === simple record example ===
| |
| | |
| This is an example of a record that only has fields with a known epicsType. | |
| | |
| <tt>exampleRecord.dbd</tt> contains:
| |
| record(example) extends iocRecord {
| |
| field(value,float64)
| |
| field(displayLimit,struct(displayLimit))
| |
| field(info,string)
| |
| field(arr,array(double[]))
| |
| }
| |
| | |
| <tt>exampleRecord.h</tt> is generated from <tt>exampleRecord.dbd</tt>
| |
| class exampleRecord : public iocRecord{
| |
| public:
| |
| epicsFloat64 value;
| |
| EpicsStruct displayLimit;
| |
| EpicsString info;
| |
| EpicaArray arr;
| |
|
| |
| private:
| |
| void *recordSupportPvt;
| |
| };
| |
|
| |
| const epicsInt16 example_firstIndex = 1001001
| |
| const epicsInt16 example_value = 1001001;
| |
| const epicsInt16 example_displayLimit = 1001002;
| |
| const epicsInt16 example_info = 1001003;
| |
| const epicsInt16 example_arr = 1001004;
| |
| const epicsInt16 example_lastIndex = example_arr;
| |
| | |
| In addition an implementation of interface StructDbdLifetime
| |
| will be generated.
| |
| | |
| Code that implements interface RecordDbdSupport must be created.
| |
| | |
| === record with link, and device ===
| |
| | |
| Assume that the following has been defined:
| |
| struct(vmeLink) {
| |
| field(card,uint16)
| |
| field(signal,uint16)
| |
| field(parm,string)
| |
| }
| |
| device(in,analogIO,SomeVMEdevice,vmeLink)
| |
| | |
| <tt>ioRecord.dbd</tt> contains:
| |
| | |
| record(io) extends iocRecord {
| |
| field(out, device(out,analogIO))
| |
| field(desiredOutputLink, link(in))
| |
| }
| |
| <tt>ioRecord.h</tt> is generated from <tt>ioRecord.dbd</tt>
| |
| class ioRecord : public iocRecord{
| |
| public:
| |
| DbfDevice out;
| |
| DbfLink desiredOutputLink;
| |
| private:
| |
| void *recordSupportPvt;
| |
| };
| |
| | |
| const epicsInt16 io_firstIndex = 1001001
| |
| const epicsInt16 io_out = 1001001;
| |
| const epicsInt16 io_desiredOutputLink = 1001002;
| |
| const epicsInt16 io_lastIndex = io_desiredOutputLink
| |
| | |
| === menu and enum and array and struct that are not epicsType ===
| |
| | |
| <tt>someRecord.dbd</tt> contains:
| |
| struct(inpLink) {
| |
| field(link,link(in))
| |
| field(value,float64)
| |
| }
| |
| record(some) extends iocRecord {
| |
| field(fmenu,menu(menuConverty))
| |
| field(stateNames,array(string[]))
| |
| field(fenum,enum(stateNames))
| |
| field(flink,link(dir))
| |
| field(fdevice,device(dir,interfaceName))
| |
| field(inp,struct(inpLink))
| |
| field(inparray,array(struct(inpLink)[]))
| |
| }
| |
| === Generated Header Files ===
| |
| <tt>someRecord.h</tt> is generated from <tt>someRecord.dbd</tt>
| |
| class someRecord : public iocRecord{
| |
| public:
| |
| DbfMenu fmenu;
| |
| EpicsArray stateNames;
| |
| DbfEnum fenum
| |
| DbfLink flink;
| |
| DbfDevice fdevice;
| |
| DbfStruct inp;
| |
| DbfArray inparray;
| |
| private:
| |
| void *recordSupportPvt;
| |
| };
| |
|
| |
| const epicsInt16 some_firstIndex = 1001001;
| |
| const epicsInt16 some_fmenu = 1001002;
| |
| const epicsInt16 some_stateNames = 1001003;
| |
| const epicsInt16 some_fenum = 1001004;
| |
| const epicsInt16 some_flink = 1001005;
| |
| const epicsInt16 some_fdevice = 1001006;
| |
| const epicsInt16 some_inp = 1001007;
| |
| const epicsInt16 some_inparray = 1001008;
| |
| const epicsInt16 some_lastIndex = some_inparray
| |
| | |
| ----
| |