101 Commits
5.0.4 ... 6.0.1

Author SHA1 Message Date
Andrew Johnson
e0367a2dd7 Update release notes and release date. 2016-09-14 17:01:51 -05:00
Andrew Johnson
1e0f1119e2 testTypeCast: mangle values to be printable
print  (u)int8 as integer instead of character

(cherry picked from commit da8ba56dd1)
2016-09-14 16:43:53 -05:00
Andrew Johnson
6d6314a924 #include <algorithm> required for MSVS 2015
(cherry picked from commit 4555f69733)
2016-09-14 16:33:37 -05:00
Dave Hickin
e0b881d036 Correction to documentation for 6.0.1 2016-09-14 11:25:30 +01:00
Dave Hickin
d24ff6c3d2 Update documentation for 6.0.1 2016-09-13 22:44:11 +01:00
Dave Hickin
ef17aac046 Update release notes for 6.0.1 2016-09-13 22:33:28 +01:00
Dave Hickin
83b63a9138 Fix for MinGW
Fixes #42
2016-09-07 15:14:17 +01:00
Dave Hickin
0a5ab8625d Update documentation for 6.0.0 2016-08-01 17:25:12 +01:00
Dave Hickin
a115c9cd15 Add release notes for 6.0.0 2016-08-01 17:23:11 +01:00
Dave Hickin
6ba40803d8 Add 5.0.x release notes 2016-08-01 15:00:36 +01:00
Dave Hickin
8d6094c55a jenkins: Remove COPYRIGHT from tar 2016-07-22 16:08:27 +01:00
Dave Hickin
d258acfc49 SHRLIB: Set version to 6.0 2016-07-22 16:02:21 +01:00
Dave Hickin
d9072402db Update source boilerplate for new LICENSE file 2016-07-22 15:56:43 +01:00
Dave Hickin
1a706e3842 Remove COPYRIGHT file
Copyright is now in LICENSE file
2016-07-22 15:33:50 +01:00
Dave Hickin
a227897504 Update LICENSE to new version 2016-07-22 15:33:20 +01:00
Ralph Lange
0833d68e91 jenkins: fix installE4 logic, add pvCommon dependency 2016-07-22 14:59:48 +02:00
Dave Hickin
99bab6796c Fix windows dynamic build error
Fix error introduced by #40. #include epicsThread.h in timer.cpp
before #defining epicsExportSharedSymbols. Avoids multiply-defined
symbols.
2016-07-20 15:33:20 +01:00
dhickin
0544187057 Merge pull request #40 from anjohnson/master
Resolve github #37 without cacheing epicsExportSharedSymbols
2016-07-20 14:39:25 +01:00
Andrew Johnson
e12e7b4d76 Resolve github #37 without cacheing epicsExportSharedSymbols 2016-07-19 18:40:58 -05:00
Ralph Lange
7609ac6f1e jenkins: fix syntax in local declaration 2016-07-19 22:09:03 +02:00
Ralph Lange
3c946a91e8 jenkins: use install functions, add BRANCH variable to doc script 2016-07-19 22:00:34 +02:00
Ralph Lange
2389ebd87e jenkins: fix CloudBees jobs (paths) 2016-07-12 19:39:50 +02:00
Ralph Lange
90ad497a6f Use environment variables; default Base = 3.15.4; new artifact paths 2016-07-12 15:45:30 +02:00
Ralph Lange
1bb0b6fe03 Use environment variables; new default version of Base 2016-07-12 14:53:21 +02:00
dhickin
c16c1df6fd Merge pull request #39 from dhickin/use_template_getSubField
Replace template getSubField with template version
2016-07-05 15:19:58 +01:00
dhickin
e460641711 Merge pull request #38 from dhickin/getSubField_overload
Add char* overload for non-template getSubField
2016-07-05 15:18:46 +01:00
Dave Hickin
1e980651a9 Use template getSubField when type known
Replace non-template getSubField with template version when PVField is
of a known, derived type.
2016-07-04 17:03:07 +01:00
Dave Hickin
028076e79c Add char* overload for non-template getSubField 2016-07-04 14:59:56 +01:00
dhickin
e5b6a88551 Merge pull request #30 from mdavidsaver/requestermsg
Default implementation for Requester::message()
2016-04-12 16:01:45 +01:00
Andrew Johnson
b18b4f236f Make the PVScalarValue explicit specializations inline
Microsoft's compiler seems to prefer this when building a static library.
2016-04-11 17:16:43 -05:00
Andrew Johnson
605d4e99b9 Remove remaining 'undef epicsExportSharedSymbols' stuff 2016-04-11 15:24:46 -05:00
Andrew Johnson
ad00b6465a Fix VxWorks build, add explanatory comments 2016-04-11 11:33:05 -05:00
dhickin
537ebd05f2 Merge pull request #36 from anjohnson/master
Support for additional Windows targets
2016-04-11 10:06:54 +01:00
Andrew Johnson
2ee8769752 Prevent redefinition of NOMINMAX
While this protection is not strictly necessary here, if someone
does a cut-and-paste into a header file it should be included.
2016-04-06 15:29:30 -05:00
Andrew Johnson
8d7f534d54 VxWorks fix in parseToPOD.cpp 2016-03-28 17:11:25 -05:00
Andrew Johnson
47bb62b051 Disable another useless MSVC warning 2016-03-28 16:41:29 -05:00
Andrew Johnson
50b8213781 Fix NEED_OLL_FUNCS for windows-x64 and Base-3.15 2016-03-28 16:41:29 -05:00
Andrew Johnson
fd1fe53b49 Use the EPICS_DEPRECATED macro from Base.
Neither USAGE_DEPRECATED nor USAGE_ERROR are currently used
in the V4 code-base.
2016-03-28 16:41:28 -05:00
Andrew Johnson
378def0a58 Fix logic for when to define strtoll() and strtoull()
Needed for MinGW and VxWorks when built against Base-3.15
2016-03-28 16:41:28 -05:00
Andrew Johnson
ed5f48b353 EPICS sources use vxWorks for arch-detection 2016-03-28 16:41:28 -05:00
Andrew Johnson
fa6c2c7683 EPICS sources use _MINGW for arch-detection 2016-03-28 16:41:28 -05:00
Andrew Johnson
3fadc9b481 Remove unnecessary includes from epicsException.h
Fix up byteBuffer.h and epicsException.cpp to match.
2016-03-28 16:41:28 -05:00
Andrew Johnson
c3d7fa0d26 Declare explicit specializations
Resolves duplicate symbol build error on MinGW.
2016-03-28 16:41:28 -05:00
Andrew Johnson
5c16357fe2 Don't redefine NOMINMAX (clean up MinGW warnings) 2016-03-28 16:41:28 -05:00
Andrew Johnson
ef2e6079ba Wrap WIN32 #pragma warning(disable) inside push/pop
Exclude from MinGW, G++ doesn't understand these pragmas.
2016-03-28 16:41:28 -05:00
Dave Hickin
18633288fb Documentation: Remove maturity and date comment 2016-03-18 21:48:06 +00:00
Dave Hickin
67daef7bcc Documentation: Remove old versions 2016-03-18 21:43:09 +00:00
Dave Hickin
5eb29dcfc4 Documentation: Change to release-based versioning
Replace dated documentation scheme by one using release version.
2016-03-18 21:41:33 +00:00
Michael Davidsaver
d2fc922ee7 remove unnecessary const_cast 2016-03-18 14:53:24 -04:00
Michael Davidsaver
d35010c1cb Status: remove m_emptyStringtring
No reason to have a global for this.
2016-03-18 14:53:10 -04:00
dhickin
bd4b65225c Merge pull request #28 from mdavidsaver/overhaulbitset
bitSet: macros and vector storage
2016-03-17 14:20:20 +00:00
dhickin
be95a62965 Merge pull request #31 from mdavidsaver/deprecatemonitiorplugin
Deprecate monitorPlugin.h
2016-03-15 14:46:53 +00:00
dhickin
4336d524af Merge pull request #33 from msekoranja/master
Minor Win32 compilation fix
2016-03-07 12:02:03 +00:00
Matej Sekoranja
ae7976fc01 Merge remote-tracking branch 'epics-base/master' 2016-03-06 21:33:43 +01:00
Matej Sekoranja
72f9dc4c7c win32 compilation fix 2016-03-06 21:29:04 +01:00
dhickin
84760648fe Merge pull request #29 from mdavidsaver/fixsharedvector 2016-03-02 13:56:06 +00:00
Michael Davidsaver
b0df40d9a6 testSharedVector more PG locals 2016-03-01 13:25:20 -05:00
Michael Davidsaver
139217914d deprecate monitorPlugin.h 2016-02-26 12:17:12 -05:00
Michael Davidsaver
efa5795193 Default implementation for Requester::message()
This is what many sub-classes do (or should)
so lets prepare to remove some boilerplate.
2016-02-26 12:16:28 -05:00
Michael Davidsaver
4f499aed01 remove PVField::notImplemented
An unused waste of space in every instance...
2016-02-26 12:13:23 -05:00
Michael Davidsaver
a8ba831f5e fix freeze() of shared_vector<void> 2016-02-26 12:13:23 -05:00
Michael Davidsaver
a90405c25a shared_vector update doc 2016-02-26 12:13:23 -05:00
Michael Davidsaver
4546fda8e9 note shared_vector casts which should fail 2016-02-26 12:13:23 -05:00
Michael Davidsaver
b02f771146 shared_vector: vtype lost when freeze/thaw untyped
The vtype code is not copied for freeze/thaw
of shared_vector<void> to/from shared_vector<const void>.
2016-02-26 12:13:23 -05:00
Michael Davidsaver
dc94b26e50 fix static_shared_vector_cast<>() no-op casting
Turns out that Enablers as typically used for
member functions don't work to select
constructors.

