1 Commits
6.0.0 ... 5.0.1

Author SHA1 Message Date
Ralph Lange
7707da0b45 jenkins: adapt doc script to new CloudBees jenkins job 2015-09-14 16:48:33 +02:00
151 changed files with 47031 additions and 2712 deletions

31
COPYRIGHT Normal file
View File

@@ -0,0 +1,31 @@
This software is in part copyrighted by the various organizations and
individuals listed below. Permission to use it is set out in the file
LICENSE that accompanies the software.
In no event shall any copyright holder be liable to any party for
direct, indirect, special, incidental, or consequential damages arising
out of the use of this software, its documentation, or any derivatives
thereof, even if they have been advised of the possibility of such
damage.
The copyright holders specifically disclaim any warranties, including,
but not limited to, the implied warranties of merchantability, fitness
for a particular purpose, and non-infringement. This software is
provided on an "as is" basis, and the copyright holders have no
obligation either collectively or individually to provide maintenance,
support, updates, enhancements, or modifications.
Copyright (c) 2006 - 2015 All rights reserved
Martin R. Kraimer
The University of Chicago, as Operator of Argonne National Laboratory.
Deutsches Elektronen-Synchroton, Member of the Helmholtz Association,
(DESY), HAMBURG, GERMANY,
BERLINER SPEICHERRING GESELLSCHAFT FUER SYNCHROTRONSTRAHLUNG M.B.H.
(BESSY), BERLIN, GERMANY.
COSYLAB (Control System Laboratory), Ljubljana, Slovenia.
Brookhaven Science Associates, as Operator of Brookhaven
National Laboratory.
Diamond Light Source Ltd., Didcot, United Kingdom.

109
LICENSE
View File

@@ -1,16 +1,14 @@
Copyright and License Terms
---------------------------
Copyright (c) 2006-2016 Martin R. Kraimer
Copyright (c) 2006-2016 UChicago Argonne LLC, as Operator of Argonne
Copyright (c) 2006-2015 Martin R. Kraimer
Copyright (c) 2006 The University of Chicago, as Operator of Argonne
National Laboratory.
Copyright (c) 2006 Deutsches Elektronen-Synchrotron,
Member of the Helmholtz Association, (DESY), HAMBURG, GERMANY.
Copyright (c) 2007-2016 Control System Laboratory,
Copyright (c) 2007-2015 Control System Laboratory,
(COSYLAB) Ljubljana Slovenia
Copyright (c) 2010-2016 Brookhaven Science Associates, as Operator
of Brookhaven National Laboratory
Copyright (c) 2011-2016 Diamond Light Source Limited,
Copyright (c) 2010-2015 Brookhaven Science Associates, as Operator of Brookhaven
National Laboratory
Copyright (c) 2011-2015 Diamond Light Source Limited,
(DLS) Didcot, United Kingdom
Permission is hereby granted, free of charge, to any person
@@ -36,30 +34,81 @@ OTHER DEALINGS IN THE SOFTWARE.
________________________________________________________________________
Additional Disclaimers
----------------------
This software is in part copyrighted by the University of Chicago (UofC)
This software is copyright in part by these institutions:
In no event shall UofC be liable to any party for direct, indirect,
special, incidental, or consequential damages arising out of the use of
this software, its documentation, or any derivatives thereof, even if
UofC has been advised of the possibility of such damage.
* Brookhaven Science Associates, as Operator of Brookhaven
National Laboratory, New York, USA
* Control System Laboratory, Ljubljana, Slovenia
* Deutsches Elektronen-Synchroton, Member of the Helmholtz
Association, Hamburg, Germany
* Diamond Light Source Limited, Didcot, United Kingdom
* Helmholtz-Zentrum Berlin fuer Materialien und Energie m.b.H.,
Berlin, Germany.
* UChicage Argonne LLC, as Operator of Argonne National Laboratory,
Illinois, USA
UofC specifically disclaims any warranties, including, but not limited
to, the implied warranties of merchantability, fitness for a particular
purpose, and non-infringement. This software is provided on an "as is"
basis, and UofC has no obligation to provide maintenance, support,
updates, enhancements, or modifications.
In no event shall these institutions be liable to any party for direct,
indirect, special, incidental, or consequential damages arising out of
the use of this software, its documentation, or any derivatives thereof,
even if advised of the possibility of such damage.
________________________________________________________________________
These institutions specifically disclaim any warranties, including, but
not limited to, the implied warranties of merchantability, fitness for a
particular purpose, and non-infringement. This software is provided on
an "as is" basis, and these institutions have no obligation to provide
maintenance, support, updates, enhancements, or modifications.
This software is in part copyrighted by the BERLINER SPEICHERRING
GESELLSCHAFT FUER SYNCHROTRONSTRAHLUNG M.B.H. (BESSY), BERLIN, GERMANY.
In no event shall BESSY be liable to any party for direct, indirect,
special, incidental, or consequential damages arising out of the use of
this software, its documentation, or any derivatives thereof, even if
BESSY has been advised of the possibility of such damage.
BESSY specifically disclaims any warranties, including, but not limited
to, the implied warranties of merchantability, fitness for a particular
purpose, and non-infringement. This software is provided on an "as is"
basis, and BESSY has no obligation to provide maintenance, support,
updates, enhancements, or modifications.
________________________________________________________________________
This software is in part copyrighted by the Deutsches Elektronen-Synchroton,
Member of the Helmholtz Association, (DESY), HAMBURG, GERMANY.
In no event shall DESY be liable to any party for direct, indirect,
special, incidental, or consequential damages arising out of the use of
this software, its documentation, or any derivatives thereof, even if
DESY has been advised of the possibility of such damage.
DESY specifically disclaims any warranties, including, but not limited
to, the implied warranties of merchantability, fitness for a particular
purpose, and non-infringement. This software is provided on an "as is"
basis, and DESY has no obligation to provide maintenance, support,
updates, enhancements, or modifications.
______________________________________________________________________
This software is in part copyrighted by the Brookhaven
National Laboratory (BNL).
In no event shall BNL be liable to any party for direct, indirect,
special, incidental, or consequential damages arising out of the use of
this software, its documentation, or any derivatives thereof, even if
BNL has been advised of the possibility of such damage.
BNL specifically disclaims any warranties, including, but not limited
to, the implied warranties of merchantability, fitness for a particular
purpose, and non-infringement. This software is provided on an "as is"
basis, and BNL has no obligation to provide maintenance, support,
updates, enhancements, or modifications.
________________________________________________________________________
This software is in part copyrighted by Diamond Light Source Limited (DLS)
In no event shall DLS be liable to any party for direct, indirect,
special, incidental, or consequential damages arising out of the use of
this software, its documentation, or any derivatives thereof, even if
DLS has been advised of the possibility of such damage.
DLS specifically disclaims any warranties, including, but not limited
to, the implied warranties of merchantability, fitness for a particular
purpose, and non-infringement. This software is provided on an "as is"
basis, and DLS has no obligation to provide maintenance, support,
updates, enhancements, or modifications.
________________________________________________________________________

82
README.html Normal file
View File

@@ -0,0 +1,82 @@
<?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 pvData C++</title>
</head>
<body>
<h1 style="text-align: center">EPICS pvData C++<br />
Overview<br />
2010.08.10</h1>
CONTENTS
<hr />
<h2 style="text-align: center">Introduction</h2>
<hr />
<p>This project has the begining of the C++ implementation of pvData. The
following is done:</p>
<dl>
<dt>introspection interfaces</dt>
<dd>The introspection interfaces for clients are described.</dd>
<dt>introspection implementation</dt>
<dd>The following have been implemented: Type, ScalarType, Field,
Scalar</dd>
<dt>test</dt>
<dd>A test of Scalar.</dd>
<dt>As mentioned below there are problems with the current
implementation.</dt>
</dl>
<hr />
<h2 style="text-align: center">Building</h2>
<hr />
<p>The project is structured as an epics base client application. Edit
configure/RELEASE so that it references your EPICS base and then just
type:</p>
<pre> make</pre>
<p>At the top. Then execute the test in the bin directory.</p>
<p>pvDataApp has the following sub directories:</p>
<dl>
<dt>pv</dt>
<dd>pvData.h has the interface descriptions for client code.</dd>
<dt>factory</dt>
<dd>FieldCreateFactory.cpp has the current implementation</dd>
<dt>test</dt>
<dd>Has a test for the current implementation.</dd>
</dl>
<hr />
<h2 style="text-align: center">Questions about Classes</h2>
<hr />
<p>The pure virtual classes defined in pvData.h now work. But there are still
some things that are not so nice. Amoung these are:</p>
<ul>
<li>In FieldCreateFactory.cpp look for "WHY DO I". It asks why the derived
class must also define methods defined in the base class. If it does not
then a compilation error occurs. WHY??? </li>
<li>The toString methods have an argument of "std::string &amp;buf" instead
of "std::string *". Does this seem correct?</li>
<li>Can arguments and return descriptions be defined better?</li>
<li>Is const present everywhere it should be? Remember that introspection
classes are immutable.</li>
<li>The code is NOT thread safe. When we decide for sure what thread/lock
support to choose I will fix this.</li>
</ul>
<p>HELP WILL BE GREATLY APPRECIATED. because I am still coming up to speed
with c++</p>
<hr />
<h2 style="text-align: center">Garbage Collection</h2>
<hr />
<p>Not yet implemented. Lets get class structure correct first.</p>
</body>
</html>

View File

