document new PVStructure::getAs method
This commit is contained in:
@@ -1,10 +1,26 @@
|
||||
<h1>Release 4.1 IN DEVELOPMENT</h1>
|
||||
<p>The main changes since release 4.0 are:</p>
|
||||
<ul>
|
||||
<li>Convert copy methods and equals operators (re)moved</li>
|
||||
<li>Convert::copyUnion now always copies between subfields.</li>
|
||||
<li>CreateRequest prevents a possible SEGFAULT.</li>
|
||||
<li>New stream operators for Field and PVField are provided.</li>
|
||||
<li>New method getAs that is like getSubField except that it throws exception</li>
|
||||
</ul>
|
||||
<h2>Convert copy methods and equals operators</h2>
|
||||
<p>Convert copy methods where moved and replaced with methods
|
||||
on PVField classes, i.e.</p>
|
||||
<pre><code>PVField::copy(const PVField& from)
|
||||
</code></pre>
|
||||
<p>Methods</p>
|
||||
<pre><code>PVField::copyUnchecked(const PVField& from)
|
||||
</code></pre>
|
||||
<p>where added to allow unchecked copies, to gain performance
|
||||
where checked are not needed (anymore).</p>
|
||||
<p>In addition:
|
||||
- isCompatibleXXX methods were removed in favour of Field::operator==.
|
||||
- equals methods were remove in favour of PVField::operator==.
|
||||
- operator== methods where moved to pvIntrospect.h and pvData.h</p>
|
||||
<h2>Convert::copyUnion</h2>
|
||||
<p>Before this method, depending on types for to and from,
|
||||
sometimes did a shallow cppy, i. e. just made to shared_ptr for to
|
||||
@@ -39,6 +55,10 @@ it was necessary to have code like:</p>
|
||||
cout << pv << endl;
|
||||
}
|
||||
</code></pre>
|
||||
<h2>New method getAs that is like getSubField except that it throws exception</h2>
|
||||
<p><b>PVStructure</b> has a new template member <b>getAs(const char *name)</b>
|
||||
that is like <b>getSubField</b> except that it throws a runtime_error
|
||||
instead of returning null.</p>
|
||||
<h1>Release 4.0</h1>
|
||||
<p>The main changes since release 3.0.2 are:</p>
|
||||
<ul>
|
||||
|
||||
@@ -7,6 +7,7 @@ The main changes since release 4.0 are:
|
||||
* Convert::copyUnion now always copies between subfields.
|
||||
* CreateRequest prevents a possible SEGFAULT.
|
||||
* New stream operators for Field and PVField are provided.
|
||||
* New method getAs that is like getSubField except that it throws exception
|
||||
|
||||
Convert copy methods and equals operators
|
||||
-----------------------------------------
|
||||
@@ -72,6 +73,12 @@ Now it can be done as follows:
|
||||
cout << pv << endl;
|
||||
}
|
||||
|
||||
New method getAs that is like getSubField except that it throws exception
|
||||
--------------------
|
||||
|
||||
<b>PVStructure</b> has a new template member <b>getAs(const char *name)</b>
|
||||
that is like <b>getSubField</b> except that it throws a runtime_error
|
||||
instead of returning null.
|
||||
|
||||
Release 4.0
|
||||
===========
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
<h1>EPICS pvDataCPP</h1>
|
||||
<!-- Maturity: Working Draft or Request for Comments, or Recommendation, and date. -->
|
||||
|
||||
<h2 class="nocount">EPICS v4 Working Group, Working Draft, 10-Nov-2014</h2>
|
||||
<h2 class="nocount">EPICS v4 Working Group, Working Draft, 23-June-2015</h2>
|
||||
|
||||
<dl>
|
||||
<dt>Latest version:</dt>
|
||||
@@ -46,11 +46,11 @@
|
||||
</dd>
|
||||
<dt>This version:</dt>
|
||||
<dd><a
|
||||
href="pvDataCPP_20141110.html">pvDataCPP_20141110.html</a>
|
||||
href="pvDataCPP_20150623.html">pvDataCPP_20150623.html</a>
|
||||
</dd>
|
||||
<dt>Previous version:</dt>
|
||||
<dd><a
|
||||
href="pvDataCPP_20140723.html">pvDataCPP_20140723.html</a>
|
||||
href="pvDataCPP_20141110.html">pvDataCPP_20141110.html</a>
|
||||
</dd>
|
||||
<dt>Editors:</dt>
|
||||
<dd>Marty Kraimer, BNL</dd>
|
||||
@@ -79,7 +79,7 @@ V4 control system programming environment:<br />
|
||||
|
||||
<h2 class="nocount">Status of this Document</h2>
|
||||
|
||||
<p>This is the 10-Nov-2014 version of the C++ implementation of pvData.
|
||||
<p>This is the 23-June-2015 version of the C++ implementation of pvData.
|
||||
</p>
|
||||
|
||||
<p>RELEASE_NOTES.md provides changes since the last release.
|
||||
@@ -465,10 +465,10 @@ structure
|
||||
PVStructurePtr doubleValue = getPVDataCreate()->createPVStructure(
|
||||
getStandardField()->scalar(pvDouble,"alarm,timeStamp"));
|
||||
PVDoublePtr pvdouble =
|
||||
doubleValue->getSubField<PVDouble>("value");
|
||||
doubleValue->getAs<PVDouble>("value");
|
||||
pvdouble->put(1e5);
|
||||
cout << *doubleValue << endl;
|
||||
double value = doubleValue->getSubField<PVDouble>("value")->get();
|
||||
double value = doubleValue->getAs<PVDouble>("value")->get();
|
||||
cout << "from get " << value << "\n\n";
|
||||
</pre>
|
||||
This produces:
|
||||
@@ -491,7 +491,7 @@ from get 100000
|
||||
PVStructurePtr doubleArrayValue = pvDataCreate->createPVStructure(
|
||||
standardField->scalarArray(pvDouble,"alarm,timeStamp"));
|
||||
PVDoubleArrayPtr pvDoubleArray =
|
||||
doubleArrayValue->getSubField<PVDoubleArray>("value");
|
||||
doubleArrayValue->getAs<PVDoubleArray>("value");
|
||||
size_t len = 10;
|
||||
shared_vector<double> xxx(len);
|
||||
for(size_t i=0; i< len; ++i) xxx[i] = i;
|
||||
@@ -605,10 +605,10 @@ structure
|
||||
createUnion(),
|
||||
"alarm,timeStamp"));
|
||||
PVStructurePtr pvTimeStamp =
|
||||
pvStructure->getSubField<PVUnion>("value")->select<PVStructure>(2);
|
||||
pvTimeStamp->getSubField<PVLong>("secondsPastEpoch")->put(1000);
|
||||
pvStructure->getAs<PVUnion>("value")->select<PVStructure>(2);
|
||||
pvTimeStamp->getAs<PVLong>("secondsPastEpoch")->put(1000);
|
||||
cout << *pvStructure) << "\n";
|
||||
pvStructure->getSubField<PVUnion>("value")->select<PVDouble>(0)->put(1e5);
|
||||
pvStructure->getAs<PVUnion>("value")->select<PVDouble>(0)->put(1e5);
|
||||
cout << *pvStructure << "\n\n";
|
||||
</pre>
|
||||
This produces:
|
||||
@@ -648,13 +648,13 @@ epics:nt/NTUnion:1.0
|
||||
standardField->variantUnion("alarm,timeStamp"));
|
||||
PVStructurePtr pvTimeStamp =
|
||||
pvDataCreate->createPVStructure(standardField->timeStamp());
|
||||
pvStructure->getSubField<PVUnion>("value")->set(pvTimeStamp);
|
||||
pvTimeStamp->getSubField<PVLong>("secondsPastEpoch")->put(1000);
|
||||
pvStructure->getAs<PVUnion>("value")->set(pvTimeStamp);
|
||||
pvTimeStamp->getAs<PVLong>("secondsPastEpoch")->put(1000);
|
||||
cout << *pvStructure << "\n";
|
||||
pvStructure->getSubField<PVUnion>("value")->set(
|
||||
pvStructure->getAs<PVUnion>("value")->set(
|
||||
pvDataCreate->createPVScalar(pvDouble));
|
||||
PVDoublePtr pvValue = static_pointer_cast<PVDouble>(
|
||||
pvStructure->getSubField<PVUnion>("value")->get());
|
||||
pvStructure->getAs<PVUnion>("value")->get());
|
||||
pvValue->put(1e5);
|
||||
cout << *pvStructure << "\n\n";
|
||||
</pre>
|
||||
@@ -718,7 +718,7 @@ epics:nt/NTUnion:1.0
|
||||
cout << *pvStructure->getStructure() << endl;
|
||||
cout << "data\n";
|
||||
cout << *pvStructure << "\n";
|
||||
PVUnionPtr pvUnion = pvStructure->getSubField<PVUnion>("value");;
|
||||
PVUnionPtr pvUnion = pvStructure->getAs<PVUnion>("value");;
|
||||
pvUnion->select("doubleValue");
|
||||
PVDoublePtr pvDouble = pvUnion->get<PVDouble>();
|
||||
pvDouble->put(1.55);
|
||||
@@ -726,7 +726,7 @@ epics:nt/NTUnion:1.0
|
||||
cout << *pvStructure << "\n";
|
||||
cout << "value = " << pvDouble->get() << "\n";
|
||||
pvUnion->select("structValue");
|
||||
pvDouble = pvUnion->get<PVStructure>()->getSubField<PVDouble>("doubleValue");
|
||||
pvDouble = pvUnion->get<PVStructure>()->getAs<PVDouble>("doubleValue");
|
||||
pvDouble->put(1.65);
|
||||
cout << "select structValue\n";
|
||||
cout << *pvStructure << "\n";
|
||||
@@ -2304,6 +2304,9 @@ public:
|
||||
template<typename PVT>
|
||||
std::tr1::shared_ptr<PVT> getSubField(std::string const &fieldName) const
|
||||
|
||||
template<typename PVT>
|
||||
PVT& getAs(const char *name) const;
|
||||
|
||||
PVFieldPtr getSubField(std::size_t fieldOffset) const;
|
||||
|
||||
template<typename PVT>
|
||||
@@ -2329,6 +2332,9 @@ public:
|
||||
<dt>getPVFields</dt>
|
||||
<dd>Returns the array of subfields. The set of subfields must all have
|
||||
different field names.</dd>
|
||||
<dt>getAs(const char *name)</dt>
|
||||
<dd>Like the getSubField except that it throws std::runtime_error if
|
||||
the field does not exists or has the wrong type.</dd>
|
||||
<dt>getSubField(std::string fieldName)</dt>
|
||||
<dd>
|
||||
Get a subField of a field.d
|
||||
@@ -5408,7 +5414,7 @@ public:
|
||||
raiseMonitor = true;
|
||||
if(pvFieldOptions!=NULL) {
|
||||
PVStringPtr pvString =
|
||||
pvFieldOptions->getSubField<PVString>("raiseMonitor");
|
||||
pvFieldOptions->getAs<PVString>("raiseMonitor");
|
||||
if(pvString!=NULL) {
|
||||
std::string value = pvString->get();
|
||||
if(value.compare("false")==0) raiseMonitor = false;
|
||||
|
||||
5472
documentation/pvDataCPP_20150623.html
Normal file
5472
documentation/pvDataCPP_20150623.html
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user