Move this selection logic to
struct detail::static_shared_vector_caster<>
to correctly allow no-op casts (eg. void to void).
Previously this would not compile.

Allows PVScalarArray getAs() and putFrom() using
shared_vector<const void>.
2016-02-26 12:13:23 -05:00
Michael Davidsaver
4c32f37ede bitSet: macros and vector storage
use std::vector<uint64> to manage storage.
Make some global variable "constants" into macros.
add swap()
2016-02-18 18:39:32 -05:00
Dave Hickin
336a8b3bc2 Fix win32 deserialization test fail 2016-02-18 18:56:04 +00:00
Dave Hickin
faecea39c8 Merge branch 'master' of github.com:msekoranja/pvDataCPP 2016-02-18 15:35:36 +00:00
Michael Davidsaver
d08d5362be testBitSet: forgot to update test count 2016-02-17 10:53:32 -05:00
Michael Davidsaver
d4292d81f2 BitSet: truncation in or_and
For "this |= set1 & set2" the result size
should be "max(this, min(set1, set2))" while
at present it is "min(set1, set2)" resulting
in truncation if the LHS is longer than the
RHS.
2016-02-17 10:17:21 -05:00
Michael Davidsaver
62893e33e9 testBitSet: demo bug in BitSet::or_and
Incorrect handling of wordsInUse truncates if
RHS (b1 & b2) is shorter than LHS (b3).
2016-02-17 10:17:16 -05:00
Michael Davidsaver
5b07ecbd01 testBitSet more diag output 2016-02-17 10:17:04 -05:00
Ralph Lange
b5c1b9178d jenkins: switch to Base 3.15.3 2016-02-16 10:18:41 +01:00
Matej Sekoranja
65ff7ab1c3 fixed bitSet serialization 2016-02-12 19:35:44 +01:00
Dave Hickin
35fd991fdc Improve directSerialize/Deserialize() documentation
Add explanation of returned values and more description of the methods.
2016-02-11 10:51:43 +00:00
Michael Davidsaver
57e1acba79 add missing epicsShareFunc 2016-02-10 11:22:07 -05:00
Michael Davidsaver
620d351946 current_function.h not executable 2016-02-10 14:43:58 +00:00
Michael Davidsaver
de3c2656ef INC += pv/ 2016-02-10 14:40:29 +00:00
Michael Davidsaver
3b2e9b2485 move all headers to pv/ 2016-02-10 14:40:29 +00:00
dhickin
75a3005d74 Merge pull request #17 from mdavidsaver/sertovector
add serializeToVector()
2016-02-10 14:04:01 +00:00
Michael Davidsaver
448f606054 update comments 2016-02-09 19:17:39 -05:00
Michael Davidsaver
e35c6f29fb add deserializeFrom* helpers 2016-02-05 18:34:16 -05:00
Michael Davidsaver
85a1a48b00 add serializeToVector 2016-01-27 11:25:09 -05:00
dhickin
45427d3202 Merge pull request #21 from mdavidsaver/getfieldnull
getSubField -> getSubFieldT to avoid potential NULL de-ref.
2016-01-26 22:14:53 +00:00
Michael Davidsaver
93c7a05dac remove redundant getSubField 2016-01-25 13:15:15 -05:00
Michael Davidsaver
a34c38c9b9 getSubField -> getSubFieldT to avoid potential NULL de-ref. 2016-01-25 12:12:06 -05:00
Michael Davidsaver
3100b77a1a Merge remote-tracking branch 'origin/master'
* origin/master:
  missing buffer capacity check in PVUnion::serialize
  byteBuffer throw invalid_argument when ctor w/ NULL
  revert incorrect doc string
  byteBuffer check for alloc failure and const
  new Thread::Config
2016-01-25 12:05:32 -05:00
Michael Davidsaver
c8429069a3 SONAME in src/Makefile 2016-01-25 11:49:05 -05:00
Michael Davidsaver
01172217dc Merge remote-tracking branch 'md/threadconfig'
* md/threadconfig:
  new Thread::Config
2015-12-29 18:34:18 -05:00
Michael Davidsaver
14b0e409f2 missing buffer capacity check in PVUnion::serialize
Allows a buffer overflow in PVUnionArray::serialize().
2015-12-28 18:16:01 -05:00
Michael Davidsaver
2107bae8dd set SHRLIB_VERSION 2015-12-18 16:07:09 -05:00
Michael Davidsaver
433676226c byteBuffer throw invalid_argument when ctor w/ NULL 2015-12-17 16:45:56 -05:00
Michael Davidsaver
f0c88234a0 revert incorrect doc string 2015-12-15 10:26:31 -05:00
Michael Davidsaver
393d711e5f byteBuffer check for alloc failure and const
Ensure that bad_alloc is thrown if allocations fail, presently unchecked.

Also add const qualifier where possible.
2015-12-14 13:25:42 -05:00
Michael Davidsaver
cb24bd9c2c Merge remote-tracking branch 'md/validatefieldnames'
* md/validatefieldnames:
  fix testCreateRequest
  field names may not begin with a digit
  fail zero length field names
  validate field names
2015-11-30 20:55:16 -05:00
Michael Davidsaver
abc5c5a374 new Thread::Config 2015-11-23 15:21:21 -05:00
Michael Davidsaver
54c94f181a add global namespace so these macros work anywhere 2015-11-23 15:21:21 -05:00
Michael Davidsaver
6641e7f5d1 fix testCreateRequest
field names may not begin with a digit
2015-11-23 14:33:43 -05:00
Michael Davidsaver
f4a00f2b0f field names may not begin with a digit
Enforce C identifer syntax

[A-Za-z_][A-Za-z0-9_]*
2015-11-23 14:31:27 -05:00
Michael Davidsaver
3714be4f16 fail zero length field names 2015-09-24 13:04:49 -04:00
Michael Davidsaver
f24f565e58 validate field names
check for invalid characters in field names (eg '.').

Restrict character set to ascii alpha numeric and '_'.
2015-09-23 15:32:46 -04:00
148 changed files with 2197 additions and 46665 deletions

View File

