mostly changes to ntCPP.html; in NTMultiChannel addValue changed to value

This commit is contained in:
Marty Kraimer
2014-09-19 09:52:53 -04:00
parent eba5aa6c8b
commit 0d21cb267a
12 changed files with 3172 additions and 194 deletions

View File

@ -0,0 +1,4 @@
<h1>Release 4.0 IN DEVELOPMENT</h1>
<p>This is the first release of normativeTypesCPP that is part of an official
EPICS V4 release.
It is a major rewrite of the previous versions of normativeTypesCPP.</p>

View File

@ -0,0 +1,7 @@
Release 4.0 IN DEVELOPMENT
===========
This is the first release of normativeTypesCPP that is part of an official
EPICS V4 release.
It is a major rewrite of the previous versions of normativeTypesCPP.

2
documentation/TODO.html Normal file
View File

@ -0,0 +1,2 @@
<h1>TODO</h1>
<p>lots of code is a copy paste, consider inheritance and templates</p>

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,289 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<title>EPICS pvDataCPP</title>
<link rel="stylesheet" type="text/css"
href="http://epics-pvdata.sourceforge.net/base.css" />
<link rel="stylesheet" type="text/css"
href="http://epics-pvdata.sourceforge.net/epicsv4.css" />
<style type="text/css">
/*<![CDATA[*/
.about { margin-left: 3em; margin-right: 3em; font-size: .83em}
table { margin-left: auto; margin-right: auto }
.diagram { text-align: center; margin: 2.5em 0 }
span.opt { color: grey }
span.nterm { font-style:italic }
span.term { font-family:courier }
span.user { font-family:courier }
span.user:before { content:"<" }
span.user:after { content:">" }
.nonnorm { font-style:italic }
p.ed { color: #AA0000 }
span.ed { color: #AA0000 }
p.ed.priv { display: inline; }
span.ed.priv { display: inline; }
/*]]>*/</style>
<!-- Script that generates the Table of Contents -->
<script type="text/javascript"
src="http://epics-pvdata.sourceforge.net/script/tocgen.js">
</script>
</head>
<body>
<div class="head">
<h1>EPICS pvDataCPP</h1>
<!-- Maturity: Working Draft or Request for Comments, or Recommendation, and date. -->
<h2 class="nocount">EPICS v4 Working Group, Working Draft, 23-July-2014</h2>
<dl>
<dt>Latest version:</dt>
<dd><a
href="ntCPP.html">ntCPP.html</a>
</dd>
<dt>This version:</dt>
<dd><a
href="ntCPP_20140723.html">ntCPP_20140723.html</a>
</dd>
<dt>Previous version:</dt>
<dd>None</dd>
<dt>Editors:</dt>
<dd>Marty Kraimer, BNL</dd>
<dd>Michael Davidsaver, BNL</dd>
<dd>Matej Sekoranja, CosyLab</dd>
</dl>
<p class="copyright">This product is made available subject to acceptance of the <a
href="http://epics-pvdata.sourceforge.net/LICENSE.html">EPICS open source
license.</a></p>
<hr />
</div>
<h2 class="nocount">Abstract</h2>
<p>EPICS Version 4 provides efficient
storage, access, and communication, of memory resident structured data.
pvData is the storage compoment.
pvDataCPP is the C++ implementation of pvData.
It is one part of the set of related products in the EPICS
V4 control system programming environment:<br />
<a href="http://epics-pvdata.sourceforge.net/relatedDocumentsV4.html">relatedDocumentsV4.html</a>
</p>
<h2 class="nocount">Status of this Document</h2>
<p>For now this is a working copy so it is not the same as "This version" shown above.</p>
<p>This is the 23-July-2014 version of the C++ implementation of pvData.
</p>
<p>RELEASE_NOTES.md provides changes since the last release.
TODO.md describes things to do before the next release.
</p>
<div id="toc">
<h2 class="nocount" style="page-break-before: always">Table of Contents</h2>
</div>
<div id="contents" class="contents">
<body>
<h1 style="text-align: center">EPICS normative type C++ implementation
</h1>
<h2 class="nocount" id="L50">Draft, 4-Nov-2012</h2>
<dl>
<dt>This version:</dt>
<dd><a href="http://epics-pvdata.hg.sourceforge.net/hgweb/epics-pvdata/normativeTypesCPP/raw-file/tip/documentation/ntCPP.html">ntCPP.html</a></dd>
<dt>Editors:</dt>
<dd>Matej Sekoranja, CosyLab<br>
Marty Kraimer, BNL
</dd>
</dl>
<hr />
</div>
<h2>Introduction</h2>
<p>This section describes the C++ implemmentation of normative types. Two (2) helper classes are implemented,
ntNameValue and NTTable respectively. </p>
<h3>Normative Type Fields.</h3>
<p>These are helper classes for creating standard fields for normative types.
There is a single instance of this class, which is obtained via NTField::get().
</p>
<pre>class NTField: NoDefaultMethods {
public:
static NTFieldPtr get();
~NTField() {}
PVStructurePtr createEnumerated(StringArray const &amp; choices);
PVStructurePtr createTimeStamp();
PVStructurePtr createAlarm();
PVStructurePtr createDisplay();
PVStructurePtr createAlarmLimit();
PVStructurePtr createControl();
PVStructureArrayPtr createEnumeratedArray();
PVStructureArrayPtr createTimeStampArray();
PVStructureArrayPtr createAlarmArray();
};</pre>
<p>where</p>
<dl>
<dt>createEnumerated</dt>
<dd>Create an introspection interface for an enumerated structure.</dd>
<dt>createTimeStamp</dt>
<dd>Create an interspection interface for a timeStamp structure.</dd>
<dt>createAlarm</dt>
<dd>Create an interspection interface for an alarm structure.</dd>
<dt>createDisplay</dt>
<dd>Create an introsepecion interface for a display structure.</dd>
<dt>createAlarmLimit</dt>
<dd>Create an introspection interface for an alarm limit structure.</dd>
<dt>createControl</dt>
<dd>Create an introspection interface for a control structure.</dd>
<dt>createEnumeratedArray</dt>
<dd>Create an introspection interface for an structureArray of enumerated
structures.</dd>
<dt>createTimeStampArray</dt>
<dd>Create an introspection interface for an structureArray of timeStamp
structures.</dd>
<dt>createAlarmArray</dt>
<dd>Create an introspection interface for an structureArray of alarm
structures.</dd>
</dl>
<h3>NTNameValue</h3>
<p>These are helper classes for NTNameValue</p>
<pre>class NTNameValue : private NoDefaultMethods
{
public:
static bool isNTNameValue(PVStructurePtr const & pvStructure);
static NTNameValuePtr create(
bool hasFunction,bool hasTimeStamp, bool hasAlarm);
static NTNameValuePtr create(
PVStructurePtr const & pvStructure);
~NTNameValue();
PVStringPtr getFunction();
void attachTimeStamp(PVTimeStamp &amp;pvTimeStamp);
void attachAlarm(PVAlarm &amp;pvAlarm);
PVStructurePtr getPVStructure();
PVStructurePtr getTimeStamp();
PVStructurePtr getAlarm();
PVStringArrayPtr getNames();
PVStringArrayPtr getValues();
};</pre>
<p>where</p>
<dl>
<dt>isNTNameValue</dt>
<dd>Is the structure a NTNameValue structure?</dd>
<dt>create</dt>
<dd>Create an NTNameValue that has the associated fields.</dd>
<dt>~NTNameValue</dt>
<dd>The destructor.</dd>
<dt>getFunction</dt>
<dd>Get the function field. This can be null.</dd>
<dt>attachTimeStamp</dt>
<dd>The timeStamp field of the NTNameValue is atttached to the
pvTimeStamp.</dd>
<dt>attachAlarm</dt>
<dd>The alarm field of the NTNameValue is atttached to the alarm.</dd>
<dt>getPVStructure</dt>
<dd>Get the pvStructure that this NTNameValue contains.</dd>
<dt>getTimeStamp</dt>
<dd>Get the timeStamp field.</dd>
<dt>getAlarm</dt>
<dd>Get the alarm field.</dd>
<dt>getNames</dt>
<dd>Get the names field.</dd>
<dt>getValues</dt>
<dd>Get the values field.</dd>
</dl>
<h3>NTTable</h3>
<p>These are helper classes for NTTable</p>
<pre>class NTTable: private NoDefaultMethods
{
public:
static bool isNTTable(PVStructurePtr const & pvStructure);
static PVStructure::shared_pointer create(
bool hasFunction,bool hasTimeStamp, bool hasAlarm,
int numberValues,
FieldConstPtrArray valueFields);
static NTTablePtr create(
bool hasFunction,bool hasTimeStamp, bool hasAlarm,
StringArray const & valueNames,
FieldConstPtrArray const &valueFields);
static NTTablePtr clone(PVStructurePtr const &);
~NTTable();
PVStringPtr getFunction();
void attachTimeStamp(PVTimeStamp &amp;pvTimeStamp);
void attachAlarm(PVAlarm &amp;pvAlarm);
PVStructurePtr getPVStructure();
PVStructurePtr getTimeStamp();
PVStructurePtr getAlarm();
PVStringArrayPtr getLabel();
size_t getNumberValues();
FieldConstPtr getField(int index);
PVFieldPtr getPVField(int index);
};</pre>
<p>where</p>
<dl>
<dt>isNTTable</dt>
<dd>y</dd>
<dt>create</dt>
<dd>Create an NTTable that has the associated fields.</dd>
<dt>~NTTable</dt>
<dd>The destructor.</dd>
<dt>getFunction</dt>
<dd>Get the function field. This can be null.</dd>
<dt>attachTimeStamp</dt>
<dd>The timeStamp field of the NTTable is atttached to the pvTimeStamp.</dd>
<dt>attachAlarm</dt>
<dd>The alarm field of the NTTable is atttached to the alarm.</dd>
<dt>getPVStructure</dt>
<dd>Get the pvStructure that this NTTable contains.</dd>
<dt>getTimeStamp</dt>
<dd>Get the timeStamp field.</dd>
<dt>getAlarm</dt>
<dd>Get the alarm field.</dd>
<dt>getLabel</dt>
<dd>Get the label field.</dd>
<dt>getNumberValues</dt>
<dd>Get the number of value fields.</dd>
<dt>getField</dt>
<dd>Get the introspection interface for the specified field.</dd>
<dt>getPVField</dt>
<dd>Get the data field for the specified field.</dd>
</dl>
<h2>MTMultiChannel</h2>
<pre>
structure NTMultiChannel
union_t[] value
string[] channelName
time_t timeStamp :opt // time when data collected
alarm_t alarm :opt // alarm associated with data collection
int[] severity :opt // alarm severity for each value
int[] status :opt // alarm status for each value
string[] message :opt // alarm message for each value
long[] secondsPastEpoch :opt // seconds for each value.
int[] nanoseconds :opt // nanoseconds for each value
string descriptor :opt // descriptor data
</pre>
</div>
</body>
</html>

File diff suppressed because it is too large Load Diff

View File

@ -20,10 +20,9 @@ static NTFieldPtr ntField = NTField::get();
namespace detail {
NTMultiChannelBuilder::shared_pointer NTMultiChannelBuilder::addValue(UnionConstPtr valuePtr)
NTMultiChannelBuilder::shared_pointer NTMultiChannelBuilder::value(UnionConstPtr valuePtr)
{
value = true;
valueUnion = valuePtr;
valueType = valuePtr;
return shared_from_this();
}
@ -101,8 +100,8 @@ StructureConstPtr NTMultiChannelBuilder::createStructure()
StringArray names(nfields);
size_t ind = 0;
names[ind] = "value";
if(value) {
fields[ind++] = fieldCreate->createUnionArray(valueUnion);
if(valueType) {
fields[ind++] = fieldCreate->createUnionArray(valueType);
} else {
fields[ind++] = fieldCreate->createVariantUnion();
}
@ -173,10 +172,9 @@ NTMultiChannelBuilder::NTMultiChannelBuilder()
void NTMultiChannelBuilder::reset()
{
valueUnion.reset();
valueType.reset();
extraFieldNames.clear();
extraFields.clear();
value = false;
descriptor = false;
alarm = false;
timeStamp = false;
@ -266,13 +264,13 @@ NTMultiChannel::NTMultiChannel(PVStructurePtr const & pvStructure)
}
void NTMultiChannel::attachTimeStamp(PVTimeStamp &pv)
void NTMultiChannel::attachTimeStamp(PVTimeStamp &pv) const
{
if(!pvTimeStamp) return;
pv.attach(pvTimeStamp);
}
void NTMultiChannel::attachAlarm(PVAlarm &pv)
void NTMultiChannel::attachAlarm(PVAlarm &pv) const
{
if(!pvAlarm) return;
pv.attach(pvAlarm);

View File

@ -41,7 +41,7 @@ namespace detail {
* If this is not called then a variantUnion is the default.
* @return this instance of a {@code NTMultiChannelBuilder}.
*/
shared_pointer addValue(epics::pvData::UnionConstPtr valuePtr);
shared_pointer value(epics::pvData::UnionConstPtr valuePtr);
/**
* Add descriptor field to the NTMultiChannel.
* @return this instance of a {@code NTMultiChannelBuilder}.
@ -117,8 +117,7 @@ namespace detail {
void reset();
epics::pvData::UnionConstPtr valueUnion;
bool value;
epics::pvData::UnionConstPtr valueType;
bool descriptor;
bool alarm;
bool timeStamp;
@ -194,78 +193,91 @@ public:
* @param pvTimeStamp The pvTimeStamp that will be attached.
* Does nothing if no timeStamp
*/
void attachTimeStamp(epics::pvData::PVTimeStamp &pvTimeStamp);
void attachTimeStamp(epics::pvData::PVTimeStamp &pvTimeStamp) const;
/**
* Attach a pvAlarm.
* @param pvAlarm The pvAlarm that will be attached.
* Does nothing if no alarm
*/
void attachAlarm(epics::pvData::PVAlarm &pvAlarm);
void attachAlarm(epics::pvData::PVAlarm &pvAlarm) const;
/**
* Get the pvStructure.
* @return PVStructurePtr.
*/
epics::pvData::PVStructurePtr getPVStructure(){return pvNTMultiChannel;}
epics::pvData::PVStructurePtr getPVStructure() const
{return pvNTMultiChannel;}
/**
* Get the timeStamp.
* @return PVStructurePtr which may be null.
*/
epics::pvData::PVStructurePtr getTimeStamp(){return pvTimeStamp;}
epics::pvData::PVStructurePtr getTimeStamp() const
{return pvTimeStamp;}
/**
* Get the alarm.
* @return PVStructurePtr which may be null.
*/
epics::pvData::PVStructurePtr getAlarm() {return pvAlarm;}
epics::pvData::PVStructurePtr getAlarm() const
{return pvAlarm;}
/**
* Get the value of each channel.
* @return PVUnionArrayPtr
*/
epics::pvData::PVUnionArrayPtr getValue() {return pvValue;}
epics::pvData::PVUnionArrayPtr getValue() const
{return pvValue;}
/**
* Get the channelName of each channel.
* @return PVStringArrayPtr
*/
epics::pvData::PVStringArrayPtr getChannelName() { return pvChannelName;};
epics::pvData::PVStringArrayPtr getChannelName() const
{ return pvChannelName;};
/**
* Get the connection state of each channel.
* @return PVBooleanArrayPtr
*/
epics::pvData::PVBooleanArrayPtr getIsConnected() { return pvIsConnected;};
epics::pvData::PVBooleanArrayPtr getIsConnected() const
{ return pvIsConnected;};
/**
* Get the severity of each channel.
* @return PVIntArrayPtr which may be null.
*/
epics::pvData::PVIntArrayPtr getSeverity() {return pvSeverity;}
epics::pvData::PVIntArrayPtr getSeverity() const
{return pvSeverity;}
/**
* Get the status of each channel.
* @return PVIntArrayPtr which may be null.
*/
epics::pvData::PVIntArrayPtr getStatus() {return pvStatus;}
epics::pvData::PVIntArrayPtr getStatus() const
{return pvStatus;}
/**
* Get the message of each chnnel.
* @return PVStringArrayPtr which may be null.
*/
epics::pvData::PVStringArrayPtr getMessage() {return pvMessage;}
epics::pvData::PVStringArrayPtr getMessage() const
{return pvMessage;}
/**
* Get the secondsPastEpoch of each channel.
* @return PVLongArrayPtr which may be null.
*/
epics::pvData::PVLongArrayPtr getSecondsPastEpoch() {return pvSecondsPastEpoch;}
epics::pvData::PVLongArrayPtr getSecondsPastEpoch() const
{return pvSecondsPastEpoch;}
/**
* Get the nanoseconds of each channel.
* @return PVIntArrayPtr which may be null.
*/
epics::pvData::PVIntArrayPtr getNanoseconds() {return pvNanoseconds;}
epics::pvData::PVIntArrayPtr getNanoseconds() const
{return pvNanoseconds;}
/**
* Get the userTag of each channel.
* @return PVIntArrayPtr which may be null.
*/
epics::pvData::PVIntArrayPtr getUserTag() {return pvUserTag;}
epics::pvData::PVIntArrayPtr getUserTag() const
{return pvUserTag;}
/**
* Get the descriptor.
* @return PVStringPtr which may be null.
*/
epics::pvData::PVStringPtr getDescriptor() {return pvDescriptor;}
epics::pvData::PVStringPtr getDescriptor() const
{return pvDescriptor;}
private:
NTMultiChannel(epics::pvData::PVStructurePtr const & pvStructure);
epics::pvData::PVStructurePtr pvNTMultiChannel;

View File

@ -329,6 +329,11 @@ PVStructurePtr NTNDArray::getAlarm() const
return pvNTNDArray->getSubField<PVStructure>("alarm");
}
PVStructurePtr NTNDArray::getDisplay() const
{
return pvNTNDArray->getSubField<PVStructure>("display");
}
NTNDArray::NTNDArray(PVStructurePtr const & pvStructure) :
pvNTNDArray(pvStructure)

View File

@ -252,6 +252,12 @@ public:
*/
epics::pvData::PVStructurePtr getAlarm() const;
/**
* Get the display field.
* @return PVStructurePtr which may be null.
*/
epics::pvData::PVStructurePtr getDisplay() const;
private:
NTNDArray(epics::pvData::PVStructurePtr const & pvStructure);
epics::pvData::PVStructurePtr pvNTNDArray;

View File

@ -34,10 +34,10 @@ namespace detail {
/**
* Add a column of given {@code Scalar} type.
* @param name name of the column.
* @param scalarType column type, a scalar array.
* @param elementType column type, a scalar array.
* @return this instance of a {@code NTTableBuilder}.
*/
shared_pointer add(std::string const & name, epics::pvData::ScalarType scalarType);
shared_pointer add(std::string const & name, epics::pvData::ScalarType elememtType);
/**
* Add descriptor field to the NTTable.

View File

@ -72,7 +72,7 @@ static void test()
add("intValue", pvInt)->
createUnion();
multiChannel = builder->
addValue(unionPtr) ->
value(unionPtr) ->
addDescriptor()->
addAlarm()->
addTimeStamp()->
@ -108,7 +108,7 @@ static void test()
PVBooleanArrayPtr pvIsConnected = multiChannel->getIsConnected();
shared_vector<const boolean> isConnected = pvIsConnected->view();
multiChannel = builder->
addValue(unionPtr) ->
value(unionPtr) ->
addDescriptor()->
addAlarm()->
addTimeStamp()->