make compatible with pvDataCPP-md; channelArray implemented; can be part of v3IOC.

This commit is contained in:
Marty Kraimer
2013-07-25 10:27:17 -04:00
parent 255f58aeb8
commit e40fe7b0ac
57 changed files with 2595 additions and 318 deletions

View File

@@ -38,7 +38,7 @@
<h1>pvDatabaseCPP</h1>
<!-- Maturity: Working Draft or Request for Comments, or Recommendation, and date. -->
<h2 class="nocount">EPICS v4 Working Group, Working Draft, 27-Jun-2013</h2>
<h2 class="nocount">EPICS v4 Working Group, Working Draft, 25-Jul-2013</h2>
<dl>
<dt>Latest version:</dt>
<dd><a
@@ -46,11 +46,14 @@
</dd>
<dt>This version:</dt>
<dd><a
href="http://epics-pvdata.hg.sourceforge.net/hgweb/epics-pvdata/pvDatabaseCPP/raw-file/tip/documentation/pvDatabaseCPP_20130627.html">pvDatabaseCPP20130627.html</a>
href=
"http://epics-pvdata.hg.sourceforge.net/hgweb/epics-pvdata/pvDatabaseCPP/raw-file/tip/documentation/pvDatabaseCPP_20130725.html">
pvDatabaseCPP20130725.html</a>
</dd>
<dt>Previous version:</dt>
<dd><a
href="http://epics-pvdata.hg.sourceforge.net/hgweb/epics-pvdata/pvDatabaseCPP/raw-file/tip/documentation/pvDatabaseCPP_20130523.html">pvDatabaseCPP20130523.html</a>
href="http://epics-pvdata.hg.sourceforge.net/hgweb/epics-pvdata/pvDatabaseCPP/raw-file/tip/documentation/pvDatabaseCPP_20130627.html">
pvDatabaseCPP20130627.html</a>
</dd>
<dt>Editors:</dt>
<dd>Marty Kraimer, BNL</dd>
@@ -74,29 +77,36 @@ The minimum that an extenson must provide is a top level PVStructure and a proce
<h2 class="nocount">Status of this Document</h2>
<p>This is the 27-Jun-2013 version of the definition of pvDatabaseCPP.
<p>This is the 25-Jul-2013 version of the definition of pvDatabaseCPP.
<p><b>NOTE:</b>
This is built against pvDataCPP-md NOT against pvDataCPP.
To build you must also
checkout pvAccessCPP and build it against pvDataCPP-md.
</p>
<p>The following Channel methods are implemented and working: getField,
channelProcess, channelGet, channelPut, channelPutGet,channelArray and Monitor.
But work remains:</p>
</p>
<p>All channel methods except channelRPCi, which is implemented
by pvAccess, have been implemented.
This project is ready for alpha users.
</p>
<p>Future enhancements in priority order:</p>
<dl>
<dt>Other Channel Methods</dt>
<dd>channlRPC will not be implemented because pvAccess itself
provides what is required to easily implement channelRPC requests.
</dd>
<dt>pvAccess directly to local channelProvider</dt>
<dd>Create an example record that communicates with another
record via pvAccess but directly connects to channelProviderLocal.
Thus channelGet and monitor of arrays will be done without
copying raw array data.</dd>
<dt>Array performance</dt>
<dd>Create an example record that continuously creates array data.
The idea is to compare performance allocating memory from the
heap vs using a free list.</dd>
<dt>Separate example that also has pvaSrv</dt>
<dd>Create a separate example that combines a V3IOC,
a pvDatabase, and pvaSrv.</dd>
<dt>Monitor Algorithms</dt>
<dd>Monitor algorithms have not been implemented.
Thus all monitors are onPut.</dd>
<dt>Memory leaks</dt>
<dd>I think all memory leaks have been fixed.</dd>
<dt>Scalar Arrays</dt>
<dd>Share has not been implemented.
This will wait for a new implementation of ScalarArray.</dd>
<dt>Structure Arrays</dt>
<dd>Has not been implemented</dd>
<dt>toString</dt>
<dd>The toString methods should be replaced by stream operator&lt;&lt;.
</dd>
<dt>Testing</dt>
<dd>Needs more testing</dd>
</dl>
@@ -137,8 +147,19 @@ A record is smart because code can be attached to a record, which is accessed vi
as defined by pvAccess.
It is used by the server side of pvAccess to attach to pvRecords.
This component also includes the monitor and pvCopy components from pvIOCJava</dd>
<dt>Main and V3IOC</dt>
<dd>The pvDatabase can be provided via a Main program or can be part
of a V3IOC. In tha later case the IOC has both a database of V3 Records
and a pvDatabase.</dd>
<dt>exampleCounter</dt>
<dd>This is a simple example showing how to create a PVRecord and
how to deploy it either as a standalone process or as part of a V3IOC.</dd>
<dt>exampleServer</dt>
<dd>This example has a set of PVRecords.
Again the records can be deployed either as a standalone process or
as part of a V3IOC.
</dl>
<p>database provides base classes that make it easy to create record instances.
<p><b>database</b> provides base classes that make it easy to create record instances.
The code attached to each record must create the top
level PVStructure and the following three methods:</p>
<dl>
@@ -153,42 +174,68 @@ level PVStructure and the following three methods:</p>
<dd>This releases and resorurces used by the impplementation.</dd>
</dl>
<h3>Getting started</h3>
<p>Included with this project are two main programs that are useful for
<p>Included with this project are two examples that are useful for
seeing how pvDatabase can be used by clients.
The programs are:
Each can be deployed either as a standalone process or as part of a V3IOC.
The examples are:
<dl>
<dt>exampleCounterMain</dt>
<dd>This has a database consisting of two records:
The exampleCounter discussed in a following section and a record
that allows a pvAccess client to set the trace level of the
exampleCounter. This is also discussed below.
</dd>
<dt>testExamplServerMain</dt>
<dd>This has a database consisting of a single record named exampleCounter:
The exampleCounter is discussed in a following section.</dd>
<dt>exampleCounter</dt>
<dd>This is exampleCounter as part of a V3IOC.</dd>
<dt>exampleServerMain</dt>
<dd>This has a database with several records.</dd>
<dt>exampleServer</dt>
<dd>This is exampleServer as part of a V3IOC</dd>
</dt>
</p>
<p>To start one of the programs on linux, do the following:
<h3>exampleCounter</h3>
<p>To start exampleCounterMain:
<pre>
mrk&gt; pwd
/home/hg/pvDatabaseCPP
mrk&gt; bin/linux-x86_64/testExampleServer
mrk&gt; bin/linux-x86_64/exampleCounterMain
</pre></p>
<p>The Java programs
<p>To start exampleCounter as part of a V3IOC:
<pre>
mrk&gt; pwd
/home/hg/pvDatabaseCPP/iocBoot/exampleCounter
mrk&gt; ../../../bin/linux-x86_64/exampleCounter st.cmd
</pre></p>
<p>You can then issue the commands dbl and pvdbl:
<pre>
epics&gt; dbl
double01
epics&gt; pvdbl
exampleCounter
epics&gt;
</pre>
double01 is a v3Record.
exampleCounter is a pvRecord.
</p>
<p>Starting exampleServer is similar.
After successfully running exampleCounterMain and exampleCounter then
try starting exampleServerMain and exampleServer.
</p>
<h3>swtshell</h3>
<p>The Java program
<a
href="http://epics-pvdata.hg.sourceforge.net/hgweb/epics-pvdata/swtshellJava/raw-file/tip/documentation/swtshellJava.html">
swtshellJava.html</a>
can be used to access the database.</p>
swtshell</a>
can be used to access pvDatabase.</p>
<p>In particular read the sections "Getting Started" and "Simple Example".
They will work on the testExampleServer with the following differences:
They will work on the exampleServer with the following differences:
<dl>
<dt>startExample.zip</dt>
<dd>Do NOT use this. Instead run testExampleServer</dd>
<dd>Do NOT use this. Instead run exampleServer</dd>
<dt>channelList result</dt>
<dd>The result of channelList will show the list of records that
testExampleServer has rather than the records from startExample.zip</dd>
exampleServer has rather than the records from startExample.zip</dd>
</dl>
</p>
<p>The database has the following records:
<h3>exampleServer</h3>
<p>The exampleServer pvDatabase includes the following records:
<dl>
<dt>exampleCounter</dt>
<dd>A record that is an instance of exampleCounter described below.
@@ -209,6 +256,7 @@ They will work on the testExampleServer with the following differences:
<dt>traceRecordPGRPC</dt>
<dd>This can be used via channelPutGet to set the trace level of another record.</dd>
</dl>
<p>It also has a number of other scalar and array records.</p>
<h3>Relationship with pvIOCJava.</h3>
<p>This document descibes a C++ implementation of some of the components in pvIOCJava,
@@ -240,13 +288,23 @@ mrk&gt; pwd
mrk&gt; bin/linux-x86_64/exampleCounter
</pre>
<p>The example consists of two components:</p>
<p>The example consists of four components:</p>
<dl>
<dt>ExampleCounter.h</dt>
<dd>The source code for the counter.</dd>
<dd>The source code for the counter.
It is located in directory pvDatabaseCPP/example/src/exampleCounter.
</dd>
<dt>exampleCounterMain.cpp</dt>
<dd>A main program that runs the example so that it can be accessed
by a pvAccess client.</dd>
by a pvAccess client.
It is located in directory pvDatabaseCPP/example/exampleCounter.
</dd>
<dt>v3IOC/exampleCounter</dt>
<dd>This is a directory that packages exampleCounter to make it
part of a v3IOC.</dd>
<dt>iocBoot/exampleCounter</dt>
<dd>A place to start exampleCounter as part of a v3IOC.
It follows the normal iocCore conventions.</dd>
</dl>
<h4>ExampleCounter.h</h4>
<p>The example resides in src/database.
@@ -383,11 +441,10 @@ void ExampleCounter::process()
It adds 1.0 to the current value.
It then sets the timeStamp to the current time.
<h4>exampleCounterMain.cpp</h4>
<p>This is in test/server.</p>
<p><b>NOTE:</b>
This is a shorter version of the actual code.
It shows the essential code.
The actual example shows how the create additional records.
The actual example shows how create an additional record.
</p>
<p>The main program is:</p>
<pre>
@@ -400,7 +457,8 @@ int main(int argc,char *argv[])
bool result = master-&gt;addRecord(pvRecord);
cout &lt;&lt; "result of addRecord " &lt;&lt; recordName &lt;&lt; " " &lt;&lt; result &lt;&lt; endl;
pvRecord.reset();
cout &lt;&lt; "exampleServer\n";
startPVAServer(PVACCESS_ALL_PROVIDERS,0,true,true);
cout &lt;&lt; "exampleCounter\n";
string str;
while(true) {
cout &lt;&lt; "Type exit to stop: \n";
@@ -420,6 +478,40 @@ This:
<li>Prints exampleCounter on standard out.</li>
<li>Runs forever until the user types exit on standard in.</li>
</ul>
<h4>v3IOC exampleCounter</h4>
<p>This has two subdirectories:
<dl>
<dt>Db</dt>
<dd>This has a template for a single v3Record.</dd>
<dt>src</dt>
<dd>This has code to allow exampleCounter to reside in a v3IOC.</dd>
</dl>
</p>
<p>The src directory has the following components:</p>
<dl>
<dt>exampleCounterMain.cpp</dt>
<dd>This is just a standard Main for a v3IOC.</dd>
<dt>exampleCounterInclude.dbd</dt>
<dd>This is:
<pre>
include "base.dbd"
include "PVAServerRegister.dbd"
registrar("exampleCounterRegister")
</pre>
This includes the dbd components required from base,
the dbd file for starting pvAccess and the local channelProvider,
and the dbd file for the example. The later is for the code from the
next file.
</dd>
<dt>exampleCounter.cpp</dt>
<dd>This is the code that registers a command the can be issued
via the iocsh, which is the console for a v3IOC.
The example supports a single command:
<pre>
exampleCounterCreateRecord recordName
</pre>
</dd>
</dl>
<h3>Phased Development</h3>
<p>This documentation describes the first phase of a phased implementation of pvDatabaseCPP:</pp>
<dl>