@@ -1,31 +0,0 @@
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,14 +1,16 @@
Copyright and License Terms
---------------------------
Copyright (c) 2006-2015 Martin R. Kraimer
Copyright (c) 2006 The University of Chicago, as Operator of Argonne
Copyright (c) 2006-2016 Martin R. Kraimer
Copyright (c) 2006-2016 UChicago Argonne LLC, as Operator of Argonne
National Laboratory.
Copyright (c) 2006 Deutsches Elektronen-Synchrotron,
Member of the Helmholtz Association, (DESY), HAMBURG, GERMANY.
Copyright (c) 2007-2015 Control System Laboratory,
Copyright (c) 2007-2016 Control System Laboratory,
(COSYLAB) Ljubljana Slovenia
Copyright (c) 2010-2015 Brookhaven Science Associates, as Operator of Brookhaven
National Laboratory
Copyright (c) 2011-2015 Diamond Light Source Limited,
Copyright (c) 2010-2016 Brookhaven Science Associates, as Operator
of Brookhaven National Laboratory
Copyright (c) 2011-2016 Diamond Light Source Limited,
(DLS) Didcot, United Kingdom
Permission is hereby granted, free of charge, to any person
@@ -34,81 +36,30 @@ OTHER DEALINGS IN THE SOFTWARE.
________________________________________________________________________
This software is in part copyrighted by the University of Chicago (UofC)
Additional Disclaimers
----------------------
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.
This software is copyright in part by these institutions:
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.
* 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
________________________________________________________________________
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.
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.
________________________________________________________________________
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.

View File

@@ -1,8 +1,7 @@
pvaDataCPP
==========
pvDataCPP is a set of data types and utilities that form part of the EPICS V4
project.
pvDataCPP is a set of data types and utilities that form part of the EPICS V4 project.
Further Info

View File

