EPICS exampleCPP/database

2016.08.29

Abstract

database provides an IOC with a combination of V3 DBRecords, PVRecords, and also starts pvaSrv. It also provides a main program that has only the PVRecords.

Table of Contents


Overview

The database can be started either as a main program of as part of an EPICS V3 IOC.

Start as a main program

mrk> pwd
/home/epicsv4/master/exampleCPP/database
mrk> bin/$EPICS_HOST_ARCH/exampleDatabaseMain

Start it as part of an EPICS V3 IOC:

mrk> pwd
/home/epicsv4/master/exampleCPP/database/iocBoot/exampleDatabase
mrk> ../../bin/$EPICS_HOST_ARCH/exampleDatabase st.cmd 

The database has both iocCore DBRecords and pvDatabase PVRecords. Since pvaSrv is also started, the DBRecords can be accesed via either channelAccess or pvAccess. For example both caget and pvget can be used to access the DBRecords.

V4 PVRecords

These are the names of the channels that are available if the database is started as a main program or as part of a V3 IOC.

The following are the PVRecords plus helloRPC, which is accessed via channelRPC:

PVRboolean
PVRbooleanArray
PVRbyte
PVRbyteArray
PVRdouble
PVRdouble01
PVRdouble01Array
PVRdouble02
PVRdouble02Array
PVRdouble03
PVRdouble03Array
PVRdouble04
PVRdouble04Array
PVRdouble05
PVRdouble05Array
PVRdoubleArray
PVRdumbPowerSupply
PVRenum
PVRfloat
PVRfloatArray
PVRhelloPutGet
PVRhelloRPC
PVRint
PVRintArray
PVRlong
PVRlongArray
PVRremoveRecord
PVRrestrictedUnion
PVRrestrictedUnionArray
PVRshort
PVRshortArray
PVRstring
PVRstringArray
PVRstructureArray
PVRtraceRecord
PVRubyte
PVRubyteArray
PVRuint
PVRuintArray
PVRulong
PVRulongArray
PVRushort
PVRushortArray
PVRvariantUnion
PVRvariantUnionArray

V3 DB Records

If the database is started as a V3 IOC, the following DBRecords are present:

DBRbo00
DBRbo01
DBRstring00
DBRstring01
DBRstring02
DBRstring03
DBRstring04
DBRstring05
DBRstring06
DBRstring07
DBRstring08
DBRstring09
DBRbyteArray01
DBRdoubleArray
DBRdoubleArray01
DBRfloatArray01
DBRintArray01
DBRshortArray01
DBRstringArray01
DBRenum01
DBRmbbo00
DBRmbbo02
DBRcalc00
DBRcounter01
DBRmbbiwierd
DBRint00
DBRint01
DBRao01
DBRdouble00
DBRdouble01
DBRdouble02
DBRdouble03
DBRdouble04
DBRdouble05
DBRdouble06
DBRdouble07
DBRdouble08
DBRdouble09

database/src/pv

This directory has the following files:

exampleHelloRecord.h
Header file for exampleHelloRecord.cpp
exampleHelloRPC.h
Header file for exampleHelloRPC.cpp
exampleDatabase.h
Header file for exampleDatabase.cpp

database/src

This directory has the following files:

exampleHelloRecord.cpp
Code for an example that is accessed via channelPutGet
exampleHelloRPC.cpp
Code for an example that is accesed via channelRPC
exampleDatabase.cpp
Code that creates many PVRecords. Most are soft records but also exampleHelloRecord and exampleHelloRPC. The code is described in the following sub - section.
exampleDatabaseRegister.dbd and exampleDatabaseRegister.cpp
Code that allows the PVRecords to be part of a V3 IOC.
This is the code that supports the exampleDatabase shell command in database/iocBoot/exampleDatabase/st.cmd
exampleDatabaseMain.cpp
Code that allows the PVRecords to be available via a standalone main program.

database/src/code/exampleDatabase.cpp

This has a number of private methods:

createRecords
Given a scalarType this creates an NTScalar and an NTScalarArray record of the specified type.
createStructureArrayRecord
Creates a record with a value field that is a structureArray.
createRestrictedUnionRecord
Creates a record with a value field that is a regulav.
createVariantUnionRecord
Creates a record with a value field that a structureArray.
createRestrictedUnionArrayRecord
Creates a record with a value field that a structureArray.
createVariantUnionArrayRecord
Creates a record with a value field that a structureArray.
createDumbPowerSupplyRecord
Creates a record with a value field that a structureArray.

ExampleDatabase::create is a static method of ExampleDatabase that creates all the PVRecords that make up the example database.

It:

createRecords
This is called for each scalarType.
addRecord for PVRenum
Creates PVRenum
createStructureArrayRecord
Creates PVRstructureArray
createRestrictedUnionRecord
Creates PVRrestrictedUnion
createVariantUnionRecord
Creates PVRvariantUnion
createRestrictedUnionArrayRecord
Creates PVRrestrictedUnionArray
createVariantUnionArrayRecord
Creates PVRvariantUnionArray
createDumbPowerSupplyRecord
Creates PVRdumbPowerSupply
addRecord for PVRhelloPutGet
Creates PVRhelloPutGet
registerService for helloRPC
Creates helloRPC

database/ioc

database/ioc/Db

This has V3 record templates for creating DBRecords. They are used when the example database is started as part of a V3 IOC.

database/ioc/src

This has:

exampleDatabaseInclude.dbd
This has the following:
include "base.dbd"
This is from iocCore
include "PVAServerRegister.dbd"
This is to create the iocsh commmand startPVAServer
include "registerChannelProviderLocal.dbd"
This is to start local provider from pvDatabaseCPP
include "dbPv.dbd"
This is to start pvaSrv
include "exampleDatabaseRegister.dbd"
This is to create the iocsh commmand exampleDatabase
exampleDatabaseMain.cpp

database/iocBoot/exampleDatabase

This is where the example database is started as part of a V3 IOC.

st.cmd is like a normal startup file except for:

exampleDatabase
This creates the PVRecords.
startPVAServer
This starts the local channel provider and pvAccess