@@ -1,57 +0,0 @@
pvaDataCPP
==========
pvDataCPP is a set of data types and utilities that form part of the EPICS V4 project.
Further Info
------------
Consult the documents in the documentation directory, in particular
* pvDataCPP.html
* RELEASE_NOTES.md
Also see the [EPICS Version 4 website](http://epics-pvdata.sourceforge.net)
Prerequisites
-------------
The pvDataCPP requires recent versions of the following software:
1. EPICS Base (v3.14.12.3 or later)
2. EPICS4 pvCommonCPP (4.1.0 or later)
(pvCommonCPP may not be needed depending on host/compiler.)
Building
--------
Building uses the make utility and the EPICS base build system.
The build system needs the location of the prerequisites, e.g. by placing the
lines of the form
PVCOMMON = /home/install/epicsV4/pvCommonCPP
EPICS_BASE = /home/install/epics/base
pointing to the locations in a file called RELEASE.local
in the configure directory or the parent directory of pvDataCPP.
With this in place, to build type make
make
To perform a clean build type
make clean uninstall
To run the unit tests type
make runtests
For more information on the EPICS build system consult the
[Application Development guide](http://www.aps.anl.gov/epics/base/R3-14/12-docs/AppDevGuide.pdf).

View File

@@ -1,239 +1,66 @@
<h1>Release 6.0.0</h1>
<p>The main changes since release 5.0.4 are:</p>
<h1>Release 4.1 IN DEVELOPMENT</h1>
<p>The main changes since release 4.0 are:</p>
<ul>
<li>Linux shared library version added</li>
<li>Headers have been moved into pv directories</li>
<li>Bitset functions declared const where possible</li>
<li>Bitset::swap added</li>
<li>Requester::message has default implementation</li>
<li>Serialization/deserialization helpers added</li>
<li>Non-template getSubField char* overload added</li>
<li>MonitorPlugin deprecated</li>
<li>Field name validation performed</li>
<li>Now builds for Cygwin and MinGW targets</li>
<li>Fix for debug build issue.</li>
<li>New license file replaces LICENSE and COPYRIGHT</li>
</ul>
<h2>Shared library version added</h2>
<p>Linux shared library version numbers have been added by setting SHRLIB_VERSION
(to 6.0 in this case). So shared object will be libpvData.so.6.0 instead of
libpvData.so.</p>
<h2>Headers have been moved into pv directories</h2>
<p>E.g. src/property/alarm.h -> src/property/pv/alarm.h</p>
<p>This facilitates using some IDEs such as Qt Creator.</p>
<h2>Requester::message has default implementation</h2>
<p>Requester::message is no longer pure virtual. Default implementation sends
string to std::cerr.</p>
<h2>Serialization/deserialization helpers added</h2>
<p>A helper function, serializeToVector, has been added which serializes a
Serializable object into a standard vector of UInt8s.</p>
<p>Similarly a function deserializeFromVector deserializes a standard vector into
a Deserializable object.</p>
<p>A function deserializeFromBuffer deserializes a ByteBuffer into a
Deserializable object.</p>
<h2>Field name validation performed</h2>
<p>On creating a Structure or Union the field names are now validated.</p>
<p>Valid characters for a field name are upper or lowercase letters, numbers and
underscores and intial numbers are invalid, i.e. names must be of the form
[A-Za-z<em>][A-Za-z0-9</em>]*.</p>
<h2>Now builds for Cygwin and MinGW targets</h2>
<p>Includes cross-compiling MinGW on Linux.</p>
<h1>Release 5.0.4</h1>
<p>The changes since release 5.0.3 are:</p>
<ul>
<li>Fixed bitset serialization (issue #24)</li>
<li>Fixed truncation in BitSet::or_and (issue #27)</li>
</ul>
<h2>Fixed bitset serialization (issue #24)</h2>
<p>C++ bitset serialization was not consistent with the C++ deserialization and
Java code in some instances (depending on the endianness of the serializer and
deserializer) when the number of bits was 56-63 modulo 64. C++ serialization
has been fixed.</p>
<p>Fix exposed issue in deserialization on 32-bit platforms which
has also been corrected. </p>
<h2>Fixed truncation in BitSet::or_and (issue #27)</h2>
<p>If n, n1 and n2 words are used to store the values of the bitsets bitset,
bitset1 and bitset2 respectively then max(n, min(n1,n2)) words are needed
to store bitset.or_(bitset1, bitset2).</p>
<p>Previously min(n1,n2) words were used and the result would be truncated in
some instances. This has been fixed.</p>
<h1>Release 5.0.3</h1>
<p>The only change since release 5.0.2 is:</p>
<h2>Fixed buffer overflow in PVUnion::serialize() (issue #20)</h2>
<p>A PVUnion whose stored value was null was serialized without checking
whether the buffer had sufficient capacity. This has been fixed by calling
ensureBuffer().</p>
<h1>Release 5.0.2</h1>
<p>The main changes since release 4.0.3 are:</p>
<ul>
<li>Deprecated getXXXField() methods have been removed from PVStructure</li>
<li>Convert copy methods and equals operators (re)moved</li>
<li>Convert::copyUnion now always copies between subfields.</li>
<li>New method getSubFieldT, like getSubField except it throws an exception</li>
<li>findSubField method removed from PVStructure</li>
<li>New stream operators for Field and PVField are provided</li>
<li>New template versions of Structure::getField</li>
<li>Fixes for static initialisation order issues</li>
<li>CreateRequest prevents a possible SEGFAULT</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>Deprecated getXXXField methods have been removed from PVStructure</h2>
<p>The following methods have been removed from PVStructure</p>
<ul>
<li>getBooleanField</li>
<li>getByteField, getShortField, getIntField, getLongField</li>
<li>getUByteField, getUShortField, getUIntField, getULongField</li>
<li>getStringField</li>
<li>getStructureField, getUnionField</li>
<li>getScalarArrayField, getStructureArrayField, getUnionArrayField</li>
</ul>
<p>Use template getSubField instead, e.g. use</p>
<pre><code>getSubField&lt; PVInt &gt;(fieldName)
</code></pre>
<p>in place of</p>
<pre><code>getIntField(fieldName)
</code></pre>
<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&amp; from)
</code></pre>
<p>Methods</p>
<pre><code>PVField::copyUnchecked(const PVField&amp; from)
</code></pre>
<p>were added to allow unchecked copies, to gain performance
<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 copy, i.e. just made to shared_ptr for to
sometimes did a shallow cppy, i. e. just made to shared_ptr for to
share the same data as from.
Now it always copies between the subfield of to and from.</p>
<h2>New method getSubFieldT, like getSubField except it throws an exception</h2>
<p>PVStructure has a new template member</p>
<pre><code>getSubFieldT(std::string const &amp;fieldName)
</code></pre>
<p>that is like <b>getSubField</b> except that it throws a runtime_error
instead of returning null.</p>
<h2>findSubField method removed from PVStructure</h2>
<p>This was mainly used in the implementation of getSubField. With a change to
the latter, findSubField was removed.</p>
<h2>CreateRequest change</h2>
<p>createRequest could cause a SEGFAULT if passed a bad argument.
This has been changed so the it returns a null pvStructure
and provies an error.</p>
<h2>New stream operators</h2>
<p>New steam operators are available for Field and PVField.
Before to print a Field (or any extension) or a PVField (or any extension)
it was necessary to have code like:</p>
<pre><code> void print(StructureConstPtr struc, PVStructurePtr pv)
<pre><code> void print(StructureConstPtr struct, PVStructurePtr pv)
{
if(struc) {
cout &lt;&lt; *struc &lt;&lt; endl;
if(struct) {
cout &lt;&lt; *struct &lt;&lt; endl;
} else {
cout &lt;&lt; "nullptr\n"
}
if(pv) {
cout &lt;&lt; *.struc &lt;&lt; endl;
cout &lt;&lt; *.struct &lt;&lt; endl;
} else {
cout &lt;&lt; "nullptr\n"
}
}
</code></pre>
<p>Now it can be done as follows:</p>
<pre><code> void print(StructureConstPtr struc, PVStructurePtr pv)
<pre><code> void print(StructureConstPtr struct, PVStructurePtr pv)
{
cout &lt;&lt; struc &lt;&lt; endl;
cout &lt;&lt; struct &lt;&lt; endl;
cout &lt;&lt; pv &lt;&lt; endl;
}
</code></pre>
<h2>New template version of Structure::getField</h2>
<p>A new template getField method has been added to Structure</p>
<p>template<typename FT >
std::tr1::shared_ptr&lt; const FT > getField(std::string const &amp;fieldName) const </p>
<p>Can be used, for example, as follows:</p>
<pre><code>StructurePtr tsStruc = struc-&gt;getField&lt;Structure&gt;("timeStamp");
</code></pre>
<h2>Fixes for static initialisation order issues</h2>
<p>Certain static builds (in particular Windows builds) of applications using
pvData had issues due to PVStructure::DEFAULT_ID being used before being initialised. This has been fixed.</p>
<h2>CreateRequest change</h2>
<p>createRequest could cause a SEGFAULT if passed a bad argument.
This has been changed so the it returns a null pvStructure
and provides an error.</p>
<h1>Release 4.0.3</h1>
<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>
<li>array semantics now enforce Copy On Write.</li>
<li>String no longer defined.</li>
@@ -243,31 +70,21 @@ and provides an error.</p>
<li>copy is new.</li>
<li>monitorPlugin is new.</li>
</ul>
<h2>New Semantics for Arrays</h2>
<p>PVScalarArray, PVStructureArray, and PVUnionArray all enforce COW (Copy On Write) Semantics.
In order to limit memory usage the storage for raw data is managed via a new shared<em>vector facility.
In order to limit memory usage the storage for raw data is managed via a new shared_vector facility.
This allows multiple instances of array data to use the shared raw data.
COW is implemented via shared</em>vectors of const data, i. e. data that can not be modified.</p>
COW is implemented via shared_vectors of const data, i. e. data that can not be modified.</p>
<h2>String no longer defined</h2>
<p>This is replaced by std::string.</p>
<h2>timeStamp and valueAlarm name changes</h2>
<p>In timeStamp nanoSeconds is changed to nanoseconds.</p>
<p>In valueAlarm hysteresis is changed to hysteresis</p>
<p>In valueAlarm hystersis is changed to hysteresis</p>
<h2>toString replaced by stream I/O</h2>
<p>pvData.h and pvIntrospect no longer defines toString
Instead they have stream support.
pvIntrospect uses method dump and pvData uses dumpValue.
For example:</p>
<pre><code> PVDoublePtr pvValue;
String buffer;
pvValue-&gt;toString(&amp;buffer);
@@ -276,40 +93,27 @@ For example:</p>
pvValue-&gt;getField()-&gt;toString(&amp;buffer);
cout &lt;&lt; buffer &lt;&lt; evdl;
</code></pre>
<p>is replaced by</p>
<pre><code> PVDoublePtr pvValue;
cout &lt;&lt; *pvValue &lt;&lt; endl
cout &lt;&lt; *pvValue-&gt;getField() &lt;&lt; endl;
</code></pre>
<h2>union is a new basic type.</h2>
<p>There are two new basic types: union_t and unionArray.</p>
<p>A union is like a structure that has a single subfield.
There are two flavors:</p>
<ul>
<li><b>variant union</b> The field can have any type.</li>
<li><b>varient union</b> The field can have any type.</li>
<li><b>union</b> The field can any of specified set of types.</li>
</ul>
<p>The field type can be dynamically changed.</p>
<h2>copy </h2>
<h2>copy</h2>
<p>This consists of createRequest and pvCopy.
createRequest was moved from pvAccess to here.
pvCopy is moved from pvDatabaseCPP and now depends
only on pvData, i.e. it no longer has any knowledge of PVRecord.</p>
only on pvData, i. e. it no longer has any knowledge of PVRecord.</p>
<h2>monitorPlugin</h2>
<p>This is for is for use by code that implements pvAccess monitors.
This is prototype and is subject to debate.</p>
<h1>Release 3.0.2</h1>
<p>This was the starting point for RELEASE_NOTES</p>
<p>This was the starting point for RELEASE_NOTES</p>

View File

@@ -1,147 +1,13 @@
Release 6.0.0
=============
Release 4.1 IN DEVELOPMENT
===========
The main changes since release 5.0.4 are:
The main changes since release 4.0 are:
* Linux shared library version added
* Headers have been moved into pv directories
* Bitset functions declared const where possible
* Bitset::swap added
* Requester::message has default implementation
* Serialization/deserialization helpers added
* Non-template getSubField char* overload added
* MonitorPlugin deprecated
* Field name validation performed
* Now builds for Cygwin and MinGW targets
* Fix for debug build issue.
* New license file replaces LICENSE and COPYRIGHT
Shared library version added
----------------------------
Linux shared library version numbers have been added by setting SHRLIB_VERSION
(to 6.0 in this case). So shared object will be libpvData.so.6.0 instead of
libpvData.so.
Headers have been moved into pv directories
-------------------------------------------
E.g. src/property/alarm.h -> src/property/pv/alarm.h
This facilitates using some IDEs such as Qt Creator.
Requester::message has default implementation
---------------------------------------------
Requester::message is no longer pure virtual. Default implementation sends
string to std::cerr.
Serialization/deserialization helpers added
-------------------------------------------
A helper function, serializeToVector, has been added which serializes a
Serializable object into a standard vector of UInt8s.
Similarly a function deserializeFromVector deserializes a standard vector into
a Deserializable object.
A function deserializeFromBuffer deserializes a ByteBuffer into a
Deserializable object.
Field name validation performed
-------------------------------
On creating a Structure or Union the field names are now validated.
Valid characters for a field name are upper or lowercase letters, numbers and
underscores and intial numbers are invalid, i.e. names must be of the form
[A-Za-z_][A-Za-z0-9_]*.
Now builds for Cygwin and MinGW targets
---------------------------------------
Includes cross-compiling MinGW on Linux.
Release 5.0.4
=============
The changes since release 5.0.3 are:
* Fixed bitset serialization (issue #24)
* Fixed truncation in BitSet::or_and (issue #27)
Fixed bitset serialization (issue #24)
--------------------------------------
C++ bitset serialization was not consistent with the C++ deserialization and
Java code in some instances (depending on the endianness of the serializer and
deserializer) when the number of bits was 56-63 modulo 64. C++ serialization
has been fixed.
Fix exposed issue in deserialization on 32-bit platforms which
has also been corrected.
Fixed truncation in BitSet::or_and (issue #27)
----------------------------------------------
If n, n1 and n2 words are used to store the values of the bitsets bitset,
bitset1 and bitset2 respectively then max(n, min(n1,n2)) words are needed
to store bitset.or_(bitset1, bitset2).
Previously min(n1,n2) words were used and the result would be truncated in
some instances. This has been fixed.
Release 5.0.3
=============
The only change since release 5.0.2 is:
Fixed buffer overflow in PVUnion::serialize() (issue #20)
---------------------------------------------------------
A PVUnion whose stored value was null was serialized without checking
whether the buffer had sufficient capacity. This has been fixed by calling
ensureBuffer().
Release 5.0.2
=============
The main changes since release 4.0.3 are:
* Deprecated getXXXField() methods have been removed from PVStructure
* Convert copy methods and equals operators (re)moved
* Convert::copyUnion now always copies between subfields.
* New method getSubFieldT, like getSubField except it throws an exception
* findSubField method removed from PVStructure
* New stream operators for Field and PVField are provided
* New template versions of Structure::getField
* Fixes for static initialisation order issues
* CreateRequest prevents a possible SEGFAULT
Deprecated getXXXField methods have been removed from PVStructure
-----------------------------------------------------------------
The following methods have been removed from PVStructure
* getBooleanField
* getByteField, getShortField, getIntField, getLongField
* getUByteField, getUShortField, getUIntField, getULongField
* getStringField
* getStructureField, getUnionField
* getScalarArrayField, getStructureArrayField, getUnionArrayField
Use template getSubField instead, e.g. use
getSubField< PVInt >(fieldName)
in place of
getIntField(fieldName)
* CreateRequest prevents a possible SEGFAULT.
* New stream operators for Field and PVField are provided.
* New method getSubFieldT that is like getSubField except that it throws exception
Convert copy methods and equals operators
-----------------------------------------
@@ -155,7 +21,7 @@ Methods
PVField::copyUnchecked(const PVField& from)
were added to allow unchecked copies, to gain performance
where added to allow unchecked copies, to gain performance
where checked are not needed (anymore).
In addition:
@@ -163,33 +29,20 @@ In addition:
- equals methods were remove in favour of PVField::operator==.
- operator== methods where moved to pvIntrospect.h and pvData.h
Convert::copyUnion
-----------------
Before this method, depending on types for to and from,
sometimes did a shallow copy, i.e. just made to shared_ptr for to
sometimes did a shallow cppy, i. e. just made to shared_ptr for to
share the same data as from.
Now it always copies between the subfield of to and from.
New method getSubFieldT, like getSubField except it throws an exception
CreateRequest change
--------------------
PVStructure has a new template member
getSubFieldT(std::string const &fieldName)
that is like <b>getSubField</b> except that it throws a runtime_error
instead of returning null.
findSubField method removed from PVStructure
--------------------------------------------
This was mainly used in the implementation of getSubField. With a change to
the latter, findSubField was removed.
createRequest could cause a SEGFAULT if passed a bad argument.
This has been changed so the it returns a null pvStructure
and provies an error.
New stream operators
--------------------
@@ -198,15 +51,15 @@ New steam operators are available for Field and PVField.
Before to print a Field (or any extension) or a PVField (or any extension)
it was necessary to have code like:
void print(StructureConstPtr struc, PVStructurePtr pv)
void print(StructureConstPtr struct, PVStructurePtr pv)
{
if(struc) {
cout << *struc << endl;
if(struct) {
cout << *struct << endl;
} else {
cout << "nullptr\n"
}
if(pv) {
cout << *.struc << endl;
cout << *.struct << endl;
} else {
cout << "nullptr\n"
}
@@ -214,43 +67,21 @@ it was necessary to have code like:
Now it can be done as follows:
void print(StructureConstPtr struc, PVStructurePtr pv)
void print(StructureConstPtr struct, PVStructurePtr pv)
{
cout << struc << endl;
cout << struct << endl;
cout << pv << endl;
}
New template version of Structure::getField
--------------------------------------------
A new template getField method has been added to Structure
template<typename FT >
std::tr1::shared_ptr< const FT > getField(std::string const &fieldName) const
Can be used, for example, as follows:
StructurePtr tsStruc = struc->getField<Structure>("timeStamp");
Fixes for static initialisation order issues
--------------------------------------------
Certain static builds (in particular Windows builds) of applications using
pvData had issues due to PVStructure::DEFAULT_ID being used before being initialised. This has been fixed.
CreateRequest change
New method getSubFieldT that is like getSubField except that it throws exception
--------------------
createRequest could cause a SEGFAULT if passed a bad argument.
This has been changed so the it returns a null pvStructure
and provides an error.
<b>PVStructure</b> has a new template member <b>getSubFieldT(std::string const &fieldName)</b>
that is like <b>getSubField</b> except that it throws a runtime_error
instead of returning null.
Release 4.0.3
=============
Release 4.0
===========
The main changes since release 3.0.2 are:
@@ -282,7 +113,7 @@ timeStamp and valueAlarm name changes
In timeStamp nanoSeconds is changed to nanoseconds.
In valueAlarm hysteresis is changed to hysteresis
In valueAlarm hystersis is changed to hysteresis
toString replaced by stream I/O
@@ -316,7 +147,7 @@ There are two new basic types: union_t and unionArray.
A union is like a structure that has a single subfield.
There are two flavors:
* <b>variant union</b> The field can have any type.
* <b>varient union</b> The field can have any type.
* <b>union</b> The field can any of specified set of types.
The field type can be dynamically changed.
@@ -327,7 +158,7 @@ copy
This consists of createRequest and pvCopy.
createRequest was moved from pvAccess to here.
pvCopy is moved from pvDatabaseCPP and now depends
only on pvData, i.e. it no longer has any knowledge of PVRecord.
only on pvData, i. e. it no longer has any knowledge of PVRecord.
monitorPlugin
-------------

17
documentation/TODO.html Normal file
View File

@@ -0,0 +1,17 @@
<h1>TODO</h1>
<h2>printer</h2>
<p>pv/printer.h is not used.</p>
<h2>doxygen</h2>
<p>There is a lot of public code that does not have doxygen tags.</p>
<h2>postMonitor: PVUnion, PVUnionArray, and PVStructureArray</h2>
<p>PVUnion, PVUnionArray, and PVStructureArray all have elements
that are treated like a top level field.</p>
<p>Currently if a subField of any of these is changed postMonitor is not called for the field itself.</p>
<p>David asked if this could be changed so that it is called.
Marty thinks this may not be a good idea.</p>
<h2>valueAlarm</h2>
<p>normativeTypes.html describes valueAlarm only for a value field that has type
double.
The implementation also supports all the numeric scalar types.</p>
<h2>monitorPlugin</h2>
<p>A debate is on-going about what semantics should be.</p>

View File

@@ -6,6 +6,19 @@ doxygen
There is a lot of public code that does not have doxygen tags.
postMonitor: PVUnion, PVUnionArray, and PVStructureArray
--------
PVUnion, PVUnionArray, and PVStructureArray all have elements
that are treated like a top level field.
Currently if a subField of any of these is changed postMonitor is not called for the field itself.
David asked if this could be changed so that it is called.
Marty thinks this may not be a good idea.
valueAlarm
---------

View File

@@ -35,10 +35,23 @@
<div class="head">
<h1>EPICS pvDataCPP</h1>
<!-- Maturity: Working Draft or Request for Comments, or Recommendation, and date. -->
<h2 class="nocount">Release 6.0.0 - 2016.08.01</h2>
<h2 class="nocount">EPICS v4 Working Group, Working Draft, 23-June-2015</h2>
<dl>
<dt>Latest version:</dt>
<dd><a
href="pvDataCPP.html">pvDataCPP.html</a>
</dd>
<dt>This version:</dt>
<dd><a
href="pvDataCPP_20150623.html">pvDataCPP_20150623.html</a>
</dd>
<dt>Previous version:</dt>
<dd><a
href="pvDataCPP_20141110.html">pvDataCPP_20141110.html</a>
</dd>
<dt>Editors:</dt>
<dd>Marty Kraimer, BNL</dd>
<dd>Michael Davidsaver, BNL</dd>
@@ -66,8 +79,7 @@ V4 control system programming environment:<br />
<h2 class="nocount">Status of this Document</h2>
<p>This is the 01-August-2016 version for the 6.0.0 release 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.
@@ -4875,7 +4887,7 @@ Monitor provides:
monitor. It, together with the queue facility, provides support for
monitor queues.
</dd>
<dt>monitorPlugin [Deprecated]</dt>
<dt>monitorPlugin</dt>
<dd>This is support for implementing monitor plugins.
A monitor plugin can be developed that has no knowledge
of pvAccess but only pvData.
@@ -5057,7 +5069,7 @@ where
<dl>
<dt>monitor</dt>
<dd>Used by code that implements pvAccess monitors.</dd>
<dt>monitorPlugin [Deprecated]</dt>
<dt>monitorPlugin</dt>
<dd>Code that provides special semantics for monitors.</dd>
</dl>
<h3>monitor</h3>
@@ -5173,8 +5185,6 @@ It has the methods:</p>
</dl>
<h3>monitorPlugin</h3>
<p>[ MonitorPlugin and related classes MonitorPluginCreator and
MonitorPluginManager are deprecated.]</p>
<pre>
class MonitorPlugin
{

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -6,38 +6,16 @@
#
# Author: Ralph Lange <ralph.lange@gmx.de>
# Copyright (C) 2013 Helmholtz-Zentrum Berlin für Materialien und Energie GmbH
# Copyright (C) 2014-2016 ITER Organization.
# Copyright (C) 2014-2015 ITER Organization.
# All rights reserved. Use is subject to license terms.
installTool () {
local module=$1
local version=$2
wget -nv https://openepics.ci.cloudbees.com/job/${module}-${version}_Build/lastSuccessfulBuild/artifact/${module,,}-${version}.CB-dist.tar.gz
tar -xzf ${module,,}-${version}.CB-dist.tar.gz
}
installE4 () {
local module=$1
local branch=$2
# If microbench version does not exist, try without
if [ "${MB}" = "WITH_MICROBENCH" ]; then
if ! wget -nv https://openepics.ci.cloudbees.com/job/e4-cpp-${module}-${branch}-build/BASE=${BASE},MB=WITH_MICROBENCH/lastSuccessfulBuild/artifact/${module}.CB-dist.tar.gz; then
wget -nv https://openepics.ci.cloudbees.com/job/e4-cpp-${module}-${branch}-build/BASE=${BASE},MB=NO_MICROBENCH/lastSuccessfulBuild/artifact/${module}.CB-dist.tar.gz
fi
else
wget -nv https://openepics.ci.cloudbees.com/job/e4-cpp-${module}-${branch}-build/BASE=${BASE},MB=NO_MICROBENCH/lastSuccessfulBuild/artifact/${module}.CB-dist.tar.gz
fi
tar -xzf ${module}.CB-dist.tar.gz
}
###########################################
# Defaults for EPICS Base and MB
# Determine EPICS Base version
DEFAULT_BASE=3.15.4
BASE=${BASE:-${DEFAULT_BASE}}
MB=${MB:-"NO_MICROBENCH"}
DEFAULT_BASE=3.14.12.5
BASE=${1:-${DEFAULT_BASE}}
USE_MB=${2:-"MB_NO"}
###########################################
# Fetch and unpack dependencies
@@ -48,8 +26,8 @@ rm -fr ${STUFF}
mkdir -p ${STUFF}
cd ${STUFF}
installTool Boost 1.61.0
installTool Base ${BASE}
wget -nv https://openepics.ci.cloudbees.com/job/Base-${BASE}_Build/lastSuccessfulBuild/artifact/base-${BASE}.CB-dist.tar.gz
tar -xzf base-${BASE}.CB-dist.tar.gz
###########################################
# Build
@@ -75,4 +53,4 @@ make runtests
###########################################
# Create distribution
tar czf pvData.CB-dist.tar.gz lib include LICENSE
tar czf pvData.CB-dist.tar.gz lib include COPYRIGHT LICENSE

View File

@@ -6,39 +6,14 @@
#
# Author: Ralph Lange <ralph.lange@gmx.de>
# Copyright (C) 2013 Helmholtz-Zentrum Berlin für Materialien und Energie GmbH
# Copyright (C) 2014-2016 ITER Organization.
# Copyright (C) 2014-2015 ITER Organization.
# All rights reserved. Use is subject to license terms.
installTool () {
local module=$1
local version=$2
wget -nv https://openepics.ci.cloudbees.com/job/${module}-${version}_Build/lastSuccessfulBuild/artifact/${module,,}-${version}.CB-dist.tar.gz
tar -xzf ${module,,}-${version}.CB-dist.tar.gz
}
installE4 () {
local module=$1
local branch=$2
# If microbench version does not exist, try without
if [ "${MB}" = "WITH_MICROBENCH" ]; then
if ! wget -nv https://openepics.ci.cloudbees.com/job/e4-cpp-${module}-${branch}-build/BASE=${BASE},MB=WITH_MICROBENCH/lastSuccessfulBuild/artifact/${module}.CB-dist.tar.gz; then
wget -nv https://openepics.ci.cloudbees.com/job/e4-cpp-${module}-${branch}-build/BASE=${BASE},MB=NO_MICROBENCH/lastSuccessfulBuild/artifact/${module}.CB-dist.tar.gz
fi
else
wget -nv https://openepics.ci.cloudbees.com/job/e4-cpp-${module}-${branch}-build/BASE=${BASE},MB=NO_MICROBENCH/lastSuccessfulBuild/artifact/${module}.CB-dist.tar.gz
fi
tar -xzf ${module}.CB-dist.tar.gz
}
###########################################
# Defaults for EPICS Base and parameters
# Set EPICS Base version and upload target
BASE=3.15.4
PUBLISH=${PUBLISH:-NO}
BRANCH=${BRANCH:-master}
MB=NO_MICROBENCH
BASE=3.15.2
PUBLISH=${1:-DONT}
###########################################
# Fetch and unpack dependencies
@@ -49,14 +24,16 @@ rm -fr ${STUFF}
mkdir -p ${STUFF}
cd ${STUFF}
installTool Doxygen 1.8.11
wget -nv https://openepics.ci.cloudbees.com/job/Doxygen-1.8.3_Build/lastSuccessfulBuild/artifact/doxygen-1.8.3.CB-dist.tar.gz
tar -xzf doxygen-1.8.3.CB-dist.tar.gz
###########################################
# Generate
cd ${WORKSPACE}
installE4 pvData ${BRANCH}
wget -nv https://openepics.ci.cloudbees.com/job/pvDataCPP_Build/BASE=${BASE},USE_MB=MB_NO/lastSuccessfulBuild/artifact/pvData.CB-dist.tar.gz
tar -xzf pvData.CB-dist.tar.gz
export PATH=${STUFF}/bin:${PATH}
@@ -65,10 +42,10 @@ doxygen
###########################################
# Publish
if [ "${PUBLISH}" != "NO" ]; then
if [ "${PUBLISH}" != "DONT" ]; then
# Upload explicit dummy to ensure target directory exists
echo "Created by CloudBees Jenkins upload job. Should be deleted as part of the job." > DUMMY
rsync -q -e ssh DUMMY epics-jenkins@web.sourceforge.net:/home/project-web/epics-pvdata/htdocs/docbuild/pvDataCPP/${PUBLISH}/
rsync -q -e ssh DUMMY epics-jenkins@web.sourceforge.net:/home/project-web/epics-pvdata/htdocs/docbuild/pvDataCPP/${PUBLISH}/DUMMY
rsync -aqP --delete -e ssh documentation epics-jenkins@web.sourceforge.net:/home/project-web/epics-pvdata/htdocs/docbuild/pvDataCPP/${PUBLISH}/
fi

View File

@@ -3,6 +3,9 @@
TOP = ..
include $(TOP)/configure/CONFIG
INSTALL_INCLUDE = $(INSTALL_LOCATION)/include/pv
USR_INCLUDES += -I$(INSTALL_LOCATION)/include
PVDATA_SRC = $(TOP)/src
include $(PVDATA_SRC)/misc/Makefile
@@ -17,8 +20,5 @@ LIBRARY = pvData
pvData_LIBS += Com
# shared library ABI version.
SHRLIB_VERSION ?= 6.0
include $(TOP)/configure/RULES

View File

@@ -2,8 +2,8 @@
SRC_DIRS += $(PVDATA_SRC)/copy
INC += pv/createRequest.h
INC += pv/pvCopy.h
INC += createRequest.h
INC += pvCopy.h
LIBSRCS += createRequest.cpp
LIBSRCS += pvCopy.cpp

View File

@@ -1,13 +1,12 @@
/*
* Copyright information and license terms for this software can be
* found in the file LICENSE that is included with the distribution
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* pvAccessCPP is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
#include <string>
#include <sstream>
#include <epicsMutex.h>
#define epicsExportSharedSymbols
#include <pv/pvData.h>

View File

@@ -1,7 +1,8 @@
/*createRequest.h*/
/*
* Copyright information and license terms for this software can be
* found in the file LICENSE that is included with the distribution
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* pvDataCPP is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
#ifndef CREATEREQUEST_H
@@ -37,6 +38,7 @@ class epicsShareClass CreateRequest {
* Create a request structure for the create calls in Channel.
* See the package overview documentation for details.
* @param request The field request. See the package overview documentation for details.
* @param requester The requester;
* @return The request PVStructure if a valid request was given.
* If a NULL PVStructure is returned then getMessage will return
* the reason.

View File

@@ -1,7 +1,8 @@
/* pvCopy.cpp */
/*
* Copyright information and license terms for this software can be
* found in the file LICENSE that is included with the distribution
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvData is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
/**
* @author Marty Kraimer
@@ -12,8 +13,6 @@
#include <memory>
#include <sstream>
#include <epicsThread.h>
#define epicsExportSharedSymbols
#include <pv/thread.h>
@@ -82,7 +81,7 @@ PVCopyPtr PVCopy::create(
pvStructure = pvRequest->getSubField<PVStructure>(structureName);
if(!pvStructure) return NULLPVCopy;
}
} else if(pvStructure->getSubField<PVStructure>("field")) {
} else if(pvStructure->getSubField("field")) {
pvStructure = pvRequest->getSubField<PVStructure>("field");
}
PVCopyPtr pvCopy = PVCopyPtr(new PVCopy(pvMaster));
@@ -349,7 +348,7 @@ bool PVCopy::init(epics::pvData::PVStructurePtr const &pvRequest)
if(len==string::npos) entireMaster = true;
if(len==0) entireMaster = true;
PVStructurePtr pvOptions;
if(len==1) {
if(len==1 && pvRequest->getSubField("_options")) {
pvOptions = pvRequest->getSubField<PVStructure>("_options");
}
if(entireMaster) {
@@ -442,8 +441,11 @@ CopyNodePtr PVCopy::createStructureNodes(
PVFieldPtr copyPVField = copyPVFields[i];
string fieldName = copyPVField->getFieldName();
PVStructurePtr requestPVStructure = pvFromRequest->getSubField<PVStructure>(fieldName);
PVStructurePtr pvSubFieldOptions = requestPVStructure->getSubField<PVStructure>("_options");
PVStructurePtr requestPVStructure = static_pointer_cast<PVStructure>(
pvFromRequest->getSubField(fieldName));
PVStructurePtr pvSubFieldOptions;
PVFieldPtr pvField = requestPVStructure->getSubField("_options");
if(pvField) pvSubFieldOptions = static_pointer_cast<PVStructure>(pvField);
PVFieldPtr pvMasterField;
PVFieldPtrArray const & pvMasterFields = pvMasterStructure->getPVFields();
for(size_t j=0; i<pvMasterFields.size(); j++ ) {
@@ -549,7 +551,7 @@ void PVCopy::updateStructureNodeFromBitSet(
CopyNodePtrArrayPtr nodes = structureNode->nodes;
for(size_t i=0; i<nodes->size(); i++) {
CopyNodePtr node = (*nodes)[i];
PVFieldPtr pvField = pvCopy->getSubFieldT(node->structureOffset);
PVFieldPtr pvField = pvCopy->getSubField(node->structureOffset);
if(node->isStructure) {
PVStructurePtr xxx = static_pointer_cast<PVStructure>(pvField);
CopyStructureNodePtr subStructureNode =

View File

@@ -1,7 +1,8 @@
/* pvCopy.h */
/*
* Copyright information and license terms for this software can be
* found in the file LICENSE that is included with the distribution
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvData is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
/**
* @author Marty Kraimer
@@ -115,8 +116,8 @@ public:
PVStructurePtr const &masterPVStructure,
PVFieldPtr const &masterPVField);
/**
* Given an offset in the copy get the corresponding field in pvMaster.
* @param structureOffset The offset in the copy.
* Given a offset in the copy get the corresponding field in pvMaster.
* @param offset The offset in the copy.
*/
PVFieldPtr getMasterPVField(std::size_t structureOffset);
/**
@@ -158,7 +159,7 @@ public:
BitSetPtr const &bitSet);
/**
* Get the options for the field at the specified offset.
* @param fieldOffset the offset in copy.
* @param offset the offset in copy.
* @returns A NULL is returned if no options were specified for the field.
* If options were specified,PVStructurePtr is a structures
* with a set of PVString subfields that specify name,value pairs.s

View File

@@ -1,6 +1,7 @@
/*
* Copyright information and license terms for this software can be
* found in the file LICENSE that is included with the distribution
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvData is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
/**
* @author mes

View File

@@ -1,7 +1,8 @@
/* Convert.cpp */
/*
* Copyright information and license terms for this software can be
* found in the file LICENSE that is included with the distribution
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvData is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
/**
* @author mrk
@@ -12,8 +13,6 @@
#include <stdexcept>
#include <typeinfo>
#include <epicsMutex.h>
#define epicsExportSharedSymbols
#include <pv/lock.h>
#include <pv/pvIntrospect.h>

View File

@@ -1,13 +1,14 @@
/*FieldCreateFactory.cpp*/
/*
* Copyright information and license terms for this software can be
* found in the file LICENSE that is included with the distribution
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvData is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
/**
* @author mrk
*/
#if defined(_WIN32) && !defined(NOMINMAX)
#ifdef _WIN32
#define NOMINMAX
#endif
@@ -18,8 +19,6 @@
#include <stdexcept>
#include <sstream>
#include <epicsMutex.h>
#define epicsExportSharedSymbols
#include <pv/lock.h>
#include <pv/pvIntrospect.h>
@@ -948,53 +947,9 @@ StructureConstPtr FieldCreate::createStructure () const
return createStructure(fieldNames,fields);
}
namespace {
bool xisalnum(char c)
{
return (c>='a' && c<='z') || (c>='A' && c<='Z') || (c>='0' && c<='9');
}
void validateFieldName(const std::string& n)
{
// enforce [A-Za-z_][A-Za-z0-9_]*
if(n.size()==0)
throw std::invalid_argument("zero length field names not allowed");
if(n[0]>='0' && n[0]<='9') {
std::ostringstream msg;
msg<<"Field name \""<<n<<"\" must begin with A-Z, a-z, or '_'";
throw std::invalid_argument(msg.str());
}
for(size_t i=0, N=n.size(); i<N; i++)
{
char c = n[i];
if(xisalnum(c)) {}
else {
switch(c){
case '_':
break;
default:
{
std::ostringstream msg;
msg<<"Invalid charactor '"<<c<<"' ("<<(int)c<<") in field name \""<<n<<"\" "
"must be A-Z, a-z, 0-9, or '_'";
throw std::invalid_argument(msg.str());
}
}
}
}
}
void validateFieldNames(const StringArray& l)
{
for(StringArray::const_iterator it=l.begin(), end=l.end(); it!=end; ++it)
validateFieldName(*it);
}
}
StructureConstPtr FieldCreate::createStructure (
StringArray const & fieldNames,FieldConstPtrArray const & fields) const
{
validateFieldNames(fieldNames);
// TODO use std::make_shared
std::tr1::shared_ptr<Structure> sp(new Structure(fieldNames,fields), Field::Deleter());
StructureConstPtr structure = sp;
@@ -1006,7 +961,6 @@ StructureConstPtr FieldCreate::createStructure (
StringArray const & fieldNames,
FieldConstPtrArray const & fields) const
{
validateFieldNames(fieldNames);
// TODO use std::make_shared
std::tr1::shared_ptr<Structure> sp(new Structure(fieldNames,fields,id), Field::Deleter());
StructureConstPtr structure = sp;
@@ -1025,7 +979,6 @@ StructureArrayConstPtr FieldCreate::createStructureArray(
UnionConstPtr FieldCreate::createUnion (
StringArray const & fieldNames,FieldConstPtrArray const & fields) const
{
validateFieldNames(fieldNames);
// TODO use std::make_shared
std::tr1::shared_ptr<Union> sp(new Union(fieldNames,fields), Field::Deleter());
UnionConstPtr punion = sp;
@@ -1037,7 +990,6 @@ UnionConstPtr FieldCreate::createUnion (
StringArray const & fieldNames,
FieldConstPtrArray const & fields) const
{
validateFieldNames(fieldNames);
// TODO use std::make_shared
std::tr1::shared_ptr<Union> sp(new Union(fieldNames,fields,id), Field::Deleter());
UnionConstPtr punion = sp;
@@ -1087,7 +1039,6 @@ StructureConstPtr FieldCreate::appendFields(
StringArray const & fieldNames,
FieldConstPtrArray const & fields) const
{
validateFieldNames(fieldNames);
StringArray const & oldNames = structure->getFieldNames();
FieldConstPtrArray const & oldFields = structure->getFields();
size_t oldLen = oldNames.size();

View File

@@ -2,7 +2,7 @@
SRC_DIRS += $(PVDATA_SRC)/factory
INC += pv/factory.h
INC += factory.h
LIBSRCS += TypeFunc.cpp
LIBSRCS += FieldCreateFactory.cpp
LIBSRCS += PVField.cpp

View File

@@ -1,7 +1,8 @@
/*PVArray.cpp*/
/*
* Copyright information and license terms for this software can be
* found in the file LICENSE that is included with the distribution
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvData is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
/**
* @author mrk

View File

@@ -1,13 +1,14 @@
/*PVDataCreateFactory.cpp*/
/*
* Copyright information and license terms for this software can be
* found in the file LICENSE that is included with the distribution
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvData is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
/**
* @author mrk
*/
#if defined(_WIN32) && !defined(NOMINMAX)
#ifdef _WIN32
#define NOMINMAX
#endif
@@ -16,8 +17,6 @@
#include <string>
#include <cstdio>
#include <epicsMutex.h>
#define epicsExportSharedSymbols
#include <pv/lock.h>
#include <pv/pvIntrospect.h>

View File

@@ -1,7 +1,8 @@
/*PVField.cpp*/
/*
* Copyright information and license terms for this software can be
* found in the file LICENSE that is included with the distribution
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvData is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
/**
* @author mrk
@@ -11,8 +12,6 @@
#include <string>
#include <cstdio>
#include <epicsMutex.h>
#define epicsExportSharedSymbols
#include <pv/lock.h>
#include <pv/pvData.h>
@@ -25,7 +24,8 @@ using std::string;
namespace epics { namespace pvData {
PVField::PVField(FieldConstPtr field)
: parent(NULL),field(field),
: notImplemented("not implemented"),
parent(NULL),field(field),
fieldOffset(0), nextFieldOffset(0),
immutable(false)
{

View File

@@ -1,7 +1,8 @@
/*PVScalar.cpp*/
/*
* Copyright information and license terms for this software can be
* found in the file LICENSE that is included with the distribution
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvData is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
/**
* @author mrk
@@ -28,4 +29,22 @@ namespace epics { namespace pvData {
{
return static_pointer_cast<const Scalar>(PVField::getField());
}
template<>
std::ostream& PVScalarValue<int8>::dumpValue(std::ostream& o) const
{
return o << static_cast<int>(get());
}
template<>
std::ostream& PVScalarValue<uint8>::dumpValue(std::ostream& o) const
{
return o << static_cast<unsigned int>(get());
}
template<>
std::ostream& PVScalarValue<boolean>::dumpValue(std::ostream& o) const
{
return o << std::boolalpha << static_cast<bool>(get());
}
}}

View File

@@ -1,7 +1,8 @@
/*PVScalarArray.cpp*/
/*
* Copyright information and license terms for this software can be
* found in the file LICENSE that is included with the distribution
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvData is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
/**
* @author mrk

View File

@@ -1,7 +1,8 @@
/*PVStructure.cpp*/
/*
* Copyright information and license terms for this software can be
* found in the file LICENSE that is included with the distribution
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvData is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
/**
* @author mrk
@@ -51,6 +52,7 @@ PVStructure::PVStructure(StructureConstPtr const & structurePtr)
size_t numberFields = structurePtr->getNumberFields();
FieldConstPtrArray const & fields = structurePtr->getFields();
StringArray const & fieldNames = structurePtr->getFieldNames();
// PVFieldPtrArray * xxx = const_cast<PVFieldPtrArray *>(&pvFields);
pvFields.reserve(numberFields);
PVDataCreatePtr pvDataCreate = getPVDataCreate();
for(size_t i=0; i<numberFields; i++) {
@@ -103,9 +105,9 @@ const PVFieldPtrArray & PVStructure::getPVFields() const
return pvFields;
}
PVFieldPtr PVStructure::getSubField(const char * fieldName) const
PVFieldPtr PVStructure::getSubField(string const &fieldName) const
{
PVField * field = getSubFieldImpl(fieldName, false);
PVField * field = getSubFieldImpl(fieldName.c_str(), false);
if (field)
return field->shared_from_this();
else
@@ -257,8 +259,9 @@ void PVStructure::deserialize(ByteBuffer *pbuffer,
void PVStructure::serialize(ByteBuffer *pbuffer,
SerializableControl *pflusher, BitSet *pbitSet) const {
size_t numberFields = this->getNumberFields();
size_t offset = this->getFieldOffset();
PVStructure* nonConstThis = const_cast<PVStructure*>(this);
size_t numberFields = nonConstThis->getNumberFields();
size_t offset = nonConstThis->getFieldOffset();
int32 next = pbitSet->nextSetBit(static_cast<uint32>(offset));
// no more changes or no changes in this structure

View File

@@ -1,7 +1,8 @@
/*PVStructureArray.cpp*/
/*
* Copyright information and license terms for this software can be
* found in the file LICENSE that is included with the distribution
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvData is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
/**
* @author mrk

View File

@@ -1,7 +1,8 @@
/*PVUnion.cpp*/
/*
* Copyright information and license terms for this software can be
* found in the file LICENSE that is included with the distribution
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvData is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
/**
* @author mse
@@ -144,10 +145,10 @@ void PVUnion::serialize(ByteBuffer *pbuffer, SerializableControl *pflusher) cons
if (variant)
{
// write introspection data
if (value.get() == 0) {
pflusher->ensureBuffer(1);
if (value.get() == 0)
pbuffer->put((int8)-1);
}else {
else
{
pflusher->cachedSerialize(value->getField(), pbuffer);
value->serialize(pbuffer, pflusher);
}

View File

@@ -1,7 +1,8 @@
/*PVUnionArray.cpp*/
/*
* Copyright information and license terms for this software can be
* found in the file LICENSE that is included with the distribution
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvData is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
/**
* @author mrk

View File

@@ -1,7 +1,8 @@
/* StandardField.cpp */
/*
* Copyright information and license terms for this software can be
* found in the file LICENSE that is included with the distribution
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvData is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
/**
* @author mrk
@@ -10,8 +11,6 @@
#include <cstdio>
#include <stdexcept>
#include <epicsMutex.h>
#define epicsExportSharedSymbols
#include <pv/lock.h>
#include <pv/pvIntrospect.h>

View File

@@ -1,7 +1,8 @@
/* StandardPVField.cpp */
/*
* Copyright information and license terms for this software can be
* found in the file LICENSE that is included with the distribution
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvData is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
/**
* @author mrk
@@ -9,8 +10,6 @@
#include <string>
#include <stdexcept>
#include <epicsMutex.h>
#define epicsExportSharedSymbols
#include <pv/lock.h>
#include <pv/pvIntrospect.h>
@@ -69,7 +68,7 @@ PVStructurePtr StandardPVField::enumerated(StringArray const &choices)
PVStructurePtr pvStructure = pvDataCreate->createPVStructure(field);
PVStringArray::svector cdata(choices.size());
std::copy(choices.begin(), choices.end(), cdata.begin());
pvStructure->getSubFieldT<PVStringArray>("choices")->replace(freeze(cdata));
pvStructure->getSubField<PVStringArray>("choices")->replace(freeze(cdata));
return pvStructure;
}
@@ -80,7 +79,7 @@ PVStructurePtr StandardPVField::enumerated(
PVStructurePtr pvStructure = pvDataCreate->createPVStructure(field);
PVStringArray::svector cdata(choices.size());
std::copy(choices.begin(), choices.end(), cdata.begin());
pvStructure->getSubFieldT<PVStringArray>("value.choices")->replace(freeze(cdata));
pvStructure->getSubField<PVStringArray>("value.choices")->replace(freeze(cdata));
return pvStructure;
}

View File

@@ -1,7 +1,8 @@
/*TypeFunc.cpp*/
/*
* Copyright information and license terms for this software can be
* found in the file LICENSE that is included with the distribution
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvData is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
/**
* @author mrk

18
src/factory/factory.h Normal file
View File

@@ -0,0 +1,18 @@
/*factory.h*/
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvData is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
/**
* @author mrk
*/
#ifndef FACTORY_H
#define FACTORY_H
namespace epics { namespace pvData {
enum DebugLevel{noDebug,lowDebug,highDebug};
}}
#endif /*FACTORY_H */

View File

@@ -1,7 +1,8 @@
/* printer.cpp */
/*
* Copyright information and license terms for this software can be
* found in the file LICENSE that is included with the distribution
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvData is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
#include <deque>

View File

@@ -1,17 +0,0 @@
/*factory.h*/
/*
* Copyright information and license terms for this software can be
* found in the file LICENSE that is included with the distribution
*/
/**
* @author mrk
*/
#ifndef FACTORY_H
#define FACTORY_H
namespace epics { namespace pvData {
enum DebugLevel{noDebug,lowDebug,highDebug};
}}
#endif /*FACTORY_H */

View File

@@ -1,6 +1,7 @@
/*
* Copyright information and license terms for this software can be
* found in the file LICENSE that is included with the distribution
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvData is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
/**
* @author Marty Kraimer

View File

@@ -2,29 +2,29 @@
SRC_DIRS += $(PVDATA_SRC)/misc
INC += pv/noDefaultMethods.h
INC += pv/lock.h
INC += pv/requester.h
INC += pv/serialize.h
INC += pv/bitSet.h
INC += pv/byteBuffer.h
INC += pv/epicsException.h
INC += pv/serializeHelper.h
INC += pv/event.h
INC += pv/thread.h
INC += pv/executor.h
INC += pv/timeFunction.h
INC += pv/timer.h
INC += pv/queue.h
INC += pv/messageQueue.h
INC += pv/destroyable.h
INC += pv/status.h
INC += pv/sharedPtr.h
INC += pv/localStaticLock.h
INC += pv/typeCast.h
INC += pv/sharedVector.h
INC += pv/templateMeta.h
INC += pv/current_function.h
INC += noDefaultMethods.h
INC += lock.h
INC += requester.h
INC += serialize.h
INC += bitSet.h
INC += byteBuffer.h
INC += epicsException.h
INC += serializeHelper.h
INC += event.h
INC += thread.h
INC += executor.h
INC += timeFunction.h
INC += timer.h
INC += queue.h
INC += messageQueue.h
INC += destroyable.h
INC += status.h
INC += sharedPtr.h
INC += localStaticLock.h
INC += typeCast.h
INC += sharedVector.h
INC += templateMeta.h
INC += current_function.h
LIBSRCS += byteBuffer.cpp
LIBSRCS += bitSet.cpp

View File

@@ -1,7 +1,8 @@
/* bitSet.cpp */
/*
* Copyright information and license terms for this software can be
* found in the file LICENSE that is included with the distribution
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvData is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
/**
* @author mes
@@ -9,37 +10,12 @@
#include <string.h>
#include <stdio.h>
#include <iostream>
#include <stdexcept>
#include <epicsMutex.h>
#define epicsExportSharedSymbols
#include <pv/lock.h>
#include <pv/serializeHelper.h>
#include <pv/bitSet.h>
/*
* BitSets are packed into arrays of "words." Currently a word is
* a long, which consists of 64 bits, requiring 6 address bits.
* The choice of word size is determined purely by performance concerns.
*/
#define ADDRESS_BITS_PER_WORD 6u
#define BITS_PER_WORD (1u << ADDRESS_BITS_PER_WORD)
#define BYTES_PER_WORD sizeof(uint64)
#define BIT_INDEX_MASK (BITS_PER_WORD - 1u)
/** Used to shift left or right for a partial word mask */
#define WORD_MASK ~((uint64)0)
// index of work containing this bit
#define WORD_INDEX(bitn) ((bitn)>>ADDRESS_BITS_PER_WORD)
// bit offset within word
#define WORD_OFFSET(bitn) ((bitn)&BIT_INDEX_MASK)
// the words vector should be size()d as small as posible,
// so the last word should always have a bit set when the set is not empty
#define CHECK_POST() assert(words.empty() || words.back()!=0)
namespace epics { namespace pvData {
BitSet::shared_pointer BitSet::create(uint32 nbits)
@@ -47,59 +23,88 @@ namespace epics { namespace pvData {
return BitSet::shared_pointer(new BitSet(nbits));
}
BitSet::BitSet() {}
BitSet::BitSet() : words(0), wordsLength(0), wordsInUse(0) {
initWords(BITS_PER_WORD);
BitSet::BitSet(uint32 nbits)
{
words.reserve((nbits == 0) ? 1 : WORD_INDEX(nbits-1) + 1);
}
BitSet::~BitSet() {}
BitSet::BitSet(uint32 nbits) : words(0), wordsLength(0), wordsInUse(0) {
initWords(nbits);
}
BitSet::~BitSet() {
delete[] words;
}
void BitSet::initWords(uint32 nbits) {
uint32 length = (nbits <= 0) ? 1 : wordIndex(nbits-1) + 1;
if (words) delete[] words;
words = new uint64[length];
memset(words, 0, sizeof(uint64)*length);
wordsLength = length;
}
void BitSet::recalculateWordsInUse() {
// step back from the end to find the first non-zero element
size_t nsize = words.size();
for(; nsize; nsize--) {
if(words[nsize-1])
// wordsInUse is unsigned
if (wordsInUse == 0)
return;
// Traverse the bitset until a used word is found
int32 i;
for (i = (int32)wordsInUse-1; i >= 0; i--)
if (words[i] != 0)
break;
}
words.resize(nsize);
CHECK_POST();
wordsInUse = i+1; // The new logical size
}
void BitSet::ensureCapacity(uint32 wordsRequired) {
words.resize(std::max(words.size(), (size_t)wordsRequired), 0);
if (wordsLength < wordsRequired) {
// create and copy
uint64* newwords = new uint64[wordsRequired];
memset(newwords, 0, sizeof(uint64)*wordsRequired);
memcpy(newwords, words, sizeof(uint64)*wordsLength);
if (words) delete[] words;
words = newwords;
wordsLength = wordsRequired;
}
}
void BitSet::expandTo(uint32 wordIndex) {
ensureCapacity(wordIndex+1);
uint32 wordsRequired = wordIndex+1;
if (wordsInUse < wordsRequired) {
ensureCapacity(wordsRequired);
wordsInUse = wordsRequired;
}
}
void BitSet::flip(uint32 bitIndex) {
uint32 wordIdx = WORD_INDEX(bitIndex);
uint32 wordIdx = wordIndex(bitIndex);
expandTo(wordIdx);
words[wordIdx] ^= (((uint64)1) << WORD_OFFSET(bitIndex));
words[wordIdx] ^= (((uint64)1) << (bitIndex % BITS_PER_WORD));
recalculateWordsInUse();
}
void BitSet::set(uint32 bitIndex) {
uint32 wordIdx = WORD_INDEX(bitIndex);
uint32 wordIdx = wordIndex(bitIndex);
expandTo(wordIdx);
words[wordIdx] |= (((uint64)1) << WORD_OFFSET(bitIndex));
words[wordIdx] |= (((uint64)1) << (bitIndex % BITS_PER_WORD));
}
void BitSet::clear(uint32 bitIndex) {
uint32 wordIdx = WORD_INDEX(bitIndex);
if (wordIdx >= words.size())
uint32 wordIdx = wordIndex(bitIndex);
if (wordIdx >= wordsInUse)
return;
words[wordIdx] &= ~(((uint64)1) << WORD_OFFSET(bitIndex));
words[wordIdx] &= ~(((uint64)1) << (bitIndex % BITS_PER_WORD));
recalculateWordsInUse();
}
@@ -112,13 +117,14 @@ namespace epics { namespace pvData {
}
bool BitSet::get(uint32 bitIndex) const {
uint32 wordIdx = WORD_INDEX(bitIndex);
return ((wordIdx < words.size())
&& ((words[wordIdx] & (((uint64)1) << WORD_OFFSET(bitIndex))) != 0));
uint32 wordIdx = wordIndex(bitIndex);
return ((wordIdx < wordsInUse)
&& ((words[wordIdx] & (((uint64)1) << (bitIndex % BITS_PER_WORD))) != 0));
}
void BitSet::clear() {
words.clear();
while (wordsInUse > 0)
words[--wordsInUse] = 0;
}
uint32 BitSet::numberOfTrailingZeros(uint64 i) {
@@ -147,8 +153,8 @@ namespace epics { namespace pvData {
int32 BitSet::nextSetBit(uint32 fromIndex) const {
uint32 u = WORD_INDEX(fromIndex);
if (u >= words.size())
uint32 u = wordIndex(fromIndex);
if (u >= wordsInUse)
return -1;
uint64 word = words[u] & (WORD_MASK << (fromIndex % BITS_PER_WORD));
@@ -156,7 +162,7 @@ namespace epics { namespace pvData {
while (true) {
if (word != 0)
return (u * BITS_PER_WORD) + numberOfTrailingZeros(word);
if (++u == words.size())
if (++u == wordsInUse)
return -1;
word = words[u];
}
@@ -165,8 +171,8 @@ namespace epics { namespace pvData {
int32 BitSet::nextClearBit(uint32 fromIndex) const {
// Neither spec nor implementation handle bitsets of maximal length.
uint32 u = WORD_INDEX(fromIndex);
if (u >= words.size())
uint32 u = wordIndex(fromIndex);
if (u >= wordsInUse)
return fromIndex;
uint64 word = ~words[u] & (WORD_MASK << (fromIndex % BITS_PER_WORD));
@@ -174,63 +180,79 @@ namespace epics { namespace pvData {
while (true) {
if (word != 0)
return (u * BITS_PER_WORD) + numberOfTrailingZeros(word);
if (++u == words.size())
return words.size() * BITS_PER_WORD;
if (++u == wordsInUse)
return wordsInUse * BITS_PER_WORD;
word = ~words[u];
}
}
bool BitSet::isEmpty() const {
return words.empty();
return (wordsInUse == 0);
}
uint32 BitSet::cardinality() const {
uint32 sum = 0;
for (uint32 i = 0; i < words.size(); i++)
for (uint32 i = 0; i < wordsInUse; i++)
sum += bitCount(words[i]);
return sum;
}
uint32 BitSet::size() const {
return words.size() * BITS_PER_WORD;
return wordsLength * BITS_PER_WORD;
}
BitSet& BitSet::operator&=(const BitSet& set) {
// Check for self-assignment!
if (this == &set) return *this;
// the result length will be <= the shorter of the two inputs
words.resize(std::min(words.size(), set.words.size()), 0);
while (wordsInUse > set.wordsInUse)
words[--wordsInUse] = 0;
for(size_t i=0, e=words.size(); i<e; i++)
// Perform logical AND on words in common
for (uint32 i = 0; i < wordsInUse; i++)
words[i] &= set.words[i];
recalculateWordsInUse();
return *this;
}
BitSet& BitSet::operator|=(const BitSet& set) {
// Check for self-assignment!
if (this == &set) return *this;
// result length will be the same as the longer of the two inputs
words.resize(std::max(words.size(), set.words.size()), 0);
// since we expand w/ zeros, then iterate using the size of the other vector
for(size_t i=0, e=set.words.size(); i<e; i++)
uint32 wordsInCommon = wordsInUse;
if(wordsInUse>set.wordsInUse) wordsInCommon = set.wordsInUse;
if (wordsInUse < set.wordsInUse) {
ensureCapacity(set.wordsInUse);
wordsInUse = set.wordsInUse;
}
// Perform logical OR on words in common
for (uint32 i =0; i < wordsInCommon; i++) {
words[i] |= set.words[i];
CHECK_POST();
}
// Copy any remaining words
for(uint32 i=wordsInCommon; i<set.wordsInUse; ++i) {
words[i] = set.words[i];
}
// recalculateWordsInUse() is not needed
return *this;
}
BitSet& BitSet::operator^=(const BitSet& set) {
// result length will <= the longer of the two inputs
words.resize(std::max(words.size(), set.words.size()), 0);
for(size_t i=0, e=set.words.size(); i<e; i++)
uint32 wordsInCommon = wordsInUse;
if(wordsInUse>set.wordsInUse) wordsInCommon = set.wordsInUse;
if (wordsInUse < set.wordsInUse) {
ensureCapacity(set.wordsInUse);
wordsInUse = set.wordsInUse;
}
// Perform logical OR on words in common
for (uint32 i =0; i < wordsInCommon; i++) {
words[i] ^= set.words[i];
}
// Copy any remaining words
for(uint32 i=wordsInCommon; i<set.wordsInUse; ++i) {
words[i] = set.words[i];
}
recalculateWordsInUse();
return *this;
}
@@ -238,27 +260,32 @@ namespace epics { namespace pvData {
BitSet& BitSet::operator=(const BitSet &set) {
// Check for self-assignment!
if (this != &set) {
words = set.words;
if (this == &set) return *this;
// we ensure that words array size is adequate (and not wordsInUse to ensure capacity to the future)
if (wordsLength < set.wordsLength)
{
if (words) delete[] words;
words = new uint64[set.wordsLength];
wordsLength = set.wordsLength;
}
memcpy(words, set.words, sizeof(uint64)*set.wordsInUse);
wordsInUse = set.wordsInUse;
return *this;
}
void BitSet::swap(BitSet& set)
{
words.swap(set.words);
}
void BitSet::or_and(const BitSet& set1, const BitSet& set2) {
uint32 inUse = (set1.wordsInUse < set2.wordsInUse) ? set1.wordsInUse : set2.wordsInUse;
const size_t andlen = std::min(set1.words.size(), set2.words.size());
words.resize(std::max(words.size(), andlen), 0);
ensureCapacity(inUse);
wordsInUse = inUse;
// Perform logical AND on words in common
for (uint32 i = 0; i < andlen; i++)
for (uint32 i = 0; i < inUse; i++)
words[i] |= (set1.words[i] & set2.words[i]);
recalculateWordsInUse();
// recalculateWordsInUse()...
}
bool BitSet::operator==(const BitSet &set) const
@@ -266,11 +293,11 @@ namespace epics { namespace pvData {
if (this == &set)
return true;
if (words.size() != set.words.size())
if (wordsInUse != set.wordsInUse)
return false;
// Check words in use by both BitSets
for (uint32 i = 0; i < words.size(); i++)
for (uint32 i = 0; i < wordsInUse; i++)
if (words[i] != set.words[i])
return false;
@@ -283,55 +310,56 @@ namespace epics { namespace pvData {
}
void BitSet::serialize(ByteBuffer* buffer, SerializableControl* flusher) const {
uint32 n = words.size();
uint32 n = wordsInUse;
if (n == 0) {
SerializeHelper::writeSize(0, buffer, flusher);
return;
}
uint32 len = BYTES_PER_WORD * (n-1); // length excluding bits in the last word
// count non-zero bytes in the last word
uint32 len = 8 * (n-1);
for (uint64 x = words[n - 1]; x != 0; x >>= 8)
len++;
SerializeHelper::writeSize(len, buffer, flusher);
flusher->ensureBuffer(len);
n = len / 8;
for (uint32 i = 0; i < n; i++)
for (uint32 i = 0; i < n - 1; i++)
buffer->putLong(words[i]);
if (n < words.size())
for (uint64 x = words[words.size() - 1]; x != 0; x >>= 8)
buffer->putByte((int8) (x & 0xff));
for (uint64 x = words[n - 1]; x != 0; x >>= 8)
buffer->putByte((int8) (x & 0xff));
}
void BitSet::deserialize(ByteBuffer* buffer, DeserializableControl* control) {
uint32 bytes = static_cast<uint32>(SerializeHelper::readSize(buffer, control)); // in bytes
size_t wordsInUse = (bytes + 7) / BYTES_PER_WORD;
words.resize(wordsInUse);
wordsInUse = (bytes + 7) / 8;
if (wordsInUse > wordsLength)
{
if (words) delete[] words;
words = new uint64[wordsInUse];
wordsLength = wordsInUse;
}
if (wordsInUse == 0)
return;
control->ensureData(bytes);
uint32 i = 0;
uint32 longs = bytes / 8;
while (i < longs)
words[i++] = buffer->getLong();
for (uint32 j = i; j < wordsInUse; j++)
words[j] = 0;
for (uint32 remaining = (bytes - longs * 8), j = 0; j < remaining; j++)
words[i] |= (buffer->getByte() & 0xffLL) << (8 * j);
recalculateWordsInUse(); // Sender shouldn't add extra zero bytes, but don't fail it it does
words[i] |= (buffer->getByte() & 0xffL) << (8 * j);
}
epicsShareExtern std::ostream& operator<<(std::ostream& o, const BitSet& b)
{
o << '{';

View File

@@ -1,7 +1,8 @@
/* bitSet.h */
/*
* Copyright information and license terms for this software can be
* found in the file LICENSE that is included with the distribution
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvData is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
/**
* @author mse
@@ -9,7 +10,7 @@
#ifndef BITSET_H
#define BITSET_H
#include <vector>
#include <stdexcept>
#include <pv/pvType.h>
#include <pv/serialize.h>
@@ -26,15 +27,15 @@ namespace epics { namespace pvData {
* @brief A vector of bits.
*
* This class implements a vector of bits that grows as needed. Each
* component of the bit set has a @c bool value. The bits of a
* @c BitSet are indexed by nonnegative integers. Individual
* indexed bits can be examined, set, or cleared. One @c BitSet may
* be used to modify the contents of another @c BitSet through
* logical AND, logical inclusive OR, and logical exclusive OR
* operations.
* component of the bit set has a {@code bool} value. The
* bits of a {@code BitSet} are indexed by nonnegative integers.
* Individual indexed bits can be examined, set, or cleared. One
* {@code BitSet} may be used to modify the contents of another
* {@code BitSet} through logical AND, logical inclusive OR, and
* logical exclusive OR operations.
*
* <p>By default, all bits in the set initially have the value
* @c false.
* {@code false}.
*
* <p>Every bit set has a current size, which is the number of bits
* of space currently in use by the bit set. Note that the size is
@@ -42,8 +43,8 @@ namespace epics { namespace pvData {
* implementation. The length of a bit set relates to logical length
* of a bit set and is defined independently of implementation.
*
* <p>A @c BitSet is not safe for multithreaded use without external
* synchronization.
* <p>A {@code BitSet} is not safe for multithreaded use without
* external synchronization.
*
* Based on Java implementation.
*/
@@ -52,14 +53,14 @@ namespace epics { namespace pvData {
POINTER_DEFINITIONS(BitSet);
static BitSetPtr create(uint32 nbits);
/**
* Creates a new bit set. All bits are initially @c false.
* Creates a new bit set. All bits are initially {@code false}.
*/
BitSet();
/**
* Creates a bit set whose initial size is large enough to explicitly
* represent bits with indices in the range @c 0 through
* @c nbits-1. All bits are initially @c false.
* represent bits with indices in the range {@code 0} through
* {@code nbits-1}. All bits are initially {@code false}.
*
* @param nbits the initial size of the bit set
*/
@@ -79,14 +80,14 @@ namespace epics { namespace pvData {
void flip(uint32 bitIndex);
/**
* Sets the bit at the specified index to @c true.
* Sets the bit at the specified index to {@code true}.
*
* @param bitIndex a bit index
*/
void set(uint32 bitIndex);
/**
* Sets the bit specified by the index to @c false.
* Sets the bit specified by the index to {@code false}.
*
* @param bitIndex the index of the bit to be cleared
*/
@@ -102,8 +103,9 @@ namespace epics { namespace pvData {
/**
* Returns the value of the bit with the specified index. The value
* is @c true if the bit with the index @c bitIndex is currently
* set in this @c BitSet; otherwise, the result is @c false.
* is {@code true} if the bit with the index {@code bitIndex}
* is currently set in this {@code BitSet}; otherwise, the result
* is {@code false}.
*
* @param bitIndex the bit index
* @return the value of the bit with the specified index
@@ -111,16 +113,16 @@ namespace epics { namespace pvData {
bool get(uint32 bitIndex) const;
/**
* Sets all of the bits in this BitSet to @c false.
* Sets all of the bits in this BitSet to {@code false}.
*/
void clear();
/**
* Returns the index of the first bit that is set to @c true that
* occurs on or after the specified starting index. If no such bit
* exists then @c -1 is returned.
* Returns the index of the first bit that is set to {@code true}
* that occurs on or after the specified starting index. If no such
* bit exists then {@code -1} is returned.
*
* <p>To iterate over the @c true bits in a @c BitSet,
* <p>To iterate over the {@code true} bits in a {@code BitSet},
* use the following loop:
*
* <pre> {@code
@@ -129,13 +131,13 @@ namespace epics { namespace pvData {
* }}</pre>
*
* @param fromIndex the index to start checking from (inclusive)
* @return the index of the next set bit, or @c -1 if there
* @return the index of the next set bit, or {@code -1} if there
* is no such bit
*/
int32 nextSetBit(uint32 fromIndex) const;
/**
* Returns the index of the first bit that is set to @c false
* Returns the index of the first bit that is set to {@code false}
* that occurs on or after the specified starting index.
*
* @param fromIndex the index to start checking from (inclusive)
@@ -144,23 +146,23 @@ namespace epics { namespace pvData {
int32 nextClearBit(uint32 fromIndex) const;
/**
* Returns true if this @c BitSet contains no bits that are set
* to @c true.
* Returns true if this {@code BitSet} contains no bits that are set
* to {@code true}.
*
* @return indicating whether this @c BitSet is empty
* @return indicating whether this {@code BitSet} is empty
*/
bool isEmpty() const;
/**
* Returns the number of bits set to @c true in this @c BitSet.
* Returns the number of bits set to {@code true} in this {@code BitSet}.
*
* @return the number of bits set to @c true in this @c BitSet
* @return the number of bits set to {@code true} in this {@code BitSet}
*/
uint32 cardinality() const;
/**
* Returns the number of bits of space actually in use by this
* @c BitSet to represent bit values.
* {@code BitSet} to represent bit values.
* The maximum element in the set is the size - 1st element.
*
* @return the number of bits currently in this bit set
@@ -170,9 +172,9 @@ namespace epics { namespace pvData {
/**
* Performs a logical <b>AND</b> of this target bit set with the
* argument bit set. This bit set is modified so that each bit in it
* has the value @c true if and only if it both initially
* had the value @c true and the corresponding bit in the
* bit set argument also had the value @c true.
* has the value {@code true} if and only if it both initially
* had the value {@code true} and the corresponding bit in the
* bit set argument also had the value {@code true}.
*
* @param set a bit set
*/
@@ -181,9 +183,9 @@ namespace epics { namespace pvData {
/**
* Performs a logical <b>OR</b> of this bit set with the bit set
* argument. This bit set is modified so that a bit in it has the
* value @c true if and only if it either already had the
* value @c true or the corresponding bit in the bit set
* argument has the value @c true.
* value {@code true} if and only if it either already had the
* value {@code true} or the corresponding bit in the bit set
* argument has the value {@code true}.
*
* @param set a bit set
*/
@@ -192,13 +194,13 @@ namespace epics { namespace pvData {
/**
* Performs a logical <b>XOR</b> of this bit set with the bit set
* argument. This bit set is modified so that a bit in it has the
* value @c true if and only if one of the following
* value {@code true} if and only if one of the following
* statements holds:
* <ul>
* <li>The bit initially has the value @c true, and the
* corresponding bit in the argument has the value @c false.
* <li>The bit initially has the value @c false, and the
* corresponding bit in the argument has the value @c true.
* <li>The bit initially has the value {@code true}, and the
* corresponding bit in the argument has the value {@code false}.
* <li>The bit initially has the value {@code false}, and the
* corresponding bit in the argument has the value {@code true}.
* </ul>
*
* @param set a bit set
@@ -210,9 +212,6 @@ namespace epics { namespace pvData {
*/
BitSet& operator=(const BitSet &set);
//! Swap contents
void swap(BitSet& set);
/**
* Perform AND operation on <code>set1</code> and <code>set2</code>,
* and OR on result and this instance.
@@ -235,11 +234,42 @@ namespace epics { namespace pvData {
private:
typedef std::vector<uint64> words_t;
/*
* BitSets are packed into arrays of "words." Currently a word is
* a long, which consists of 64 bits, requiring 6 address bits.
* The choice of word size is determined purely by performance concerns.
*/
static const uint32 ADDRESS_BITS_PER_WORD = 6;
static const uint32 BITS_PER_WORD = 1 << ADDRESS_BITS_PER_WORD;
static const uint32 BIT_INDEX_MASK = BITS_PER_WORD - 1;
/** Used to shift left or right for a partial word mask */
static const uint64 WORD_MASK = ~((uint64)0);
/** The internal field corresponding to the serialField "bits". */
words_t words;
uint64* words;
/** The internal field corresponding to the size of words[] array. */
uint32 wordsLength;
/** The number of words in the logical size of this BitSet. */
uint32 wordsInUse;
private:
/**
* Given a bit index, return word index containing it.
*/
static inline uint32 wordIndex(uint32 bitIndex) {
return bitIndex >> ADDRESS_BITS_PER_WORD;
}
/**
* Creates a new word array.
*/
void initWords(uint32 nbits);
/**
* Sets the field wordsInUse to the logical size in words of the bit set.
* WARNING: This method assumes that the number of words actually in use is

View File

@@ -1,10 +1,8 @@
/*
* Copyright information and license terms for this software can be
* found in the file LICENSE that is included with the distribution
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvData is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
/**
* @author mse
*/
#define epicsExportSharedSymbols
#include <pv/byteBuffer.h>

View File

@@ -1,7 +1,8 @@
/* byteBuffer.h */
/*
* Copyright information and license terms for this software can be
* found in the file LICENSE that is included with the distribution
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvData is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
/**
* @author mse
@@ -10,15 +11,24 @@
#define BYTEBUFFER_H
#include <string>
#include <cstring>
#include <cstdlib>
#include <string.h>
#ifdef epicsExportSharedSymbols
#define byteBufferepicsExportSharedSymbols
#undef epicsExportSharedSymbols
#endif
#include <epicsEndian.h>
#include <shareLib.h>
#ifdef byteBufferepicsExportSharedSymbols
#define epicsExportSharedSymbols
#undef byteBufferepicsExportSharedSymbols
#endif
#include <pv/pvType.h>
#include <pv/epicsException.h>
#include <shareLib.h>
namespace epics {
namespace pvData {
@@ -198,7 +208,7 @@ inline double swap(double val)
/**
* @brief This class implements a Bytebuffer that is like the java.nio.ByteBuffer.
*
* <p>A @c BitSet is not safe for multithreaded use without
* <p>A {@code BitSet} is not safe for multithreaded use without
* external synchronization.
*
* Based on Java implementation.
@@ -214,20 +224,19 @@ public:
* Must be one of EPICS_BYTE_ORDER,EPICS_ENDIAN_LITTLE,EPICS_ENDIAN_BIG.
*/
ByteBuffer(std::size_t size, int byteOrder = EPICS_BYTE_ORDER) :
_buffer((char*)std::malloc(size)), _size(size),
_buffer(0), _size(size),
_reverseEndianess(byteOrder != EPICS_BYTE_ORDER),
_reverseFloatEndianess(byteOrder != EPICS_FLOAT_WORD_ORDER),
_wrapped(false)
{
if(!_buffer)
throw std::bad_alloc();
_buffer = (char*)malloc(size);
clear();
}
/**
* Constructor for wrapping an existing buffer.
* Constructor for wrapping existing buffers.
* Given buffer will not be released by the ByteBuffer instance.
* @param buffer Existing buffer. May not be NULL.
* @param buffer Existing buffer.
* @param size The number of bytes.
* @param byteOrder The byte order.
* Must be one of EPICS_BYTE_ORDER,EPICS_ENDIAN_LITTLE,EPICS_ENDIAN_BIG.
@@ -238,8 +247,6 @@ public:
_reverseFloatEndianess(byteOrder != EPICS_FLOAT_WORD_ORDER),
_wrapped(true)
{
if(!_buffer)
throw std::invalid_argument("ByteBuffer can't be constructed with NULL");
clear();
}
/**
@@ -247,7 +254,7 @@ public:
*/
~ByteBuffer()
{
if (_buffer && !_wrapped) std::free(_buffer);
if (_buffer && !_wrapped) free(_buffer);
}
/**
* Set the byte order.
@@ -264,7 +271,7 @@ public:
* Get the raw buffer data.
* @return the raw buffer data.
*/
inline const char* getBuffer() const
inline const char* getBuffer()
{
return _buffer;
}
@@ -296,7 +303,7 @@ public:
* Returns the current position.
* @return The current position in the raw data.
*/
inline std::size_t getPosition() const
inline std::size_t getPosition()
{
return (std::size_t)(((std::ptrdiff_t)(const void *)_position) - ((std::ptrdiff_t)(const void *)_buffer));
}
@@ -316,7 +323,7 @@ public:
*
* @return The offset into the raw buffer.
*/
inline std::size_t getLimit() const
inline std::size_t getLimit()
{
return (std::size_t)(((std::ptrdiff_t)(const void *)_limit) - ((std::ptrdiff_t)(const void *)_buffer));
}
@@ -337,7 +344,7 @@ public:
*
* @return The number of elements remaining in this buffer.
*/
inline std::size_t getRemaining() const
inline std::size_t getRemaining()
{
return (std::size_t)(((std::ptrdiff_t)(const void *)_limit) - ((std::ptrdiff_t)(const void *)_position));
}
@@ -346,7 +353,7 @@ public:
*
* @return The size of the raw data buffer.
*/
inline std::size_t getSize() const
inline std::size_t getSize()
{
return _size;
}
@@ -366,7 +373,7 @@ public:
template<typename T>
inline void put(std::size_t index, T value);
/**
* Get the new object from the byte buffer. The item MUST have type @c T.
* Get the new object from the byte buffer. The item MUST have type {@code T}.
* The position is adjusted based on the type.
*
* @return The object.
@@ -380,7 +387,7 @@ public:
#endif
/**
* Get the new object from the byte buffer at the specified index.
* The item MUST have type @c T.
* The item MUST have type {@code T}.
* The position is adjusted based on the type.
*
* @param index The location in the byte buffer.
@@ -392,9 +399,9 @@ public:
* Put a sub-array of bytes into the byte buffer.
* The position is increased by the count.
*
* @param src The source array.
* @param src_offset The starting position within src.
* @param count The number of bytes to put into the byte buffer,
* @param src The source array.
* @param offset The starting position within src.
* @param count The number of bytes to put into the byte buffer,
*/
inline void put(const char* src, std::size_t src_offset, std::size_t count) {
//if(count>getRemaining()) THROW_BASE_EXCEPTION("buffer overflow");
@@ -405,9 +412,9 @@ public:
* Get a sub-array of bytes from the byte buffer.
* The position is increased by the count.
*
* @param dest The destination array.
* @param dest_offset The starting position within src.
* @param count The number of bytes to put into the byte buffer.
* @param dest The destination array.
* @param offset The starting position within src.
* @param count The number of bytes to put into the byte buffer,
*/
inline void get(char* dest, std::size_t dest_offset, std::size_t count) {
//if(count>getRemaining()) THROW_BASE_EXCEPTION("buffer overflow");
@@ -415,7 +422,7 @@ public:
_position += count;
}
/**
* Put an array of type @c T into the byte buffer.
* Put an array of type {@code T} into the byte buffer.
* The position is adjusted.
*
* @param values The input array.
@@ -424,7 +431,7 @@ public:
template<typename T>
inline void putArray(const T* values, std::size_t count);
/**
* Get an array of type @c T from the byte buffer.
* Get an array of type {@code T} from the byte buffer.
* The position is adjusted.
*
* @param values The destination array.
@@ -437,7 +444,7 @@ public:
* @return (false,true) if (is, is not) the EPICS_BYTE_ORDER
*/
template<typename T>
inline bool reverse() const
inline bool reverse()
{
return _reverseEndianess;
}
@@ -630,54 +637,54 @@ public:
/**
* Get a boolean value from the byte buffer at the specified index.
*
* @param index The offset in the byte buffer.
* @param double The offset in the byte buffer.
* @return The value.
*/
inline double getDouble (std::size_t index) { return get<double>(index); }
// TODO remove
inline const char* getArray() const
inline const char* getArray()
{
return _buffer;
}
private:
char* const _buffer;
char* _buffer;
char* _position;
char* _limit;
const std::size_t _size;
std::size_t _size;
bool _reverseEndianess;
bool _reverseFloatEndianess;
const bool _wrapped;
bool _wrapped;
};
template<>
inline bool ByteBuffer::reverse<bool>() const
inline bool ByteBuffer::reverse<bool>()
{
return false;
}
template<>
inline bool ByteBuffer::reverse<int8>() const
inline bool ByteBuffer::reverse<int8>()
{
return false;
}
template<>
inline bool ByteBuffer::reverse<uint8>() const
inline bool ByteBuffer::reverse<uint8>()
{
return false;
}
template<>
inline bool ByteBuffer::reverse<float>() const
inline bool ByteBuffer::reverse<float>()
{
return _reverseFloatEndianess;
}
template<>
inline bool ByteBuffer::reverse<double>() const
inline bool ByteBuffer::reverse<double>()
{
return _reverseFloatEndianess;
}

View File

View File

@@ -1,7 +1,8 @@
/* destroyable.h */
/*
* Copyright information and license terms for this software can be
* found in the file LICENSE that is included with the distribution
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvData is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
/**
* @author mse

View File

@@ -1,6 +1,7 @@
/*
* Copyright information and license terms for this software can be
* found in the file LICENSE that is included with the distribution
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvData is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
/**
* @author mes
@@ -9,7 +10,6 @@
#include <sstream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <string>
#define epicsExportSharedSymbols
@@ -50,7 +50,7 @@ ExceptionMixin::show() const
out<<symbols[i]<<"\n";
}
std::free(symbols);
free(symbols);
}
#endif

View File

@@ -1,9 +1,10 @@
/*
* Copyright information and license terms for this software can be
* found in the file LICENSE that is included with the distribution
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvData is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
/*
* epicsException.h
* epicsException.hpp
*
* Created on: Oct 20, 2010
* Author: Matej Sekoranja
@@ -33,14 +34,19 @@
#ifndef EPICSEXCEPTION_H_
#define EPICSEXCEPTION_H_
#if defined(_WIN32) && !defined(NOMINMAX)
#define NOMINMAX
#ifdef _WIN32
#pragma warning( push )
#pragma warning(disable: 4275) // warning C4275: non dll-interface class used as base for dll-interface class (std::logic_error)
#endif
#include <stdexcept>
#include <string>
#include <cstdio>
#include <stdio.h>
#include <stdlib.h>
#include <shareLib.h>
// Users may redefine this for a large size if desired
@@ -52,7 +58,7 @@
# include <execinfo.h>
# include <cxxabi.h>
# define EXCEPT_USE_BACKTRACE
#elif defined(_WIN32) && !defined(_MINGW) && !defined(SKIP_DBGHELP)
#elif defined(_WIN32) && !defined(__MINGW__) && !defined(SKIP_DBGHELP)
# define _WINSOCKAPI_
# include <windows.h>
# include <dbghelp.h>
@@ -61,12 +67,6 @@
# define EXCEPT_USE_NONE
#endif
#if defined(_WIN32) && !defined(_MINGW)
#pragma warning( push )
#pragma warning(disable: 4275) // non dll-interface class used as base for dll-interface class (std::logic_error)
#pragma warning(disable: 4251) // class std::string needs to have dll-interface to be used by clients
#endif
namespace epics { namespace pvData {
@@ -175,7 +175,7 @@ do { \
#define PRINT_EXCEPTION2(EI, FP) \
do { \
::epics::pvData::ExceptionMixin *_em_p=dynamic_cast< ::epics::pvData::ExceptionMixin*>(&EI); \
ExceptionMixin *_em_p=dynamic_cast<ExceptionMixin*>(&EI); \
if (_em_p) {_em_p->print(FP);} \
}while(0)
@@ -185,7 +185,7 @@ do { \
# define SHOW_EXCEPTION(EI) ::epics::pvData::detail::showException(EI)
#else
# define SHOW_EXCEPTION(EI) \
({ ::epics::pvData::ExceptionMixin *_mx=dynamic_cast< ::epics::pvData::ExceptionMixin*>(&(EI)); \
({ ExceptionMixin *_mx=dynamic_cast<ExceptionMixin*>(&(EI)); \
_mx ? _mx->show() : std::string(); \
})
#endif
@@ -228,7 +228,7 @@ private:
mutable std::string base_msg;
};
#if defined(_WIN32) && !defined(_MINGW)
#ifdef _WIN32
#pragma warning( pop )
#endif

View File

@@ -1,7 +1,8 @@
/* event.cpp */
/*
* Copyright information and license terms for this software can be
* found in the file LICENSE that is included with the distribution
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvData is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
/**
* @author mrk

View File

@@ -1,7 +1,8 @@
/* event.h */
/*
* Copyright information and license terms for this software can be
* found in the file LICENSE that is included with the distribution
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvData is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
/**
* @author mrk
@@ -12,12 +13,22 @@
#include <memory>
#include <vector>
#ifdef epicsExportSharedSymbols
#define eventepicsExportSharedSymbols
#undef epicsExportSharedSymbols
#endif
#include <epicsEvent.h>
#include <shareLib.h>
#ifdef eventepicsExportSharedSymbols
#define epicsExportSharedSymbols
#undef eventepicsExportSharedSymbols
#endif
#include <pv/pvType.h>
#include <pv/sharedPtr.h>
#include <shareLib.h>
namespace epics { namespace pvData {

View File

@@ -1,7 +1,8 @@
/* executor.cpp */
/*
* Copyright information and license terms for this software can be
* found in the file LICENSE that is included with the distribution
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvData is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
/**
* @author mrk
@@ -12,10 +13,6 @@
#include <string>
#include <cstdio>
#include <epicsEvent.h>
#include <epicsMutex.h>
#include <epicsThread.h>
#define epicsExportSharedSymbols
#include <pv/executor.h>

View File

@@ -1,7 +1,8 @@
/* executor.h */
/*
* Copyright information and license terms for this software can be
* found in the file LICENSE that is included with the distribution
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvData is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
/**
* @author mrk

View File

@@ -1,7 +1,8 @@
/* localStaticLock.cpp */
/*
* Copyright information and license terms for this software can be
* found in the file LICENSE that is included with the distribution
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvData is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
/**
* @author mse

View File

@@ -1,7 +1,8 @@
/* localStaticLock.h */
/*
* Copyright information and license terms for this software can be
* found in the file LICENSE that is included with the distribution
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvData is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
/**
* @author mse

View File

@@ -1,7 +1,8 @@
/* lock.h */
/*
* Copyright information and license terms for this software can be
* found in the file LICENSE that is included with the distribution
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvData is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
/**
* @author mrk
@@ -11,11 +12,21 @@
#include <stdexcept>
#ifdef epicsExportSharedSymbols
#define lockepicsExportSharedSymbols
#undef epicsExportSharedSymbols
#endif
#include <epicsMutex.h>
#include <shareLib.h>
#ifdef lockepicsExportSharedSymbols
#define epicsExportSharedSymbols
#undef lockepicsExportSharedSymbols
#endif
#include <pv/noDefaultMethods.h>
#include <shareLib.h>
/* This is based on item 14 of
* Effective C++, Third Edition, Scott Meyers

View File

@@ -1,7 +1,8 @@
/* messageQueue.cpp */
/*
* Copyright information and license terms for this software can be
* found in the file LICENSE that is included with the distribution
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvData is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
/**
* @author mrk

View File

@@ -1,7 +1,8 @@
/* messageQueue.h */
/*
* Copyright information and license terms for this software can be
* found in the file LICENSE that is included with the distribution
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvData is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
/**
* @author mrk

View File

@@ -1,7 +1,8 @@
/* noDefaultMethods.h */
/*
* Copyright information and license terms for this software can be
* found in the file LICENSE that is included with the distribution
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvData is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
/**
* @author mrk

View File

@@ -1,7 +1,3 @@
/*
* Copyright information and license terms for this software can be
* found in the file LICENSE that is included with the distribution
*/
#include <ctype.h>
#include <stdio.h>
#include <errno.h>
@@ -16,7 +12,7 @@
#include <epicsConvert.h>
#define epicsExportSharedSymbols
#include "pv/typeCast.h"
#include "typeCast.h"
using std::string;
@@ -31,7 +27,7 @@ using std::string;
#endif
#if EPICS_VERSION_INT < VERSION_INT(3,15,0,1)
/* These integer conversion primitives added to epicsStdlib.c in 3.15.0.1 */
/* integer conversion primitives added to epicsStdlib.c in 3.15.0.1 */
#define S_stdlib_noConversion 1 /* No digits to convert */
#define S_stdlib_extraneous 2 /* Extraneous characters */
@@ -253,19 +249,18 @@ epicsParseFloat(const char *str, float *to, char **units)
}
#endif
// Sometimes we have to provide our own copy of strtoll()
#if defined(_WIN32) && !defined(_MINGW)
// On Windows with MSVC, Base-3.15 provides strtoll()
# define NEED_OLL_FUNCS (EPICS_VERSION_INT < VERSION_INT(3,15,0,1))
#elif defined(vxWorks)
// On VxWorks, Base-3.15 provides strtoll()
# define NEED_OLL_FUNCS (EPICS_VERSION_INT < VERSION_INT(3,15,0,1))
// MS Visual Studio 2013 defines strtoll, etc.
#if defined(_WIN32)
# if (_MSC_VER >= 1800)
# define WIN_NEEDS_OLL_FUNC 0
# else
# define WIN_NEEDS_OLL_FUNC 1
# endif
#else
// Other architectures all provide strtoll()
# define NEED_OLL_FUNCS 0
# define WIN_NEEDS_OLL_FUNC 0
#endif
#if defined(NEED_LONGLONG) && NEED_OLL_FUNCS
#if defined(NEED_LONGLONG) && (defined(__vxworks) || WIN_NEEDS_OLL_FUNC)
static
long long strtoll(const char *ptr, char ** endp, int base)
{
@@ -313,10 +308,8 @@ noconvert:
return 0;
}
#if defined(vxWorks)
/* The VxWorks version of std::istringstream >> uint64_t is buggy,
* provide our own implementation
*/
#if defined(__vxworks)
/* vxworks version of std::istringstream >>uint64_t is buggy, we use out own implementation */
static
unsigned long long strtoull(const char *nptr, char **endptr, int base)
{
@@ -558,10 +551,9 @@ void parseToPOD(const string& in, float *out) {
void parseToPOD(const string& in, double *out) {
int err = epicsParseDouble(in.c_str(), out, NULL);
if(err) handleParseError(err);
#if defined(vxWorks)
/* vxWorks strtod returns [-]epicsINF when it should return ERANGE error.
* If [-]epicsINF is returned and the first char is a digit we translate
* this into an ERANGE error
#if defined(__vxworks)
/* vxWorks strtod returns [-]epicsINF when it should return ERANGE error
* if [-]epicsINF is returned and first char is a digit then translate this into ERANGE error
*/
else if (*out == epicsINF || *out == -epicsINF) {
const char* s = in.c_str();

View File

@@ -1,296 +0,0 @@
/* thread.h */
/*
* Copyright information and license terms for this software can be
* found in the file LICENSE that is included with the distribution
*/
/**
* @author mrk
*/
#ifndef THREAD_H
#define THREAD_H
#include <memory>
#include <sstream>
#if __cplusplus>=201103L
#include <functional>
#endif
#include <epicsThread.h>
#include <shareLib.h>
#include <pv/noDefaultMethods.h>
#include <pv/pvType.h>
namespace epics { namespace pvData {
enum ThreadPriority {
lowestPriority =epicsThreadPriorityLow,
lowerPriority =epicsThreadPriorityLow + 15,
lowPriority =epicsThreadPriorityMedium - 15,
middlePriority =epicsThreadPriorityMedium,
highPriority =epicsThreadPriorityMedium + 15,
higherPriority =epicsThreadPriorityHigh - 15,
highestPriority =epicsThreadPriorityHigh
};
class Thread;
typedef std::tr1::shared_ptr<Thread> ThreadPtr;
typedef std::tr1::shared_ptr<epicsThread> EpicsThreadPtr;
typedef epicsThreadRunable Runnable;
//! Helper for those cases where a class should have more than one runnable
template<typename C>
class epicsShareClass RunnableMethod : public Runnable, private NoDefaultMethods
{
typedef void (C::*meth_t)();
C *inst;
meth_t meth;
virtual void run()
{
(inst->*meth)();
}
public:
RunnableMethod(C* inst, void (C::*meth)())
:inst(inst), meth(meth)
{}
};
namespace detail {
struct FuncRunner : public epicsThreadRunable
{
typedef void (*fn_t)(void*);
fn_t fn;
void *arg;
FuncRunner(fn_t f, void *a) :fn(f), arg(a) {}
virtual ~FuncRunner(){}
virtual void run()
{
(*fn)(arg);
}
};
template<typename C>
struct MethRunner : public epicsThreadRunable
{
typedef void(C::*fn_t)();
fn_t fn;
C* inst;
MethRunner(C* i, fn_t f) :fn(f), inst(i) {}
virtual ~MethRunner() {}
virtual void run()
{
(inst->*fn)();
}
};
#if __cplusplus>=201103L
struct BindRunner : public epicsThreadRunable
{
typedef std::function<void()> fn_t;
fn_t fn;
BindRunner(const fn_t f) : fn(f) {}
virtual ~BindRunner() {}
virtual void run()
{
fn();
}
};
#endif
} // namespace detail
/**
* @brief C++ wrapper for epicsThread from EPICS base.
*
*/
class epicsShareClass Thread : public epicsThread, private NoDefaultMethods {
public:
/** @brief Holds all the configuration necessary to launch a @class Thread
*
* The defaults may be used except for the runnable, which must be given
* either in the constructor, or the @method run() method.
*
* @note Instances of @class Config may not be reused.
*
* Defaults:
* name: ""
* priority: epicsThreadPriorityLow (aka epics::pvData::lowestPriority)
* stack size: epicsThreadStackSmall
* auto start: true
* runner: nil (must be set explictly)
*
@code
stuct bar { void meth(); ... } X;
// with a static thread name
Thread foo(Thread::Config(&X, &bar::meth)
.name("example")
.prio(epicsThreadPriorityHigh));
// with a constructed thread name
Thread foo(Thread::Config(&X, &bar::meth)
.prio(epicsThreadPriorityHigh)
<<"example"<<1);
@endcode
*/
class epicsShareClass Config
{
unsigned int p_prio, p_stack;
std::ostringstream p_strm;
bool p_autostart;
Runnable *p_runner;
#if __cplusplus>=201103L
typedef std::unique_ptr<Runnable> p_owned_runner_t;
#else
typedef std::auto_ptr<Runnable> p_owned_runner_t;
#endif
p_owned_runner_t p_owned_runner;
friend class Thread;
Runnable& x_getrunner()
{
if(!this->p_runner)
throw std::logic_error("Thread::Config missing run()");
return *this->p_runner;
}
void x_setdefault()
{
this->p_prio = epicsThreadPriorityLow;
this->p_autostart = true;
this->p_runner = NULL;
(*this).stack(epicsThreadStackSmall);
}
public:
Config() {this->x_setdefault();}
Config(Runnable *r) {this->x_setdefault();this->run(r);}
Config(void(*fn)(void*), void *ptr) {this->x_setdefault();this->run(fn, ptr);}
template<typename C>
Config(C* inst, void(C::*meth)()) {this->x_setdefault();this->run(inst, meth);}
#if __cplusplus>=201103L
Config(const std::function<void()>& fn) {this->x_setdefault();this->run(fn);}
#endif
inline Config& name(const std::string& n)
{ this->p_strm.str(n); return *this; }
inline Config& prio(unsigned int p)
{ this->p_prio = p; return *this; }
inline Config& stack(epicsThreadStackSizeClass s)
{ this->p_stack = epicsThreadGetStackSize(s); return *this; }
inline Config& autostart(bool a)
{ this->p_autostart = a; return *this; }
//! Thread will execute Runnable::run()
Config& run(Runnable* r)
{ this->p_runner = r; return *this; }
//! Thread will execute (*fn)(ptr)
Config& run(void(*fn)(void*), void *ptr)
{
this->p_owned_runner.reset(new detail::FuncRunner(fn, ptr));
this->p_runner = this->p_owned_runner.get();
return *this;
}
//! Thread will execute (inst->*meth)()
template<typename C>
Config& run(C* inst, void(C::*meth)())
{
this->p_owned_runner.reset(new detail::MethRunner<C>(inst, meth));
this->p_runner = this->p_owned_runner.get();
return *this;
}
#if __cplusplus>=201103L
Config& run(const std::function<void()>& fn)
{
this->p_owned_runner.reset(new detail::BindRunner(fn));
this->p_runner = this->p_owned_runner.get();
return *this;
}
#endif
//! Append to thread name string. Argument must be understood by std::ostream::operator<<
template<typename T>
Config& operator<<(T x) { this->p_strm<<x; return *this; }
};
/**
*
* Constructor
* @param name thread name.
* @param priority priority is one of:
@code
enum ThreadPriority {
lowestPriority, lowerPriority, lowPriority,
middlePriority,
highPriority, higherPriority, highestPriority
};
@endcode
* @param runnable this is a c function
* @param stkcls stack size as specified by epicsThreadStackSizeClass
*/
Thread(std::string name,
ThreadPriority priority,
Runnable *runnable,
epicsThreadStackSizeClass stkcls=epicsThreadStackSmall)
:epicsThread(*runnable,
name.c_str(),
epicsThreadGetStackSize(stkcls),
priority)
{
this->start();
}
/**
*
* Constructor
* @param runnable this is a c function
* @name thread name.
* @param stkcls stack size as specified by epicsThreadStackSizeClass
* @param priority priority is one of:
@code
enum ThreadPriority {
lowestPriority, lowerPriority, lowPriority,
middlePriority,
highPriority, higherPriority, highestPriority
};
@endcode
*/
Thread(Runnable &runnable,
std::string name,
unsigned int stksize,
unsigned int priority=lowestPriority)
:epicsThread(runnable,
name.c_str(),
stksize,
priority)
{
this->start();
}
//! @brief Create a new thread using the given @class Config
//! @throws std::logic_error for improper @class Config (ie. missing runner)
Thread(Config& c)
:epicsThread(c.x_getrunner(), c.p_strm.str().c_str(),
c.p_stack, c.p_prio)
{
#if __cplusplus>=201103L
p_owned = std::move(c.p_owned_runner);
#else
p_owned = c.p_owned_runner;
#endif
if(c.p_autostart)
this->start();
}
/**
* Destructor
*/
~Thread()
{
this->exitWait();
}
Config::p_owned_runner_t p_owned;
};
}}
#endif /* THREAD_H */

View File

@@ -1,7 +1,8 @@
/* queue.h */
/*
* Copyright information and license terms for this software can be
* found in the file LICENSE that is included with the distribution
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvData is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
/**
* @author mrk

View File

@@ -1,16 +1,14 @@
/* requester.cpp */
/*
* Copyright information and license terms for this software can be
* found in the file LICENSE that is included with the distribution
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvData is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
/**
* @author mrk
*/
#include <string>
#include <cstdio>
#include <iostream>
#include <epicsMutex.h>
#define epicsExportSharedSymbols
#include <pv/lock.h>
@@ -36,9 +34,6 @@ string getMessageTypeName(MessageType messageType)
return messageTypeName[messageType];
}
void Requester::message(std::string const & message,MessageType messageType)
{
std::cerr << "[" << getRequesterName() << "] message(" << message << ", " << getMessageTypeName(messageType) << ")\n";
}
}}

View File

@@ -1,7 +1,8 @@
/* requester.h */
/*
* Copyright information and license terms for this software can be
* found in the file LICENSE that is included with the distribution
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvData is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
/**
* @author mrk
@@ -64,7 +65,7 @@ public:
};
@endcode
*/
virtual void message(std::string const & message,MessageType messageType);
virtual void message(std::string const & message,MessageType messageType) = 0;
};
}}

View File

@@ -1,7 +1,8 @@
/* serialize.h */
/*
* Copyright information and license terms for this software can be
* found in the file LICENSE that is included with the distribution
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvData is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
/**
* @author mrk
@@ -9,8 +10,6 @@
#ifndef SERIALIZE_H
#define SERIALIZE_H
#include <epicsTypes.h>
#include <pv/byteBuffer.h>
#include <pv/sharedPtr.h>
@@ -53,18 +52,14 @@ namespace epics { namespace pvData {
*/
virtual void alignBuffer(std::size_t alignment) =0;
/**
* Method for serializing primitive array data.
* Hook for supplying custom serialization implementation.
* The serialization implementation need not be provided.
* Returns true if method performs serialization, false otherwise.
* This should only be used for arrays of primitive types,
* i. e. boolean, byte,..., double.
* It cannot be called for string, structure, or union arrays.
* method for serializing array data.
* This should only be used for arrays of primitive types.
* i. e. boolean,byte,...,double.
* It can not be called for string, structure, or union arrays.
* @param existingBuffer the existing buffer from the caller.
* @param toSerialize location of data to be put into buffer.
* @param elementCount number of elements.
* @param elementSize element size.
* @returns true if serialization performed, else false.
*/
virtual bool directSerialize(
ByteBuffer *existingBuffer,
@@ -107,18 +102,14 @@ namespace epics { namespace pvData {
*/
virtual void alignData(std::size_t alignment) =0;
/**
* Method for deserializing array data.
* Hook for supplying custom deserialization implementation.
* The deserialization implementation need not be provided.
* Returns true if method performs deserialization, false otherwise.
* method for deserializing array data.
* This should only be used for arrays of primitive types.
* i.e. boolean, byte,..., double.
* It cannot be called for string, structure, or union arrays.
* i. e. boolean,byte,...,double.
* It can not be called for string, structure, or union arrays.
* @param existingBuffer the existing buffer from the caller.
* @param deserializeTo location of data.
* @param elementCount number of elements.
* @param elementSize element size.
* @returns true if deserialization performed, else false.
*/
virtual bool directDeserialize(
ByteBuffer *existingBuffer,
@@ -127,6 +118,7 @@ namespace epics { namespace pvData {
std::size_t elementSize) = 0;
/**
* deserialize via cache
* @param field instance to be deserialized
* @param buffer buffer to be deserialized from
*/
virtual std::tr1::shared_ptr<const Field> cachedDeserialize(
@@ -159,41 +151,6 @@ namespace epics { namespace pvData {
DeserializableControl *flusher) = 0;
};
/**
* @brief Push serialize and append to the provided byte vector.
* No caching is done. Only complete serialization.
*
* @param S A Serializable object
* @param byteOrder Byte order to write (EPICS_ENDIAN_LITTLE or EPICS_ENDIAN_BIG)
* @param out The output vector. Results are appended
*/
void epicsShareFunc serializeToVector(const Serializable *S,
int byteOrder,
std::vector<epicsUInt8>& out);
/**
* @brief deserializeFromBuffer Deserialize into S from provided vector
* @param S A Serializeable object. The current contents will be replaced
* @param in The input buffer (byte order of this buffer is used)
* @throws std::logic_error if input buffer is too small. State of S is then undefined.
*/
void epicsShareFunc deserializeFromBuffer(Serializable *S,
ByteBuffer& in);
/**
* @brief deserializeFromBuffer Deserialize into S from provided vector
* @param S A Serializeable object. The current contents will be replaced
* @param byteOrder Byte order to write (EPICS_ENDIAN_LITTLE or EPICS_ENDIAN_BIG)
* @param in The input vector
* @throws std::logic_error if input buffer is too small. State of S is then undefined.
*/
inline void deserializeFromVector(Serializable *S,
int byteOrder,
const std::vector<epicsUInt8>& in)
{
ByteBuffer B((char*)&in[0], in.size(), byteOrder); // we promise not the modify 'in'
deserializeFromBuffer(S, B);
}
/**
* @brief Class for serializing bitSets.
@@ -209,7 +166,7 @@ namespace epics { namespace pvData {
* Serialize field into given buffer.
* @param buffer serialization buffer.
* @param flusher flush interface.
* @param bitSet The bitSet to serialize.
* &param bitSet The bitSet to serialize.
*/
virtual void serialize(ByteBuffer *buffer,
SerializableControl *flusher,BitSet *bitSet) const = 0;
@@ -217,7 +174,7 @@ namespace epics { namespace pvData {
* Deserialize buffer.
* @param buffer serialization buffer.
* @param flusher deserialization control.
* @param bitSet The bitSet to deserialize.
* &param bitSet The bitSet to deserialize.
*/
virtual void deserialize(ByteBuffer *buffer,
DeserializableControl *flusher,BitSet *bitSet) = 0;
@@ -239,7 +196,7 @@ namespace epics { namespace pvData {
* Serialize field into given buffer.
* @param buffer serialization buffer.
* @param flusher flush interface.
* @param offset offset in elements.
* &param offset offset in elements.
* @param count number of elements
*/
virtual void serialize(

View File

@@ -1,6 +1,7 @@
/*
* Copyright information and license terms for this software can be
* found in the file LICENSE that is included with the distribution
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvData is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
/*
* serializeHelper.cpp
@@ -11,11 +12,8 @@
#include <algorithm>
#include <epicsEndian.h>
#define epicsExportSharedSymbols
#include <pv/pvType.h>
#include <pv/byteBuffer.h>
#include <pv/epicsException.h>
#include <pv/byteBuffer.h>
#include <pv/serializeHelper.h>
@@ -141,132 +139,6 @@ namespace epics {
else
return emptyStringtring;
}
}
}
namespace {
using namespace epics::pvData;
struct ToString : public epics::pvData::SerializableControl
{
typedef std::vector<epicsUInt8> buf_type;
buf_type buf;
buf_type& out;
ByteBuffer bufwrap;
ToString(buf_type& out, int byteOrder = EPICS_BYTE_ORDER)
:buf(16*1024)
,out(out)
,bufwrap((char*)&buf[0], buf.size(), byteOrder)
{}
virtual void flushSerializeBuffer()
{
size_t N = out.size();
out.resize(out.size()+bufwrap.getPosition());
std::copy(buf.begin(),
buf.begin()+bufwrap.getPosition(),
out.begin()+N);
bufwrap.clear();
}
virtual void ensureBuffer(std::size_t size)
{
flushSerializeBuffer();
assert(bufwrap.getRemaining()>0);
}
virtual void alignBuffer(std::size_t alignment)
{
if(bufwrap.getRemaining()<alignment)
flushSerializeBuffer();
assert(bufwrap.getRemaining()>=alignment);
bufwrap.align(alignment);
}
virtual bool directSerialize(
ByteBuffer *existingBuffer,
const char* toSerialize,
std::size_t elementCount,
std::size_t elementSize)
{
return false;
}
virtual void cachedSerialize(
std::tr1::shared_ptr<const Field> const & field,
ByteBuffer* buffer)
{
field->serialize(buffer, this);
}
};
} // namespace
namespace epics {
namespace pvData {
void serializeToVector(const Serializable *S,
int byteOrder,
std::vector<epicsUInt8>& out)
{
ToString TS(out, byteOrder);
S->serialize(&TS.bufwrap, &TS);
TS.flushSerializeBuffer();
assert(TS.bufwrap.getPosition()==0);
}
}
}
namespace {
struct FromString : public epics::pvData::DeserializableControl
{
ByteBuffer &buf;
epics::pvData::FieldCreatePtr create;
FromString(ByteBuffer& b)
:buf(b)
,create(epics::pvData::getFieldCreate())
{}
virtual void ensureData(std::size_t size)
{
if(size>buf.getRemaining())
throw std::logic_error("Incomplete buffer");
}
virtual void alignData(std::size_t alignment)
{
size_t pos = buf.getPosition(), k = alignment-1;
if(pos&k) {
std::size_t npad = alignment-(pos&k);
ensureData(npad);
buf.align(alignment);
}
}
virtual bool directDeserialize(
ByteBuffer *existingBuffer,
char* deserializeTo,
std::size_t elementCount,
std::size_t elementSize)
{
return false;
}
virtual std::tr1::shared_ptr<const Field> cachedDeserialize(
ByteBuffer* buffer)
{
return create->deserialize(buffer, this);
}
};
}
namespace epics {
namespace pvData {
void deserializeFromBuffer(Serializable *S,
ByteBuffer& buf)
{
FromString F(buf);
S->deserialize(&buf, &F);
}
}
}

View File

@@ -1,6 +1,7 @@
/*
* Copyright information and license terms for this software can be
* found in the file LICENSE that is included with the distribution
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvData is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
/*
* serializeHelper.h
@@ -30,25 +31,19 @@ namespace epics {
public:
/**
* Serialize the specified array size into the specified
* buffer, flushing when necessary.
* The specified SerializableControl manages any flushing
* required.
* Serialize array size.
*
* @param[in] s size to encode
* @param[in] buffer serialization buffer
* @param[in] flusher SerializableControl to manage the flushing
* @param[in] flusher flusher
*/
static void writeSize(std::size_t s, ByteBuffer* buffer,
SerializableControl* flusher);
/**
* Deserialize array size.
* The specified DeserializableControl ensures
* sufficient bytes are available.
*
* @param[in] buffer deserialization buffer.
* @param[in] control the DeserializableControl.
* @returns array size.
*/
static std::size_t readSize(ByteBuffer* buffer,
@@ -68,7 +63,7 @@ namespace epics {
* std::string serialization helper method.
*
* @param[in] value std::string to serialize
* @param[in] offset start of the substring in value
* @param[in] offset start of the substring in {@code value}
* @param[in] count the number of characters to write
* @param[in] buffer serialization buffer
* @param[in] flusher flusher

View File

@@ -1,6 +1,7 @@
/*
* Copyright information and license terms for this software can be
* found in the file LICENSE that is included with the distribution
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvData is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
/**
* @author Michael Davidsaver
@@ -25,7 +26,7 @@
// where should we look?
#if defined(__GNUC__) && __GNUC__>=4 && !defined(vxWorks)
#if defined(__GNUC__) && __GNUC__>=4 && !defined(__vxworks)
// GCC >=4.0.0
# define SHARED_FROM_TR1

View File

@@ -1,12 +1,13 @@
/* sharedVector.h */
/*
* Copyright information and license terms for this software can be
* found in the file LICENSE that is included with the distribution
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvData is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
#ifndef SHAREDVECTOR_H
#define SHAREDVECTOR_H
#if defined(_WIN32) && !defined(NOMINMAX)
#ifdef _WIN32
#define NOMINMAX
#endif
@@ -325,7 +326,7 @@ public:
//! Internal for static_shared_vector_cast
template<typename FROM>
shared_vector(const shared_vector<FROM> &src,
detail::_shared_vector_cast_tag)
typename meta::is_void<FROM, detail::_shared_vector_cast_tag>::type)
:base_t(std::tr1::static_pointer_cast<E>(src.dataPtr()),
src.dataOffset()/sizeof(E),
src.dataCount()/sizeof(E))
@@ -431,8 +432,8 @@ public:
shared_vector<E> original(...);
if(!original.unique()){
std::tr1::shared_ptr<E> sptr(myalloc(original.size()), myfree);
shared_vector<E> temp(sptr, 0, original.size());
shared_vector<E> temp(myallocator(original.size()),
0, original.size());
std::copy(original.begin(), original.end(), temp.begin());
original.swap(temp);
}
@@ -531,20 +532,6 @@ public:
*
* Does not allow access or iteration of contents
* other than as void* or const void*
*
* In order to support shared_vector_convert<>()
* information about the type of the underlying allocation
* is stored.
* This is implicitly set by static_shared_vector_cast<>()
* and may be explicitly checked/changed using
* original_type()/set_original_type().
*
* A shared_vector<void> directly constructed
* from a smart pointer does not have an associated
* original_type().
* Use epics::pvData::ScalarTypeFunc::allocArray()
* to convienently allocate an array with a known
* original_type().
*/
template<typename E>
class shared_vector<E, typename meta::is_void<E>::type >
@@ -552,11 +539,7 @@ class shared_vector<E, typename meta::is_void<E>::type >
{
typedef detail::shared_vector_base<E> base_t;
ScalarType m_vtype;
// allow specialization for all E to be friends
template<typename E1, class Enable1> friend class shared_vector;
public:
typedef E value_type;
typedef E* pointer;
typedef ptrdiff_t difference_type;
typedef size_t size_type;
@@ -583,7 +566,7 @@ public:
//! Internal for static_shared_vector_cast
template<typename FROM>
shared_vector(const shared_vector<FROM> &src,
detail::_shared_vector_cast_tag)
typename meta::is_not_void<FROM, detail::_shared_vector_cast_tag>::type)
:base_t(std::tr1::static_pointer_cast<E>(src.dataPtr()),
src.dataOffset()*sizeof(FROM),
src.dataCount()*sizeof(FROM))
@@ -592,12 +575,12 @@ public:
shared_vector(shared_vector<void>& O,
detail::_shared_vector_freeze_tag t)
:base_t(O,t), m_vtype(O.m_vtype)
:base_t(O,t)
{}
shared_vector(shared_vector<const void>& O,
detail::_shared_vector_thaw_tag t)
:base_t(O,t), m_vtype(O.m_vtype)
:base_t(O,t)
{}
shared_vector& operator=(const shared_vector& o)
@@ -619,64 +602,6 @@ public:
ScalarType original_type() const {return m_vtype;}
};
namespace detail {
template<typename TO, typename FROM, class Enable = void>
struct static_shared_vector_caster { /* no default */ };
// from void to non-void with same const-ness
template<typename TO>
struct static_shared_vector_caster<TO, void,
typename meta::_and<meta::same_const<TO,void>, meta::is_not_void<TO> >::type> {
static inline shared_vector<TO> op(const shared_vector<void>& src) {
return shared_vector<TO>(src, detail::_shared_vector_cast_tag());
}
};
template<typename TO>
struct static_shared_vector_caster<TO, const void,
typename meta::_and<meta::same_const<TO,const void>, meta::is_not_void<TO> >::type> {
static inline shared_vector<TO> op(const shared_vector<const void>& src) {
return shared_vector<TO>(src, detail::_shared_vector_cast_tag());
}
};
// from non-void to void with same const-ness
template<typename FROM>
struct static_shared_vector_caster<void, FROM,
typename meta::_and<meta::same_const<void,FROM>, meta::is_not_void<FROM> >::type> {
static FORCE_INLINE shared_vector<void> op(const shared_vector<FROM>& src) {
return shared_vector<void>(src, detail::_shared_vector_cast_tag());
}
};
template<typename FROM>
struct static_shared_vector_caster<const void, FROM,
typename meta::_and<meta::same_const<const void,FROM>, meta::is_not_void<FROM> >::type> {
static FORCE_INLINE shared_vector<const void> op(const shared_vector<FROM>& src) {
return shared_vector<const void>(src, detail::_shared_vector_cast_tag());
}
};
// cast to same type, no-op
template<typename TOFRO>
struct static_shared_vector_caster<TOFRO,TOFRO,void> {
static FORCE_INLINE const shared_vector<TOFRO>& op(const shared_vector<TOFRO>& src) {
return src;
}
};
} // namespace detail
/** @brief Allow casting of shared_vector between types
*
* Currently only to/from void is implemented.
*
@warning Casting from void is undefined unless the offset and length
* are integer multiples of the size of the destination type.
*/
template<typename TO, typename FROM>
static FORCE_INLINE
shared_vector<TO>
static_shared_vector_cast(const shared_vector<FROM>& src)
{
return detail::static_shared_vector_caster<TO,FROM>::op(src);
}
namespace detail {
// Default to type conversion using castUnsafe (C++ type casting) on each element
@@ -709,7 +634,7 @@ namespace detail {
return shared_vector<TO>(src, detail::_shared_vector_cast_tag());
}
};
// convert from void uses original type or throws an exception.
template<typename TO, typename FROM>
struct shared_vector_converter<TO,FROM,
@@ -737,16 +662,30 @@ namespace detail {
};
}
/** @brief Allow casting of shared_vector between types
*
* Currently only to/from void is implemented.
*
@warning Casting from void is undefined unless the offset and length
* are integer multiples of the size of the destination type.
*/
template<typename TO, typename FROM>
static FORCE_INLINE
shared_vector<TO>
static_shared_vector_cast(const shared_vector<FROM>& src,
typename meta::same_const<TO,FROM,int>::type = 0)
{
return shared_vector<TO>(src, detail::_shared_vector_cast_tag());
}
/** @brief Allow converting of shared_vector between types
*
* Conversion utilizes castUnsafe<TO,FROM>().
*
* Converting to/from void is supported. Convert to void
* is an alias for static_shared_vector_cast<void>().
* Convert from void utilizes shared_vector<void>::original_type().
*
* @throws std::runtime_error if cast is not valid.
* @throws std::bad_alloc for out of memory condition
* Convert from void utilizes shared_vector<void>::original_type()
* and throws std::runtime_error if this is not valid.
*/
template<typename TO, typename FROM>
static FORCE_INLINE
@@ -922,11 +861,8 @@ std::ostream& operator<<(std::ostream& strm, const epics::pvData::shared_vector<
* shared_vector has additional constructors from raw pointers
* and shared_ptr s.
*
* Implicit casting is not allowed. Instead use
* const_shared_vector_cast()/freeze()/thaw() (@ref vectorconst)
* to casting between 'T' and 'const T'.
* Use static_shared_vector_cast() to cast between
* void and non-void (same const-ness).
* The copy constructor and assignment operator allow implicit
* casting from type 'shared_vector<T>' to 'shared_vector<const T>'.
*
* To facilitate safe modification the methods unique() and
* make_unique() are provided.
@@ -1028,15 +964,17 @@ Type #2 is constant reference to a mutable value.
Type #3 is a mutable reference to a constant value.
Type #4 is a constant reference to a constant value.
Casting between const and non-const references of the same value type
is governed by the normal C++ casting rules.
Casting between const and non-const values does @b not follow the normal
C++ casting rules (no implicit cast).
C++ casting rules.
For casting between shared_vector<T> and shared_vector<const T>
explicit casting operations are required. These operations are
@b freeze() (non-const to const) and @b thaw() (const to non-const).
A 'shared_vector<const T>' is "frozen" as its value can not be modified.
However it can still be sliced because the reference is not const.
A shared_vector<const T> is "frozen" as its value can not be modified.
These functions are defined like:
@@ -1060,18 +998,17 @@ The following guarantees are provided by both functions:
# The returned reference points to a value which is only referenced by
shared_vectors with the same value const-ness as the returned reference.
@note The argument of both freeze() and thaw() is a non-const
Please note that the argument of both freeze and thaw is a non-const
reference which will always be cleared.
@section vfreeze Freezing
The act of freezing a shared_vector requires that the shared_vector
passed in must be unique() or an exception is thrown.
No copy is made.
passed in must be unique() or an exception is thrown. This is
done to reduce the possibility of accidental copying.
The possibility of an exception can be avoided by calling the make_unique() on a
This possibility can be avoided by calling the make_unique() on a
shared_vector before passing it to freeze().
This will make a copy if necessary.
@section vthaw Thawing

View File

@@ -1,7 +1,8 @@
/*status.cpp*/
/*
* Copyright information and license terms for this software can be
* found in the file LICENSE that is included with the distribution
/*pvData.cpp*/
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvData is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
/**
* @author mrk
@@ -16,6 +17,7 @@ using std::string;
namespace epics { namespace pvData {
const char* Status::StatusTypeName[] = { "OK", "WARNING", "ERROR", "FATAL" };
string Status::m_emptyStringtring;
Status Status::Ok;
@@ -100,8 +102,7 @@ void Status::deserialize(ByteBuffer *buffer, DeserializableControl *flusher)
if (m_statusType != STATUSTYPE_OK)
{
m_statusType = STATUSTYPE_OK;
m_message.clear();
m_stackDump.clear();
m_message = m_stackDump = m_emptyStringtring;
}
}
else

View File

@@ -1,7 +1,8 @@
/* status.h */
/*
* Copyright information and license terms for this software can be
* found in the file LICENSE that is included with the distribution
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvData is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
/**
* @author mse
@@ -102,7 +103,9 @@ namespace epics { namespace pvData {
void dump(std::ostream& o) const;
private:
static std::string m_emptyStringtring;
StatusType m_statusType;
std::string m_message;
std::string m_stackDump;

View File

@@ -1,6 +1,7 @@
/*
* Copyright information and license terms for this software can be
* found in the file LICENSE that is included with the distribution
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvData is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
/** C++ Template meta programming helpers
*/

122
src/misc/thread.h Normal file
View File

@@ -0,0 +1,122 @@
/* thread.h */
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvData is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
/**
* @author mrk
*/
#ifndef THREAD_H
#define THREAD_H
#include <memory>
#ifdef epicsExportSharedSymbols
#define threadepicsExportSharedSymbols
#undef epicsExportSharedSymbols
#endif
#include <epicsThread.h>
#ifdef threadepicsExportSharedSymbols
#define epicsExportSharedSymbols
#undef threadepicsExportSharedSymbols
#endif
#include <pv/noDefaultMethods.h>
#include <pv/pvType.h>
#include <shareLib.h>
namespace epics { namespace pvData {
enum ThreadPriority {
lowestPriority =epicsThreadPriorityLow,
lowerPriority =epicsThreadPriorityLow + 15,
lowPriority =epicsThreadPriorityMedium - 15,
middlePriority =epicsThreadPriorityMedium,
highPriority =epicsThreadPriorityMedium + 15,
higherPriority =epicsThreadPriorityHigh - 15,
highestPriority =epicsThreadPriorityHigh
};
class Thread;
typedef std::tr1::shared_ptr<Thread> ThreadPtr;
typedef std::tr1::shared_ptr<epicsThread> EpicsThreadPtr;
typedef epicsThreadRunable Runnable;
/**
* @brief C++ wrapper for epicsThread from EPICS base.
*
*/
class epicsShareClass Thread : public epicsThread, private NoDefaultMethods {
public:
/**
*
* Constructor
* @param name thread name.
* @param priority priority is one of:
@code
enum ThreadPriority {
lowestPriority, lowerPriority, lowPriority,
middlePriority,
highPriority, higherPriority, highestPriority
};
@endcode
* @param runnable this is a c function
* @param stkcls stack size as specified by epicsThreadStackSizeClass
*/
Thread(std::string name,
ThreadPriority priority,
Runnable *runnable,
epicsThreadStackSizeClass stkcls=epicsThreadStackSmall)
:epicsThread(*runnable,
name.c_str(),
epicsThreadGetStackSize(stkcls),
priority)
{
this->start();
}
/**
*
* Constructor
* @param runnable this is a c function
* @name thread name.
* @param stkcls stack size as specified by epicsThreadStackSizeClass
* @param priority priority is one of:
@code
enum ThreadPriority {
lowestPriority, lowerPriority, lowPriority,
middlePriority,
highPriority, higherPriority, highestPriority
};
@endcode
*/
Thread(Runnable &runnable,
std::string name,
unsigned int stksize,
unsigned int priority=lowestPriority)
:epicsThread(runnable,
name.c_str(),
stksize,
priority)
{
this->start();
}
/**
* Destructor
*/
~Thread()
{
this->exitWait();
}
};
}}
#endif /* THREAD_H */

View File

@@ -1,7 +1,8 @@
/* timeFunction.cpp */
/*
* Copyright information and license terms for this software can be
* found in the file LICENSE that is included with the distribution
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvData is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
/**
* @author mrk
@@ -12,8 +13,6 @@
#include <string>
#include <cstdio>
#include <epicsTime.h>
#define epicsExportSharedSymbols
#include <pv/pvType.h>
#include <pv/timeStamp.h>

View File

@@ -1,7 +1,8 @@
/* timeFunction.h */
/*
* Copyright information and license terms for this software can be
* found in the file LICENSE that is included with the distribution
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvData is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
/**
* @author mrk

View File

@@ -1,13 +1,14 @@
/* timer.cpp */
/*
* Copyright information and license terms for this software can be
* found in the file LICENSE that is included with the distribution
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvData is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
/**
* @author mrk
*/
#if defined(_WIN32) && !defined(NOMINMAX)
#ifdef _WIN32
#define NOMINMAX
#endif
@@ -15,8 +16,6 @@
#include <string>
#include <iostream>
#include <epicsThread.h>
#define epicsExportSharedSymbols
#include <pv/timer.h>

View File

@@ -1,7 +1,8 @@
/* timer.h */
/*
* Copyright information and license terms for this software can be
* found in the file LICENSE that is included with the distribution
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvData is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
/**
* @author mrk
@@ -114,7 +115,7 @@ public:
bool isScheduled(TimerCallbackPtr const &timerCallback);
/**
* show the elements in the timer queue.
* @param o The output stream for the output
* @parm o The output stream for the output
*/
void dump(std::ostream& o);

View File

@@ -1,15 +1,14 @@
/*
* Copyright information and license terms for this software can be
* found in the file LICENSE that is included with the distribution
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvData is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
/* Author: Michael Davidsaver */
#include <algorithm>
#include <sstream>
#include <epicsConvert.h>
#define epicsExportSharedSymbols
#include "pv/typeCast.h"
#include "typeCast.h"
using epics::pvData::castUnsafe;
using epics::pvData::ScalarType;

View File

@@ -1,6 +1,7 @@
/*
* Copyright information and license terms for this software can be
* found in the file LICENSE that is included with the distribution
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvData is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
/* Author: Michael Davidsaver */
#ifndef PVTYPECAST_H
@@ -9,13 +10,23 @@
#include <stdexcept>
#include <sstream>
#ifdef epicsExportSharedSymbols
#define typeCastepicsExportSharedSymbols
#undef epicsExportSharedSymbols
#endif
#include <epicsConvert.h>
#include <shareLib.h>
#ifdef typeCastepicsExportSharedSymbols
#define epicsExportSharedSymbols
#undef typeCastepicsExportSharedSymbols
#endif
#include <pv/pvType.h>
#include <pv/pvIntrospect.h>
#include <pv/templateMeta.h>
#include <shareLib.h>
namespace epics { namespace pvData {

View File

@@ -2,8 +2,8 @@
SRC_DIRS += $(PVDATA_SRC)/monitor
INC += pv/monitor.h
INC += pv/monitorPlugin.h
INC += monitor.h
INC += monitorPlugin.h
LIBSRCS += monitor.cpp
LIBSRCS += monitorPlugin.cpp
LIBSRCS += monitorPlugin.cpp

View File

@@ -1,7 +1,8 @@
/*monitor.cpp*/
/*
* Copyright information and license terms for this software can be
* found in the file LICENSE that is included with the distribution
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvData is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
/**
* @author mse

View File

@@ -1,7 +1,8 @@
/* monitor.h */
/*
* Copyright information and license terms for this software can be
* found in the file LICENSE that is included with the distribution
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvData is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
/**
* @author mrk

View File

@@ -1,13 +1,13 @@
/* monitorPlugin.cpp */
/*
* Copyright information and license terms for this software can be
* found in the file LICENSE that is included with the distribution
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvData is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
/**
* @author mrk
*/
#define IN_MONITORPLUGIN_CPP
#define epicsExportSharedSymbols
#include <pv/monitorPlugin.h>

View File

@@ -1,7 +1,8 @@
/* monitorPlugin.h */
/*
* Copyright information and license terms for this software can be
* found in the file LICENSE that is included with the distribution
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvData is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
/**
* @author mrk
@@ -17,16 +18,6 @@
#include <shareLib.h>
#if !defined(IN_MONITORPLUGIN_CPP)
#warning monitorPlugin.h is deprecated
#endif
#if !defined(IN_MONITORPLUGIN_CPP) && defined(__GNUC__) && !(defined(__vxworks) && !defined(_WRS_VXWORKS_MAJOR))
#define USAGE_DEPRECATED __attribute__((deprecated))
#else
#define USAGE_DEPRECATED
#endif
namespace epics { namespace pvData {
class MonitorPlugin;
@@ -50,7 +41,7 @@ typedef std::tr1::shared_ptr<MonitorPluginManager> MonitorPluginManagerPtr;
* A monitor is assumed to be associated with a field of a top-level
* structure.
*/
class epicsShareClass USAGE_DEPRECATED MonitorPlugin
class epicsShareClass MonitorPlugin
{
public:
virtual ~MonitorPlugin(){}
@@ -75,6 +66,9 @@ public:
MonitorElementPtr const &monitorElement) = 0;
/**
* A monitor will be sent to the client.
* @param pvField The copy of the field being monitored.
* The plugin can modify the data.
* @param pvTop The top-level structure in which the field resides.
* @param monitorElement The data for the client.
* The plugin is allowed to change the data values.
*/
@@ -104,7 +98,7 @@ public:
*
* Normlly a plugin is created for a single client.
*/
class epicsShareClass USAGE_DEPRECATED MonitorPluginCreator
class epicsShareClass MonitorPluginCreator
{
public:
virtual ~MonitorPluginCreator() {}
@@ -136,7 +130,7 @@ public:
* This manages a set of monitor plugins.
* @author mrk
*/
class epicsShareClass USAGE_DEPRECATED MonitorPluginManager
class epicsShareClass MonitorPluginManager
{
public:
POINTER_DEFINITIONS(MonitorPluginManager);
@@ -174,7 +168,7 @@ private:
epics::pvData::Mutex mutex;
};
#undef USAGE_DEPRECATED
}}
#endif /* MONITORPLUGIN_H */

View File

@@ -2,15 +2,15 @@
SRC_DIRS += $(PVDATA_SRC)/property
INC += pv/alarm.h
INC += pv/pvAlarm.h
INC += pv/control.h
INC += pv/pvControl.h
INC += pv/display.h
INC += pv/pvDisplay.h
INC += pv/pvEnumerated.h
INC += pv/timeStamp.h
INC += pv/pvTimeStamp.h
INC += alarm.h
INC += pvAlarm.h
INC += control.h
INC += pvControl.h
INC += display.h
INC += pvDisplay.h
INC += pvEnumerated.h
INC += timeStamp.h
INC += pvTimeStamp.h
LIBSRCS += alarm.cpp
LIBSRCS += pvAlarm.cpp

View File

@@ -1,7 +1,8 @@
/* alarm.cpp */
/*
* Copyright information and license terms for this software can be
* found in the file LICENSE that is included with the distribution
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvData is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
/**
* @author mrk
@@ -9,8 +10,6 @@
#include <string>
#include <stdexcept>
#include <epicsMutex.h>
#define epicsExportSharedSymbols
#include <pv/lock.h>
#include <pv/pvType.h>

View File

@@ -1,7 +1,8 @@
/* alarm.h */
/*
* Copyright information and license terms for this software can be
* found in the file LICENSE that is included with the distribution
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvData is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
/**
* @author mrk

View File

@@ -1,7 +1,8 @@
/* control.h */
/*
* Copyright information and license terms for this software can be
* found in the file LICENSE that is included with the distribution
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvData is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
/**
* @author mrk

View File

@@ -1,7 +1,8 @@
/* display.h */
/*
* Copyright information and license terms for this software can be
* found in the file LICENSE that is included with the distribution
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvData is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
/**
* @author mrk

View File

@@ -1,7 +1,8 @@
/* pvAlarm.cpp */
/*
* Copyright information and license terms for this software can be
* found in the file LICENSE that is included with the distribution
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvData is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
/**
* @author mrk

View File

@@ -1,7 +1,8 @@
/* pvAlarm.h */
/*
* Copyright information and license terms for this software can be
* found in the file LICENSE that is included with the distribution
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvData is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
/**
* @author mrk

View File

@@ -1,7 +1,8 @@
/* pvControl.cpp */
/*
* Copyright information and license terms for this software can be
* found in the file LICENSE that is included with the distribution
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvData is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
/**
* @author mrk

View File

@@ -1,7 +1,8 @@
/* pvControl.h */
/*
* Copyright information and license terms for this software can be
* found in the file LICENSE that is included with the distribution
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvData is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
/**
* @author mrk

Some files were not shown because too many files have changed in this diff Show More