@@ -1,3 +1,88 @@
<?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;" />
<meta name="keywords" content="EPICS, EPICSv4" />
<title>EPICS V4 pvData C++ Release Notes</title>
<link rel="stylesheet" type="text/css" href="../../base.css" />
<link rel="stylesheet" type="text/css" href="../../epicsv4.css" />
</head>
<body>
<h1>Release 6.0.1</h1>
<p>The changes since release 6.0.0 are:</p>
<ul>
<li>Fix "Problem building pvDataCPP for win32-x86-mingw" (issue #42)</li>
<li>In src/misc/bitSet.cpp #include <algorithm> required for MSVS 2015</li>
<li>In testApp/misc/testTypeCast.cpp print (u)int8 values as integers</li>
<li>Minor documentation updates</li>
</ul>
<h1>Release 6.0.0</h1>
<p>The main changes since release 5.0.4 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>
@@ -10,7 +95,8 @@
<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
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
@@ -151,8 +237,8 @@ it was necessary to have code like:</p>
<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>template&lt;typename FT-&gt;
std::tr1::shared_ptr&lt; const FT-&gt; getField(std::string const &amp;fieldName) const </p>
<p>Can be used, for example, as follows:</p>
@@ -253,3 +339,7 @@ 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>
</body>
</html>

View File

@@ -1,3 +1,78 @@
Release 6.0.1
=============
The changes since release 6.0.0 are:
* Fix "Problem building pvDataCPP for win32-x86-mingw" (issue #42)
* In src/misc/bitSet.cpp #include <algorithm> required for MSVS 2015
* In testApp/misc/testTypeCast.cpp print (u)int8 values as integers
* Minor documentation updates
Release 6.0.0
=============
The main changes since release 5.0.4 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
=============

View File

@@ -35,33 +35,16 @@
<div class="head">
<h1>EPICS pvDataCPP</h1>
<!-- Maturity: Working Draft or Request for Comments, or Recommendation, and date. -->
<h2 class="nocount">EPICS v4 Working Group, Working Draft, 23-June-2015</h2>
<h2 class="nocount">Release 6.0.1 - 2016-09-14</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>
<dd>Matej Sekoranja, CosyLab</dd>
<dd>David Hickin, Diamond Light Source</dd>
</dl>
<p class="copyright">This product is made available subject to acceptance of the <a
href="http://epics-pvdata.sourceforge.net/LICENSE.html">EPICS open source
license.</a></p>
<hr />
</div>
@@ -79,7 +62,8 @@ V4 control system programming environment:<br />
<h2 class="nocount">Status of this Document</h2>
<p>This is the 23-June-2015 version of the C++ implementation of pvData.
<p>This is the 14-September-2016 version for the 6.0.1 release of the
C++ implementation of pvData.
</p>
<p>RELEASE_NOTES.md provides changes since the last release.
@@ -4887,7 +4871,7 @@ Monitor provides:
monitor. It, together with the queue facility, provides support for
monitor queues.
</dd>
<dt>monitorPlugin</dt>
<dt>monitorPlugin [Deprecated]</dt>
<dd>This is support for implementing monitor plugins.
A monitor plugin can be developed that has no knowledge
of pvAccess but only pvData.
@@ -5069,7 +5053,7 @@ where
<dl>
<dt>monitor</dt>
<dd>Used by code that implements pvAccess monitors.</dd>
<dt>monitorPlugin</dt>
<dt>monitorPlugin [Deprecated]</dt>
<dd>Code that provides special semantics for monitors.</dd>
</dl>
<h3>monitor</h3>
@@ -5185,6 +5169,8 @@ 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,16 +6,38 @@
#
# Author: Ralph Lange <ralph.lange@gmx.de>
# Copyright (C) 2013 Helmholtz-Zentrum Berlin für Materialien und Energie GmbH
# Copyright (C) 2014-2015 ITER Organization.
# Copyright (C) 2014-2016 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
}
###########################################
# Determine EPICS Base version
# Defaults for EPICS Base and MB
DEFAULT_BASE=3.14.12.5
BASE=${1:-${DEFAULT_BASE}}
USE_MB=${2:-"MB_NO"}
DEFAULT_BASE=3.15.4
BASE=${BASE:-${DEFAULT_BASE}}
MB=${MB:-"NO_MICROBENCH"}
###########################################
# Fetch and unpack dependencies
@@ -26,8 +48,8 @@ rm -fr ${STUFF}
mkdir -p ${STUFF}
cd ${STUFF}
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
installTool Boost 1.61.0
installTool Base ${BASE}
###########################################
# Build
@@ -53,4 +75,4 @@ make runtests
###########################################
# Create distribution
tar czf pvData.CB-dist.tar.gz lib include COPYRIGHT LICENSE
tar czf pvData.CB-dist.tar.gz lib include LICENSE

View File

@@ -6,14 +6,39 @@
#
# Author: Ralph Lange <ralph.lange@gmx.de>
# Copyright (C) 2013 Helmholtz-Zentrum Berlin für Materialien und Energie GmbH
# Copyright (C) 2014-2015 ITER Organization.
# Copyright (C) 2014-2016 ITER Organization.
# All rights reserved. Use is subject to license terms.
###########################################
# Set EPICS Base version and upload target
installTool () {
local module=$1
local version=$2
BASE=3.15.2
PUBLISH=${1:-DONT}
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
BASE=3.15.4
PUBLISH=${PUBLISH:-NO}
BRANCH=${BRANCH:-master}
MB=NO_MICROBENCH
###########################################
# Fetch and unpack dependencies
@@ -24,16 +49,14 @@ rm -fr ${STUFF}
mkdir -p ${STUFF}
cd ${STUFF}
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
installTool Doxygen 1.8.11
###########################################
# Generate
cd ${WORKSPACE}
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
installE4 pvData ${BRANCH}
export PATH=${STUFF}/bin:${PATH}
@@ -42,7 +65,7 @@ doxygen
###########################################
# Publish
if [ "${PUBLISH}" != "DONT" ]; then
if [ "${PUBLISH}" != "NO" ]; 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}/

View File

@@ -3,9 +3,6 @@
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
@@ -20,5 +17,8 @@ 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 += createRequest.h
INC += pvCopy.h
INC += pv/createRequest.h
INC += pv/pvCopy.h
LIBSRCS += createRequest.cpp
LIBSRCS += pvCopy.cpp

View File

@@ -1,12 +1,13 @@
/**
* 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.
/*
* Copyright information and license terms for this software can be
* found in the file LICENSE that is included with the distribution
*/
#include <string>
#include <sstream>
#include <epicsMutex.h>
#define epicsExportSharedSymbols
#include <pv/pvData.h>

View File

@@ -1,8 +1,7 @@
/*createRequest.h*/
/**
* 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.
/*
* Copyright information and license terms for this software can be
* found in the file LICENSE that is included with the distribution
*/
#ifndef CREATEREQUEST_H

View File

@@ -1,8 +1,7 @@
/* pvCopy.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.
/*
* Copyright information and license terms for this software can be
* found in the file LICENSE that is included with the distribution
*/
/**
* @author Marty Kraimer

View File

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

View File

@@ -1,7 +1,6 @@
/**
* 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.
/*
* Copyright information and license terms for this software can be
* found in the file LICENSE that is included with the distribution
*/
/**
* @author mes

View File

@@ -1,8 +1,7 @@
/* Convert.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.
/*
* Copyright information and license terms for this software can be
* found in the file LICENSE that is included with the distribution
*/
/**
* @author mrk
@@ -13,6 +12,8 @@
#include <stdexcept>
#include <typeinfo>
#include <epicsMutex.h>
#define epicsExportSharedSymbols
#include <pv/lock.h>
#include <pv/pvIntrospect.h>

View File

@@ -1,14 +1,13 @@
/*FieldCreateFactory.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.
/*
* Copyright information and license terms for this software can be
* found in the file LICENSE that is included with the distribution
*/
/**
* @author mrk
*/
#ifdef _WIN32
#if defined(_WIN32) && !defined(NOMINMAX)
#define NOMINMAX
#endif
@@ -19,6 +18,8 @@
#include <stdexcept>
#include <sstream>
#include <epicsMutex.h>
#define epicsExportSharedSymbols
#include <pv/lock.h>
#include <pv/pvIntrospect.h>
@@ -947,9 +948,53 @@ 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;
@@ -961,6 +1006,7 @@ 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;
@@ -979,6 +1025,7 @@ 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;
@@ -990,6 +1037,7 @@ 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;
@@ -1039,6 +1087,7 @@ 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 += factory.h
INC += pv/factory.h
LIBSRCS += TypeFunc.cpp
LIBSRCS += FieldCreateFactory.cpp
LIBSRCS += PVField.cpp

View File

@@ -1,8 +1,7 @@
/*PVArray.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.
/*
* Copyright information and license terms for this software can be
* found in the file LICENSE that is included with the distribution
*/
/**
* @author mrk

View File

@@ -1,14 +1,13 @@
/*PVDataCreateFactory.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.
/*
* Copyright information and license terms for this software can be
* found in the file LICENSE that is included with the distribution
*/
/**
* @author mrk
*/
#ifdef _WIN32
#if defined(_WIN32) && !defined(NOMINMAX)
#define NOMINMAX
#endif
@@ -17,6 +16,8 @@
#include <string>
#include <cstdio>
#include <epicsMutex.h>
#define epicsExportSharedSymbols
#include <pv/lock.h>
#include <pv/pvIntrospect.h>

View File

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

View File

@@ -1,8 +1,7 @@
/*PVScalar.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.
/*
* Copyright information and license terms for this software can be
* found in the file LICENSE that is included with the distribution
*/
/**
* @author mrk
@@ -29,22 +28,4 @@ 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,8 +1,7 @@
/*PVScalarArray.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.
/*
* Copyright information and license terms for this software can be
* found in the file LICENSE that is included with the distribution
*/
/**
* @author mrk

View File

@@ -1,8 +1,7 @@
/*PVStructure.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.
/*
* Copyright information and license terms for this software can be
* found in the file LICENSE that is included with the distribution
*/
/**
* @author mrk
@@ -52,7 +51,6 @@ 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++) {
@@ -105,9 +103,9 @@ const PVFieldPtrArray & PVStructure::getPVFields() const
return pvFields;
}
PVFieldPtr PVStructure::getSubField(string const &fieldName) const
PVFieldPtr PVStructure::getSubField(const char * fieldName) const
{
PVField * field = getSubFieldImpl(fieldName.c_str(), false);
PVField * field = getSubFieldImpl(fieldName, false);
if (field)
return field->shared_from_this();
else
@@ -259,9 +257,8 @@ void PVStructure::deserialize(ByteBuffer *pbuffer,
void PVStructure::serialize(ByteBuffer *pbuffer,
SerializableControl *pflusher, BitSet *pbitSet) const {
PVStructure* nonConstThis = const_cast<PVStructure*>(this);
size_t numberFields = nonConstThis->getNumberFields();
size_t offset = nonConstThis->getFieldOffset();
size_t numberFields = this->getNumberFields();
size_t offset = this->getFieldOffset();
int32 next = pbitSet->nextSetBit(static_cast<uint32>(offset));
// no more changes or no changes in this structure

View File

@@ -1,8 +1,7 @@
/*PVStructureArray.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.
/*
* Copyright information and license terms for this software can be
* found in the file LICENSE that is included with the distribution
*/
/**
* @author mrk

View File

@@ -1,8 +1,7 @@
/*PVUnion.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.
/*
* Copyright information and license terms for this software can be
* found in the file LICENSE that is included with the distribution
*/
/**
* @author mse

View File

@@ -1,8 +1,7 @@
/*PVUnionArray.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.
/*
* Copyright information and license terms for this software can be
* found in the file LICENSE that is included with the distribution
*/
/**
* @author mrk

View File

@@ -1,8 +1,7 @@
/* StandardField.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.
/*
* Copyright information and license terms for this software can be
* found in the file LICENSE that is included with the distribution
*/
/**
* @author mrk
@@ -11,6 +10,8 @@
#include <cstdio>
#include <stdexcept>
#include <epicsMutex.h>
#define epicsExportSharedSymbols
#include <pv/lock.h>
#include <pv/pvIntrospect.h>

View File

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

View File

@@ -1,8 +1,7 @@
/*TypeFunc.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.
/*
* Copyright information and license terms for this software can be
* found in the file LICENSE that is included with the distribution
*/
/**
* @author mrk

View File

@@ -1,18 +0,0 @@
/*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,8 +1,7 @@
/* printer.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.
/*
* Copyright information and license terms for this software can be
* found in the file LICENSE that is included with the distribution
*/
#include <deque>

17
src/factory/pv/factory.h Normal file
View File

@@ -0,0 +1,17 @@
/*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,7 +1,6 @@
/**
* 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.
/*
* Copyright information and license terms for this software can be
* found in the file LICENSE that is included with the distribution
*/
/**
* @author Marty Kraimer

View File

@@ -2,29 +2,29 @@
SRC_DIRS += $(PVDATA_SRC)/misc
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
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
LIBSRCS += byteBuffer.cpp
LIBSRCS += bitSet.cpp

View File

@@ -1,8 +1,7 @@
/* bitSet.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.
/*
* Copyright information and license terms for this software can be
* found in the file LICENSE that is included with the distribution
*/
/**
* @author mes
@@ -10,12 +9,38 @@
#include <string.h>
#include <stdio.h>
#include <iostream>
#include <stdexcept>
#include <algorithm>
#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)
@@ -23,88 +48,59 @@ namespace epics { namespace pvData {
return BitSet::shared_pointer(new BitSet(nbits));
}
BitSet::BitSet() : words(0), wordsLength(0), wordsInUse(0) {
initWords(BITS_PER_WORD);
BitSet::BitSet() {}
BitSet::BitSet(uint32 nbits)
{
words.reserve((nbits == 0) ? 1 : WORD_INDEX(nbits-1) + 1);
}
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;
}
BitSet::~BitSet() {}
void BitSet::recalculateWordsInUse() {
// 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)
// step back from the end to find the first non-zero element
size_t nsize = words.size();
for(; nsize; nsize--) {
if(words[nsize-1])
break;
wordsInUse = i+1; // The new logical size
}
words.resize(nsize);
CHECK_POST();
}
void BitSet::ensureCapacity(uint32 wordsRequired) {
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;
}
words.resize(std::max(words.size(), (size_t)wordsRequired), 0);
}
void BitSet::expandTo(uint32 wordIndex) {
uint32 wordsRequired = wordIndex+1;
if (wordsInUse < wordsRequired) {
ensureCapacity(wordsRequired);
wordsInUse = wordsRequired;
}
ensureCapacity(wordIndex+1);
}
void BitSet::flip(uint32 bitIndex) {
uint32 wordIdx = wordIndex(bitIndex);
uint32 wordIdx = WORD_INDEX(bitIndex);
expandTo(wordIdx);
words[wordIdx] ^= (((uint64)1) << (bitIndex % BITS_PER_WORD));
words[wordIdx] ^= (((uint64)1) << WORD_OFFSET(bitIndex));
recalculateWordsInUse();
}
void BitSet::set(uint32 bitIndex) {
uint32 wordIdx = wordIndex(bitIndex);
uint32 wordIdx = WORD_INDEX(bitIndex);
expandTo(wordIdx);
words[wordIdx] |= (((uint64)1) << (bitIndex % BITS_PER_WORD));
words[wordIdx] |= (((uint64)1) << WORD_OFFSET(bitIndex));
}
void BitSet::clear(uint32 bitIndex) {
uint32 wordIdx = wordIndex(bitIndex);
if (wordIdx >= wordsInUse)
uint32 wordIdx = WORD_INDEX(bitIndex);
if (wordIdx >= words.size())
return;
words[wordIdx] &= ~(((uint64)1) << (bitIndex % BITS_PER_WORD));
words[wordIdx] &= ~(((uint64)1) << WORD_OFFSET(bitIndex));
recalculateWordsInUse();
}
@@ -117,14 +113,13 @@ namespace epics { namespace pvData {
}
bool BitSet::get(uint32 bitIndex) const {
uint32 wordIdx = wordIndex(bitIndex);
return ((wordIdx < wordsInUse)
&& ((words[wordIdx] & (((uint64)1) << (bitIndex % BITS_PER_WORD))) != 0));
uint32 wordIdx = WORD_INDEX(bitIndex);
return ((wordIdx < words.size())
&& ((words[wordIdx] & (((uint64)1) << WORD_OFFSET(bitIndex))) != 0));
}
void BitSet::clear() {
while (wordsInUse > 0)
words[--wordsInUse] = 0;
words.clear();
}
uint32 BitSet::numberOfTrailingZeros(uint64 i) {
@@ -153,8 +148,8 @@ namespace epics { namespace pvData {
int32 BitSet::nextSetBit(uint32 fromIndex) const {
uint32 u = wordIndex(fromIndex);
if (u >= wordsInUse)
uint32 u = WORD_INDEX(fromIndex);
if (u >= words.size())
return -1;
uint64 word = words[u] & (WORD_MASK << (fromIndex % BITS_PER_WORD));
@@ -162,7 +157,7 @@ namespace epics { namespace pvData {
while (true) {
if (word != 0)
return (u * BITS_PER_WORD) + numberOfTrailingZeros(word);
if (++u == wordsInUse)
if (++u == words.size())
return -1;
word = words[u];
}
@@ -171,8 +166,8 @@ namespace epics { namespace pvData {
int32 BitSet::nextClearBit(uint32 fromIndex) const {
// Neither spec nor implementation handle bitsets of maximal length.
uint32 u = wordIndex(fromIndex);
if (u >= wordsInUse)
uint32 u = WORD_INDEX(fromIndex);
if (u >= words.size())
return fromIndex;
uint64 word = ~words[u] & (WORD_MASK << (fromIndex % BITS_PER_WORD));
@@ -180,79 +175,63 @@ namespace epics { namespace pvData {
while (true) {
if (word != 0)
return (u * BITS_PER_WORD) + numberOfTrailingZeros(word);
if (++u == wordsInUse)
return wordsInUse * BITS_PER_WORD;
if (++u == words.size())
return words.size() * BITS_PER_WORD;
word = ~words[u];
}
}
bool BitSet::isEmpty() const {
return (wordsInUse == 0);
return words.empty();
}
uint32 BitSet::cardinality() const {
uint32 sum = 0;
for (uint32 i = 0; i < wordsInUse; i++)
for (uint32 i = 0; i < words.size(); i++)
sum += bitCount(words[i]);
return sum;
}
uint32 BitSet::size() const {
return wordsLength * BITS_PER_WORD;
return words.size() * BITS_PER_WORD;
}
BitSet& BitSet::operator&=(const BitSet& set) {
// Check for self-assignment!
if (this == &set) return *this;
while (wordsInUse > set.wordsInUse)
words[--wordsInUse] = 0;
// the result length will be <= the shorter of the two inputs
words.resize(std::min(words.size(), set.words.size()), 0);
// Perform logical AND on words in common
for (uint32 i = 0; i < wordsInUse; i++)
for(size_t i=0, e=words.size(); i<e; i++)
words[i] &= set.words[i];
recalculateWordsInUse();
return *this;
}
BitSet& BitSet::operator|=(const BitSet& set) {
// Check for self-assignment!
if (this == &set) return *this;
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++) {
// 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++)
words[i] |= set.words[i];
}
// Copy any remaining words
for(uint32 i=wordsInCommon; i<set.wordsInUse; ++i) {
words[i] = set.words[i];
}
// recalculateWordsInUse() is not needed
CHECK_POST();
return *this;
}
BitSet& BitSet::operator^=(const BitSet& set) {
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++) {
// 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++)
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;
}
@@ -260,33 +239,27 @@ namespace epics { namespace pvData {
BitSet& BitSet::operator=(const BitSet &set) {
// Check for self-assignment!
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;
if (this != &set) {
words = set.words;
}
memcpy(words, set.words, sizeof(uint64)*set.wordsInUse);
wordsInUse = set.wordsInUse;
return *this;
}
void BitSet::or_and(const BitSet& set1, const BitSet& set2) {
uint32 inUse = (set1.wordsInUse < set2.wordsInUse) ? set1.wordsInUse : set2.wordsInUse;
void BitSet::swap(BitSet& set)
{
words.swap(set.words);
}
ensureCapacity(inUse);
if(inUse>wordsInUse)
wordsInUse = inUse;
void BitSet::or_and(const BitSet& set1, const BitSet& set2) {
const size_t andlen = std::min(set1.words.size(), set2.words.size());
words.resize(std::max(words.size(), andlen), 0);
// Perform logical AND on words in common
for (uint32 i = 0; i < inUse; i++)
for (uint32 i = 0; i < andlen; i++)
words[i] |= (set1.words[i] & set2.words[i]);
// recalculateWordsInUse()...
recalculateWordsInUse();
}
bool BitSet::operator==(const BitSet &set) const
@@ -294,11 +267,11 @@ namespace epics { namespace pvData {
if (this == &set)
return true;
if (wordsInUse != set.wordsInUse)
if (words.size() != set.words.size())
return false;
// Check words in use by both BitSets
for (uint32 i = 0; i < wordsInUse; i++)
for (uint32 i = 0; i < words.size(); i++)
if (words[i] != set.words[i])
return false;
@@ -311,58 +284,55 @@ namespace epics { namespace pvData {
}
void BitSet::serialize(ByteBuffer* buffer, SerializableControl* flusher) const {
uint32 n = wordsInUse;
uint32 n = words.size();
if (n == 0) {
SerializeHelper::writeSize(0, buffer, flusher);
return;
}
uint32 len = 8 * (n-1);
uint32 len = BYTES_PER_WORD * (n-1); // length excluding bits in the last word
// count non-zero bytes in the last word
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++)
buffer->putLong(words[i]);
if (n < wordsInUse)
for (uint64 x = words[wordsInUse - 1]; x != 0; x >>= 8)
if (n < words.size())
for (uint64 x = words[words.size() - 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
wordsInUse = (bytes + 7) / 8;
if (wordsInUse > wordsLength)
{
if (words) delete[] words;
words = new uint64[wordsInUse];
wordsLength = wordsInUse;
}
size_t wordsInUse = (bytes + 7) / BYTES_PER_WORD;
words.resize(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
}
epicsShareExtern std::ostream& operator<<(std::ostream& o, const BitSet& b)
{
o << '{';

View File

@@ -1,8 +1,10 @@
/**
* 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.
/*
* Copyright information and license terms for this software can be
* found in the file LICENSE that is included with the distribution
*/
/**
* @author mse
*/
#define epicsExportSharedSymbols
#include <pv/byteBuffer.h>

View File

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

View File

@@ -1,8 +1,7 @@
/* event.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.
/*
* Copyright information and license terms for this software can be
* found in the file LICENSE that is included with the distribution
*/
/**
* @author mrk

View File

@@ -1,8 +1,7 @@
/* executor.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.
/*
* Copyright information and license terms for this software can be
* found in the file LICENSE that is included with the distribution
*/
/**
* @author mrk
@@ -13,6 +12,10 @@
#include <string>
#include <cstdio>
#include <epicsEvent.h>
#include <epicsMutex.h>
#include <epicsThread.h>
#define epicsExportSharedSymbols
#include <pv/executor.h>

View File

@@ -1,8 +1,7 @@
/* localStaticLock.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.
/*
* Copyright information and license terms for this software can be
* found in the file LICENSE that is included with the distribution
*/
/**
* @author mse

View File

@@ -1,8 +1,7 @@
/* messageQueue.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.
/*
* Copyright information and license terms for this software can be
* found in the file LICENSE that is included with the distribution
*/
/**
* @author mrk

View File

@@ -1,3 +1,7 @@
/*
* 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>
@@ -12,7 +16,7 @@
#include <epicsConvert.h>
#define epicsExportSharedSymbols
#include "typeCast.h"
#include "pv/typeCast.h"
using std::string;
@@ -27,7 +31,7 @@ using std::string;
#endif
#if EPICS_VERSION_INT < VERSION_INT(3,15,0,1)
/* integer conversion primitives added to epicsStdlib.c in 3.15.0.1 */
/* These 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 */
@@ -249,18 +253,19 @@ epicsParseFloat(const char *str, float *to, char **units)
}
#endif
// 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
// 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))
#else
# define WIN_NEEDS_OLL_FUNC 0
// Other architectures all provide strtoll()
# define NEED_OLL_FUNCS 0
#endif
#if defined(NEED_LONGLONG) && (defined(__vxworks) || WIN_NEEDS_OLL_FUNC)
#if defined(NEED_LONGLONG) && NEED_OLL_FUNCS
static
long long strtoll(const char *ptr, char ** endp, int base)
{
@@ -308,8 +313,10 @@ noconvert:
return 0;
}
#if defined(__vxworks)
/* vxworks version of std::istringstream >>uint64_t is buggy, we use out own implementation */
#if defined(vxWorks)
/* The VxWorks version of std::istringstream >> uint64_t is buggy,
* provide our own implementation
*/
static
unsigned long long strtoull(const char *nptr, char **endptr, int base)
{
@@ -551,9 +558,10 @@ 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 first char is a digit then translate this into ERANGE error
#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
*/
else if (*out == epicsINF || *out == -epicsINF) {
const char* s = in.c_str();

View File

@@ -1,8 +1,7 @@
/* bitSet.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.
/*
* Copyright information and license terms for this software can be
* found in the file LICENSE that is included with the distribution
*/
/**
* @author mse
@@ -10,7 +9,7 @@
#ifndef BITSET_H
#define BITSET_H
#include <stdexcept>
#include <vector>
#include <pv/pvType.h>
#include <pv/serialize.h>
@@ -211,6 +210,9 @@ 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.
@@ -233,42 +235,11 @@ namespace epics { namespace pvData {
private:
/*
* 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);
typedef std::vector<uint64> words_t;
/** The internal field corresponding to the serialField "bits". */
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;
words_t words;
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,8 +1,7 @@
/* byteBuffer.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.
/*
* Copyright information and license terms for this software can be
* found in the file LICENSE that is included with the distribution
*/
/**
* @author mse
@@ -11,24 +10,15 @@
#define BYTEBUFFER_H
#include <string>
#include <string.h>
#ifdef epicsExportSharedSymbols
#define byteBufferepicsExportSharedSymbols
#undef epicsExportSharedSymbols
#endif
#include <cstring>
#include <cstdlib>
#include <epicsEndian.h>
#ifdef byteBufferepicsExportSharedSymbols
#define epicsExportSharedSymbols
#undef byteBufferepicsExportSharedSymbols
#endif
#include <shareLib.h>
#include <pv/pvType.h>
#include <pv/epicsException.h>
#include <shareLib.h>
namespace epics {
namespace pvData {
@@ -224,19 +214,20 @@ 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(0), _size(size),
_buffer((char*)std::malloc(size)), _size(size),
_reverseEndianess(byteOrder != EPICS_BYTE_ORDER),
_reverseFloatEndianess(byteOrder != EPICS_FLOAT_WORD_ORDER),
_wrapped(false)
{
_buffer = (char*)malloc(size);
if(!_buffer)
throw std::bad_alloc();
clear();
}
/**
* Constructor for wrapping existing buffers.
* Constructor for wrapping an existing buffer.
* Given buffer will not be released by the ByteBuffer instance.
* @param buffer Existing buffer.
* @param buffer Existing buffer. May not be NULL.
* @param size The number of bytes.
* @param byteOrder The byte order.
* Must be one of EPICS_BYTE_ORDER,EPICS_ENDIAN_LITTLE,EPICS_ENDIAN_BIG.
@@ -247,6 +238,8 @@ public:
_reverseFloatEndianess(byteOrder != EPICS_FLOAT_WORD_ORDER),
_wrapped(true)
{
if(!_buffer)
throw std::invalid_argument("ByteBuffer can't be constructed with NULL");
clear();
}
/**
@@ -254,7 +247,7 @@ public:
*/
~ByteBuffer()
{
if (_buffer && !_wrapped) free(_buffer);
if (_buffer && !_wrapped) std::free(_buffer);
}
/**
* Set the byte order.
@@ -271,7 +264,7 @@ public:
* Get the raw buffer data.
* @return the raw buffer data.
*/
inline const char* getBuffer()
inline const char* getBuffer() const
{
return _buffer;
}
@@ -303,7 +296,7 @@ public:
* Returns the current position.
* @return The current position in the raw data.
*/
inline std::size_t getPosition()
inline std::size_t getPosition() const
{
return (std::size_t)(((std::ptrdiff_t)(const void *)_position) - ((std::ptrdiff_t)(const void *)_buffer));
}
@@ -323,7 +316,7 @@ public:
*
* @return The offset into the raw buffer.
*/
inline std::size_t getLimit()
inline std::size_t getLimit() const
{
return (std::size_t)(((std::ptrdiff_t)(const void *)_limit) - ((std::ptrdiff_t)(const void *)_buffer));
}
@@ -344,7 +337,7 @@ public:
*
* @return The number of elements remaining in this buffer.
*/
inline std::size_t getRemaining()
inline std::size_t getRemaining() const
{
return (std::size_t)(((std::ptrdiff_t)(const void *)_limit) - ((std::ptrdiff_t)(const void *)_position));
}
@@ -353,7 +346,7 @@ public:
*
* @return The size of the raw data buffer.
*/
inline std::size_t getSize()
inline std::size_t getSize() const
{
return _size;
}
@@ -444,7 +437,7 @@ public:
* @return (false,true) if (is, is not) the EPICS_BYTE_ORDER
*/
template<typename T>
inline bool reverse()
inline bool reverse() const
{
return _reverseEndianess;
}
@@ -643,48 +636,48 @@ public:
inline double getDouble (std::size_t index) { return get<double>(index); }
// TODO remove
inline const char* getArray()
inline const char* getArray() const
{
return _buffer;
}
private:
char* _buffer;
char* const _buffer;
char* _position;
char* _limit;
std::size_t _size;
const std::size_t _size;
bool _reverseEndianess;
bool _reverseFloatEndianess;
bool _wrapped;
const bool _wrapped;
};
template<>
inline bool ByteBuffer::reverse<bool>()
inline bool ByteBuffer::reverse<bool>() const
{
return false;
}
template<>
inline bool ByteBuffer::reverse<int8>()
inline bool ByteBuffer::reverse<int8>() const
{
return false;
}
template<>
inline bool ByteBuffer::reverse<uint8>()
inline bool ByteBuffer::reverse<uint8>() const
{
return false;
}
template<>
inline bool ByteBuffer::reverse<float>()
inline bool ByteBuffer::reverse<float>() const
{
return _reverseFloatEndianess;
}
template<>
inline bool ByteBuffer::reverse<double>()
inline bool ByteBuffer::reverse<double>() const
{
return _reverseFloatEndianess;
}

View File

View File

@@ -1,8 +1,7 @@
/* destroyable.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.
/*
* Copyright information and license terms for this software can be
* found in the file LICENSE that is included with the distribution
*/
/**
* @author mse

View File

@@ -1,10 +1,9 @@
/**
* 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.
/*
* Copyright information and license terms for this software can be
* found in the file LICENSE that is included with the distribution
*/
/*
* epicsException.hpp
* epicsException.h
*
* Created on: Oct 20, 2010
* Author: Matej Sekoranja
@@ -34,19 +33,14 @@
#ifndef EPICSEXCEPTION_H_
#define EPICSEXCEPTION_H_
#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)
#if defined(_WIN32) && !defined(NOMINMAX)
#define NOMINMAX
#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
@@ -58,7 +52,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>
@@ -67,6 +61,12 @@
# 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 { \
ExceptionMixin *_em_p=dynamic_cast<ExceptionMixin*>(&EI); \
::epics::pvData::ExceptionMixin *_em_p=dynamic_cast< ::epics::pvData::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) \
({ ExceptionMixin *_mx=dynamic_cast<ExceptionMixin*>(&(EI)); \
({ ::epics::pvData::ExceptionMixin *_mx=dynamic_cast< ::epics::pvData::ExceptionMixin*>(&(EI)); \
_mx ? _mx->show() : std::string(); \
})
#endif
@@ -228,7 +228,7 @@ private:
mutable std::string base_msg;
};
#ifdef _WIN32
#if defined(_WIN32) && !defined(_MINGW)
#pragma warning( pop )
#endif

View File

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

View File

@@ -1,8 +1,7 @@
/* executor.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.
/*
* Copyright information and license terms for this software can be
* found in the file LICENSE that is included with the distribution
*/
/**
* @author mrk

View File

@@ -1,8 +1,7 @@
/* localStaticLock.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.
/*
* Copyright information and license terms for this software can be
* found in the file LICENSE that is included with the distribution
*/
/**
* @author mse

View File

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

View File

@@ -1,8 +1,7 @@
/* messageQueue.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.
/*
* Copyright information and license terms for this software can be
* found in the file LICENSE that is included with the distribution
*/
/**
* @author mrk

View File

@@ -1,8 +1,7 @@
/* noDefaultMethods.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.
/*
* Copyright information and license terms for this software can be
* found in the file LICENSE that is included with the distribution
*/
/**
* @author mrk

View File

@@ -1,8 +1,7 @@
/* queue.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.
/*
* Copyright information and license terms for this software can be
* found in the file LICENSE that is included with the distribution
*/
/**
* @author mrk

View File

@@ -1,8 +1,7 @@
/* requester.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.
/*
* Copyright information and license terms for this software can be
* found in the file LICENSE that is included with the distribution
*/
/**
* @author mrk
@@ -65,7 +64,7 @@ public:
};
@endcode
*/
virtual void message(std::string const & message,MessageType messageType) = 0;
virtual void message(std::string const & message,MessageType messageType);
};
}}

View File

@@ -1,8 +1,7 @@
/* serialize.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.
/*
* Copyright information and license terms for this software can be
* found in the file LICENSE that is included with the distribution
*/
/**
* @author mrk
@@ -10,6 +9,8 @@
#ifndef SERIALIZE_H
#define SERIALIZE_H
#include <epicsTypes.h>
#include <pv/byteBuffer.h>
#include <pv/sharedPtr.h>
@@ -52,14 +53,18 @@ namespace epics { namespace pvData {
*/
virtual void alignBuffer(std::size_t alignment) =0;
/**
* 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.
* 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.
* @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,
@@ -102,14 +107,18 @@ namespace epics { namespace pvData {
*/
virtual void alignData(std::size_t alignment) =0;
/**
* method for deserializing array data.
* 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.
* 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.
* i.e. boolean, byte,..., double.
* It cannot 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,
@@ -150,6 +159,41 @@ 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.

View File

@@ -1,7 +1,6 @@
/**
* 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.
/*
* Copyright information and license terms for this software can be
* found in the file LICENSE that is included with the distribution
*/
/*
* serializeHelper.h

View File

@@ -1,7 +1,6 @@
/**
* 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.
/*
* Copyright information and license terms for this software can be
* found in the file LICENSE that is included with the distribution
*/
/**
* @author Michael Davidsaver
@@ -26,7 +25,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,13 +1,12 @@
/* sharedVector.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.
/*
* Copyright information and license terms for this software can be
* found in the file LICENSE that is included with the distribution
*/
#ifndef SHAREDVECTOR_H
#define SHAREDVECTOR_H
#ifdef _WIN32
#if defined(_WIN32) && !defined(NOMINMAX)
#define NOMINMAX
#endif
@@ -326,7 +325,7 @@ public:
//! Internal for static_shared_vector_cast
template<typename FROM>
shared_vector(const shared_vector<FROM> &src,
typename meta::is_void<FROM, detail::_shared_vector_cast_tag>::type)
detail::_shared_vector_cast_tag)
:base_t(std::tr1::static_pointer_cast<E>(src.dataPtr()),
src.dataOffset()/sizeof(E),
src.dataCount()/sizeof(E))
@@ -432,8 +431,8 @@ public:
shared_vector<E> original(...);
if(!original.unique()){
shared_vector<E> temp(myallocator(original.size()),
0, original.size());
std::tr1::shared_ptr<E> sptr(myalloc(original.size()), myfree);
shared_vector<E> temp(sptr, 0, original.size());
std::copy(original.begin(), original.end(), temp.begin());
original.swap(temp);
}
@@ -532,6 +531,20 @@ 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 >
@@ -539,7 +552,11 @@ 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;
@@ -566,7 +583,7 @@ public:
//! Internal for static_shared_vector_cast
template<typename FROM>
shared_vector(const shared_vector<FROM> &src,
typename meta::is_not_void<FROM, detail::_shared_vector_cast_tag>::type)
detail::_shared_vector_cast_tag)
:base_t(std::tr1::static_pointer_cast<E>(src.dataPtr()),
src.dataOffset()*sizeof(FROM),
src.dataCount()*sizeof(FROM))
@@ -575,12 +592,12 @@ public:
shared_vector(shared_vector<void>& O,
detail::_shared_vector_freeze_tag t)
:base_t(O,t)
:base_t(O,t), m_vtype(O.m_vtype)
{}
shared_vector(shared_vector<const void>& O,
detail::_shared_vector_thaw_tag t)
:base_t(O,t)
:base_t(O,t), m_vtype(O.m_vtype)
{}
shared_vector& operator=(const shared_vector& o)
@@ -602,6 +619,64 @@ 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
@@ -634,7 +709,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,
@@ -662,30 +737,16 @@ 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()
* and throws std::runtime_error if this is not valid.
* 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
*/
template<typename TO, typename FROM>
static FORCE_INLINE
@@ -861,8 +922,11 @@ std::ostream& operator<<(std::ostream& strm, const epics::pvData::shared_vector<
* shared_vector has additional constructors from raw pointers
* and shared_ptr s.
*
* The copy constructor and assignment operator allow implicit
* casting from type 'shared_vector<T>' to 'shared_vector<const T>'.
* 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).
*
* To facilitate safe modification the methods unique() and
* make_unique() are provided.
@@ -964,17 +1028,15 @@ 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.
C++ casting rules (no implicit cast).
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.
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.
These functions are defined like:
@@ -998,17 +1060,18 @@ 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.
Please note that the argument of both freeze and thaw is a non-const
@note 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. This is
done to reduce the possibility of accidental copying.
passed in must be unique() or an exception is thrown.
No copy is made.
This possibility can be avoided by calling the make_unique() on a
The possibility of an exception 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,8 +1,7 @@
/* status.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.
/*
* Copyright information and license terms for this software can be
* found in the file LICENSE that is included with the distribution
*/
/**
* @author mse
@@ -103,9 +102,7 @@ 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,7 +1,6 @@
/**
* 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.
/*
* Copyright information and license terms for this software can be
* found in the file LICENSE that is included with the distribution
*/
/** C++ Template meta programming helpers
*/
@@ -11,7 +10,9 @@
// gently nudge the compiler to inline our wrappers
// Warning: Only use this when the template body is *small*.
// You have been warned!
#if defined(__GNUC__) && __GNUC__>=3
#if defined(__MINGW32__)
# define FORCE_INLINE inline
#elif defined(__GNUC__) && __GNUC__>=3
# define FORCE_INLINE __attribute__((always_inline)) inline
#elif defined(_MSC_VER)
# define FORCE_INLINE __forceinline

296
src/misc/pv/thread.h Normal file
View File

@@ -0,0 +1,296 @@
/* 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,8 +1,7 @@
/* timeFunction.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.
/*
* Copyright information and license terms for this software can be
* found in the file LICENSE that is included with the distribution
*/
/**
* @author mrk

View File

@@ -1,8 +1,7 @@
/* timer.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.
/*
* Copyright information and license terms for this software can be
* found in the file LICENSE that is included with the distribution
*/
/**
* @author mrk

View File

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

View File

@@ -1,14 +1,16 @@
/* requester.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.
/*
* Copyright information and license terms for this software can be
* found in the file LICENSE that is included with the distribution
*/
/**
* @author mrk
*/
#include <string>
#include <cstdio>
#include <iostream>
#include <epicsMutex.h>
#define epicsExportSharedSymbols
#include <pv/lock.h>
@@ -34,6 +36,9 @@ 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,6 @@
/**
* 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.
/*
* Copyright information and license terms for this software can be
* found in the file LICENSE that is included with the distribution
*/
/*
* serializeHelper.cpp
@@ -12,8 +11,11 @@
#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>
@@ -139,6 +141,132 @@ 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,8 +1,7 @@
/*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.
/*status.cpp*/
/*
* Copyright information and license terms for this software can be
* found in the file LICENSE that is included with the distribution
*/
/**
* @author mrk
@@ -17,7 +16,6 @@ using std::string;
namespace epics { namespace pvData {
const char* Status::StatusTypeName[] = { "OK", "WARNING", "ERROR", "FATAL" };
string Status::m_emptyStringtring;
Status Status::Ok;
@@ -102,7 +100,8 @@ void Status::deserialize(ByteBuffer *buffer, DeserializableControl *flusher)
if (m_statusType != STATUSTYPE_OK)
{
m_statusType = STATUSTYPE_OK;
m_message = m_stackDump = m_emptyStringtring;
m_message.clear();
m_stackDump.clear();
}
}
else

View File

@@ -1,122 +0,0 @@
/* 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,8 +1,7 @@
/* timeFunction.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.
/*
* Copyright information and license terms for this software can be
* found in the file LICENSE that is included with the distribution
*/
/**
* @author mrk
@@ -13,6 +12,8 @@
#include <string>
#include <cstdio>
#include <epicsTime.h>
#define epicsExportSharedSymbols
#include <pv/pvType.h>
#include <pv/timeStamp.h>

View File

@@ -1,14 +1,13 @@
/* timer.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.
/*
* Copyright information and license terms for this software can be
* found in the file LICENSE that is included with the distribution
*/
/**
* @author mrk
*/
#ifdef _WIN32
#if defined(_WIN32) && !defined(NOMINMAX)
#define NOMINMAX
#endif
@@ -16,6 +15,8 @@
#include <string>
#include <iostream>
#include <epicsThread.h>
#define epicsExportSharedSymbols
#include <pv/timer.h>

View File

@@ -1,14 +1,15 @@
/**
* 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.
/*
* Copyright information and license terms for this software can be
* found in the file LICENSE that is included with the distribution
*/
/* Author: Michael Davidsaver */
#include <algorithm>
#include <sstream>
#include <epicsConvert.h>
#define epicsExportSharedSymbols
#include "typeCast.h"
#include "pv/typeCast.h"
using epics::pvData::castUnsafe;
using epics::pvData::ScalarType;

View File

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

View File

@@ -1,8 +1,7 @@
/*monitor.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.
/*
* Copyright information and license terms for this software can be
* found in the file LICENSE that is included with the distribution
*/
/**
* @author mse

View File

@@ -1,13 +1,13 @@
/* monitorPlugin.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.
/*
* Copyright information and license terms for this software can be
* found in the file LICENSE that is included with the distribution
*/
/**
* @author mrk
*/
#define IN_MONITORPLUGIN_CPP
#define epicsExportSharedSymbols
#include <pv/monitorPlugin.h>

View File

@@ -1,8 +1,7 @@
/* monitor.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.
/*
* Copyright information and license terms for this software can be
* found in the file LICENSE that is included with the distribution
*/
/**
* @author mrk

View File

@@ -1,8 +1,7 @@
/* monitorPlugin.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.
/*
* Copyright information and license terms for this software can be
* found in the file LICENSE that is included with the distribution
*/
/**
* @author mrk
@@ -18,6 +17,16 @@
#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;
@@ -41,7 +50,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 MonitorPlugin
class epicsShareClass USAGE_DEPRECATED MonitorPlugin
{
public:
virtual ~MonitorPlugin(){}
@@ -95,7 +104,7 @@ public:
*
* Normlly a plugin is created for a single client.
*/
class epicsShareClass MonitorPluginCreator
class epicsShareClass USAGE_DEPRECATED MonitorPluginCreator
{
public:
virtual ~MonitorPluginCreator() {}
@@ -127,7 +136,7 @@ public:
* This manages a set of monitor plugins.
* @author mrk
*/
class epicsShareClass MonitorPluginManager
class epicsShareClass USAGE_DEPRECATED MonitorPluginManager
{
public:
POINTER_DEFINITIONS(MonitorPluginManager);
@@ -165,7 +174,7 @@ private:
epics::pvData::Mutex mutex;
};
#undef USAGE_DEPRECATED
}}
#endif /* MONITORPLUGIN_H */

View File

@@ -2,15 +2,15 @@
SRC_DIRS += $(PVDATA_SRC)/property
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
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
LIBSRCS += alarm.cpp
LIBSRCS += pvAlarm.cpp

View File

@@ -1,8 +1,7 @@
/* alarm.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.
/*
* Copyright information and license terms for this software can be
* found in the file LICENSE that is included with the distribution
*/
/**
* @author mrk
@@ -10,6 +9,8 @@
#include <string>
#include <stdexcept>
#include <epicsMutex.h>
#define epicsExportSharedSymbols
#include <pv/lock.h>
#include <pv/pvType.h>

View File

@@ -1,8 +1,7 @@
/* alarm.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.
/*
* Copyright information and license terms for this software can be
* found in the file LICENSE that is included with the distribution
*/
/**
* @author mrk

View File

@@ -1,8 +1,7 @@
/* control.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.
/*
* Copyright information and license terms for this software can be
* found in the file LICENSE that is included with the distribution
*/
/**
* @author mrk

View File

@@ -1,8 +1,7 @@
/* display.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.
/*
* Copyright information and license terms for this software can be
* found in the file LICENSE that is included with the distribution
*/
/**
* @author mrk

View File

@@ -1,8 +1,7 @@
/* pvAlarm.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.
/*
* Copyright information and license terms for this software can be
* found in the file LICENSE that is included with the distribution
*/
/**
* @author mrk

View File

@@ -1,8 +1,7 @@
/* pvControl.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.
/*
* Copyright information and license terms for this software can be
* found in the file LICENSE that is included with the distribution
*/
/**
* @author mrk

View File

@@ -1,8 +1,7 @@
/* pvDisplay.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.
/*
* Copyright information and license terms for this software can be
* found in the file LICENSE that is included with the distribution
*/
/**
* @author mrk

View File

@@ -1,8 +1,7 @@
/* pvEnumerated.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.
/*
* Copyright information and license terms for this software can be
* found in the file LICENSE that is included with the distribution
*/
/**
* @author mrk

View File

@@ -1,8 +1,7 @@
/* pvTimeStamp.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.
/*
* Copyright information and license terms for this software can be
* found in the file LICENSE that is included with the distribution
*/
/**
* @author mrk

View File

@@ -1,8 +1,7 @@
/* timeStamp.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.
/*
* Copyright information and license terms for this software can be
* found in the file LICENSE that is included with the distribution
*/
/**
* @author mrk
@@ -12,21 +11,11 @@
#include <ctime>
#ifdef epicsExportSharedSymbols
#define timeStampepicsExportSharedSymbols
#undef epicsExportSharedSymbols
#endif
#include <epicsTime.h>
#ifdef timeStampepicsExportSharedSymbols
#define epicsExportSharedSymbols
#undef timeStampepicsExportSharedSymbols
#endif
#include <shareLib.h>
#include <pv/pvType.h>
#include <shareLib.h>
namespace epics { namespace pvData {

View File

@@ -1,8 +1,7 @@
/* pvAlarm.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.
/*
* Copyright information and license terms for this software can be
* found in the file LICENSE that is included with the distribution
*/
/**
* @author mrk

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