919 Commits

Author SHA1 Message Date
Andrew Johnson
e069c699e9 Final commit for 8.0.7 2025-12-15 11:44:53 -06:00
Andrew Johnson
8963b2dba1 Add release notes for changes since 8.0.6
- Jeremy Lorelli
- Andrew Johnson
- Dirk Zimoch
- Chris Johns
- Michael Davidsaver
2025-12-15 11:37:47 -06:00
Michael Davidsaver
9ec9a526f5 revise Timer phase reset 2025-12-05 17:01:00 -08:00
Chris Johns
b4114589ff Skip any missed timer events updating the timer to now
This stops a timer calling the callback for every missed event if the
time jumps forward when corrected or moved.
2025-12-05 17:01:00 -08:00
6689c9ce1f Allow testing deprecated functions without causing compiler warnings 2025-12-03 16:47:55 -08:00
Andrew Johnson
0c1773f25d Clang warnings: sprintf() => epicsSnprintf() 2025-12-01 18:20:27 -08:00
Andrew Johnson
d0ff9a9592 CI: Final GHA config adjustments
Don't change the MSC C++ standard when building submodules!
2025-12-01 17:39:24 -06:00
JJL772
bf36070860 Allow Timer to be cancelled during callback execution
Useful for when e.g. a periodic timer needs to cancel itself
2025-11-19 08:49:41 -08:00
Andrew Johnson
5552773e5e CI: Rename and adjust jobs (#102)
* Update Appveyor and GHA CI build configurations to more closely match Base CI.

* Other CI script clean-up
2025-11-10 12:29:19 -06:00
Andrew Johnson
b3a1077270 CI: Update Ubuntu 20.04 to 22.04 2025-05-05 12:26:24 -05:00
Ralph Lange
1c5f75bcd6 Merge pull request #97 from ralphlange/fix-ci
ci: consistent AppVeyor job config for pvData/pvAccess
2024-12-25 09:09:33 +01:00
Ralph Lange
2455039594 ci: consistent AppVeyor job config for pvData/pvAccess 2024-12-24 17:19:59 +01:00
Ralph Lange
f47676c225 Merge pull request #96 from ralphlange/fix-ci
Fix CI issues
2024-12-19 14:42:15 +01:00
Ralph Lange
0881e0ed86 ci: update appveyor.yml from base 2024-12-19 08:48:41 +01:00
Ralph Lange
e457b60b30 ci: Update GHA workflow from base
- Run Fedora in containers
- Add Linux cross builds
2024-12-18 21:32:11 +01:00
Ralph Lange
a6746f8161 GHA: Update actions/upload-artifact to v4 2024-12-16 12:08:55 +01:00
Ralph Lange
144f0228cc ci: update ci-scripts to v3.4.1 2023-12-15 09:40:45 +01:00
Andrew Johnson
7300e6b0bd Set next development version 2023-12-13 14:52:07 -06:00
Andrew Johnson
0ef8a36172 Set version numbers for release 2023-12-13 14:46:12 -06:00
Andrew Johnson
c0be043aaf Replease UNRELEASED 2023-12-13 14:43:07 -06:00
Ralph Lange
dd74289eaf Silence warning about uninitialized local variable
found by static code analysis (cppcheck @ sonarqube)
(that doesn't realize ">>=" calls an overloaded operator)
2023-11-01 09:41:07 -05:00
thomasms
3da69257a0 Remove duplicate doxygen comment - see issue #75 2023-11-01 09:39:33 -05:00
Michael Davidsaver
13e4e577bb gha update 2023-10-22 16:24:15 -07:00
Michael Davidsaver
5387face45 rename print.cpp -> jprint.cpp
In GHA builder somehow print.cpp becomes PRINT.obj
instead of print.obj for mkmf.pl, which later fails
when print.obj is missing.  (apparently windows
filesystems are now case sensitive...)
2023-10-22 16:24:15 -07:00
JJL772
eac2a8e70f Fix use-after-destroy in epicsRefSnapshopCurrent 2023-08-06 21:30:32 -07:00
JJL772
04fcb7e38f Don't return local copy of std::string in AnyScalar::bufferUnsafe 2023-08-06 21:30:32 -07:00
Andrew Johnson
45018a2163 Generate JSON5 when available
Fixes lp: #2029482 / GitHub #92
2023-08-06 21:28:01 -07:00
Simon Rose
b7ad4478a4 Update debugPtr to work with EPICS base 7.0.7
There are at least two changes to EPICS base since the addition of
debugPtr:
* In pvAccess/**/dbdToPv.cpp, a write to an ostream was added (also in
  pvData/**/testSerialization.cpp) which does not resolve correctly when
  the operator<< overload is in the global namespace.
* In pvAccess/**/caChannel.cpp, weak_ptr->expired() was added

The interface to deal with each of these has been added.
2023-05-29 17:09:29 -07:00
Michael Davidsaver
c16f19c80e Flip #if logic for unaligned access
Assume only x86 can correctly/efficiently handle unaligned access.
2023-05-24 21:49:38 -07:00
Michael Davidsaver
87018882d1 ARM/Linux can fault on unaligned access
Sometimes SIGBUS results from unaligned access.
2023-05-24 20:44:32 -07:00
2547514abb fix for use-after-free warning 2023-02-28 09:04:58 -08:00
Michael Davidsaver
9447eacbd2 gha update 2022-11-26 11:15:37 -08:00
Michael Davidsaver
0b424a71ec isprint() wants value in range [-1, 255]
The MSVC impl. assert()s this
2022-11-26 10:52:03 -08:00
Andrew Johnson
45671faaea Set next development version 2022-09-07 10:51:29 -05:00
Andrew Johnson
016d1154fc Set module version number for release 2022-09-07 10:17:07 -05:00
Michael Davidsaver
f3911d5831 add 3.16 build 2022-01-27 09:44:54 -08:00
Michael Davidsaver
93e90c5a04 fix 3.16 2022-01-27 09:27:19 -08:00
Michael Davidsaver
8039c75b3e .ci: update 2022-01-27 07:51:17 -08:00
Michael Davidsaver
a647c8b174 printJSON() use yajl_gen 2022-01-19 10:27:09 -08:00
Michael Davidsaver
d3b4976ea2 Set next development version 2021-02-25 09:36:05 -08:00
Michael Davidsaver
b1c8303870 Update version numbers for release 2021-02-25 09:35:12 -08:00
Michael Davidsaver
a3ef984f4f ci: switch travis -> github 2020-12-20 11:08:29 -08:00
Michael Davidsaver
ca86a63180 update release notes 2020-11-14 13:43:38 -08:00
Michael Davidsaver
07b79693af Deprecate/remove unused buffer alignment tools
ByteBuffer::align() does not work as expected
on some RTEMS targets where malloc() returns
buffers aligned only to 4 bytes.

SerializableControl::alignBuffer() and
DeserializableControl::alignData() are implemented,
but never called, in this module and pvAccessCPP.
ByteBuffer::align() is only needed to implement
these two methods.

Leave non-pure virtual stubs to assist in migration.
2020-11-14 11:07:15 -08:00
Michael Davidsaver
4ef9e18ac6 enable RTEMS CI testing 2020-11-13 20:51:23 -08:00
Michael Davidsaver
320cc3c60b shared_vector_convert<>() fix convert of empty array
Empty arrays can be untyped, but this doesn't matter.
2020-09-29 15:52:49 -07:00
Michael Davidsaver
45d0d76a7f Set next development version 2020-07-26 13:30:34 -07:00
Michael Davidsaver
b2b42d5f8c Update version numbers for release 2020-07-26 13:29:52 -07:00
Michael Davidsaver
90b1f2f6da doc 2020-06-17 14:08:14 -07:00
Michael Davidsaver
2e775ef2fb drop THROW_BASE_EXCEPTION_CAUSE() 2020-06-17 14:08:14 -07:00
Michael Davidsaver
f17d2bbca1 add maybeQuote()
Something for the *NIX gurus
to light their pipes with.
2020-06-17 14:08:14 -07:00
Michael Davidsaver
79b02254c4 update ci-scripts to 3.0.1 2020-06-17 14:06:50 -07:00
Michael Davidsaver
19245ce805 sharedVector extend base_ptr() to VS2013 2020-06-03 10:14:38 -07:00
Andrew Johnson
0fa927afa7 Set next development version 2020-05-28 16:26:00 -05:00
Andrew Johnson
d9b3f98e35 Update version numbers for release 2020-05-28 13:37:15 -05:00
Michael Davidsaver
81e7968230 doc 2020-05-20 14:54:39 -07:00
Michael Davidsaver
06f3b96992 ci-scripts 2.3.2 (with appveyor) 2020-04-27 12:18:16 -07:00
1038182a16 removed empty lines at end of file 2020-04-15 07:53:22 -07:00
60091bfe56 removed spaces at end of line 2020-04-15 07:53:22 -07:00
f4de6dd9b1 replaced tabs with spaces 2020-04-15 07:53:22 -07:00
Michael Davidsaver
3d93a80cce travis switch to ci-scripts 2019-12-20 10:33:03 -08:00
Michael Davidsaver
94eff54fa9 Revert "Properly declare isnan() in C++ testcode"
This reverts commit 07b75e4543.

std:: qualified names not portable until c++11
epicsMath.h changed to ensure that unqualified
names continue to work.
2019-12-19 18:50:33 -08:00
Michael Davidsaver
e9dde4d2f8 update doc 2019-12-13 09:32:42 -08:00
Michael Davidsaver
0a5e22e5b0 testPVData print additional sizes 2019-12-13 09:32:42 -08:00
Michael Davidsaver
3a5cfba4e1 catch exception by ref 2019-12-13 09:32:42 -08:00
Ralph Lange
07b75e4543 Properly declare isnan() in C++ testcode 2019-12-11 13:29:27 +01:00
Michael Davidsaver
e4f150b34f finalize doxygen 2019-11-03 20:03:24 -08:00
Andrew Johnson
ca2ae0d0e7 Incr version and set development flag after release 2019-10-31 17:04:21 -05:00
Andrew Johnson
828506720c Clear development flag for 8.0.1 release 2019-10-31 16:57:41 -05:00
Andrew Johnson
ad712b63f9 Sub-bullets must be indented by at least 2 spaces 2019-10-31 16:52:53 -05:00
Michael Davidsaver
4c3d5a788d release notes for 8.0.1 2019-10-31 10:34:52 -07:00
Michael Davidsaver
df89135455 cleanup 2019-10-11 16:17:49 -07:00
Michael Davidsaver
95d452870c move dedup to most derived
Making virtual calls from a base class dtor is not safe.
2019-10-11 16:17:25 -07:00
Michael Davidsaver
8a82ff9fe4 Revert "dynamic_cast may not be defined during dtor"
This reverts commit dd24b2ad75.
2019-10-11 08:41:30 -07:00
Michael Davidsaver
dd24b2ad75 dynamic_cast may not be defined during dtor 2019-09-30 18:24:13 -07:00
Michael Davidsaver
17fa7a7724 travis matrix build
switch to matrix build to test multiple ubuntu versions
2019-09-23 13:41:23 -07:00
Michael Davidsaver
d01ba94ed7 avoid extraneous copy 2019-09-23 10:14:55 -07:00
Michael Davidsaver
c7c7585950 release notes 2019-09-23 10:14:55 -07:00
Michael Davidsaver
f869936cfd travis drop 3.14 build 2019-09-23 10:14:55 -07:00
Michael Davidsaver
0ad253c6f0 Remove Base 3.14 compatibility 2019-09-23 10:14:55 -07:00
Michael Davidsaver
52d04d5044 note class sizes 2019-09-23 10:14:55 -07:00
Ralph Lange
bff2dc9cd2 rtd-ci: add read-the-docs integration 2019-09-06 11:27:03 +02:00
Andrew Johnson
b903df5d0d Update version number to 8.0.1 DEVELOPMENT 2019-08-13 11:11:57 -05:00
Michael Davidsaver
416d910577 Timer: further attempt to avoid state corruption 2019-07-31 20:13:33 -07:00
Michael Davidsaver
37b7a0708f Timer more alive checks 2019-07-31 19:01:20 -07:00
Michael Davidsaver
6ceaa6adb0 update release notes for 8.0.0 2019-07-24 11:19:30 -07:00
Michael Davidsaver
0447826e7c minor 2019-07-14 19:09:54 -07:00
Michael Davidsaver
3ef60a61a2 always epicsThreadStackBig
On RTEMS at least, c++ code needs the largest
standard stack frame size.
2019-07-08 09:07:09 -07:00
Daniel Damiani
31802a8bde Added additional explicit template instantiations to fix build problems on macos with c+11 2019-07-04 07:09:58 -07:00
Bruno Martins
c2bc77a649 Improve and add new tests for testIntrospect 2019-05-20 16:35:59 -07:00
Bruno Martins
4dd7a18301 Improve docs. Make getFieldT(offset) use vector::at. 2019-05-20 16:35:59 -07:00
Bruno Martins
a29894ee2b getField<T>() fail to compile when T isn't Field or a sub-class 2019-05-20 16:35:59 -07:00
Bruno Martins
2f8ac7f673 Fix tests with expected exceptions for getField(size_t) 2019-05-20 16:35:59 -07:00
Bruno Martins
b050fbbcbe Revert {Structure,Union}::getField to previous behavior 2019-05-20 16:35:59 -07:00
Bruno Martins
caa11605fc Add {Structure,Union}::getFieldT, fix {Structure,Union}::getField 2019-05-20 16:35:59 -07:00
Michael Davidsaver
cfcdd1a3f9 deprecate ByteBuffer::getArray()
in favor of identical ByteBuffer::getBuffer()
2019-05-18 18:21:06 -07:00
Michael Davidsaver
95ff606ba1 quiet (un)signed comparison warning 2019-05-16 10:17:56 -07:00
Michael Davidsaver
4cc9b650c5 getSubField<T>() fail to compile when T isn't PVField or a sub-class 2019-05-16 10:17:56 -07:00
Michael Davidsaver
cd2436342d Revert "Replace display.format with .form and .precision"
This reverts commit 4ffddfa2f6.
2019-05-06 10:40:54 -07:00
Michael Davidsaver
3ae2d09fe3 bump module version after removals 2019-05-01 14:43:33 -07:00
Michael Davidsaver
35b3403de6 remove deprecated pvCopy 2019-05-01 14:18:48 -07:00
Michael Davidsaver
f780ebdf76 remove deprecated localStaticLock 2019-05-01 14:06:33 -07:00
Michael Davidsaver
93f0518b4b Merge remote-tracking branch 'md/display-format'
* md/display-format:
  Replace display.format with .form and .precision
2019-05-01 14:03:57 -07:00
Michael Davidsaver
6da871fa64 7.1.3 2019-04-17 11:48:01 -07:00
Michael Davidsaver
d53cb0cbc9 doc 2019-04-17 11:47:56 -07:00
Michael Davidsaver
8f0111e482 fix ByteBuffer::putArray() and getArray()
Erroneous mixing of byte and element indexing
introduced by a51b308cc8
2019-04-08 09:46:23 -07:00
Michael Davidsaver
5525119778 test ByteBuffer array operations 2019-04-08 09:46:20 -07:00
Michael Davidsaver
6410600205 testByteBuffer cleanup 2019-04-08 09:46:16 -07:00
Michael Davidsaver
a5d44745d1 cleanup testSharedVector
"using namespace" considered harmful...
2019-04-08 09:46:07 -07:00
Michael Davidsaver
8c275cbc1c 7.1.2 2019-03-18 11:07:20 -07:00
Michael Davidsaver
b79f69231c more doxygen 2019-03-18 10:32:50 -07:00
Michael Davidsaver
ff165595c4 minor doc 2019-03-18 09:28:00 -07:00
Michael Davidsaver
12d851dc6f release notes for 7.1.1 2019-03-18 09:08:08 -07:00
Michael Davidsaver
643f289c23 missing include 2019-03-11 14:55:55 -07:00
Michael Davidsaver
68e74ed1d2 update release notes 2019-03-11 14:08:01 -07:00
Michael Davidsaver
f0ef0965c4 AnyScalar doc 2019-03-11 14:05:10 -07:00
Michael Davidsaver
61ce532fdf cleanup test 2019-03-11 14:05:05 -07:00
Michael Davidsaver
d746e1bfb3 minor 2019-03-11 14:04:53 -07:00
MJGaughran
deccc41b9a Disabled NEED_OLL_FUNCS for Visual Studio 2013+ (#64)
* Disabled NEED_OLL_FUNCS for Visual Studio 2013+

Both _MSC_VER (VC++ compiler version) and EPICS base version should be
checked for strtoll, strtoull definitions.

* NEED_OLL_FUNCS now defined only for VS builds
2019-03-02 11:11:42 -08:00
Michael Davidsaver
4ffddfa2f6 Replace display.format with .form and .precision
Remove instance accessors w/o replacement
as a prelude to deprecation.
2019-01-16 09:06:15 -08:00
Michael Davidsaver
2814c779bd StandardField::getStandardField safety 2019-01-15 21:01:38 -08:00
Michael Davidsaver
4c73607799 cleanup StandardField 2019-01-15 21:01:38 -08:00
Andrew Johnson
d776f6eaf0 Update and unify README.md 2018-12-17 15:00:28 -06:00
Andrew Johnson
706ef01782 Delete ancient and unused examples.zip file 2018-12-17 14:59:23 -06:00
Michael Davidsaver
00c62cbd67 Fix deprecation message w/ gcc < 4.5
Apparently deprecated(msg) is newer than I thought.
2018-11-26 12:05:34 -08:00
Michael Davidsaver
da8f3d6cc7 minor 2018-11-26 10:25:29 -08:00
Michael Davidsaver
0bc95e51c2 7.1.0 2018-11-26 10:20:31 -08:00
Michael Davidsaver
727153e965 deprecate BoundedString, BoundedScalarArray, and FixedScalarArray
https://github.com/epics-base/pvDataCPP/issues/52
2018-11-26 10:13:08 -08:00
Michael Davidsaver
d00f54228d quiet warning, and possible dllimport/export
Seen as a warning on clang, but class/struct
can result in different mangled symbol names
w/ MSVC.
2018-11-07 09:06:58 -08:00
Michael Davidsaver
77c67802a3 printer.cpp extend precision 2018-10-30 17:09:56 -07:00
Michael Davidsaver
7d68d177d7 printer.cpp update time format 2018-10-30 17:02:22 -07:00
Michael Davidsaver
9b20505dcd stream() remove comma in NTTable 2018-10-30 14:33:15 -07:00
Michael Davidsaver
5f93e292b2 testprinter fix plan 2018-10-29 13:12:01 -07:00
Michael Davidsaver
edd3e20f3c format NTEnum 2018-10-29 13:12:01 -07:00
Michael Davidsaver
90cffa60d6 format NTTable as CSV 2018-10-29 13:12:01 -07:00
Michael Davidsaver
6171cd6867 escape and quote PVString(Array)::dumpValue()
Escaping for both.  quote array values,
but not scalar.

Also move remaining template virtuals out of line.
2018-10-29 13:12:01 -07:00
Michael Davidsaver
fa731bf6c3 helper to escape while printing strings 2018-10-29 13:12:01 -07:00
Michael Davidsaver
818fce324c Add PVStructure::stream() 2018-10-29 13:12:01 -07:00
Michael Davidsaver
1bc867e48d update travis-ci 2018-10-29 13:12:01 -07:00
Michael Davidsaver
434b9f7a9f Timer: simply wakeup condition 2018-10-19 13:35:35 -07:00
Michael Davidsaver
f54602dead update doc 2018-10-18 16:43:56 -07:00
Michael Davidsaver
fb546b41c1 rename documentation/*.h -> .dox 2018-10-18 16:43:56 -07:00
Michael Davidsaver
e400d9f5fd Timer reschedule if earlier timer added 2018-10-18 14:44:51 -07:00
Michael Davidsaver
f0fa8a2481 deprecate pvCopy.h 2018-10-16 20:52:50 -07:00
Michael Davidsaver
c3b0b49e3f use FieldBuilder::begin() and Field::build() 2018-10-16 20:52:38 -07:00
Michael Davidsaver
45265b4f9b Add FieldBuilder::begin() and Field::build()
Boilerplate reduction in structure
definition and instanciation.
2018-10-16 20:52:24 -07:00
Michael Davidsaver
aa87a2a23d json print/parse updates
These functions don't create new refs,
so they don't really need to work with shared_ptr.

Fully support printing.

Add option for maskable PVStructure printing.
2018-09-21 10:28:37 -07:00
Michael Davidsaver
5a59b1da75 Status avoid extra copies 2018-09-21 10:28:37 -07:00
Michael Davidsaver
32aa0dd72f drop extractRequestMask()
superceded by PVRequestMapper
2018-09-21 10:27:43 -07:00
mdavidsaver
c1188b16a1 Merge pull request #56 from mdavidsaver/pvrequestmapper
add PVRequestMapper
2018-09-21 10:27:08 -07:00
Michael Davidsaver
a02a60c658 Field::m_hash friends
Avoid additional access of m_hash by FieldCreate::Helper
which has an unclear (though I think correct) friend
relationship with Field.

Attempt to placate old gcc 3.4.4
2018-09-19 11:04:02 -07:00
c5f9f5a2dc link with rt when using clock_gettime() 2018-09-19 10:49:14 -07:00
Michael Davidsaver
342b1bc8ef add PVRequestMapper
utility to having pvRequest .field mangling

Warn if requesting some non-existant fields.
Error if no requested fields exist.

PVRequestMapper mode enum to select between
two "styles" of interpretation.
2018-09-17 09:11:28 -07:00
Michael Davidsaver
64158376f5 PVStructure inline access to member variables 2018-07-31 16:55:15 -07:00
Michael Davidsaver
850d4ff056 PVField::copyUnchecked assert()
Field comparison is now O(0), so do this anyway
to help catch mistakes.
2018-07-31 16:55:15 -07:00
Michael Davidsaver
f0cfe1c85a PVField::copy() avoid duplication with copyUnchecked() 2018-07-31 16:55:15 -07:00
Michael Davidsaver
c8b615b3ee Field initialize m_hash
valgrind complain (rightly) about use of uninitialized
if Structure ctor throws (eg. duplicate field).
~Field will then try to use m_hash before it has been
initialized.  This don't hurt and the subsequent equality
tests prevent any bad behavior.
2018-07-30 14:50:19 -07:00
Michael Davidsaver
c67fdafb43 add pvRequest -> bitmask processing 2018-07-14 15:10:46 -07:00
Michael Davidsaver
f66d277918 msvc 9 compat 2018-07-12 19:05:12 -07:00
Michael Davidsaver
4ef7db20f8 sharePtr.h: adjust apply/llvm compatibility 2018-07-12 15:38:49 -07:00
Michael Davidsaver
e1216dfa76 move PVValueArray dtor out of line
This class has out of line members, and explicit
instanciations.  Move the dtor out of line as
well to maybe avoid emitting duplicate
typeinfo.
2018-07-12 15:38:49 -07:00
Michael Davidsaver
340fa8a7cb Thread accept non-copyable std::function 2018-07-11 16:30:05 -07:00
Michael Davidsaver
a029455466 Thread reftrack 2018-07-11 16:30:04 -07:00
Michael Davidsaver
27f78c430b move Thread out of line 2018-07-11 16:29:50 -07:00
Michael Davidsaver
3d707e5e95 Field de-duplication performance test 2018-07-06 12:01:15 -07:00
Michael Davidsaver
0406a2f614 Field de-duplication
add a global cache of Field instances to
allow O(0) comparison of types.
2018-07-06 12:01:14 -07:00
Michael Davidsaver
a1c0e432ee fix Timer
use after free
2018-06-19 16:32:39 -07:00
Michael Davidsaver
57e57d9e43 de-virtualize PVValueArray<T> methods append(), remove(), and compress()
These were never members of a common base class,
nor overridden by a sub-class.
2018-06-07 09:53:38 -07:00
Michael Davidsaver
e4e4188eaf some more FINAL 2018-06-07 09:53:38 -07:00
Michael Davidsaver
f1553cc90e Move NOMINMAX to configure/CONFIG_SITE
The macro must be defined before MS system headers are
included.

This rev. remove #define NOMINMAX from public headers,
but no public headers use min()/max() and this was
never the correct way to use this macro as by convention
library headers are included after system headers,
which is too late to have an effect.
2018-05-28 11:24:49 -07:00
Michael Davidsaver
997e68c99a remove usage of min()/max() from public headers
Avoids need for #define NOMINMAX w/ MSVC
2018-05-28 10:14:03 -07:00
Michael Davidsaver
25663d9a7b additional EPICS_NOT_COPYABLE
attempt to pacify, or at least clarify, msvc
link error.
2018-05-21 21:02:32 -07:00
Michael Davidsaver
1e55266396 pvUnitTest.h avoid unintended copies
template argument matching doesn't always preserve
rvalue references, so force use of const ref.
2018-05-21 11:21:01 -07:00
Michael Davidsaver
810ae15991 printer.cpp avoid alloc of spaces
No need to allocate a std::string
just to repeat spaces.
2018-05-21 11:21:01 -07:00
Michael Davidsaver
271fec7f5e printer.cpp: clean whitespace 2018-05-21 11:21:01 -07:00
Michael Davidsaver
c43486791e prevent Field/PVField from being copied
I don't think this was ever intended to be possible,
but it was...
2018-05-21 11:19:42 -07:00
Michael Davidsaver
499c03265f update release notes 2018-04-24 13:30:15 -07:00
Michael Davidsaver
7eaa613d4d try to fix dllimport error 2018-04-17 21:13:22 -07:00
Michael Davidsaver
19db72031c shared_vector add missing void swap
swap() of void and const void misses vtype
2018-04-13 12:40:22 -07:00
Michael Davidsaver
671f9cca4b anyscalar.h: move out of line
No reason to believe that inline was helping.
2018-04-08 15:53:21 -07:00
Michael Davidsaver
9ecdb80534 anyscalar.h: remove unnecesary vcast
what was I thinking...
2018-04-08 15:53:21 -07:00
Michael Davidsaver
e973422ee1 anyscalar.h: add ctor from type code and void*
also helper bufferUnsafe() to get storage pointer
or c_str().
2018-04-08 15:53:21 -07:00
Michael Davidsaver
8093c25b72 typeCast.h: allow cast from C string to numeric w/o copy
also re-enable compile test of string to int64 which
was disabled for some reason...
2018-04-08 15:53:21 -07:00
Michael Davidsaver
a7c9c620dd Timer avoid deadlock in timerStopped()
No code actually uses this hook, but lets make
sure nothing bad would happen.
2018-04-08 15:53:21 -07:00
Michael Davidsaver
1e1d94ed73 rework Timer
I'm not sure how I broke it, but I know I don't have the patience
to fix it.  So replacing intrusive list and custom sorting with
std::list and std::list::merge().
2018-04-04 21:03:11 -07:00
Michael Davidsaver
7b8ef390ce add Timer::close()
An aid to orderly shutdown
2018-04-02 15:54:48 -07:00
Michael Davidsaver
87ade13234 Timer cleanup and hide run() 2018-04-02 15:54:48 -07:00
Michael Davidsaver
32abde7f19 redo Timer to avoid data race
run() was accessing this->head w/o locking
2018-04-02 10:54:49 -07:00
Michael Davidsaver
fe413af177 timerTest: redo to avoid time related false positives 2018-04-02 09:34:15 -07:00
Michael Davidsaver
b4cd026fe5 byteBuffer cleanup 2018-03-23 10:05:31 -07:00
Michael Davidsaver
a51b308cc8 ByteBuffer avoid PPC alignment fault 2018-03-19 15:26:40 -07:00
Michael Davidsaver
1c09b42951 ByteBuffer change order of tests for optimized byte swap
Check __clang__ before __GNUC__ as clang
also identifies itself as gcc for compatibility.
2018-03-19 15:26:35 -07:00
Michael Davidsaver
e42bb46563 ByteBuffer collapse some trivial indirection 2018-03-19 15:26:35 -07:00
Michael Davidsaver
a7788f9847 remove rtemsConfig.c
no longer needed.
2018-03-19 09:11:37 -07:00
Michael Davidsaver
b597364419 simpler test harness main() 2018-03-13 18:44:54 -07:00
Andrew Johnson
a9a951d970 Move epicsExit() call into pvDataAllTests()
Needed on VxWorks to display the test summary.
2018-03-13 12:24:59 -05:00
Andrew Johnson
6ac879ec6a Rename vxTestHarness -> pvdTestHarness
Integrate with Michael's similar changes for RTEMS.
2018-03-13 12:24:00 -05:00
Michael Davidsaver
2422ef50b6 rename rtemsTestHarness -> pvdTestHarness
avoid name clash with rtemsTestHarness
from pvAccessCPP
2018-03-12 09:11:44 -07:00
Michael Davidsaver
06dbf96b65 missing test count 2018-03-12 09:11:44 -07:00
Michael Davidsaver
172046e78f Add AnyScalar::clear() 2018-02-21 11:17:49 -08:00
Michael Davidsaver
7e8c49f0a0 don't use shared_ptr::get() for null test
unnecesarily verbose
2018-02-21 11:17:49 -08:00
Michael Davidsaver
f2ad6292f5 cleanup 2018-02-06 13:12:06 -08:00
Michael Davidsaver
337e13b72e pvIntrospect.h mark OVERRIDE/FINAL 2018-02-06 10:12:38 -08:00
Michael Davidsaver
2ab2fc62dc move FINAL/OVERRIDE defs to pvIntrospect.h 2018-02-06 10:12:38 -08:00
Michael Davidsaver
786575c3de a little bit of cleanup and minor opt 2018-02-06 10:02:08 -08:00
Michael Davidsaver
4cca194000 drop *HashFunction
not really implemented
2018-02-06 10:02:08 -08:00
Michael Davidsaver
cd3ead0028 testThread drop dead code 2018-01-05 11:14:59 -08:00
Michael Davidsaver
a239b95ca1 remove previously deprecated executor.h, queue.h and timerFunction.h 2018-01-05 11:14:59 -08:00
Michael Davidsaver
09574c0e82 sharedVector more c++11
support std::move() and construct
from initializer list.
2018-01-05 11:14:59 -08:00
Michael Davidsaver
0b6b01ef83 shared_vector limit MSVC workaround
limit 207efca15c
to MSVC <= 2010.
2018-01-05 11:14:59 -08:00
Andrew Johnson
34145e459b Clean up compiler warnings. 2018-01-04 17:59:09 -06:00
Michael Davidsaver
207efca15c workaround for msvc pickyness
The MSVC STL implementation asserts that
pointer/itertors are not null, even
when they would not be dereferenced
(eg. empty input range).
2018-01-04 11:52:19 -08:00
Michael Davidsaver
3e25c2ea46 fix more printf specs 2018-01-04 11:52:19 -08:00
Michael Davidsaver
2046678caa drop emptyStringtring 2018-01-04 11:52:19 -08:00
Michael Davidsaver
cb7e4e858b clear some warnings 2018-01-04 11:52:19 -08:00
Michael Davidsaver
43ee4b9cb6 thread safe getFieldCreate() and getPVDataCreate()
Fully thread safe and ctor order safe on all targets
(not just c++11).  Never destroyed to avoid global
dtor order issues.
2017-12-28 11:52:47 -06:00
Michael Davidsaver
207c24a4fd deprecate LOCAL_STATIC_LOCK
This construct is fairly useless.
Doesn't prevent ctor ordering problems.
2017-12-28 11:52:47 -06:00
Michael Davidsaver
6465ab3b6d caseUnsafeV use switch instead of jump table
Change from jump table to switch.
reduces code size (~1k of 30k for rtems/mvme3100).
use indexed loop to help gcc vectorizer.

Helpfully won't fail to compile w/ gcc 4.1 (vxworks 6.6/6.7)
2017-12-28 11:52:47 -06:00
Ralph Lange
cf624bc679 jenkins-ci: fix/update CloudBees jobs 2017-12-19 09:08:27 +01:00
Andrew Johnson
df55a776c7 Update version number after tagging release 2017-12-14 18:28:03 -06:00
Andrew Johnson
07afe3887b Reset DEVELOPMENT_FLAG for 7.0.0 release 2017-12-14 18:27:26 -06:00
Andrew Johnson
25434ba84f Insert missing release note entries
Most of these changes were only committed on the release branch and
never pulled onto the master branch. Don't want to lose history.
2017-12-14 18:23:51 -06:00
Michael Davidsaver
9787dbd14f anyscalar.h ensure that storage really is large enough
correct failure on cygwin x86 where apparently
sizeof(double) > sizeof(std::string)
2017-12-11 21:08:59 -06:00
Michael Davidsaver
fd9081c80e minor 2017-12-11 21:08:59 -06:00
Michael Davidsaver
e79c49019d quiet warning 2017-12-11 21:08:59 -06:00
Michael Davidsaver
5bc081a3af skip unnecessary inclusion of localStaticLock.h 2017-12-11 21:08:59 -06:00
Andrew Johnson
5976eb5186 Include <top>/../RELEASE.<host>.local 2017-12-06 20:37:27 -06:00
Andrew Johnson
b194bc05b1 Unify .gitignore files 2017-11-30 12:03:33 -06:00
Andrew Johnson
18207fd79e Use 'make test-results' in travis-build script 2017-11-29 16:36:39 -06:00
Andrew Johnson
7c1e0a51eb Fixes needed for older VxWorks GCC 2017-11-29 16:35:22 -06:00
Ralph Lange
7196658166 jenkins: remove microbench option from CB build 2017-11-15 17:28:05 +01:00
Michael Davidsaver
187fe67ffa fixup debugPtr 2017-11-14 17:13:43 -06:00
Andrew Johnson
7136098c3c Suppress unnecessary deprecation warnings
Disable warnings when compiling the implementations of
deprecated classes and functions.

Removes the unused USAGE_DEPRECATED and USAGE_ERROR macros
from pvData.h which aren't visible outside of it anyway.
2017-11-07 22:19:56 -06:00
Andrew Johnson
7979238029 Let's make timeStamp constants actually const 2017-11-07 11:46:36 -06:00
Michael Davidsaver
fc38dff3b0 testPVData: clarify getSubField() by index on sub-struct 2017-11-07 08:18:12 -06:00
Michael Davidsaver
c590204cf9 add epics::auto_ptr<T> and epics::swap()
Avoid the flood of auto_ptr deprecation warnings
in the common cases of using auto_ptr
to automatically delete.
2017-11-06 12:30:40 -06:00
Michael Davidsaver
284e49c807 add EPICS_NOT_COPYABLE()
More localize (my preference), and avoids
warning spam with windows builds.
2017-11-06 11:29:59 -06:00
Michael Davidsaver
43fcd3d1e2 debugPtr use libCom instead of std::
cross-builds of mingw claim c++11 but don't have std::mutex
2017-11-05 14:49:45 -06:00
Michael Davidsaver
a9f2d7df40 reftrack: remove inline operator[]
Use of class static member 'zero'
in an inline'd method is causing DLL confusion
in dependent modules.
2017-11-02 10:08:07 -05:00
Michael Davidsaver
21a03d2b85 rename configure/CONFIG_PVDATA_VERSION 2017-11-01 11:20:14 -05:00
Michael Davidsaver
f123b8654a update ignore 2017-11-01 09:40:42 -05:00
Michael Davidsaver
51cbe538e8 handle yajl 2.1.0 API changes 2017-10-31 19:34:30 -05:00
Marty Kraimer
e247a2c4eb Merge pull request #48 from mrkraimer/master
pvAlarm, pvTimeStamp, pvControl, pvDisplay: only put to fields that h…
2017-10-17 14:52:54 -04:00
Michael Davidsaver
490b6684ac more createRequest tests 2017-10-17 10:15:00 -05:00
mrkraimer
6fdeadf171 pvAlarm, pvTimeStamp, pvControl, pvDisplay: only put to fields that have changed 2017-10-16 10:00:22 -04:00
Michael Davidsaver
a88d491012 win64 one more time, move explicit instantiations after all definitions. 2017-10-06 11:06:23 +02:00
Michael Davidsaver
fd34d68933 another win64 attempt, explicitly instanciate 2017-10-05 16:24:45 +02:00
Michael Davidsaver
215e3aab7b one more attempt to appease win64 2017-10-05 15:32:31 +02:00
Michael Davidsaver
cd4feb3bab install CONFIG_PVD 2017-10-05 14:02:05 +02:00
Michael Davidsaver
6b0af421dd another attempt to appease msvc win64 2017-10-05 11:24:23 +02:00
Michael Davidsaver
9aeb4f2a96 attempt to fix win64 linking error 2017-10-05 10:39:47 +02:00
Michael Davidsaver
9b1e789e62 PVUnion: get() const propagation, add guess(), and inline trival 2017-09-30 13:43:50 -05:00
Michael Davidsaver
406b163bcc factory methods avoid creating unnecessary temporaries
Avoid some ref. counter activity (still have global mutex...)
2017-09-30 11:09:52 -05:00
Michael Davidsaver
6f2cae95e1 PVField: getParent() const propagation and inline trival 2017-09-30 11:00:37 -05:00
Michael Davidsaver
594a29b2db add PVScalar::putFrom/getAs variants for AnyScalar 2017-09-30 10:04:31 -05:00
Michael Davidsaver
0d12464e30 add AnyScalar 2017-09-29 17:22:43 -05:00
Michael Davidsaver
ccd9ab70ee pvUnitTest.h const-ness 2017-09-29 16:12:01 -05:00
Michael Davidsaver
27f2f87e29 reftrack class Field 2017-09-29 15:30:50 -05:00
Michael Davidsaver
635eb9d36d Status: inline trival and add maximize() w/ shorthand operator |= 2017-09-29 13:37:20 -05:00
Ralph Lange
f3e7f9bb8f travis-ci: consolidate travis configuration 2017-09-28 15:10:49 +02:00
Ralph Lange
2f69665056 travis-ci: fix RTEMS/qemu builds 2017-09-22 16:10:21 +02:00
Michael Davidsaver
559f7bc1b7 travis-ci: remove non-functional RTEMS builds 2017-09-21 16:13:18 -05:00
Michael Davidsaver
693f00caf5 Merge remote-tracking branch 'origin/master'
* origin/master:
  ci: changes for EPICS 7 Base structure

# Conflicts:
#	.travis.yml
2017-09-21 15:07:21 -05:00
Michael Davidsaver
822173979c FieldBuilder::add() ignore exact duplicates 2017-09-21 13:41:11 -05:00
Michael Davidsaver
9bce66f307 FieldBuilder edit union/structureArray/unionArray
Allow appending fields to existing types
to allow structure-like types
2017-09-21 13:41:11 -05:00
Michael Davidsaver
7a71e758b1 pvUnitTest.h multi-line prints 2017-09-21 13:41:11 -05:00
Michael Davidsaver
72fe0ca3e7 minor 2017-09-21 13:41:11 -05:00
Michael Davidsaver
fd0570f0c9 travis-ci fix c++11 builds 2017-09-21 13:41:11 -05:00
Ralph Lange
e0037a0c8b ci: changes for EPICS 7 Base structure 2017-09-21 16:14:02 +02:00
Michael Davidsaver
c7c83282ee parseJSON() more forgiving scalar array handling
Allow eg. to initialize array of integers with [1.0, 2.0]
2017-09-07 15:55:21 -05:00
Michael Davidsaver
8f98d9792b add typemap.h
helper for switch() over DBF or PVD scalar type codes
2017-09-07 15:53:40 -05:00
Michael Davidsaver
111f7bd15e parseJSON() track modified fields 2017-09-07 11:53:54 -05:00
Michael Davidsaver
787af8de18 BitSet building convenience
Allow set()/clear()/flip() to be chained.
Support c++11 initializer lists.
2017-09-07 11:49:07 -05:00
Michael Davidsaver
db6ebfe71b parseJSON() assign union with scalar value 2017-09-06 18:34:00 -05:00
Michael Davidsaver
1cb490039f remove another broken no-arg ctors 2017-08-30 17:55:04 -05:00
Michael Davidsaver
a152a64f1c RefSnapshot operator
move into class definition to hopefully appease MSVC
2017-08-30 17:04:02 -05:00
Michael Davidsaver
08f50e56ac win32 doesn't have ssize_t 2017-08-30 14:20:10 -05:00
Michael Davidsaver
9ae221ca0c apply reftrack to PVField 2017-08-30 11:13:10 -05:00
Michael Davidsaver
aca8da5891 remove broken no-arg ctors
Non-useful bypass of factory which leaves
private pointers undefined (eg. parent field).
2017-08-30 11:11:47 -05:00
Michael Davidsaver
34896560ea add reftrack.h
Add global Reference Counter tracker
2017-08-30 11:11:47 -05:00
Michael Davidsaver
3597fbe382 avoid unnecessary temp shared_ptr
avoid some extra ref. counter operations.
2017-08-16 17:49:17 +02:00
Michael Davidsaver
0b262baf97 fix getSubField() by index 2017-08-16 16:29:06 +02:00
Michael Davidsaver
78b51ebe59 c++98 compatible, but still reduced, number of getSubField() specializations 2017-08-16 11:22:42 +02:00
Michael Davidsaver
08a92468fe PVStructure::getSubField() const propagation 2017-08-15 18:35:54 +02:00
Michael Davidsaver
b84ed964f9 reduce # of PVStructure::getSubField overloads 2017-08-15 18:35:54 +02:00
Michael Davidsaver
8bfe7b6b9d debugPtr compat
Fails for newer RTEMS w/ c++11 but no backtrace()
2017-08-15 18:35:54 +02:00
Michael Davidsaver
dbae173399 don't import/export inline classes 2017-07-18 14:32:42 +02:00
Michael Davidsaver
4d4dbcda4d expose const void* form of PVScalar::putFrom() 2017-07-18 14:28:11 +02:00
Michael Davidsaver
fd4584a49d resolve ambiguity 2017-07-18 11:12:44 +02:00
Michael Davidsaver
ceb9f795cb whitespace: quiet gcc6 indentation warning 2017-07-17 16:25:00 +02:00
Michael Davidsaver
443c254d46 no C99 initializers
because MSVC doesn't support this...
2017-07-17 15:58:04 +02:00
Michael Davidsaver
87fa150ced 3.14 compat 2017-07-13 19:14:52 +02:00
Michael Davidsaver
4cfdb8233f more import/export 2017-07-13 18:49:32 +02:00
Michael Davidsaver
5e42cf76eb import/export fix 2017-07-13 18:35:38 +02:00
Michael Davidsaver
dccf6193da more doc 2017-07-13 18:25:25 +02:00
Michael Davidsaver
ee4fdf3f39 json print/parse from/to PVStructure 2017-07-13 18:02:10 +02:00
Michael Davidsaver
918b7f96db valueBuilder: support scalar array fields 2017-07-12 18:33:20 +02:00
Michael Davidsaver
ef55345665 pvUnitTest: compare array fields 2017-07-12 18:26:43 +02:00
Michael Davidsaver
0a41dbb443 ScalarTypeFunc::allocArray missing export 2017-07-12 15:46:01 +02:00
Michael Davidsaver
934ad32e52 debugPtr import/export 2017-07-12 15:29:34 +02:00
Michael Davidsaver
b582f0f880 createRequest clean message before each run 2017-07-12 15:28:09 +02:00
Michael Davidsaver
face3de44a more doc 2017-07-12 14:29:31 +02:00
Michael Davidsaver
8a7b9d776f requester.h moves to pvAccessCPP 2017-07-12 13:13:44 +02:00
Michael Davidsaver
a8c5d1095d remove MessageQueue 2017-07-12 13:07:36 +02:00
Michael Davidsaver
9fa5028f6c PVStructure::getStructure() avoid creation of temporary
avoid some ref-counter activity
2017-07-07 14:39:25 +02:00
Michael Davidsaver
0de3c089d2 testByteBuffer always test both byte orders 2017-07-07 11:21:00 +02:00
Michael Davidsaver
919bc0138a add pvUnitTest.h 2017-07-06 17:05:30 +02:00
Michael Davidsaver
a0210af5c6 remove unnecessary 'typename' 2017-07-06 13:23:24 +02:00
Michael Davidsaver
888291db9a move destroyable.h to pvAccessCPP 2017-07-05 11:59:22 +02:00
Michael Davidsaver
4fce663795 travis-ci 2017-07-04 15:54:29 +02:00
Michael Davidsaver
fc3384fb95 remove raw html in favor of generated
reformat release notes.
2017-07-04 15:33:43 +02:00
Michael Davidsaver
f9a30ca08e update doc 2017-07-04 15:08:01 +02:00
Michael Davidsaver
cbbe691f70 ValueBuilder dllexport 2017-07-04 12:22:04 +02:00
Michael Davidsaver
afbf0809c3 more travis-ci 2017-07-03 18:36:59 +02:00
Michael Davidsaver
db8d4b4347 fix # of tests 2017-07-03 18:35:57 +02:00
Michael Davidsaver
904ee7dfec travis-ci test mingw/win32 dll/static builds 2017-07-03 18:21:10 +02:00
Michael Davidsaver
bef616632c add ValueBuilder 2017-07-03 17:34:38 +02:00
Michael Davidsaver
1d2e5d182e oops 2017-06-26 19:26:59 +02:00
Michael Davidsaver
568ee1fa85 add debugPtr.h to troubleshoot shared_ptr problems
A wrapper around shared_ptr which tracks backwards references
to help untangle complicated ownership situations (aka. ref loop
waiting to happen).
2017-06-26 15:59:45 +02:00
Michael Davidsaver
66633a7728 test cleanup
remove compile time "debug" flag from from tests.
use testDiag() instead
2017-06-26 15:16:43 +02:00
Michael Davidsaver
18283b44b2 more sharedPtr 2017-06-19 14:15:06 +02:00
Michael Davidsaver
278696b28e more sharedPtr compat 2017-06-15 18:23:20 +02:00
Michael Davidsaver
26efd09d45 doxygen 2017-06-14 17:06:38 +02:00
Michael Davidsaver
ec9aba79ae fix warning about missing override w/ c++11 2017-06-14 16:21:51 +02:00
Michael Davidsaver
07e42d81f4 travis-ci 2017-06-14 14:20:44 +02:00
Michael Davidsaver
d272afc128 fixup sharedPtr 2017-06-14 13:59:02 +02:00
Michael Davidsaver
6cf9fa2208 fix "hides overloaded virtual function" warning 2017-06-14 13:22:06 +02:00
Michael Davidsaver
a72451cdbe Add Destroyable::cleaner to help w/ shared_ptr<> wrapping 2017-06-06 18:38:55 +02:00
Michael Davidsaver
e82489b158 Timer: actually join thread 2017-06-02 11:03:46 +02:00
Michael Davidsaver
e4c7fa6a1c move monitor.h to pvAccessCPP 2017-05-24 17:45:41 -04:00
Michael Davidsaver
48ed24dabf remove no-op monitor.cpp 2017-05-24 16:33:16 -04:00
Michael Davidsaver
9ef060a2f2 remove deprecated monitorPlugin.h 2017-05-24 16:31:26 -04:00
Michael Davidsaver
255c41607f remove deprecated monitorPlugin.h 2017-05-24 16:06:00 -04:00
Michael Davidsaver
22da026888 deprecate unused Queue, MessageQueue, Executor, and TimeFunction 2017-05-15 15:12:28 -04:00
Michael Davidsaver
def0a63008 Queue remove nullElement
avoid potential 0=1 situation.
2017-05-15 14:53:54 -04:00
Michael Davidsaver
6e62e123e8 FieldBuilder allow append to Structure
Helpful to allow a new definition to be created
as an extension of an existing definition.
2017-05-15 12:46:32 -04:00
Michael Davidsaver
262df56024 testFieldBuilder: cleanup 2017-05-12 14:26:18 -04:00
Michael Davidsaver
81cdf071a8 FieldBuilder detect duplicate field names 2017-05-12 13:24:37 -04:00
Michael Davidsaver
c5ce75888e Merge remote-tracking branch 'md/overhaulbytebuf'
* md/overhaulbytebuf:
  overhaul byteBuffer implementation
2017-05-10 15:36:49 -04:00
Michael Davidsaver
fb232896a8 avoid unnecessary globals 2017-05-10 15:00:55 -04:00
Michael Davidsaver
5efa462f19 add c++11 override/final 2017-05-10 15:00:55 -04:00
Michael Davidsaver
225f3ab125 Remove hidden sub-class
collapse Base* and Default* classes
into parents.
2017-05-10 15:00:55 -04:00
Michael Davidsaver
664fbfeb6e pvCopy: remove unnecessary globals 2017-05-07 20:17:26 -04:00
Michael Davidsaver
66f8ca0501 simpler createRequest()
A single function which throws exceptions on error
2017-05-07 20:07:01 -04:00
Michael Davidsaver
e977d63f08 add pvdVersion.h 2017-04-15 17:26:18 -04:00
Michael Davidsaver
08fc3cab38 update testPVUnion 2017-04-15 16:19:23 -04:00
Michael Davidsaver
a01885536c PVUnion fixups
select(int32)

throw for variant w/ other than UNDEFINED_INDEX.
Now same behavior for variant and discriminating,
which is to clear contents.
Fix selector range check.

set(int32)

Fix set(UNDEFINED_INDEX, NULL) for discriminating.
Fix selector range check.
2017-04-15 16:19:23 -04:00
Michael Davidsaver
f7343674ee make PVUnion::UNDEFINED_INDEX const 2017-04-15 16:19:23 -04:00
Michael Davidsaver
fc2adf98ba Status: add helpers
so that

epics::pvData::Status(epics::pvData::Status::STATUSTYPE_WARNING, msg)

can become

epics::pvData::Status::warn(msg)
2017-04-15 16:19:23 -04:00
Michael Davidsaver
a3c57a5077 bitSet: add logical_and()/_or()
Basic logical operations for tests
where a temporary can be avoided.
2017-04-15 16:19:15 -04:00
Michael Davidsaver
28b5dd0163 shared_ptr: further simplify static_shared_vector<>() 2017-04-15 16:06:01 -04:00
Michael Davidsaver
c0b69e4e6f add monitor buffer statistics
to help answer the question of why no monitorEvent()s
are happening.
2017-04-15 16:05:26 -04:00
Michael Davidsaver
a9111d78d3 overhaul byteBuffer implementation
align(n) now fills skipped bytes with '\0'.

align(n,f) to choose a different fill value.

No other changes intended

Use intrinsic byte order swapping builtins for gcc, clang, and msvc.

use assert() to check pre/post conditions.

Remove unused condition macros and unreachable code.

Add tests of byte swapping primitives and
test the correctness of unaligned operations.

add illustrations of flip() and rewind()
2017-04-07 15:09:47 -04:00
Dave Hickin
cc91e22038 testThread: Namespace qualify Thread
Fixes build error with latest RTEMS (Thread ambiguous).
2016-09-16 21:22:33 +01:00
Andrew Johnson
4555f69733 #include <algorithm> required for MSVS 2015 2016-09-14 16:23:32 -05:00
Michael Davidsaver
da8ba56dd1 testTypeCast: mangle values to be printable
print  (u)int8 as integer instead of character
2016-09-07 15:29:58 -04:00
Michael Davidsaver
4d6d5620b0 Revert "testTypeCast: Escape non-printing characters"
This reverts commit f7cad98f3e.
2016-09-07 15:28:48 -04:00
Dave Hickin
f7cad98f3e testTypeCast: Escape non-printing characters 2016-09-07 14:40:16 +01:00
Dave Hickin
d978c4c3bf Fix for MinGW
Fixes #42
2016-09-07 10:45:39 +01:00
Dave Hickin
1c4b7810b1 jenkins: Remove COPYRIGHT from tar 2016-07-22 16:07:35 +01:00
Dave Hickin
a6ec43f81c SHRLIB: Set version to 6.1 2016-07-22 16:05:32 +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
Dave Hickin
05d41f81e4 Minor correction to README 2015-10-15 10:37:12 +01:00
Dave Hickin
fdc289d888 Add new README
Replace out of date HTML README with a new markdown one
2015-10-15 09:16:20 +01:00
Dave Hickin
0a2243e033 Update TODO 2015-10-15 07:46:40 +01:00
Dave Hickin
9d877d764f Doxgen fixes and enhancements
Change &param to @param. Add missing parameter.
Add more doxygen comments in SerializeHelper.
2015-10-15 07:12:42 +01:00
Dave Hickin
f5df29cf34 Doxygen: remove @code when code block not wanted
@code produces a separate code block, rather than just displaying
contents as code.

Mostly replaced use with @c tag when block not wanted.
2015-10-15 06:50:26 +01:00
Dave Hickin
8008823ea5 Fix doxygen warnings 2015-10-14 23:01:28 +01:00
Dave Hickin
6515de4bc0 Add release notes for 5.0 2015-10-08 15:24:14 +01:00
Ralph Lange
8c5f535b79 jenkins: fix CloudBees doc job 2015-09-28 15:29:39 +02: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
Ralph Lange
036186fc12 jenkins: adapt doc script to new CloudBees jenkins job 2015-09-14 16:48:15 +02:00
Dave Hickin
d3853bd4e9 Ignore target-specific RELEASE and CONFIG_SITE in git
Tell gir to ignore configuration files such as RELEASE.win32-x86.Common
or CONFIG_SITE.linux-x86_64.Common.
2015-09-02 16:36:26 +01:00
Dave Hickin
7253bac48a Updated copyright notice and license
Updated copyright notice using the one in normativeTypesCPP. Added
Diamond and BNL. Added legal discalimers for Diamond and BNL to license.
Added dates to copyright notice. "All rights reserved" added to
copyright.
2015-09-02 14:04:29 +01:00
dhickin
973fbeeba5 Merge pull request #8 from dhickin/move_getSubFieldT_def_from_class_body
Move getSubFieldT definitions out of class body
2015-09-01 17:03:14 +01:00
dhickin
f22cefba97 Merge pull request #11 from anjohnson/fix-mac-build
Fix build problem on Mac
2015-09-01 17:00:58 +01:00
Ralph Lange
a5abc37b17 Add QtCreator pattern to .gitignore 2015-08-18 16:11:33 +02:00
Ralph Lange
b95fa7be56 jenkins: remove hgweb job; split doc and build jobs; update EPICS Base version 2015-08-18 16:11:05 +02:00
Andrew Johnson
f6cf87a52d Fix build problem on Mac
../../testApp/pv/testPVData.cpp:549:14: error: use of overloaded operator '!='
      is ambiguous (with operand types 'PVIntPtr' (aka 'shared_ptr<PVInt>') and
      'long')
    testOk1(a!=NULL);
            ~^ ~~~~
2015-08-12 15:06:46 -05:00
dhickin
51f36b2281 Merge pull request #10 from dhickin/remove_deprecated_getDerivedTypeField
Remove deprecated PVStructure::get*Field Functions
2015-07-29 12:29:08 +01:00
Dave Hickin
ddebd494c6 Remove deprecated PVStructure::get*Field Functions
Remove the deprecated functions such as getIntField in PVStructure,
whose usage has been replaced by that of the template getSubField
function and which are now no longer called anywhere.
2015-07-28 17:45:26 +01:00
dhickin
d0a8d2b1cd Merge pull request #9 from dhickin/replace_calls_getScalarArrayField
Replace calls of deprecated PVStructure::getScalarArrayField
2015-07-28 17:07:50 +01:00
Dave Hickin
1731a0daf6 USAGE_DEPRECATED macro used for getScalarArrayField 2015-07-24 16:56:49 +01:00
Dave Hickin
3487b3ee9e Remove unused argument in testPVScalarArray 2015-07-24 11:22:50 +01:00
Dave Hickin
5834efb709 Remove calls of deprecated getScalarArrayField 2015-07-24 11:21:58 +01:00
Dave Hickin
52bc6d060d Move getSubFieldT definitions out of class body
Move definitions of 2 getSubFieldT overloads:
shared_ptr<PVT> PVStructure::getSubFieldT(const char *name) const
shared_ptr<PVT> PVStructure::getSubFieldT(size_t fieldOffset) const
out of class body so not implicitly inlined.
2015-07-15 11:34:44 +01:00
dhickin
35ca5f3aed Merge pull request #7 from dhickin/getSubFieldT
GetSubFieldT
2015-07-14 16:19:38 +01:00
Dave Hickin
ac2b6ea8db Make getSubFieldT return shared pointer
Signed-off-by: Dave Hickin <david.hickin@diamond.ac.uk>
2015-07-13 12:48:05 +01:00
Dave Hickin
9827caa3e3 Make overloads of getSubField and getSubFieldT match
For each getSubField overload a throwing getSubFieldT has been added and
vice versa. These have been documented in doxygen and in the module
documentation.

Signed-off-by: Dave Hickin <david.hickin@diamond.ac.uk>
2015-07-13 12:41:47 +01:00
Dave Hickin
ebe2d6196c Rename getAs getSubFieldT
Signed-off-by: Dave Hickin <david.hickin@diamond.ac.uk>
2015-07-13 12:34:15 +01:00
Dave Hickin
e4689dd3f8 Added unit tests for functions for getting subfields
Signed-off-by: Dave Hickin <david.hickin@diamond.ac.uk>
2015-07-13 12:07:54 +01:00
Dave Hickin
1dba611b8e Improve exception messages when getting PVStructure subfield
Signed-off-by: Dave Hickin <david.hickin@diamond.ac.uk>
2015-07-13 11:47:21 +01:00
Dave Hickin
97cbea6f4d Implement getSubField functions without using exceptions
Implementation of getSubField (and getScalarArrayField) introduced in
the getAs pull request throws an exception then catches it to return a
null pointer. Implement without throwing.

Signed-off-by: Dave Hickin <david.hickin@diamond.ac.uk>
2015-07-13 02:16:08 +01:00
Dave Hickin
d9963b0631 Add test for getAs when mid-field not structure
Signed-off-by: Dave Hickin <david.hickin@diamond.ac.uk>
2015-07-09 13:22:42 +01:00
Dave Hickin
8418303ce2 Fix bug in new PVStructure::getAs function
Fix seg fault when getAs is called with a string of the form x.y (or
x_1. ... x_n.y) where x or (x1. ... .x_i) is not a structure field.

Signed-off-by: Dave Hickin <david.hickin@diamond.ac.uk>
2015-07-09 13:21:45 +01:00
Dave Hickin
40952df965 Corrected spelling in test and exception messages
Signed-off-by: Dave Hickin <david.hickin@diamond.ac.uk>
2015-07-08 18:19:53 +01:00
Dave Hickin
4f2c51c480 Correct spelling and typos in doxygen and comments
Signed-off-by: Dave Hickin <david.hickin@diamond.ac.uk>
2015-07-08 18:18:37 +01:00
Marty Kraimer
fd31a0d6b0 Merge pull request #6 from mdavidsaver/dropprinter
remove unused PrinterPlain
2015-06-27 07:00:15 -04:00
Michael Davidsaver
9ad725a272 remove unused PrinterPlain 2015-06-25 16:51:04 -04:00
Marty Kraimer
2b6172ba63 Merge pull request #5 from mrkraimer/master
document new PVStructure::getAs method
2015-06-23 10:12:10 -04:00
Marty Kraimer
c521f9299d document new PVStructure::getAs method 2015-06-23 08:24:54 -04:00
Marty Kraimer
1e646f8df1 Merge pull request #4 from mdavidsaver/getasfield
Add PVStructure::getAs<>()
2015-06-23 07:24:30 -04:00
Marty Kraimer
b5a436c1b7 Merge pull request #3 from mdavidsaver/getdeprecate
Deprecated PVStructure::get*Field methods trigger a warning
2015-06-23 07:17:38 -04:00
Michael Davidsaver
4f25c7a3ea remove findSubField 2015-06-22 18:14:23 -04:00
Michael Davidsaver
eadb8ff65b add PVStructure::getAs<>() for field access w/o NULL 2015-06-22 18:14:23 -04:00
Michael Davidsaver
6a80e941a0 replace use of depercated methods 2015-06-22 14:36:27 -04:00
Michael Davidsaver
7fc9b42b3a PVStructure: compiler warning when deprecated methods are used 2015-06-22 14:27:44 -04:00
Dave Hickin
0d857999bf Make default type ID strings const.
Signed-off-by: Dave Hickin <david.hickin@diamond.ac.uk>
2015-06-17 14:51:07 +01:00
Marty Kraimer
8ba71b048e Merge pull request #1 from mdavidsaver/errmsg
Friendlier exception messages w/ stack trace during Field creation
2015-06-15 06:41:34 -04:00
Michael Davidsaver
e07f6c1703 Friendlier exception messages w/ stack trace during Field creation 2015-06-12 13:54:03 -04:00
Marty Kraimer
e4f38121d2 remove qtcreator file 2015-06-10 10:31:08 -04:00
Marty Kraimer
255ee3f151 clean up conversion from hg to got; remove qtcreator files 2015-06-09 08:43:41 -04:00
dhickin
e72dbaabe1 Add some doxygen 2015-06-08 10:06:06 +01:00
dhickin
b39662450f Fix for windows static build static initialisation errors. 2015-06-08 04:58:04 +01:00
dhickin
98da0c0bec Add template getField member functions which return specific field types to Structure and Union. 2015-03-30 09:05:59 +01:00
dhickin
45dde325fd Change the printing of structure array and union array fields of structure introspection objects. Removes superfluous information and brings it in line with pvData meta language. 2015-03-20 17:23:32 +00:00
dhickin
2967a8f798 Declare the one argument constructors of PVField and its derived classes explicit. 2015-03-06 21:05:50 +00:00
Matej Sekoranja
d4bdc73948 documentation/RELEASE_NOTES.md updated 2015-02-18 14:26:19 +01:00
Matej Sekoranja
37c2f6bb17 merge 2015-02-18 10:11:15 +01:00
Matej Sekoranja
a8e4d749e3 flow: Merged <feature> 'copy_refactoring' to <develop> ('default'). 2015-02-18 10:02:17 +01:00
Matej Sekoranja
3df16ee449 flow: Closed <feature> 'copy_refactoring'. 2015-02-18 10:02:17 +01:00
Matej Sekoranja
332c2f959b added copy() method back to convert, since it is usually used by external modules; marked as DEPRECATED 2015-02-17 22:36:28 +01:00
Matej Sekoranja
a1b89c9a3b PVScalar::copy made public; copy tests 2015-02-17 21:54:35 +01:00
Matej Sekoranja
d6921fdac0 removal of some methods from convert 2015-02-17 20:22:37 +01:00
Matej Sekoranja
4cb3c22221 update code to the new method, removed copy from convert 2015-02-17 18:56:56 +01:00
Matej Sekoranja
cc1536b6e1 moved operators to pvData/pvIntrospect, added copy/copyUnchecked methods 2015-02-17 13:59:15 +01:00
Matej Sekoranja
92a178cbf9 flow: Created branch 'feature/copy_refactoring'. 2015-02-17 09:36:44 +01:00
dhickin
fbebce0a49 Make sure postPut is called precisely once and after put in Convert::copyUnion. 2015-02-11 22:17:45 +00:00
Matej Sekoranja
b13bb9819a updated testPlan(0) to actual value 2015-02-11 20:56:38 +01:00
Matej Sekoranja
bb505b8ed9 win32: new operators were missing exports 2015-02-11 15:41:12 +01:00
dhickin
cf030bc711 Call postPut() in Convert::copyUnion(). 2015-02-11 14:04:15 +00:00
Marty Kraimer
6cb95c5cfc fixed possible SEGFAULT in ceateRequest; new stream operator for Field and PVField 2015-02-11 07:26:04 -05:00
Matej Sekoranja
a277a4fdd5 copy schematic 2015-02-11 11:30:39 +01:00
Matej Sekoranja
388799d39d monitors: minor monitor API doc update 2015-02-01 00:46:55 +01:00
Matej Sekoranja
4acf7edf95 non-copy (by reference) retrival of getFields()/getPVFields()/getFieldNames() 2015-01-30 11:35:43 +01:00
Matej Sekoranja
e39346d51e missing swap templates for unsigned types 2015-01-21 20:19:23 +01:00
Ralph Lange
5ae6de4f1d jenkins: fix cloudbees script (commands must return 0) 2014-12-19 14:01:13 +01:00
Ralph Lange
e0f1427af7 jenkins: create and update documentation in only one build configuration 2014-12-19 13:18:52 +01:00
Ralph Lange
69297bdb58 jenkins: make EPICS base a parameter in jenkins job 2014-12-12 09:49:01 +01:00
Marty Kraimer
0fa2f2c2ff merge branch release/4.0 2014-12-11 14:11:54 -05:00
Marty Kraimer
9efce46fff work on doxygen 2014-12-11 09:47:20 -05:00
dhickin
c356ecb402 make local RELEASE.local files take precedence over those in TOP/.. 2014-12-09 13:45:56 +00:00
dhickin
4c6887e7ec Added tag 4.0.3 for changeset 8543734dbf6e 2014-12-05 11:30:03 +00:00
Marty Kraimer
6d338cab15 merge branch release/4.0 2014-12-04 08:30:26 -05:00
dhickin
354fdd412f make "local" *.local files take precedence over those in TOP/.. 2014-12-03 16:55:27 +00:00
dhickin
f3f6141e6a include CONFIG_SITE.local instead of CONFIG.local at top-level. 2014-12-03 16:10:25 +00:00
Matej Sekoranja
f2b43b704c rtems compilation warnings (int32 != int) 2014-11-26 14:12:09 +01:00
Matej Sekoranja
de1478d7ba Event test added 2014-11-25 10:43:07 +01:00
Marty Kraimer
b9592eeb8c Added tag 4.0.2 for changeset af82285f71aa 2014-11-24 06:55:18 -05:00
Marty Kraimer
6a62f9c082 catch std::exception and return NULL PVStructurePtr 2014-11-24 06:54:28 -05:00
Matej Sekoranja
2e4a8b2e23 Structure/Union: bound check access for getFieldName(int)/getField(int) 2014-11-13 18:32:50 +01:00
Marty Kraimer
c5112ffa11 Added tag 4.0.1 for changeset b0d39d12d743 2014-11-11 07:05:19 -05:00
Matej Sekoranja
7b9fda4e81 merge 2014-11-10 21:33:47 +01:00
Matej Sekoranja
278e531806 PVUnion copy allways shallow 2014-11-10 21:30:48 +01:00
Marty Kraimer
047de40642 change date, this version, and previous version 2014-11-10 09:06:35 -05:00
Matej Sekoranja
4e671a1c21 win32 indent problem: local static DLL saga 2014-11-06 22:18:58 +01:00
Matej Sekoranja
f36c8ce280 testByteOrder: use MAIN instead of main 2014-11-06 14:28:49 +01:00
Matej Sekoranja
e77f2c91d7 fixed undeterministic serialization test on clang 2014-11-06 13:03:59 +01:00
Matej Sekoranja
82b0d5ce5f merge 2014-11-06 12:50:04 +01:00
Matej Sekoranja
6117035863 null element handling for structure/union array 2014-11-06 12:48:57 +01:00
Matej Sekoranja
c86e31ad99 vxWorks: type cast fixes 2014-11-06 12:38:01 +01:00
Matej Sekoranja
f506fe1c0e int/int32 compilation fix; now all test spass on RTEMS-i386 2014-11-05 14:05:28 +01:00
Matej Sekoranja
554dc06eda ScalarTypeID mapping fixed in case 'int' == 'long', e.g. RTEMS-i386 2014-11-05 13:52:10 +01:00
Matej Sekoranja
80e1dfd142 removed forces NE2K card or non i386 builds 2014-11-03 13:51:21 +01:00
Matej Sekoranja
6db5cf60dc removing file should not have been commited 2014-11-03 12:41:09 +01:00
Matej Sekoranja
63d181a0ac RTEMS QEMU tests 2014-11-03 12:37:12 +01:00
Matej Sekoranja
73c4896cce tests: VxWorks tests are now ready to be run 2014-10-31 17:49:10 -04:00
Matej Sekoranja
5b1b5ab904 tests: refactored test building so that one test object can be created for VxWorks and RTEMS 2014-10-31 18:29:55 +01:00
Matej Sekoranja
80a537bc4c vxWork tests for all subtests; still need to combine them all to one 2014-10-31 07:57:20 -04:00
Matej Sekoranja
2a8a1d3736 tests: PROD_HOST to TESTPROD_HOST; VxWorks tests for testApp/pv PASSES 2014-10-31 06:42:52 -04:00
Matej Sekoranja
61fbfa0684 Added tag 4.0.0 for changeset f9f187685032 2014-10-29 12:59:39 +01:00
Matej Sekoranja
f06a6bfe7b merge to default branch 2014-10-28 19:37:34 +01:00
Matej Sekoranja
587f81f511 win32 in vs2013 compilation fix 2014-10-28 19:36:57 +01:00
Matej Sekoranja
435ca63d1b ev4 to epics URI 2014-10-28 18:53:11 +01:00
Marty Kraimer
64bb660f44 Added tag 4.0.0 for changeset 9c62aaa83b9d 2014-10-15 14:47:48 -04:00
Marty Kraimer
8bf24de0b3 removed pvArray.html and pvDataDiscussion.html; good ideas now implemented 2014-10-08 15:03:52 -04:00
Marty Kraimer
943ea633a4 more work on pvDataCPP.html; minor changes to examples 2014-10-08 14:48:30 -04:00
dhickin
b1d5f7d7e5 Corrected NTUnio to NTUnion 2014-10-07 15:32:26 +01:00
dhickin
188b94ce19 Corrected spelling of synchrotron in licence. 2014-10-04 02:45:53 +01:00
dhickin
515282abfe Spelling and typos. 2014-10-04 01:33:59 +01:00
dhickin
efbdb722e7 Made sub-field/subfield consistent by changing to subfield. 2014-10-04 01:28:19 +01:00
dhickin
e980823294 Corrected NTUnio->NTUnion. 2014-10-04 00:22:46 +01:00
dhickin
3692f4fb3c Correctly produce <> for templates in code samples for PVUnionArray in pvDataCPP.html. 2014-10-03 15:58:55 +01:00
dhickin
3e645f3c79 Corrected spelling in pvDataCPP.html. 2014-10-03 15:24:20 +01:00
Marty Kraimer
6127763302 Added tag 4.0.0 for changeset 1348c22b1258 2014-09-30 16:59:37 -04:00
Marty Kraimer
19a181b38f change ev4:nt: to 3v4:nt/ 2014-09-30 15:26:23 -04:00
Marty Kraimer
2818b0384c flow: Created branch 'release/4.0'. 2014-09-30 15:06:43 -04:00
Marty Kraimer
36faf8c2ea change URI naming 2014-09-30 15:05:18 -04:00
Marty Kraimer
a208171250 change uri:ev4:nt/2012 to uri:ev4:nt/2014 2014-09-23 14:34:21 -04:00
Marty Kraimer
b8a2b7cff6 get documantation ready for pre release 2014-09-03 09:01:15 -04:00
Marty Kraimer
2a08cbc1a0 add static 2014-08-25 08:09:28 -04:00
Matej Sekoranja
62bc6c1fb1 PVControl::minStep implemented 2014-08-22 22:22:38 +02:00
Matej Sekoranja
1098650421 clang fix 2014-08-20 21:42:29 +02:00
Marty Kraimer
15d85c2f87 fix misspelled field names: nanoSecond => nanosecond; hystersis=>hysteresis 2014-08-20 06:27:24 -04:00
Matej Sekoranja
16fb3f0339 clang fixes 2014-08-19 20:58:12 +02:00
Matej Sekoranja
37f6dff065 bounded string 2014-08-19 20:42:15 +02:00
Marty Kraimer
baf8832fc9 allow record[] field() getField() putField() 2014-08-19 09:15:06 -04:00
Marty Kraimer
b558e11ede major changes to CreateRequest; now compatible with Java version 2014-08-19 08:25:38 -04:00
Matej Sekoranja
103cdabff1 fixed clang std::tr1 import by adding include 2014-08-13 21:53:15 +02:00
Matej Sekoranja
57e33c8f7d clang porting 2014-08-13 09:36:37 +02:00
Matej Sekoranja
da0f65c2d3 fixed size array serialization test 2014-08-12 13:20:00 +02:00
Matej Sekoranja
6535c075f3 fixed sized arrays 2014-08-12 13:17:17 +02:00
Matej Sekoranja
f3c0b9544c dumpValue for boolean fix 2014-08-11 22:09:46 +02:00
Matej Sekoranja
3609fd4745 fixed testCreateRequest, still fails 2014-07-30 21:49:52 +02:00
Matej Sekoranja
622e140622 Fixed/bounded scalar array impl. 2014-07-30 21:41:08 +02:00
Marty Kraimer
a4954c3825 fixed bug in createRequest.cpp 2014-07-30 06:50:22 -04:00
Matej Sekoranja
b6e1b9c203 reuse existing PVField instance on PVUnion::deserialize 2014-07-28 23:23:01 +02:00
Matej Sekoranja
34a35c2658 fixed/bounded array introspection data serialization 2014-07-28 23:05:49 +02:00
Marty Kraimer
90b7c9a17c change in TODO.md; add RELEASE_NOTES.html and TODO.html 2014-07-22 08:49:02 -04:00
Marty Kraimer
c72297020b update documentation 2014-07-10 13:17:26 -04:00
Matej Sekoranja
f07b601dce merge 2014-07-07 20:55:49 +02:00
Matej Sekoranja
63c62a2aae Union::dump indentification fixed 2014-07-07 20:54:38 +02:00
Matej Sekoranja
6888a9d340 Added tag 3.1.0 for changeset 260f35b9c6ca 2014-07-02 00:09:01 +02:00
Matej Sekoranja
72bf9f76a3 forgot to remove friend operator<< 2014-06-19 21:56:56 +02:00
Matej Sekoranja
c0c6213c7c Win32: friend incosistent linkage 2014-06-19 21:24:14 +02:00
Matej Sekoranja
652ef4bc82 merge 2014-06-19 14:29:05 +02:00
Matej Sekoranja
c6eed12139 String -> std::string, toString methods removed 2014-06-19 14:27:48 +02:00
Marty Kraimer
1132e25072 fix bug related to stride 2014-06-13 09:52:30 -04:00
Marty Kraimer
879e3a2b67 support UnionArray 2014-06-12 15:26:31 -04:00
Matej Sekoranja
6ec207141f fixed missing dllimport/dllexport on new code 2014-06-11 11:56:04 +02:00
Matej Sekoranja
45c657ce79 added missing src/copy/Makefile 2014-06-10 13:50:04 +02:00
Matej Sekoranja
888dc11c03 Added tag before_merge_changesAfter3_0_2 for changeset 40b681ffc5cd 2014-06-10 13:39:41 +02:00
Matej Sekoranja
5e3159f800 completed merge 2014-06-09 23:15:57 +02:00
Matej Sekoranja
570ec97eda flow: Closed <feature> 'changesAfter3_0_2'. 2014-06-09 22:53:59 +02:00
Matej Sekoranja
09c75823e6 byteBuffer: wrap support 2014-06-09 08:28:00 +02:00
Marty Kraimer
50c8c3b0bd more work on stride 2014-06-06 11:24:12 -04:00
Marty Kraimer
3fb44312c7 add support for stride 2014-06-05 10:20:01 -04:00
Matej Sekoranja
67bdf2ab8b bitSet <<operator(ostream) 2014-06-01 20:54:07 +02:00
Marty Kraimer
a56ed44e74 fix bugs found by tests in pvIOCJava 2014-05-24 06:47:16 -04:00
Marty Kraimer
3c912c3812 put to union field did not call postPut. 2014-05-21 16:18:38 -04:00
Matej Sekoranja
0ceb87eee1 Array IF added 2014-05-13 00:18:30 +02:00
Marty Kraimer
6510c10884 major update to pvDataCPP.html; minor updates while working on documentation 2014-05-01 10:33:01 -04:00
Andrew Johnson
89da38cfa4 Jenkins fixes.
Remove aps_build script, no longer used.
Tests have all been converted to the EPICS harness,
so don't need running separately.
2014-04-29 12:10:35 -05:00
Andrew Johnson
82b5d0e50b flow: Merged <feature> 'housekeeping' to <develop> ('default'). 2014-04-29 10:43:05 -05:00
Andrew Johnson
bb8789a9ad flow: Closed <feature> 'housekeeping'. 2014-04-29 10:43:05 -05:00
Marty Kraimer
20345ab0dd forgot monitor.h 2014-04-23 09:16:28 -04:00
Marty Kraimer
d5dfb3de0c added monitorPlugin; fixed bug in PVField::getFullName(); 2014-04-23 09:10:37 -04:00
Andrew Johnson
88aabb41e7 Replace USAGE_DEPRECATED with EPICS_DEPRECATED
Also make USAGE_ERROR conditional on the GCC version,
to remove warnings from VxWorks 6.8 builds.
2014-04-21 11:11:09 -05:00
Andrew Johnson
897059303d Merged changes from default branch 2014-04-18 16:55:13 -05:00
Andrew Johnson
0b7607cf04 Merged change from default branch. 2014-04-16 16:08:08 -05:00
Matej Sekoranja
4a512f47de merge 2014-04-09 15:19:43 +02:00
Matej Sekoranja
76a54d38e4 byteBuffer: wrapped buffer support 2014-04-09 15:18:40 +02:00
Matej Sekoranja
b9b03940a2 DefaultArray deserialize fix 2014-04-08 13:27:24 +02:00
Andrew Johnson
8370a97866 Unify configure files with the other V4 modules
Move include/pv setting into src/Makefile
2014-04-03 16:57:14 -05:00
Andrew Johnson
b659c77dbb Fix instructions in RELEASE file 2014-04-02 15:19:14 -05:00
Andrew Johnson
e45b842a6c Enable CHECK_RELEASE warnings 2014-04-02 14:43:32 -05:00
Marty Kraimer
c2f22a4ad8 make testPVCopy.cpp a proper epicsUnitTest 2014-04-02 10:15:53 -04:00
Marty Kraimer
cb15a8676b remove PVData methods that change introspection interface
remove deprecated methods
move CreateRequest from pvAccessCPP to pvDataCPP
move pvCopy from pvDatabaseCPP to pvDataCPP
2014-04-01 09:35:29 -04:00
Andrew Johnson
32ba6d444b Cleaned up CONFIG_SITE file.
Introduced WITH_COVERAGE Make variable
to control build options.
2014-03-31 17:25:22 -05:00
Andrew Johnson
95b7a04041 Makefile fixups 2014-03-28 11:53:39 -05:00
Andrew Johnson
d81ef64799 Remove __rtems__, already defined by the compiler 2014-03-28 11:20:03 -05:00
Andrew Johnson
19269735ae Rename pvDataApp to src, adjust Makefiles. 2014-03-28 10:20:24 -05:00
Matej Sekoranja
f7957c8ea5 merge 2014-03-28 00:04:18 +01:00
Andrew Johnson
1e40797bc4 Split pvDataApp/Makefile into fragments. 2014-03-27 17:58:43 -05:00
Andrew Johnson
ad66f8af73 Tidy up top-level Makefile 2014-03-27 17:36:10 -05:00
Andrew Johnson
d436e61bdb sharedPtr.h: Remove trailing ; from macro expansion. 2014-03-27 17:35:05 -05:00
Andrew Johnson
c71e62746d ParseToPOD needs limits.h on some arch's 2014-03-27 17:34:02 -05:00
Andrew Johnson
d5b0ad5d80 flow: Created branch 'feature/housekeeping'. 2014-03-27 17:28:55 -05:00
Marty Kraimer
34f2d7bc9a created feature branch 2014-03-25 07:23:14 -04:00
Marty Kraimer
fb7f1b622b flow: Created branch 'feature/changesAfter3_0_2'. 2014-03-25 07:04:59 -04:00
Marty Kraimer
4a992e6e1c flow initialization: Added configuration file. 2014-03-25 07:04:47 -04:00
Matej Sekoranja
9593de8c0f DefaultPVArray: removed unnecessary flush at the end of serialization 2014-02-17 12:47:07 +01:00
Matej Sekoranja
8205be5220 #63: implemented PVStructure.get<type>Field() using template method, no more messages emitted 2014-02-14 15:10:18 +01:00
Matej Sekoranja
39c43c4c02 rtems build: testProperty _HOST was missing 2014-02-06 11:58:14 +01:00
Matej Sekoranja
8a9fa956e0 vxWorks (vx68 and later): m_data -> m_sdata; m_data is a macro efined by vxWorks 2014-02-05 22:28:54 +01:00
Matej Sekoranja
06e9c533e3 parseToPOD RTEMS 2014-01-31 11:53:51 +01:00
Matej Sekoranja
5bdcaf43db sharedVector: count > capacity bugfix (2) 2013-12-04 10:49:16 +01:00
Matej Sekoranja
df1d13a155 sharedVector: count > capacity bugfix 2013-12-04 10:01:50 +01:00
Matej Sekoranja
6e7b19b090 added current_function.h 2013-12-03 12:16:08 +01:00
Matej Sekoranja
279b73a477 win32 port : warnings removed 2013-11-28 21:31:02 +01:00
Matej Sekoranja
74239303b3 testPVScalarArray: cast to the right type 2013-11-27 01:45:40 +01:00
Matej Sekoranja
134f390a5f fixed SerializeHelper::writeSize back 2013-11-27 01:37:16 +01:00
Matej Sekoranja
8aa26b78bb win32 port: parseToPOD NEED_LONGLONG check, missing monitor.cpp 2013-11-27 01:15:35 +01:00
Matej Sekoranja
301038664e win32 port: visibility, warnings, templates 2013-11-27 01:11:12 +01:00
Matej Sekoranja
ccad38f2db added programmers cookbook raw draft 2013-11-26 14:46:36 +01:00
Matej Sekoranja
29dee42d34 FieldBuilder: typo addNested() -> endNested() 2013-11-26 13:45:30 +01:00
Matej Sekoranja
f9135c81de testSerialization: fixed warnings 2013-11-26 11:08:16 +01:00
Matej Sekoranja
9400635fd9 testBitSet: replaced printf with testDiag 2013-11-25 22:07:28 +01:00
Marty Kraimer
4102deceb3 convert all tests to use epicsUnitTest 2013-11-25 15:46:00 -05:00
Matej Sekoranja
86306740be typeCast.cpp: do not report index in exception message for scalars 2013-11-22 10:31:21 +01:00
Matej Sekoranja
8e63fc8b25 castVtyped: added index in exeption error message 2013-11-22 09:44:21 +01:00
Matej Sekoranja
3219bd0307 Win32 port: import/export headers 2013-11-20 14:49:40 +01:00
Matej Sekoranja
bdb4430bb6 Win32 port: fix and success compile and run using GCC -fvisibility=hidden 2013-11-20 13:40:07 +01:00
Matej Sekoranja
a574dbf89b start of Win32 port 2013-11-20 13:04:28 +01:00
Matej Sekoranja
47178370d5 FieldBuilder: better method names 2013-11-11 22:36:06 +01:00
dhickin
ac67fddbcb Fixed bug in outputting UnionArrays. 2013-11-11 12:02:35 +00:00
dhickin
e97fab3107 Simpler fix for bug in outputting StructureArrays. 2013-11-08 18:49:57 +00:00
dhickin
fee6f03ec2 Fixed bug in outputting StructureArrays. 2013-11-08 18:27:15 +00:00
Matej Sekoranja
1aff2ec112 tempalte helpers; static initialization order 2013-11-08 13:50:54 +01:00
Matej Sekoranja
57b3e9a8b2 run EPICS Harness Tests on CI 2013-11-08 00:01:24 +01:00
Matej Sekoranja
35dad272eb merge 2013-11-07 14:13:37 +01:00
Matej Sekoranja
d40c41048d PVUnion/PVUnionArray support and tests 2013-11-07 14:12:26 +01:00
Marty Kraimer
03f59c94b4 commit after merge 2013-11-06 07:42:03 -05:00
Marty Kraimer
87718f1c82 get rid of warnings 2013-11-06 07:41:16 -05:00
Matej Sekoranja
cbf7b69ef0 Union/UnionArray implemented, PVUnion/PVUnionArray not yet implemented; also implemented reuse of scalar/scalarArray instances in FieldCreate 2013-11-05 16:15:12 +01:00
Matej Sekoranja
c56c976a22 FieldBuilder (incl. tests) 2013-11-04 19:04:28 +01:00
Marty Kraimer
3579d17a05 moved pvSubArrayCopy from pvDatabaseCPP to pvDataCPP 2013-10-31 06:44:54 -04:00
Marty Kraimer
0f17bd23c7 make bitSet more comnpatible with Java implementation. 2013-10-31 06:03:51 -04:00
Marty Kraimer
db10bed951 update documentation; fix bug in executor; add typedefs to thread.h 2013-10-30 08:13:19 -04:00
Michael Davidsaver
071806f12b remove redundancy in print_cast 2013-10-29 18:06:42 -04:00
Michael Davidsaver
9cd7008efe typeCast String <-> boolean 2013-10-29 17:56:36 -04:00
Michael Davidsaver
14dc098761 no deperecated warning on old vxworks 2013-10-29 16:58:09 -04:00
Michael Davidsaver
8c6a895b19 disambiguate a template 2013-10-29 16:54:02 -04:00
Michael Davidsaver
01b8e69e4b remove illegal copy op
Can bypass freeze/thaw
2013-10-28 17:54:59 -04:00
Michael Davidsaver
11e91ac3fa Merge branch 'shared-vector' 2013-10-28 17:42:11 -04:00
Marty Kraimer
70380b9a43 Added tag 3.0.2 for changeset 58092712d092 2013-09-10 16:54:02 -04:00
Marty Kraimer
fa7a44f5b3 update links in .html files 2013-09-10 16:53:21 -04:00
Andrew Johnson
fb0329c0b5 APS Jenkins adjustment 2013-09-05 12:24:38 -05:00
Andrew Johnson
c3d04fdd08 Fix VxWorks builds 2013-09-05 10:26:56 -05:00
Marty Kraimer
ebb0c97c51 Added tag 3.0.1 for changeset 2a289ff41e2e 2013-09-03 08:37:28 -04:00
Marty Kraimer
aabe0f3594 update links on .html files 2013-09-03 08:37:08 -04:00
dhickin
7c21bf7aa1 Added tag 3.0.0 for changeset 4cecd4b200f8 2013-08-21 12:03:42 +01:00
Michael Davidsaver
de70d90603 shared_vector: simplify slice()
Correctly tracks capacity when user
over-slices.
2013-08-06 11:32:34 -04:00
Michael Davidsaver
31be738c10 minor 2013-08-06 10:43:47 -04:00
Michael Davidsaver
759d268af0 update testPVScalarArray 2013-07-29 15:10:04 -04:00
Michael Davidsaver
f21811eb6a Change enum to type in converters 2013-07-29 15:09:47 -04:00
Michael Davidsaver
c643509c7e PVField converters use type
Use type as template parameter instead of ScalarType
enum value.
2013-07-29 15:08:59 -04:00
Michael Davidsaver
0860f8e6f9 don't use deprecated PVValueArray<T>::get() 2013-07-29 11:44:53 -04:00
Michael Davidsaver
e96b447e37 add print_cast()
Cast value to "printable" type.
A no-op except for char types, which are cast to int
so that they are printed as numbers std::ostream operators.
2013-07-29 11:44:52 -04:00
Michael Davidsaver
0eecd3b1fe document freeze/thaw 2013-07-29 11:44:52 -04:00
Michael Davidsaver
b5b6ae100d update pvD array in tests 2013-07-25 17:30:33 -04:00
Michael Davidsaver
8fd9bf10e5 update pvD array implementation 2013-07-25 17:30:18 -04:00
Michael Davidsaver
9ac030169a update pvD array handling
Interface only uses shared_vector<const T>
storage also uses only const.
2013-07-25 17:22:16 -04:00
Michael Davidsaver
569bd3b681 update testSharedVector 2013-07-25 17:02:08 -04:00
Michael Davidsaver
45bb461c32 shared_vector require freeze/thaw
Remove the implicit cast from non-const to const.
Require the use of freeze/thaw when
changing between const and non-const.

Change argument of const_shared_vector_cast
to a non-const shared_vector reference
to allow it to be cleared by freeze/thaw.
2013-07-25 15:26:29 -04:00
Michael Davidsaver
105c3185f7 remove take(), copyIn(), and copyOut(). 2013-07-19 14:20:55 -04:00
Michael Davidsaver
5565e4e30c Convert don't use copyIn or copyOut 2013-07-19 14:18:04 -04:00
Michael Davidsaver
70ae281f45 test freeze/thaw 2013-07-16 18:59:04 -04:00
Marty Kraimer
b518efd196 Added tag 3.0-pre1 for changeset 4cecd4b200f8 2013-07-16 14:47:34 -04:00
Michael Davidsaver
6e3a344caa fix Convert::fromStringArray
destination should grow to fit
2013-07-16 10:48:01 -04:00
Michael Davidsaver
2e3cbed520 restart testConvert
start with fromStringArray
2013-07-16 10:47:11 -04:00
Michael Davidsaver
5e2e7c81a6 Merge remote branch 'md/master' into pvarr
* md/master:
  added
  minor changes
  comparison between implementations
  Proposed pvData.h interface
  added pvArray.html; made queue.h and bitSetUtil.* compatible with pvDataCPP.
2013-07-09 18:37:53 -04:00
Michael Davidsaver
cff59487ae shared_vector freeze and thaw 2013-07-09 18:24:51 -04:00
Michael Davidsaver
cdcbfe7378 update testPVScalarArray 2013-07-09 18:24:51 -04:00
Michael Davidsaver
0c4ef8f079 PV* use shared_vector_convert 2013-07-09 18:24:50 -04:00
Michael Davidsaver
c0e9dcff21 revise static_shared_vector_cast
Move the work into a special ctor
to allow full inline of casting wrapper

Prevent static_shared_vector_cast from
casting const <-> non-const
2013-07-09 18:24:41 -04:00
Michael Davidsaver
79eeb0fa2a update PVScalar and PVScalarValue<T>
hide the void* members for now.

Define PVScalarValue<T>::getAs and putFrom
to give a more efficient implementation.
2013-07-09 18:24:41 -04:00
Michael Davidsaver
46feb86a99 test shared_vector_convert 2013-07-09 18:24:41 -04:00
Michael Davidsaver
74f68c47d3 shared_vector_convert
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.

Casting now handles 'const void'
is most places where 'void' can be used.
2013-07-09 18:24:40 -04:00
Michael Davidsaver
3c7a738ffc shared_vector<void> tracks original type 2013-07-09 18:24:40 -04:00
Michael Davidsaver
22d4a53d65 create templateMeta.h
Home for common C++ template tricks
2013-07-09 18:24:40 -04:00
Michael Davidsaver
d319e2ed7b add ScalarTypeID template
Define a compile time mapping from
type to ScalarType enum value.
2013-07-09 11:19:46 -04:00
Michael Davidsaver
2cb07a8490 move parts of ScalarTypeFunc to sharedVector.h
Move the parts of ScalarTypeFunc which
deal with untyped shared_vector s
to sharedVector.h to allow sharedVector.h
to include pvIntrospect.h w/o creating
an include loop...
2013-07-09 10:36:48 -04:00
Michael Davidsaver
6900d4bbec make boolean type unambiguous
"char", "signed char", and "unsigned char"
are distinct types.  Define "boolean" to
be whichever is not "int8" or "uint8".
2013-07-08 09:58:37 -04:00
Michael Davidsaver
73450bdbc7 combine shared_vector<T> for void and const void 2013-07-03 14:23:17 -04:00
Marty Kraimer
776ff49ed2 added 2013-07-03 12:11:05 -04:00
Michael Davidsaver
00da6c88ae minor 2013-07-03 11:41:53 -04:00
Michael Davidsaver
986f036d20 replace accepts const_svector
Allows

PVValueArray<T> *a, *b;

a->replace(b->view());
2013-07-03 11:34:32 -04:00
Michael Davidsaver
5699c43b74 correct max_size
Take into account sizeof(E).
2013-07-02 17:42:46 -04:00
Marty Kraimer
b58b97a916 minor changes 2013-06-28 14:17:23 -04:00
Marty Kraimer
5f52f14094 comparison between implementations 2013-06-25 12:18:38 -04:00
Ralph Lange
5f8fa26bf3 jenkins: Fix CloudBees hgweb job 2013-06-19 18:11:04 +02:00
Ralph Lange
a5c835cfeb jenkins: add CloudBees hgweb job to sync repo to SF webspace 2013-06-19 10:59:29 +02:00
Marty Kraimer
ec6b67ffad Proposed pvData.h interface 2013-06-18 10:01:52 -04:00
Marty Kraimer
3de28e3cef added pvArray.html; made queue.h and bitSetUtil.* compatible with pvDataCPP. 2013-06-13 14:52:27 -04:00
Andrew Johnson
d2a649f5fa Fixed compiler warning, 2013-06-12 21:21:44 -05:00
Michael Davidsaver
23d5aab1e8 add Doxyfile 2013-06-11 17:42:31 -04:00
Michael Davidsaver
cf8c6718dd test PVStructureArray in testSerialization 2013-06-11 17:42:30 -04:00
Michael Davidsaver
b0c8249562 re-write testPVStructureArray 2013-06-11 17:42:30 -04:00
Michael Davidsaver
8cb0b1a7d6 use new PVStructureArray api 2013-06-11 17:42:30 -04:00
Michael Davidsaver
7f9745c8d1 Implement PVStructureArray with shared_vector
Combine as much as possible with scalar array handling.

PVStructureArray becomes PVValueArray<shared_ptr<PVStructure> >

Bulk of shared implementation moved the PVVectorStorage
which has a parametrized base to avoid using multiple inheritance.
2013-06-11 17:42:30 -04:00
Michael Davidsaver
4e749cc8be Improve shared_vector::push_back
push_back now allocates additional space
in powers of 2 up to 1k elements, then
in blocks of 1k elements.
2013-06-11 17:42:30 -04:00
Michael Davidsaver
70c9a7c18f simplify shared_vector ctors
Casting will be done through the copy constructor.
2013-06-11 14:39:40 -04:00
Michael Davidsaver
11e2ee19ea Fix Printer for structure arrays
Not handling NULL elements correctly.
2013-06-11 14:39:40 -04:00
Michael Davidsaver
a4cfab1242 Fix "optimize shared_vector for storing non-POD types"
Can't move references when the source array is
still referenced by other shared_vectors
2013-06-11 14:39:40 -04:00
Michael Davidsaver
be4738f59c remove weak_vector
It seems that shared_ptr::use_count() does
not include weak_ptr instances.  Therefore
shared_ptr::use_count()==1 (aka unique())
does *not* ensure exclusive ownership!

This breaks the assumption used by
shared_vector::make_unique() to avoid
allocating a new array in some cases.
2013-06-10 15:09:42 -04:00
Michael Davidsaver
b63c3da565 add const_pointer to shared_vector 2013-06-10 12:09:29 -04:00
Michael Davidsaver
0b89f08d09 explicit copy and assignment for shared_vector
Add explicit copy constructor and
assignment operator for shared_vector.
2013-06-10 12:09:29 -04:00
Michael Davidsaver
ac53153bea shared_vector: test reference and const_reference
Ensure that these typedefs are present and work
for 'T' and 'const T'.
2013-06-05 16:15:49 -04:00
Michael Davidsaver
bc3187a3f6 optimize shared_vector for storing non-POD types
pass values by reference where appropriate.
When reallocating arrays of shared_ptr
"move" with swap() instead of operator=
to avoid ref counter inc and dec for each
element.
2013-06-03 19:31:05 -04:00
Michael Davidsaver
4294710d9e make viewUnsafe protected
No longer part of the public API of PVValueArray
2013-06-03 19:31:05 -04:00
Matej Sekoranja
476f18332a valueAlarm for numeric scalar arrays support 2013-05-31 21:15:54 +02:00
Michael Davidsaver
82a33460cf pvData update doc comments 2013-05-31 09:58:52 -04:00
Michael Davidsaver
3b6268a4fc add const_iterator to shared_vector 2013-05-31 09:58:52 -04:00
Michael Davidsaver
41425b3fa1 more testIntrospect 2013-05-31 09:58:52 -04:00
Andrew Johnson
a964e3668d Added jenkins/aps_build script 2013-05-30 17:32:15 -05:00
Michael Davidsaver
57804494ef Misc fixes and error checking
fix argument type for getScalarType
mark getFieldName as const
Argument checking for Field construction
2013-05-24 18:28:54 -04:00
Michael Davidsaver
9039a10c9a update testIntrospect with epicsUnitTest 2013-05-24 18:28:54 -04:00
Michael Davidsaver
9e865bc37d Avoid unnecessary copying in copyIn
Only re-use the existing reference if
it is large enough to hold all the new data.
If it isn't then throw it away to avoid
copying its current contents during
the resize().
2013-05-23 18:19:35 -04:00
Michael Davidsaver
54ee8bf7a0 PVStructureArray: setLength before postPut
Ensure that the correct (new) length is seen.
2013-05-23 17:51:52 -04:00
Michael Davidsaver
629c8346d2 postPut in new array API
Call when appropriate (putFrom(), copyIn(), and replace()).
Not called by swap(), take(), reuse(), or shareData().
Users of the second set of methods are expected to call
one of the methods in the first set, or call postPut() directly.

Document when postPut is (not) called.
2013-05-23 17:51:52 -04:00
Michael Davidsaver
1bf2ff430a array resize respect immutability 2013-05-23 17:51:52 -04:00
Marty Kraimer
69be072a07 added test 2013-05-17 19:33:16 -04:00
Marty Kraimer
a2ca21a1a6 changes to queue and to bitSetUtil. 2013-05-16 09:04:42 -04:00
Michael Davidsaver
572c02bf6e update testOperators 2013-05-08 18:35:51 -04:00
Michael Davidsaver
80777b293f rewrite testPVScalarArray 2013-05-08 18:35:51 -04:00
Michael Davidsaver
3c08834377 update testSerialization 2013-05-08 18:35:51 -04:00
Michael Davidsaver
eeae12e3d4 Convert: remove to/from*Array 2013-05-08 18:35:51 -04:00
Michael Davidsaver
992ac73068 use new API
make copying explicit and replace some
use of PVValueArray<T>::put and get
2013-05-08 18:35:51 -04:00
Michael Davidsaver
e843779555 New array API for PVValueArray using shared_vector<T>
* In PVScalarArray

Add methods assign, getAs/putFrom, and copyOut/copyIn to allow get/put
with implicit convert.

assign() copys on PVScalarArray to another converting as necessary.
If the types do not match then an allocate and convert is done.

getAs/putFrom work with shared_vector<T> and can avoid a allocate
and convert operation if the types match.

copyOut/copyIn use plain C arrays will do either a copy if the types
match, and a convert otherwise.  No allocation is performed.

* In PVValueArray<T>

All array operations re-implemented in terms of
two virtual methods

  virtual const shared_vector<T>& viewUnsafe() const;
  virtual void swap(shared_vector<T>&);

Some convienence methods are also included:

  shared_vector<const T> view() const
  shared_vector<T> take()
  shared_vector<T> reuse()

Deprecate get(...), put(...), and shareData(...)

Remove getVector() and getSharedVector()

Adjust DefaultPVArray accordingly
2013-05-08 18:35:51 -04:00
Michael Davidsaver
5f4ca240b4 add ScalarTypeFunc::elementSize 2013-05-08 18:35:50 -04:00
Michael Davidsaver
79cd374f16 add ScalarTypeFunc::allocArray 2013-05-08 18:35:50 -04:00
Michael Davidsaver
b137b32fc6 test shared_vector<T>
use epicsUnitTest
test handling of void and const void instances
2013-05-08 18:35:50 -04:00
Michael Davidsaver
3cd2bfdef0 shared_vector implementation
Shared ownership of a single C array.

Tracks offset and length for each instance
allowing each owner to "view" a different
piece of the array.

Parts of shared_vector<T> which can work
for T=void are in shared_vector_base<T>.
Specializations shared_vector<void>
and shared_vector<const void> handle
un-typed arrays.

Allow casting to/from typed vector

Offsets and sizes of untyped vectors are tracked in
bytes.  Therefore casting to types where sizeof(T)>1
is undefined if the offset is not a multiple of
sizeof(T).
2013-05-08 18:21:34 -04:00
Michael Davidsaver
461dbdf0f8 remove Convert pointer from PVField
Allow inline construction of Convert
2013-05-08 17:46:31 -04:00
Michael Davidsaver
9e8a6b6304 fix const-ness in PVField compare 2013-05-08 17:46:31 -04:00
Michael Davidsaver
fd5ea89340 typo 2013-05-01 14:27:00 -04:00
Michael Davidsaver
1d1d2b31cd remove remaining state from Convert 2013-05-01 14:20:01 -04:00
Michael Davidsaver
d75656dad7 testTypeCast use epicsUnitTest 2013-05-01 12:41:19 -04:00
Michael Davidsaver
f0aa2fe0e0 fix printer
Don't overflow the stack for deep structures!
2013-05-01 12:18:21 -04:00
Michael Davidsaver
ae847aea2b allow putFrom to implicitly resize 2013-05-01 12:18:21 -04:00
Michael Davidsaver
00ac5bf64f PVStructure::getNumberFields != Structure::getNumberFields
Apparently PVStructure::getNumberFields is one indexed???
2013-05-01 12:18:21 -04:00
Michael Davidsaver
61e8024c65 fix mapping between int* and epicsInt* types 2013-04-30 18:14:05 -04:00
Michael Davidsaver
ee5a370c01 misc 2013-04-30 18:14:05 -04:00
Michael Davidsaver
659ce13e98 replace vector to/from in Convert 2013-04-30 18:14:04 -04:00
Michael Davidsaver
a7fde21300 replace scalar to/from in Convert 2013-04-30 18:14:04 -04:00
Michael Davidsaver
a6bfab2d74 replace copyScalarArray with PVScalarArray::assign 2013-04-30 18:14:04 -04:00
Michael Davidsaver
e948af1851 PVScalar::assign and PVScalarArray::assign 2013-04-30 18:14:04 -04:00
Michael Davidsaver
2062cc5d10 Convert::toStringArray with castUnsafe 2013-04-30 18:14:02 -04:00
Michael Davidsaver
e85d10c6d9 Convert::fromStringArray with castUnsafe 2013-04-30 18:14:02 -04:00
Michael Davidsaver
0e0ab66d45 add PVScalarArray::getAs and PVScalarArray::putFrom 2013-04-30 18:14:02 -04:00
Michael Davidsaver
f2635c7fdc Convert::fromString with castUnsafe 2013-04-30 18:14:02 -04:00
Michael Davidsaver
4d92bbe541 Use PrinterPlain in Convert 2013-04-30 18:14:01 -04:00
Michael Davidsaver
e6e1434fc1 Add PrinterPlain 2013-04-30 18:13:32 -04:00
Michael Davidsaver
5e689f94f4 add PVScalar::getAs and PVScalar::putFrom
Allow get/put to a scalar without knowledge of ScalarType

Currently won't work correctly for PVBoolean
2013-04-26 15:44:05 -04:00
Michael Davidsaver
c1b6d26b8e Convert::equals: move to operator==(PVField&,PVField&) 2013-04-22 16:12:03 -04:00
Michael Davidsaver
f72c5dba84 PVStructure compare typo 2013-04-22 15:47:51 -04:00
Michael Davidsaver
704007092c Convert::getFullName becomes PVField::getFullName
Compatibility wrapper using current Convert API
Allow PVField::getFieldName to be inline'd
Avoid multiple resize and copy operations
on result String.
2013-04-22 14:48:59 -04:00
Michael Davidsaver
2f8c434429 add castUnsafeV
non-template version of castUnsafe<TO>(FROM v)).
2013-04-22 11:59:20 -04:00
Michael Davidsaver
b0c57e7ae3 test castUnsafe w/ transform() 2013-04-22 11:59:20 -04:00
Michael Davidsaver
0e57391b4d vxWorks compatibility 2013-04-22 11:59:20 -04:00
Michael Davidsaver
7ff1a93e72 parseToPOD: fix 64-bit
Try again to detect if uint16_t is long or long long.
2013-04-18 13:54:04 -04:00
Michael Davidsaver
d7eada7216 type casting with castUnsafe<TO>(FROM val) 2013-04-15 14:39:42 -04:00
Michael Davidsaver
c435f71592 testOperators: avoid warning 2013-04-15 14:34:45 -04:00
Matej Sekoranja
0dd6f01ef6 direct, i.e. no-copy, de/serialization support 2013-04-12 21:54:11 +02:00
Matej Sekoranja
cd95b75563 gcc 4.7+ compiler warnings removed 2013-02-27 11:44:00 +01:00
Ralph Lange
4122e772c1 merge SF changes 2013-02-26 17:22:16 +01:00
Ralph Lange
2fbe99909c documentation: update Doxyfile 2013-02-26 17:21:28 +01:00
Ralph Lange
d4f3d6209c jenkins: fix URLs for dependencies 2013-02-26 17:20:52 +01:00
Ralph Lange
641a51aa4f Fix .hgignore to use patterns 2013-02-26 17:20:28 +01:00
Matej Sekoranja
67afe84593 mb moved to pvCommonCPP 2013-02-25 10:29:34 +01:00
Matej Sekoranja
66f7c90c51 merge 2013-02-22 21:30:01 +01:00
Matej Sekoranja
959117c391 mb portability, still to be ported to boost atomic 2013-02-22 21:27:26 +01:00
5e810c704f Missing library reference in Makefile 2013-02-21 15:50:57 +01:00
Matej Sekoranja
675243061d -Wextra compiler warnings fixed 2013-02-16 12:50:36 +01:00
Matej Sekoranja
246825d672 base 3.14 fix 2013-02-13 14:29:38 +01:00
Matej Sekoranja
aa1a67d6c1 added micro-benchmark 2013-02-13 14:18:42 +01:00
Matej Sekoranja
97b1848ba3 added array_at manip test 2013-02-11 10:30:30 +01:00
Matej Sekoranja
c4f6132aca added simple operators 'test', added <<= >>= operators to PVScalar 2013-02-08 22:45:04 +01:00
Matej Sekoranja
a0de4f126f operator<< for all PVField, indent and array_at manipulator 2013-02-07 22:52:16 +01:00
Ralph Lange
a8a96def97 jenkins: Publish documentation to .../tip in CloudBees build 2013-01-18 15:19:37 +01:00
Ralph Lange
eaddc30def Add doxygen to Cloudbees build (as local dependency) 2013-01-14 12:22:15 +01:00
Ralph Lange
aa17639e20 Comment out doxygen (which does not work on CloudBees) 2013-01-13 18:32:09 +01:00
Ralph Lange
58d7ad494b Add doxygen run to jenkins build job 2013-01-13 18:20:43 +01:00
Ralph Lange
2895f48bd6 Add build script for Jenkins on Cloudbees 2013-01-13 18:11:55 +01:00
Ralph Lange
8f6ea47501 configure: improved generic RELEASE file 2013-01-11 19:12:50 +01:00
Marty Kraimer
3eb6237343 missing '.' in "This version" and "Previous version" 2012-12-12 15:25:18 -05:00
Marty Kraimer
cb19940fa7 I forget to do an hg add on documentation/pvDataCPP_20121212.html 2012-12-12 15:17:44 -05:00
Marty Kraimer
4bc7e9c8fe several minor problems found while developing pvDatabaseCPP 2012-12-12 14:59:33 -05:00
dhickin
18ba24156c Added tag 2.0-BETA for changeset d70c5ad29163 2012-11-22 15:23:15 +00:00
Marty Kraimer
1d3c4d1762 get rid of unnecessary copies for StringArray 2012-10-29 13:32:34 -04:00
Marty Kraimer
51abc5032c make sure copy of vector is not made 2012-10-20 07:24:07 -04:00
Ralph Lange
69b3692841 Remove IDE configuration files (QtCreator) 2012-10-18 11:36:10 -04:00
Marty Kraimer
d627e08419 fix bug in PVStructure::appendPVField and PVStructure::appendPVFields 2012-10-11 06:19:08 -04:00
Matej Sekoranja
bd9f1d1949 StandardField IDs, dumpValue fix for (u)int8 2012-10-10 17:59:12 +02:00
Matej Sekoranja
04db13d00e default Structure id serialization opt. 2012-10-09 08:43:43 +02:00
Matej Sekoranja
f88f0b4a76 localStaticLock - static local thread-safety 2012-10-08 12:19:21 +02:00
Marty Kraimer
07f9a8c0f6 must include standardField or pvAccessCPP fails 2012-10-03 09:08:51 -04:00
Marty Kraimer
5ba0209f39 get rid of all static global objects 2012-10-03 08:59:23 -04:00
Marty Kraimer
ced439f4c4 fix for crash in pvDataCPP testV3Channel 2012-10-02 16:01:03 -04:00
Matej Sekoranja
cf44ec1191 scalar array (de)serialization fixed 2012-10-01 21:47:43 +02:00
Marty Kraimer
e7458fad01 change name to what it should be 2012-10-01 10:06:01 -04:00
Marty Kraimer
52dfdace88 fix some typos in pvDataCPP.html 2012-10-01 10:02:09 -04:00
Marty Kraimer
a23631a8ca fix bug related to PVStructurePtr createPVStructure(
StringArray const & fieldNames,PVFieldPtrArray const & pvFields);
The old implementation created a new version of each element of pvField.
The new version uses the version from pvFields.
There is a new shared pointer but the new shared pointer referenced the
same PVField as the original.
2012-09-28 06:33:39 -04:00
Unknown
6a378dae0d removed sprintf format warnings 2012-09-14 13:54:35 +02:00
Unknown
0b4a8550e5 type cast warnings removed 2012-09-13 17:50:38 +02:00
Matej Sekoranja
519601595c PVStructure de/serialization fixed 2012-09-12 11:30:58 +02:00
Matej Sekoranja
8dfd8ec02e merge 2012-09-10 08:59:36 +02:00
Matej Sekoranja
4cef1135a3 PVStructure serialization fixed 2012-09-10 08:56:11 +02:00
Unknown
a7bd52bd48 minimize preprocessor branching for vxWorks 2012-09-06 17:12:53 +02:00
Unknown
55df2e06e2 compatibility with vxWorks 2012-09-05 14:11:07 +02:00
Matej Sekoranja
cfc9ebefb0 merge 2012-09-03 23:46:06 +02:00
Matej Sekoranja
516518529c VxWorks ports from Dirk 2012-09-03 23:43:26 +02:00
Marty Kraimer
6b4eb1a1b0 StandardField: fix enumeratedAlarm ; testConvert fix uint64 integer constants 2012-08-28 13:09:37 -04:00
Marty Kraimer
5e3311a024 LICENSE, COPYRIGHT, file header 2012-08-22 14:39:19 -04:00
Matej Sekoranja
233a90e608 merge 2012-08-21 23:35:50 +02:00
Matej Sekoranja
4b26e1c442 dumpValue methods 2012-08-21 23:34:59 +02:00
Marty Kraimer
b216a62d1e changes for "String const&" 2012-08-20 14:51:09 -04:00
Matej Sekoranja
978cb937c4 String const & message 2012-08-20 19:09:01 +02:00
Matej Sekoranja
86adfc091b passing string by const ref 2012-08-20 16:37:26 +02:00
Marty Kraimer
8f3a1dde34 Use "String const &" in many more places 2012-08-20 09:16:43 -04:00
Marty Kraimer
9061e8f731 better implementation of setCapacity 2012-08-20 07:13:05 -04:00
Matej Sekoranja
05be6e6729 append/remove fields now preserves ID 2012-08-20 09:22:27 +02:00
Matej Sekoranja
156a05079e structure array deserialization fixed 2012-08-20 09:03:45 +02:00
Matej Sekoranja
0e48497cd4 array deserialization fixed 2012-08-20 09:01:51 +02:00
Marty Kraimer
fbfed5bab1 make tests more like regresion tests 2012-08-17 14:13:18 -04:00
Marty Kraimer
66fb300873 documentation updated; changes for Field::ID 2012-08-17 06:45:20 -04:00
Matej Sekoranja
6a86496385 added BitSet::size() 2012-07-31 11:47:42 +02:00
Matej Sekoranja
ac10b73e69 Field::getID() added 2012-07-31 10:30:50 +02:00
Matej Sekoranja
689d0875b7 null string check 2012-07-30 22:03:23 +02:00
Matej Sekoranja
d9465b0954 fixed due to monitor.h change 2012-07-24 21:28:37 +02:00
Matej Sekoranja
25b9e5fa5a monitor.h revised 2012-07-24 20:47:56 +02:00
Marty Kraimer
31922eac32 commit so that Matej can look at Monitor 2012-07-23 16:56:49 -04:00
Marty Kraimer
60d3467b1b commit after pull and merge 2012-07-23 07:06:41 -04:00
Marty Kraimer
ec1b5860fd more changes for unsigned 2012-07-23 07:04:25 -04:00
jrowlandls
00196cb7e2 merged 2012-07-20 10:25:34 +01:00
jrowlandls
92c68dfcbc pvData ctypes: added context handler and handle destructor to test example 2012-07-20 10:25:01 +01:00
Marty Kraimer
1db56f4b29 fix bug in unsigned standardField; missing const in pvIntrospect.h 2012-07-19 16:08:11 -04:00
jrowlandls
038567280b pvData: added C api test 2012-07-19 14:22:37 +01:00
Marty Kraimer
022e6304a3 call epicsExitCallAtExits() 2012-07-17 09:40:41 -04:00
Marty Kraimer
5dcd864c58 more shared_pointer everywhere 2012-07-17 09:23:53 -04:00
Marty Kraimer
32790674d6 changes for PVStructureArray 2012-07-08 12:51:46 -04:00
Marty Kraimer
5d6205cb44 changes to PVStructureArray 2012-07-08 08:38:57 -04:00
Marty Kraimer
27c4da5b73 working on PVStructureArray 2012-07-06 13:03:37 -04:00
Marty Kraimer
5d57e9bbcf remove monitorQueue 2012-07-03 14:52:30 -04:00
Marty Kraimer
9775fd4707 redo monotorQueue 2012-07-02 16:17:58 -04:00
Marty Kraimer
12d13bc2c0 fix bug in renameField; Add check for zero length fieldNames in Structure. 2012-06-22 14:04:05 -04:00
Matej Sekoranja
3991a51fd6 size_t changes 2012-06-07 14:15:12 +02:00
Matej Sekoranja
90960d370d added unsigned ints to the test 2012-05-23 08:08:00 +02:00
Marty Kraimer
126fe9c711 use const where appropriate 2012-05-22 11:51:53 -04:00
Matej Sekoranja
770e63b8da removed BitSetPtr due to possible 4.6.1 gcc problem 2012-05-21 21:11:20 +02:00
Marty Kraimer
e9b0dcd9f4 lots of work on Scalar Arrays 2012-05-21 10:06:28 -04:00
Matej Sekoranja
8040ad5fc7 serialization test, shared-ptr const 2012-05-18 11:42:57 +02:00
Marty Kraimer
24a08fe348 after merge 2012-05-17 16:06:15 -04:00
Marty Kraimer
198eb453be add testConvert 2012-05-17 16:04:49 -04:00
Marty Kraimer
e6a97e83ab fix more bugs 2012-05-17 09:15:19 -04:00
Matej Sekoranja
9ab2262e86 serialization/deserialization of Field-s 2012-05-16 22:11:17 +02:00
Marty Kraimer
29593a6eda get rid of unnecessary method in class StructureArray 2012-05-16 06:46:23 -04:00
Marty Kraimer
27ce426f46 return StringArray instead of StringArray & for choices 2012-05-15 16:06:33 -04:00
Marty Kraimer
ca195b44cf more debuging 2012-05-15 11:58:24 -04:00
Marty Kraimer
a396d8e6ac change the way PVField::getFieldName is implemented 2012-05-15 09:40:44 -04:00
Marty Kraimer
d320f00e96 fix messageType name 2012-05-10 06:28:27 -04:00
Marty Kraimer
7a60e02d5c make methods non inline 2012-05-09 15:38:19 -04:00
Marty Kraimer
fb453ea9e5 working on queue code 2012-05-09 14:06:17 -04:00
Marty Kraimer
87bff33c30 support unsigned; move fieldName; pvData use shared_pointer everywhere 2012-05-08 09:29:30 -04:00
Matej Sekoranja
2693201cfd OK -> Ok 2012-03-29 08:19:39 +02:00
Matej Sekoranja
2dba4aab2b Dirk's VxWorks porting 2012-03-28 20:40:49 +02:00
Matej Sekoranja
6caa725f5a Field serialization moved to pvData 2012-03-27 10:32:37 +02:00
msekoranja
198562c36c Added tag 1.1-BETA for changeset 4559c3de0cb4 2012-03-25 22:26:21 +02:00
jrowlandls
686a46f24c Added tag 1.0.1-BETA for changeset 9c59737f56e7 2012-03-14 16:27:36 +00:00
jrowlandls
c6debc3208 Added tag marchtest for changeset a29729ca0ecd 2012-03-07 16:03:20 +00:00
340 changed files with 35611 additions and 24951 deletions

113
.appveyor.yml Normal file
View File

@@ -0,0 +1,113 @@
# .appveyor.yml for use with EPICS Base ci-scripts
# (see: https://github.com/epics-base/ci-scripts)
# This is YAML - indentation levels are crucial
#---------------------------------#
# build cache #
#---------------------------------#
# The AppVeyor cache allowance is way too small (1GB per account across all
# projects, branches and jobs) to be used for the dependency builds.
cache:
- C:\Users\appveyor\.tools
#---------------------------------#
# repository cloning #
#---------------------------------#
init:
# Set autocrlf to make batch files work
- cmd: git config --global core.autocrlf true
clone_depth: 5
#---------------------------------#
# build matrix configuration #
#---------------------------------#
# Build Configurations: dll/static, regular/debug
configuration:
- dynamic
- static
- dynamic-debug
- static-debug
# Environment variables: compiler toolchain, base version, setup file, ...
environment:
# common / default variables for all jobs
SETUP_PATH: .ci-local
EPICS_TEST_IMPRECISE_TIMING: YES
BASE: 7.0
matrix:
- CMP: vs2019
BASE: 3.15
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
- CMP: vs2019
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
- CMP: vs2017
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
- CMP: vs2015
- CMP: gcc
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
# TODO: static linking w/ readline isn't working. Bypass auto-detect
COMMANDLINE_LIBRARY: EPICS
# Platform: processor architecture
platform: x64
# Matrix configuration: exclude sets of jobs
matrix:
exclude:
# MinGW debug builds use the same libraries, unlike VS
- configuration: dynamic-debug
CMP: gcc
- configuration: static-debug
CMP: gcc
#---------------------------------#
# building & testing #
#---------------------------------#
install:
- cmd: git submodule update --init --recursive
- cmd: pip install git+https://github.com/mdavidsaver/ci-core-dumper#egg=ci-core-dumper
- cmd: python .ci/cue.py prepare
build_script:
- cmd: python .ci/cue.py build
test_script:
- cmd: python -m ci_core_dumper install
- cmd: python .ci/cue.py -T 20M test
on_finish:
- ps: Get-ChildItem *.tap -Recurse -Force | % { Push-AppveyorArtifact $_.FullName -FileName $_.Name }
- cmd: python .ci/cue.py -T 5M test-results
on_failure:
- cmd: python -m ci_core_dumper report
#---------------------------------#
# debugging #
#---------------------------------#
## To connect by remote desktop to a failed build, uncomment the lines below.
## You must connect within the usual build timeout limit (60 minutes),
## so adjust the build matrix above to just build the config of interest.
#on_failure:
# - ps: iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
#---------------------------------#
# notifications #
#---------------------------------#
notifications:
- provider: Email
to:
- core-talk@aps.anl.gov
on_build_success: false
- provider: GitHubPullRequest

1
.ci Submodule

Submodule .ci added at 20f8e05393

6
.ci-local/defaults.set Normal file
View File

@@ -0,0 +1,6 @@
# EPICS Base
BASE_DIRNAME=base
BASE_REPONAME=epics-base
BASE_REPOOWNER=epics-base
BASE_VARNAME=EPICS_BASE
BASE_RECURSIVE=NO

301
.github/workflows/ci-scripts-build.yml vendored Normal file
View File

@@ -0,0 +1,301 @@
# .github/workflows/ci-scripts-build.yml for use with EPICS Base ci-scripts
# (see: https://github.com/epics-base/ci-scripts)
# This is YAML - indentation levels are crucial
# Workflow name, shared by all branches
name: pvData
# Trigger on pushes and PRs to any branch
on:
push:
paths-ignore:
- .appveyor.yml
pull_request:
env:
SETUP_PATH: .ci-local:.ci
EPICS_TEST_IMPRECISE_TIMING: YES
EPICS_TEST_TIMEOUT: 300 # 5 min
jobs:
native:
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
# Set environment variables from matrix parameters
env:
# NB: PVA modules build against both BASE 7.0 and 3.15
BASE: ${{ matrix.base }}
CMP: ${{ matrix.cmp }}
BCFG: ${{ matrix.configuration }}
CI_CROSS_TARGETS: ${{ matrix.cross }}
EXTRA: ${{ matrix.extra }}
TEST: ${{ matrix.test }}
strategy:
fail-fast: false
matrix:
# Job names also name artifacts, character limitations apply
include:
- name: "7.0 Ub gcc c++20 Werror"
base: "7.0"
os: ubuntu-latest
cmp: gcc
configuration: default
# Turn all warnings into errors,
# except for those we could not fix (yet).
# Remove respective -Wno-error=... flag once it is fixed.
extra: "CMD_CXXFLAGS=-std=c++20
CMD_CPPFLAGS='-fdiagnostics-color
-fstack-protector-strong
-Wformat
-Werror
-Werror=format-security
-Wno-error=deprecated-declarations
-Wno-error=stringop-truncation
-Wno-error=restrict
-Wno-error=sizeof-pointer-memaccess
-Wno-error=nonnull
-Wno-error=dangling-pointer
-Wno-error=format-overflow
-Wno-error=stringop-overread
-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3'
CMD_LDFLAGS=-Wl,-z,relro"
- name: "7.0 Ub gcc C++11, static"
base: "7.0"
os: ubuntu-latest
cmp: gcc
configuration: static
extra: "CMD_CXXFLAGS=-std=c++11"
- name: "7.0 Ub gcc u-char"
base: "7.0"
os: ubuntu-latest
cmp: gcc
configuration: static
extra: "CMD_CFLAGS=-funsigned-char CMD_CXXFLAGS=-funsigned-char"
- name: "7.0 Ub clang"
base: "7.0"
os: ubuntu-latest
cmp: clang
configuration: default
- name: "7.0 Ub clang C++11"
base: "7.0"
os: ubuntu-latest
cmp: clang
configuration: default
extra: "CMD_CXXFLAGS=-std=c++11"
- name: "7.0 MacOS clang"
base: "7.0"
os: macos-latest
cmp: clang
configuration: default
# Cross builds
- name: "3.15 Ub-22 gcc + MinGW"
base: "3.15"
os: ubuntu-22.04
cmp: gcc
configuration: default
cross: "windows-x64-mingw"
- name: "7.0 Ub gcc + linux-aarch64"
base: "7.0"
os: ubuntu-latest
cmp: gcc
configuration: default
cross: "linux-aarch64"
- name: "7.0 Ub gcc + linux-arm gnueabi"
base: "7.0"
os: ubuntu-latest
cmp: gcc
configuration: default
cross: "linux-arm@arm-linux-gnueabi"
- name: "7.0 Ub gcc + linux-arm gnueabihf"
base: "7.0"
os: ubuntu-latest
cmp: gcc
configuration: default
cross: "linux-arm@arm-linux-gnueabihf"
- name: "7.0 Ub gcc + MinGW"
base: "7.0"
os: ubuntu-latest
cmp: gcc
configuration: default
cross: "windows-x64-mingw"
- name: "7.0 Ub gcc + MinGW, static"
base: "7.0"
os: ubuntu-latest
cmp: gcc
configuration: static
cross: "windows-x64-mingw"
- name: "7.0 Ub-22 gcc + RT-4.9 pc386"
base: "7.0"
os: ubuntu-22.04
cmp: gcc
configuration: default
cross: "RTEMS-pc386-qemu@4.9"
- name: "7.0 Ub-22 gcc + RT-4.10 pc386"
base: "7.0"
os: ubuntu-22.04
cmp: gcc
configuration: default
cross: "RTEMS-pc386-qemu@4.10"
test: NO
- name: "7.0 Ub-22 gcc + RT-5.1 pc686"
base: "7.0"
os: ubuntu-22.04
cmp: gcc
configuration: default
cross: "RTEMS-pc686-qemu@5"
- name: "7.0 Ub-22 gcc + RT-5.1 beatnik,zynq_a9,uC5282"
base: "7.0"
os: ubuntu-22.04
cmp: gcc
configuration: default
cross: "RTEMS-beatnik@5:RTEMS-xilinx_zynq_a9_qemu@5:RTEMS-uC5282@5"
test: NO
# Windows builds
- name: "7.0 Win-22 MSC-22"
base: "7.0"
os: windows-2022
cmp: vs2022
configuration: default
- name: "7.0 Win-22 MSC-22 static"
base: "7.0"
os: windows-2022
cmp: vs2022
configuration: static
- name: "7.0 Win-22 MSC-22 debug"
base: "7.0"
os: windows-2022
cmp: vs2022
configuration: debug
extra: "CMD_CXXFLAGS=-analyze"
- name: "7.0 Win-22 MinGW"
base: "7.0"
os: windows-2022
cmp: gcc
configuration: default
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Automatic core dumper analysis
uses: mdavidsaver/ci-core-dumper@master
- name: "apt-get install"
run: |
sudo apt-get update
sudo apt-get -y install qemu-system-x86 g++-mingw-w64-x86-64 gdb
if: runner.os == 'Linux'
- name: Prepare and compile dependencies
run: python .ci/cue.py prepare
- name: Build main module
run: python .ci/cue.py build
- name: Run main module tests
run: python .ci/cue.py -T 60M test
- name: Upload tapfiles Artifact
if: ${{ always() }}
uses: actions/upload-artifact@v4
with:
name: tapfiles ${{ matrix.name }}
path: '**/O.*/*.tap'
if-no-files-found: ignore
- name: Collect and show test results
if: ${{ always() }}
run: python .ci/cue.py -T 5M test-results
docker:
name: ${{ matrix.name }}
runs-on: ubuntu-latest
container:
image: ${{ matrix.image }}
# Set environment variables from matrix parameters
env:
BASE: ${{ matrix.base }}
CMP: ${{ matrix.cmp }}
BCFG: ${{ matrix.configuration }}
EXTRA: ${{ matrix.extra }}
TEST: ${{ matrix.test }}
strategy:
fail-fast: false
matrix:
# Job names also name artifacts, character limitations apply
include:
- name: "7.0 CentOS-8 gcc"
base: "7.0"
image: centos:8
cmp: gcc
configuration: default
- name: "7.0 Rocky-9 gcc"
base: "7.0"
image: rockylinux:9
cmp: gcc
configuration: default
- name: "7.0 Fedora-33 gcc"
base: "7.0"
image: fedora:33
cmp: gcc
configuration: default
- name: "7.0 Fedora gcc"
base: "7.0"
image: fedora:latest
cmp: gcc
configuration: default
steps:
- name: "Fix repo URLs on CentOS-8"
# centos:8 is frozen, repos are in the vault
if: matrix.image=='centos:8'
run: |
sed -i -e "s|mirrorlist=|#mirrorlist=|" \
-e "s|#baseurl=http://mirror|baseurl=http://vault|" \
/etc/yum.repos.d/CentOS-Linux-{BaseOS,AppStream,Extras,Plus}.repo
- name: "Redhat setup"
run: |
dnf -y install python3 gdb make perl gcc-c++ glibc-devel readline-devel ncurses-devel perl-devel perl-Test-Simple
git --version || dnf -y install git
python3 --version
- uses: actions/checkout@v4
with:
submodules: true
- name: Automatic core dumper analysis
uses: mdavidsaver/ci-core-dumper@master
- name: Prepare and compile dependencies
run: python3 .ci/cue.py prepare
- name: Build main module
run: python3 .ci/cue.py build
- name: Run main module tests
run: python3 .ci/cue.py -T 20M test
- name: Upload tapfiles Artifact
if: ${{ always() }}
uses: actions/upload-artifact@v4
with:
name: tapfiles ${{ matrix.name }}
path: '**/O.*/*.tap'
if-no-files-found: ignore
- name: Collect and show test results
if: ${{ always() }}
run: python3 .ci/cue.py -T 5M test-results

17
.gitignore vendored Normal file
View File

@@ -0,0 +1,17 @@
/cfg/
/bin/
/lib/
/db/
/dbd/
/html/
/include/
/templates/
/configure/*.local
/configure/RELEASE.*
/configure/CONFIG_SITE.*
O.*/
/QtC-*
envPaths
*.orig
*.log
.*.swp

3
.gitmodules vendored Normal file
View File

@@ -0,0 +1,3 @@
[submodule ".ci"]
path = .ci
url = https://github.com/epics-base/ci-scripts

View File

@@ -1,9 +0,0 @@
QtC-pvData.creator.user
bin
lib
doc
include
documentation/html
./O.*
configure/RELEASE.local
configure/CONFIG_SITE.local

View File

@@ -1,3 +0,0 @@
459f10877e5628241704f31437b4cbd342df0798 test1
6e8a22d01e824702088195c08bf50bfb6f293de5 1.0-BETA
d29d84f4c3f389f2accd497185b106c8541f95c9 1.1-SNAPSHOT

17
.readthedocs.yml Normal file
View File

@@ -0,0 +1,17 @@
# .readthedocs.yml
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
# Required
version: 2
# Build documentation in the documentation/ directory with Sphinx
sphinx:
configuration: documentation/conf.py
# Build documentation with MkDocs
#mkdocs:
# configuration: mkdocs.yml
# Optionally build your docs in additional formats such as PDF and ePub
formats: all

2549
Doxyfile

File diff suppressed because it is too large Load Diff

65
LICENSE Normal file
View File

@@ -0,0 +1,65 @@
Copyright and License Terms
---------------------------
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-2016 Control System Laboratory,
(COSYLAB) Ljubljana Slovenia
Copyright (c) 2010-2016 Brookhaven Science Associates, as Operator
of Brookhaven National Laboratory
Copyright (c) 2011-2016 Diamond Light Source Limited,
(DLS) Didcot, United Kingdom
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
________________________________________________________________________
Additional Disclaimers
----------------------
This software is copyright in part by these institutions:
* 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.
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,12 +1,17 @@
#Makefile at top of application tree
# Makefile for the EPICS V4 pvData module
TOP = .
include $(TOP)/configure/CONFIG
DIRS += configure
DIRS += pvDataApp
pvDataApp_DEPEND_DIRS = configure
DIRS += src
src_DEPEND_DIRS = configure
DIRS += testApp
testApp_DEPEND_DIRS = pvDataApp
testApp_DEPEND_DIRS = src
DIRS += examples
examples_DEPEND_DIRS = src
include $(TOP)/configure/RULES_TOP

View File

@@ -1 +0,0 @@
// ADD PREDEFINED MACROS HERE!

View File

@@ -1 +0,0 @@
[General]

View File

@@ -1,66 +0,0 @@
<!DOCTYPE QtCreatorProject>
<qtcreator>
<data>
<variable>GenericProjectManager.GenericProject.Toolchain</variable>
<value type="int">0</value>
</data>
<data>
<variable>ProjectExplorer.Project.ActiveTarget</variable>
<value type="int">0</value>
</data>
<data>
<variable>ProjectExplorer.Project.EditorSettings</variable>
<valuemap type="QVariantMap">
<value key="EditorConfiguration.Codec" type="QByteArray">System</value>
</valuemap>
</data>
<data>
<variable>ProjectExplorer.Project.Target.0</variable>
<valuemap type="QVariantMap">
<value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Desktop</value>
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">GenericProjectManager.GenericTarget</value>
<value key="ProjectExplorer.Target.ActiveBuildConfiguration" type="int">0</value>
<value key="ProjectExplorer.Target.ActiveRunConfiguration" type="int">0</value>
<valuemap key="ProjectExplorer.Target.BuildConfiguration.0" type="QVariantMap">
<value key="GenericProjectManager.GenericBuildConfiguration.BuildDirectory" type="QString">/home/mrk/hgwork/pvDataCPP</value>
<valuemap key="ProjectExplorer.BuildConfiguration.BuildStep.0" type="QVariantMap">
<valuelist key="GenericProjectManager.GenericMakeStep.BuildTargets" type="QVariantList">
<value type="QString">all</value>
</valuelist>
<valuelist key="GenericProjectManager.GenericMakeStep.MakeArguments" type="QVariantList"/>
<value key="GenericProjectManager.GenericMakeStep.MakeCommand" type="QString"></value>
<value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Make</value>
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">GenericProjectManager.GenericMakeStep</value>
</valuemap>
<value key="ProjectExplorer.BuildConfiguration.BuildStepsCount" type="int">1</value>
<value key="ProjectExplorer.BuildConfiguration.CleanStepsCount" type="int">0</value>
<value key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment" type="bool">false</value>
<valuelist key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges" type="QVariantList"/>
<value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">all</value>
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">GenericProjectManager.GenericBuildConfiguration</value>
</valuemap>
<value key="ProjectExplorer.Target.BuildConfigurationCount" type="int">1</value>
<valuemap key="ProjectExplorer.Target.RunConfiguration.0" type="QVariantMap">
<valuelist key="ProjectExplorer.CustomExecutableRunConfiguration.Arguments" type="QVariantList"/>
<value key="ProjectExplorer.CustomExecutableRunConfiguration.BaseEnvironmentBase" type="int">2</value>
<value key="ProjectExplorer.CustomExecutableRunConfiguration.Executable" type="QString">/home/mrk/hgwork/pvDataCPP/bin/linux-x86/testIntrospect</value>
<value key="ProjectExplorer.CustomExecutableRunConfiguration.UseTerminal" type="bool">false</value>
<valuelist key="ProjectExplorer.CustomExecutableRunConfiguration.UserEnvironmentChanges" type="QVariantList"/>
<value key="ProjectExplorer.CustomExecutableRunConfiguration.UserName" type="QString">testIntrospect</value>
<value key="ProjectExplorer.CustomExecutableRunConfiguration.UserSetName" type="bool">true</value>
<value key="ProjectExplorer.CustomExecutableRunConfiguration.WorkingDirectory" type="QString">$BUILDDIR</value>
<value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">testIntrospect</value>
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">ProjectExplorer.CustomExecutableRunConfiguration</value>
</valuemap>
<value key="ProjectExplorer.Target.RunConfigurationCount" type="int">1</value>
</valuemap>
</data>
<data>
<variable>ProjectExplorer.Project.TargetCount</variable>
<value type="int">1</value>
</data>
<data>
<variable>ProjectExplorer.Project.Updater.FileVersion</variable>
<value type="int">4</value>
</data>
</qtcreator>

View File

@@ -1,85 +0,0 @@
include/AbstractPVArray.h
include/AbstractPVField.h
include/AbstractPVScalar.h
include/AbstractPVScalarArray.h
include/BasePVBoolean.h
include/BasePVBooleanArray.h
include/BasePVByte.h
include/BasePVByteArray.h
include/BasePVDouble.h
include/BasePVDoubleArray.h
include/BasePVFloat.h
include/BasePVFloatArray.h
include/BasePVInt.h
include/BasePVIntArray.h
include/BasePVLong.h
include/BasePVLongArray.h
include/BasePVShort.h
include/BasePVShortArray.h
include/BasePVString.h
include/BasePVStructure.h
include/BasePVStructureArray.h
include/bitSet.h
include/byteBuffer.h
include/convert.h
include/factory.h
include/lock.h
include/noDefaultMethods.h
include/pvData.h
include/pvIntrospect.h
include/requester.h
include/serialize.h
include/standardField.h
pvDataApp/factory/AbstractPVArray.h
pvDataApp/factory/AbstractPVField.h
pvDataApp/factory/AbstractPVScalar.h
pvDataApp/factory/AbstractPVScalarArray.h
pvDataApp/factory/BasePVBoolean.h
pvDataApp/factory/BasePVBooleanArray.h
pvDataApp/factory/BasePVByte.h
pvDataApp/factory/BasePVByteArray.h
pvDataApp/factory/BasePVDouble.h
pvDataApp/factory/BasePVDoubleArray.h
pvDataApp/factory/BasePVFloat.h
pvDataApp/factory/BasePVFloatArray.h
pvDataApp/factory/BasePVInt.h
pvDataApp/factory/BasePVIntArray.h
pvDataApp/factory/BasePVLong.h
pvDataApp/factory/BasePVLongArray.h
pvDataApp/factory/BasePVShort.h
pvDataApp/factory/BasePVShortArray.h
pvDataApp/factory/BasePVString.h
pvDataApp/factory/BasePVStringArray.h
pvDataApp/factory/BasePVStructure.h
pvDataApp/factory/BasePVStructureArray.h
pvDataApp/factory/Convert.cpp
pvDataApp/factory/factory.h
pvDataApp/factory/FieldCreateFactory.cpp
pvDataApp/factory/PVAuxInfoImpl.cpp
pvDataApp/factory/PVDataCreateFactory.cpp
pvDataApp/factory/StandardField.cpp
pvDataApp/factory/TypeFunc.cpp
pvDataApp/misc/bitSet.h
pvDataApp/misc/byteBuffer.h
pvDataApp/misc/lock.h
pvDataApp/misc/noDefaultMethods.h
pvDataApp/misc/requester.h
pvDataApp/misc/serialize.h
pvDataApp/pv/convert.h
pvDataApp/pv/pvData.h
pvDataApp/pv/pvIntrospect.h
pvDataApp/pv/standardField.h
pvDataApp/test/testIntrospect.cpp
pvDataApp/test/testPVAuxInfo.cpp
pvDataApp/test/testPVScalar.cpp
pvDataApp/test/testPVScalarArray.cpp
pvDataApp/test/testSimpleStructure.cpp
pvDataApp/misc/epicsException.h
pvDataApp/misc/byteBuffer.cpp
pvDataApp/misc/bitSet.cpp
pvDataApp/miscTest/testByteBuffer.cpp
pvDataApp/miscTest/testBitSet.cpp
pvDataApp/miscTest/testBaseException.cpp
pvDataApp/misc/serializeHelper.h
pvDataApp/misc/serializeHelper.cpp
pvDataApp/pvTest/testIntrospect.cpp

View File

@@ -1,4 +0,0 @@
include
pvDataApp/factory
pvDataApp/misc
pvDataApp/pv

View File

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

16
README.md Normal file
View File

@@ -0,0 +1,16 @@
# pvaDataCPP
The EPICS **pvData** API provides a set of classes and utilities that form the core of the EPICS PVA implementation.
The pvDataCPP module is a part of the EPICS software toolkit that implements pvData structures as C++ class objects.
## Links
- General information about EPICS can be found at the
[EPICS Controls website](https://epics-controls.org).
- API documentation for this module can be found on its
[Github Pages website](https://epics-base.github.io/pvDataCPP/).
## Building
This module is included as a submodule of a full EPICS 7 release and will be compiled during builds of that software.

View File

@@ -1,30 +1,29 @@
# CONFIG
# CONFIG - Load build configuration data
#
# Do not make changes to this file!
# You might want to change this to some shared set of rules, e.g.
# RULES=/path/to/epics/support/modules/rules/x-y
RULES=$(EPICS_BASE)
# Allow user to override where the build rules come from
RULES = $(EPICS_BASE)
# RELEASE files point to other application tops
include $(TOP)/configure/RELEASE
-include $(TOP)/configure/RELEASE.$(EPICS_HOST_ARCH)
-include $(TOP)/configure/RELEASE.$(EPICS_HOST_ARCH).Common
ifdef T_A
-include $(TOP)/configure/RELEASE.Common.$(T_A)
-include $(TOP)/configure/RELEASE.$(EPICS_HOST_ARCH).$(T_A)
endif
CONFIG=$(RULES)/configure
CONFIG = $(RULES)/configure
include $(CONFIG)/CONFIG
# Override for definition in base
# Override the Base definition:
INSTALL_LOCATION = $(TOP)
include $(TOP)/configure/CONFIG_SITE
-include $(TOP)/configure/CONFIG_SITE.$(EPICS_HOST_ARCH)
-include $(TOP)/configure/CONFIG_SITE.$(EPICS_HOST_ARCH).Common
# CONFIG_SITE files contain other build configuration settings
include $(TOP)/configure/CONFIG_SITE
-include $(TOP)/configure/CONFIG_SITE.$(EPICS_HOST_ARCH).Common
ifdef T_A
-include $(TOP)/configure/CONFIG_SITE.Common.$(T_A)
-include $(TOP)/configure/CONFIG_SITE.$(EPICS_HOST_ARCH).$(T_A)
-include $(TOP)/configure/O.$(T_A)/CONFIG_APP_INCLUDE
endif

View File

@@ -0,0 +1,12 @@
# Version number for the PV Data API and shared library
EPICS_PVD_MAJOR_VERSION = 8
EPICS_PVD_MINOR_VERSION = 0
EPICS_PVD_MAINTENANCE_VERSION = 7
# Development flag, set to zero for release versions
EPICS_PVD_DEVELOPMENT_FLAG = 0
# Immediately after a release the MAINTENANCE_VERSION
# will be incremented and the DEVELOPMENT_FLAG set to 1

View File

@@ -1,35 +1,35 @@
# CONFIG_SITE
# Make any application-specific changes to the EPICS build
# configuration variables in this file.
# configuration variables in this file.
#
# Host/target specific settings can be specified in files named
# CONFIG_SITE.$(EPICS_HOST_ARCH).Common
# CONFIG_SITE.Common.$(T_A)
# CONFIG_SITE.$(EPICS_HOST_ARCH).$(T_A)
# CONFIG_SITE.$(EPICS_HOST_ARCH).Common
# CONFIG_SITE.Common.$(T_A)
# CONFIG_SITE.$(EPICS_HOST_ARCH).$(T_A)
# Set this when you only want to compile this application
# for a subset of the cross-compiled target architectures
# that Base is built for.
#CROSS_COMPILER_TARGET_ARCHS = vxWorks-68040
# CHECK_RELEASE controls the consistency checking of the support
# applications pointed to by the RELEASE* files.
# Normally CHECK_RELEASE should be set to YES.
# Set CHECK_RELEASE to NO to disable checking completely.
# Set CHECK_RELEASE to WARN to perform consistency checking but
# continue building anyway if conflicts are found.
CHECK_RELEASE = YES
# Set this when your IOC and the host use different paths
# to access the application. This will be needed to boot
# from a Microsoft FTP server or with some NFS mounts.
# You must rebuild in the iocBoot directory for this to
# take effect.
#IOCS_APPL_TOP = <path to application top as seen by IOC>
# To install files into a location other than $(TOP) define
# INSTALL_LOCATION here.
#INSTALL_LOCATION=</path/name/to/install/top>
# If you don't want to install into $(TOP) then
# define INSTALL_LOCATION here
#INSTALL_LOCATION=<fullpathname>
USR_CPPFLAGS += -DPVD_INTERNAL
ifeq ($(EPICS_TEST_COVERAGE),1)
-include $(TOP)/../CONFIG_SITE.local
-include $(TOP)/configure/CONFIG_SITE.local
# MSVC - skip defining min()/max() macros
USR_CPPFLAGS_WIN32 += -DNOMINMAX
ifdef WITH_COVERAGE
USR_CPPFLAGS += --coverage
USR_LDFLAGS += --coverage
endif
INSTALL_INCLUDE = $(INSTALL_LOCATION)/include/pv
USR_INCLUDES += -I $(INSTALL_LOCATION)/include
-include $(TOP)/configure/CONFIG_SITE.local

View File

@@ -2,13 +2,7 @@ TOP=..
include $(TOP)/configure/CONFIG
# CHECK_RELEASE controls the consistency checking of the support
# applications defined in the $(TOP)/configure/RELEASE* files.
# Normally CHECK_RELEASE should be set to YES.
# Set CHECK_RELEASE to NO to disable checking completely.
# Set CHECK_RELEASE to WARN to perform consistency checking,
# but continue the build even if conflicts are found.
CHECK_RELEASE = YES
CFG += CONFIG_PVDATA_VERSION
TARGETS = $(CONFIG_TARGETS)
CONFIGS += $(subst ../,,$(wildcard $(CONFIG_INSTALLS)))

View File

@@ -1,26 +1,38 @@
#RELEASE Location of external products
# RELEASE - Location of external support modules
#
# IF YOU MAKE ANY CHANGES to this file you MUST at least run
# "gnumake" in this directory afterwards; you usually need
# to run "gnumake rebuild" in the application's top level
# directory each time this file is changed.
# IF YOU CHANGE ANY PATHS in this file or make API changes to
# any modules it refers to, you should do a "make rebuild" in
# this application's top level directory.
#
# NOTE: The build does not check dependencies against files
# that are outside this application, thus you should run
# "gnumake distclean install" in the top directory each time
# EPICS_BASE, SNCSEQ, or any other external module defined
# in the RELEASE file is rebuilt.
# The EPICS build process does not check dependencies against
# any files from outside the application, so it is safest to
# rebuild it completely if any modules it depends on change.
#
# Host/target specific settings can be specified in files named
# Host- or target-specific settings can be given in files named
# RELEASE.$(EPICS_HOST_ARCH).Common
# RELEASE.Common.$(T_A)
# RELEASE.$(EPICS_HOST_ARCH).$(T_A)
#
# This file is parsed by both GNUmake and an EPICS Perl script,
# so it may ONLY contain definititions of paths to other support
# modules, variable definitions that are used in module paths,
# and include statements that pull in other RELEASE files.
# Variables may be used before their values have been set.
# Build variables that are NOT used in paths should be set in
# the CONFIG_SITE file.
TEMPLATE_TOP=$(EPICS_BASE)/templates/makeBaseApp/top
EPICS_BASE=/home/install/epics/base
# Variables and paths to dependent modules:
#MODULES = /path/to/modules
#MYMODULE = $(MODULES)/my-module
# Create a file RELEASE.local containing the
# location of your EPICS_BASE, e.g.
# EPICS_BASE=/home/install/epics/base
# If building the EPICS modules individually, set these:
#EPICS_BASE = /path/to/base
# Set RULES here if you want to use build rules from elsewhere:
#RULES = $(MODULES)/build-rules
# These allow developers to override the RELEASE variable settings
# without having to modify the configure/RELEASE file itself.
-include $(TOP)/../RELEASE.local
-include $(TOP)/../RELEASE.$(EPICS_HOST_ARCH).local
-include $(TOP)/configure/RELEASE.local

3
documentation/.gitignore vendored Normal file
View File

@@ -0,0 +1,3 @@
*.tag
*.db
html/

2367
documentation/Doxyfile Normal file

File diff suppressed because it is too large Load Diff

16
documentation/Makefile Normal file
View File

@@ -0,0 +1,16 @@
all: gen
clean:
rm -rf doxygen_sqlite3.db html
gen: libstdc++.tag
doxygen
commit: gen
touch html/.nojekyll
./commit-gh.sh documentation/html/ html/.nojekyll html/*.* html/search/*.*
libstdc++.tag:
wget -O $@ https://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/libstdc++.tag
.PHONY: all clean gen commit

14
documentation/TODO.md Normal file
View File

@@ -0,0 +1,14 @@
TODO
===========
doxygen
-------
There is a lot of public code that does not have doxygen tags.
valueAlarm
---------
normativeTypes.html describes valueAlarm only for a value field that has type
double.
The implementation also supports all the numeric scalar types.

View File

@@ -0,0 +1,7 @@
.wy-side-nav-search {
background-color: #18334B;
}
.wy-side-nav-search input[type="text"] {
border-color: #18334b;
}

45
documentation/commit-gh.sh Executable file
View File

@@ -0,0 +1,45 @@
#!/bin/sh
set -e -x
# Usage: commit-gh <sub-directory-prefix> <files...>
#
# Creates a commit containing only the files in the sub-directory provided as an argument
#
# Does not disturb the working copy or index
prefix="$1"
shift
# Commit to this branch
BRANCH=refs/heads/gh-pages
# Use the main branch description as the gh-pages commit message
MSG=`git describe --tags --always`
# Scratch space
TDIR=`mktemp -d -p $PWD`
# Automatic cleanup of scratch space
trap 'rm -rf $TDIR' INT TERM QUIT EXIT
export GIT_INDEX_FILE="$TDIR/index"
# Add listed files to a new (empty) index
git update-index --add "$@"
# Write the index into the repo, get tree hash
TREE=`git write-tree --prefix="$prefix"`
echo "TREE $TREE"
git cat-file -p $TREE
# Create a commit with our new tree
# Reference current branch head as parent (if any)
CMT=`git commit-tree -m "$MSG" $TREE`
echo "COMMIT $CMT"
git cat-file -p $CMT
# Update the branch with the new commit tree hash
git update-ref $BRANCH $CMT
echo "Done"

78
documentation/conf.py Normal file
View File

@@ -0,0 +1,78 @@
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# http://www.sphinx-doc.org/en/master/config
# -- Path setup --------------------------------------------------------------
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
# import os
# import sys
# sys.path.insert(0, os.path.abspath('.'))
# -- Project information -----------------------------------------------------
project = 'EPICS Documentation'
copyright = '2019, EPICS Controls.'
author = 'EPICS'
# -- General configuration ---------------------------------------------------
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
'sphinx.ext.intersphinx',
]
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
# Intersphinx links to subprojects
intersphinx_mapping = {
'how-tos': ('https://docs.epics-controls.org/projects/how-tos/en/latest', None),
}
# -- Options for HTML output -------------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = 'sphinx_rtd_theme'
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
html_css_files = [
'css/custom.css',
]
master_doc = 'index'
html_theme_options = {
'logo_only': True,
}
html_logo = "images/EPICS_white_logo_v02.png"
html_extra_path = ['../html']
# -- Run Doxygen ------------------------------------------------------------
import subprocess
subprocess.call('cd ..; mkdir -p html/doxygen; doxygen', shell=True)

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

16
documentation/index.rst Normal file
View File

@@ -0,0 +1,16 @@
pvData (C++) Library
====================
.. toctree::
:hidden:
EPICS Website <https://epics-controls.org>
EPICS Documentation Home <https://docs.epics-controls.org>
.. toctree::
:maxdepth: 1
:caption: pvDataCPP
Reference Manual and API Documentation <https://docs.epics-controls.org/projects/pvdata-cpp/en/latest/doxygen>
Source Code Repository on GitHub <https://github.com/epics-base/pvDataCPP>

View File

@@ -0,0 +1,58 @@
#ifndef MAINPAGE_H
#define MAINPAGE_H
/**
@mainpage pvDataCPP documentation
- This module is included in [EPICS Base releases](https://epics-controls.org/resources-and-support/base/) beginning with 7.0.1
- It may also be [Downloaded](https://github.com/epics-base/pvDataCPP/releases) and built separately.
- @htmlonly <a href="modules.html">API components</a> @endhtmlonly
- @ref release_notes
The epics::pvData namespace.
See pv/pvData.h header.
@code
#include <pv/pvData.h>
#include <pv/createRequest.h>
@endcode
- Type description epics::pvData::Field and sub-classes
- Value container epics::pvData::PVField and sub-classes
- POD array handling epics::pvData::shared_vector
- pvRequest parsing epics::pvData::createRequest()
Define a structure type and create a container with default values.
@code
namespace pvd = epics::pvData;
pvd::StructureConstPtr stype(pvd::FieldBuilder::begin()
->add("fld1", pvd::pvInt)
->addNestedStructure("sub")
->add("fld2", pvd::pvString)
->endNested()
->createStructure());
pvd::PVStructuretPtr value(stype->build());
value->getSubFieldT<pvd::PVInt>("fld1")->put(4); // store integer 4. would throw if not pvInt
value->getSubFieldT<pvd::PVScalar>("sub.fld2")->putFrom(4.2); // convert and store string "4.2"
@endcode
is equivalent to the following pseudo-code.
@code
struct stype {
pvd::int32 fld1;
struct {
std::string fld2;
} sub;
};
stype value;
value.fld1 = 4;
value.fld2 = pvd::castUnsafe<std::string>(4.2);
@endcode
*/
#endif /* MAINPAGE_H */

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,491 @@
/**
@page release_notes Release Notes
Release 8.0.7 (Dec 2025)
========================
- Compatible changes
- Allow epics::pvData::Timer to be cancelled during callback execution.
- Clang compiler warnings cleaned up.
- Limit periodic timers to one catch-up after missing many events.
Release 8.0.6 (Dec 2023)
========================
- Compatible changes
- Actually enable JSON-5 output in PVStructure::Formatter::JSON when available.
- Fix unaligned access issues for some ARM/Linux targets.
Release 8.0.5 (Sep 2022)
========================
- Compatible changes
- Internal changes to use the YAJL API for generating JSON and JSON-5 output.
Release 8.0.4 (Feb 2021)
========================
- Incompatible changes
- Remove ByteBuffer::align()
- Compatible changes
- Deprecate SerializableControl::alignBuffer() and DeserializableControl::alignData()
- shared_vector_convert<>() fix convert of empty, untyped, array
Release 8.0.3 (July 2020)
=========================
- Incompatible changes
- Removed THROW_BASE_EXCEPTION_CAUSE() macro which has long ignored its cause.
Any external users should switch to the functionally identical THROW_BASE_EXCEPTION_CAUSE()
- Various printing of functions now conditionally escape strings
including quote '\"' and similar charactors.
Release 8.0.2 (May 2020)
========================
- Changes to documentation and unittests.
No functional changes to library.
Release 8.0.1 (Nov 2019)
==========================
- Incompatible changes
- Requires Base >= 3.15
- Bug fixes
Release 8.0.0 (July 2019)
=========================
- Deprecations
- ByteBuffer::getArray()
- Removals
- pv/localStaticLock.h
- pv/pvCopy.h (see epics::pvData::PVRequestMapper)
- Additions
- Add {Structure,Union}::getFieldT
Release 7.1.3 (Apr 2019)
========================
- Fix for array serialization error to/from big endian.
https://github.com/epics-base/pvDataCPP/issues/65
Release 7.1.2 (Mar 2019)
========================
- 7.1.1 tag pushed prematurely.
Release 7.1.1 (Mar 2019)
========================
- Fixes
- Init order issue with StandardField::getStandardField()
- Build fix for Visual Studio 2013+
Release 7.1.0 (Nov 2018)
========================
- Deprecations
- BoundedString, BoundedScalarArray, and FixedScalarArray will be removed unless they are fixed.
See https://github.com/epics-base/pvDataCPP/issues/52 for discussion.
- pv/localStaticLock.h
- pv/pvCopy.h (see epics::pvData::PVRequestMapper)
- Removals
- Remove previously deprecated executor.h, queue.h and timerFunction.h
- Remove *HashFunction functors to "hash" Field sub-classes which were never fully implemented.
- Fixes
- Make thread safe getFieldCreate() and getPVDataCreate()
- Workaround for MSVC pickyness that iterators be non-NULL, even when not de-referenced.
- Fix alignment fault during (de)serialization on RTEMS/vxWorks.
- Fix epics::pvData::shared_vector::swap() for void specialization.
- Changes in several epics::pvData::Field sub-classes to return const ref. instead of a copy.
- Additions
- epics::pvData::shared_vector add c++11 move and construct for initializer list.
- Add epics::pvData::AnyScalar::clear()
- Add ctor epics::pvData::AnyScalar(ScalarType, const void*) to allow construction from an untyped buffer.
- Add epics::pvData::Timer::close()
- Allow epics::pvData::castUnsafe() from const char* without first allocating a std::string.
- De-duplication of epics::pvData::Field instances is performed using a global hash table.
Identical definitions will share a single instance. Allows O(0) comparision.
- Add epics::pvData::PVRequestMapper to facilitate (partial) copying between PVStructure instances
modified by a pvRequest.
- Add shorthand notations epics::pvData::FieldBuilder::begin() and epics::pvData::Field::build()
Release 7.0.0 (Dec 2017)
========================
- Removals
- Remove requester.h, monitor.h, and destroyable.h.. Migrated to the pvAccessCPP module.
- Previously deprecated monitorPlugin.h is removed.
- Remove pv/messageQueue.h and epics::pvData::MessageQueue
- Deprecate the following utility classes, to be removed in 8.0.
- epics::pvData::Queue
- epics::pvData::Executor
- epics::pvData::TimeFunction
- Additions
- Add pv/pvdVersion.h which is included by pv/pvIntrospect.h
- Add epics::pvData::createRequest() function. Alternative to epics::pvData::CreateRequest class which throws on error.
- epics::pvData::FieldBuilder allow Structure defintion to be changed/appended
- Add epics::pvData::ValueBuilder like FieldBuilder also sets initial values.
- Can also be constructed using an existing PVStructure to allow "editing".
- Add debugPtr.h wrapper with reference tracking to assist in troubleshooting shared_ptr related ref. loops.
- Add @ref pvjson utilities
- Add reftrack @ref pvd_reftrack
- Add header typemap.h to facilitate boilerplate switch() over ScalarType
- Add epics::auto_ptr typedef in help writing code supporting both c++98 and c++11 w/o copious deprecation warnings.
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 (Aug. 2016)
=======================
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
=============
The changes since release 5.0.3 are:
* Fixed bitset serialization (issue #24)
* Fixed truncation in BitSet::or_and (issue #27)
Fixed bitset serialization (issue #24)
--------------------------------------
C++ bitset serialization was not consistent with the C++ deserialization and
Java code in some instances (depending on the endianness of the serializer and
deserializer) when the number of bits was 56-63 modulo 64. C++ serialization
has been fixed.
Fix exposed issue in deserialization on 32-bit platforms which
has also been corrected.
Fixed truncation in BitSet::or_and (issue #27)
----------------------------------------------
If n, n1 and n2 words are used to store the values of the bitsets bitset,
bitset1 and bitset2 respectively then max(n, min(n1,n2)) words are needed
to store bitset.or_(bitset1, bitset2).
Previously min(n1,n2) words were used and the result would be truncated in
some instances. This has been fixed.
Release 5.0.3
=============
The only change since release 5.0.2 is:
Fixed buffer overflow in PVUnion::serialize() (issue #20)
---------------------------------------------------------
A PVUnion whose stored value was null was serialized without checking
whether the buffer had sufficient capacity. This has been fixed by calling
ensureBuffer().
Release 5.0.2 (Sep. 2015)
=========================
The main changes since release 4.0 are:
- Deprecated getXXXField() methods have been removed from PVStructure
- Convert copy methods and equals operators (re)moved
- Convert::copyUnion now always copies between subfields.
- New method getSubFieldT, like getSubField except it throws an exception
- findSubField method removed from PVStructure
- New stream operators for Field and PVField are provided
- New template versions of Structure::getField
- Fixes for static initialisation order issues
- CreateRequest prevents a possible SEGFAULT
Deprecated getXXXField methods have been removed from PVStructure
-------------------------------------------------------------------
The following methods have been removed from PVStructure
- getBooleanField
- getByteField, getShortField, getIntField, getLongField
- getUByteField, getUShortField, getUIntField, getULongField
- getStringField
- getStructureField, getUnionField
- getScalarArrayField, getStructureArrayField, getUnionArrayField
Use template getSubField instead, e.g. use
getSubField< PVInt >(fieldName)
in place of
getIntField(fieldName)
Convert copy methods and equals operators
-----------------------------------------
Convert copy methods where moved and replaced with methods
on PVField classes, i.e.
PVField::copy(const PVField& from)
Methods
PVField::copyUnchecked(const PVField& from)
were added to allow unchecked copies, to gain performance
where checked are not needed (anymore).
In addition:
- isCompatibleXXX methods were removed in favour of Field::operator==.
- equals methods were remove in favour of PVField::operator==.
- operator== methods where moved to pvIntrospect.h and pvData.h
Convert::copyUnion
-----------------
Before this method, depending on types for to and from,
sometimes did a shallow copy, i.e. just made to shared_ptr for to
share the same data as from.
Now it always copies between the subfield of to and from.
New method getSubFieldT, like getSubField except it throws an exception
--------------------
PVStructure has a new template member
getSubFieldT(std::string const &fieldName)
that is like `getSubField()` except that it throws a runtime_error
instead of returning null.
findSubField method removed from PVStructure
--------------------------------------------
This was mainly used in the implementation of getSubField. With a change to
the latter, findSubField was removed.
New stream operators
--------------------
New steam operators are available for Field and PVField.
Before to print a Field (or any extension) or a PVField (or any extension)
it was necessary to have code like:
void print(StructureConstPtr struc, PVStructurePtr pv)
{
if(struc) {
cout << *struc << endl;
} else {
cout << "nullptr\n"
}
if(pv) {
cout << *.struc << endl;
} else {
cout << "nullptr\n"
}
}
Now it can be done as follows:
void print(StructureConstPtr struc, PVStructurePtr pv)
{
cout << struc << endl;
cout << pv << endl;
}
New template version of Structure::getField
--------------------------------------------
A new template getField method has been added to Structure
template<typename FT >
std::tr1::shared_ptr< const FT > getField(std::string const &fieldName) const
Can be used, for example, as follows:
StructurePtr tsStruc = struc->getField<Structure>("timeStamp");
Fixes for static initialisation order issues
--------------------------------------------
Certain static builds (in particular Windows builds) of applications using
pvData had issues due to PVStructure::DEFAULT_ID being used before being initialised. This has been fixed.
CreateRequest change
--------------------
createRequest could cause a SEGFAULT if passed a bad argument.
This has been changed so the it returns a null pvStructure
and provides an error.
Release 4.0.3
=============
The main changes since release 3.0.2 are:
- array semantics now enforce Copy On Write.
- String no longer defined.
- timeStamp and valueAlarm name changes
- toString replaced by stream I/O
- union is new type.
- copy is new.
- monitorPlugin is new.
New Semantics for Arrays
--------
PVScalarArray, PVStructureArray, and PVUnionArray all enforce COW (Copy On Write) Semantics.
In order to limit memory usage the storage for raw data is managed via a new shared_vector facility.
This allows multiple instances of array data to use the shared raw data.
COW is implemented via shared_vectors of const data, i. e. data that can not be modified.
String no longer defined
---------
This is replaced by std::string.
timeStamp and valueAlarm name changes
--------------
In timeStamp nanoSeconds is changed to nanoseconds.
In valueAlarm hysteresis is changed to hysteresis
toString replaced by stream I/O
---------
pvData.h and pvIntrospect no longer defines toString
Instead they have stream support.
pvIntrospect uses method dump and pvData uses dumpValue.
For example:
PVDoublePtr pvValue;
String buffer;
pvValue->toString(&buffer);
cout << buffer << endl;
buffer.clear();
pvValue->getField()->toString(&buffer);
cout << buffer << evdl;
is replaced by
PVDoublePtr pvValue;
cout << *pvValue << endl
cout << *pvValue->getField() << endl;
union is a new basic type.
------------
There are two new basic types: union_t and unionArray.
A union is like a structure that has a single subfield.
There are two flavors:
- *variant union* The field can have any type.
- *union* The field can any of specified set of types.
The field type can be dynamically changed.
copy
----
This consists of createRequest and pvCopy.
createRequest was moved from pvAccess to here.
pvCopy is moved from pvDatabaseCPP and now depends
only on pvData, i.e. it no longer has any knowledge of PVRecord.
monitorPlugin
-------------
This is for is for use by code that implements pvAccess monitors.
This is prototype and is subject to debate.
Release 3.0.2
==========
This was the starting point for RELEASE_NOTES
*/

14
examples/Makefile Normal file
View File

@@ -0,0 +1,14 @@
# Makefile for the examples
# make sure they compile
TOP = ..
include $(TOP)/configure/CONFIG
PROD_LIBS += pvData Com
TESTPROD_HOST += unittest
unittest_SRCS += unittest.cpp
include $(TOP)/configure/RULES

30
examples/unittest.cpp Normal file
View File

@@ -0,0 +1,30 @@
/*
* Copyright information and license terms for this software can be
* found in the file LICENSE that is included with the distribution
*/
/* c++ unittest skeleton */
#include <stdexcept>
#include <testMain.h>
#include <pv/pvUnitTest.h>
#include <pv/epicsException.h>
namespace {
void testCase1() {
testEqual(1+1, 2);
}
} // namespace
MAIN(testUnitTest)
{
testPlan(1);
try {
testCase1();
}catch(std::exception& e){
PRINT_EXCEPTION(e); // print stack trace if thrown with THROW_EXCEPTION()
testAbort("Unhandled exception: %s", e.what());
}
return testDone();
}

70
jenkins/cloudbees_build Normal file
View File

@@ -0,0 +1,70 @@
# pvData C++ implementation
# Jenkins @ Cloudbees build script
#
# Jenkins invokes scripts with the "-ex" option. So the build is considered a failure
# if any of the commands exits with a non-zero exit code.
#
# Author: Ralph Lange <ralph.lange@gmx.de>
# Copyright (C) 2013 Helmholtz-Zentrum Berlin für Materialien und Energie GmbH
# Copyright (C) 2014-2016 ITER Organization.
# 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
wget -nv https://openepics.ci.cloudbees.com/job/e4-cpp-${module}-${branch}-build/BASE=${BASE}/lastSuccessfulBuild/artifact/${module}.CB-dist.tar.gz
tar -xzf ${module}.CB-dist.tar.gz
}
###########################################
# Defaults for EPICS Base
DEFAULT_BASE=3.15.4
BASE=${BASE:-${DEFAULT_BASE}}
###########################################
# Fetch and unpack dependencies
export STUFF=/tmp/stuff
rm -fr ${STUFF}
mkdir -p ${STUFF}
cd ${STUFF}
installTool Boost 1.61.0
installTool Base ${BASE}
###########################################
# Build
cd ${WORKSPACE}
export EPICS_BASE=${STUFF}
export EPICS_HOST_ARCH=$(${EPICS_BASE}/startup/EpicsHostArch)
export LD_LIBRARY_PATH=${EPICS_BASE}/lib/${EPICS_HOST_ARCH}
export PATH=${STUFF}/bin:${PATH}
cat > configure/RELEASE.local << EOF
EPICS_BASE=${EPICS_BASE}
EOF
make distclean all
###########################################
# Test
make runtests
###########################################
# Create cache
tar czf pvData.CB-dist.tar.gz lib include cfg LICENSE

66
jenkins/cloudbees_doc Normal file
View File

@@ -0,0 +1,66 @@
# pvData C++ implementation
# Jenkins @ Cloudbees documentation generation and deployment
#
# Jenkins invokes scripts with the "-ex" option. So the build is considered a failure
# if any of the commands exits with a non-zero exit code.
#
# Author: Ralph Lange <ralph.lange@gmx.de>
# Copyright (C) 2013 Helmholtz-Zentrum Berlin für Materialien und Energie GmbH
# Copyright (C) 2014-2016 ITER Organization.
# 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
wget -nv https://openepics.ci.cloudbees.com/job/e4-cpp-${module}-${branch}-build/BASE=${BASE}/lastSuccessfulBuild/artifact/${module}.CB-dist.tar.gz
tar -xzf ${module}.CB-dist.tar.gz
}
###########################################
# Defaults for EPICS Base and parameters
BASE=3.15.4
PUBLISH=${PUBLISH:-NO}
BRANCH=${BRANCH:-master}
###########################################
# Fetch and unpack dependencies
export STUFF=/tmp/stuff
rm -fr ${STUFF}
mkdir -p ${STUFF}
cd ${STUFF}
installTool Doxygen 1.8.11
###########################################
# Generate
cd ${WORKSPACE}
installE4 pvData ${BRANCH}
export PATH=${STUFF}/bin:${PATH}
doxygen
###########################################
# Publish
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}/
rsync -aqP --delete -e ssh documentation epics-jenkins@web.sourceforge.net:/home/project-web/epics-pvdata/htdocs/docbuild/pvDataCPP/${PUBLISH}/
fi

View File

@@ -1,108 +0,0 @@
TOP = ..
include $(TOP)/configure/CONFIG
PVDATA = $(TOP)/pvDataApp/
SRC_DIRS += $(PVDATA)/misc
INC += noDefaultMethods.h
INC += linkedListVoid.h
INC += linkedList.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 += CDRMonitor.h
INC += timeFunction.h
INC += timer.h
INC += queueVoid.h
INC += queue.h
INC += messageQueue.h
INC += destroyable.h
INC += status.h
INC += sharedPtr.h
LIBSRCS += CDRMonitor.cpp
#LIBSRCS += byteBuffer.cpp
LIBSRCS += bitSet.cpp
LIBSRCS += epicsException.cpp
LIBSRCS += requester.cpp
LIBSRCS += serializeHelper.cpp
LIBSRCS += linkedListVoid.cpp
LIBSRCS += event.cpp
LIBSRCS += executor.cpp
LIBSRCS += timeFunction.cpp
LIBSRCS += timer.cpp
LIBSRCS += queueVoid.cpp
LIBSRCS += messageQueue.cpp
LIBSRCS += status.cpp
SRC_DIRS += $(PVDATA)/pv
INC += pvType.h
INC += pvIntrospect.h
INC += pvData.h
INC += convert.h
INC += standardField.h
INC += standardPVField.h
SRC_DIRS += $(PVDATA)/factory
INC += factory.h
LIBSRCS += TypeFunc.cpp
LIBSRCS += PVAuxInfoImpl.cpp
LIBSRCS += FieldCreateFactory.cpp
LIBSRCS += PVField.cpp
LIBSRCS += PVScalar.cpp
LIBSRCS += PVArray.cpp
LIBSRCS += PVScalarArray.cpp
LIBSRCS += PVStructure.cpp
LIBSRCS += DefaultPVStructureArray.cpp
LIBSRCS += PVDataCreateFactory.cpp
LIBSRCS += Convert.cpp
LIBSRCS += Compare.cpp
LIBSRCS += StandardField.cpp
LIBSRCS += StandardPVField.cpp
SRC_DIRS += $(PVDATA)/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
LIBSRCS += alarm.cpp
LIBSRCS += pvAlarm.cpp
LIBSRCS += pvControl.cpp
LIBSRCS += pvDisplay.cpp
LIBSRCS += pvEnumerated.cpp
LIBSRCS += timeStamp.cpp
LIBSRCS += pvTimeStamp.cpp
SRC_DIRS += $(PVDATA)/pvMisc
INC += bitSetUtil.h
LIBSRCS += bitSetUtil.cpp
SRC_DIRS += $(PVDATA)/monitor
INC += monitor.h
INC += monitorQueue.h
LIBSRCS += monitorQueue.cpp
LIBRARY=pvData
pvData_LIBS += Com
include $(TOP)/configure/RULES

View File

@@ -1,97 +0,0 @@
#include <pv/convert.h>
#include <algorithm>
#include <iterator>
#include <sstream>
namespace epics { namespace pvData {
// PVXXX object comparison
bool operator==(PVField& left, PVField& right)
{
return getConvert()->equals(left,right);
}
// Introspection object comparision
/** Field equality conditions:
* 1) same instance
* 2) same type (field and scalar/element), same name, same subfields (if any)
*/
bool operator==(const Field& a, const Field& b)
{
if(&a==&b)
return true;
if(a.getType()!=b.getType())
return false;
switch(a.getType()) {
case scalar: {
const Scalar &A=static_cast<const Scalar&>(a);
const Scalar &B=static_cast<const Scalar&>(b);
return A==B;
}
case scalarArray: {
const ScalarArray &A=static_cast<const ScalarArray&>(a);
const ScalarArray &B=static_cast<const ScalarArray&>(b);
return A==B;
}
case structure: {
const Structure &A=static_cast<const Structure&>(a);
const Structure &B=static_cast<const Structure&>(b);
return A==B;
}
case structureArray: {
const StructureArray &A=static_cast<const StructureArray&>(a);
const StructureArray &B=static_cast<const StructureArray&>(b);
return A==B;
}
default:
throw std::logic_error("Invalid Field type in comparision");
}
}
bool operator==(const Scalar& a, const Scalar& b)
{
if(&a==&b)
return true;
return a.getScalarType()==b.getScalarType() && a.getFieldName()==b.getFieldName();
}
bool operator==(const ScalarArray& a, const ScalarArray& b)
{
if(&a==&b)
return true;
return a.getElementType()==b.getElementType() && a.getFieldName()==b.getFieldName();
}
bool operator==(const Structure& a, const Structure& b)
{
if(&a==&b)
return true;
int nflds=a.getNumberFields();
if (b.getNumberFields()!=nflds)
return false;
if (a.getFieldName()!=b.getFieldName())
return false;
// std::equals does not work, since FieldConstPtrArray is an array of shared_pointers
FieldConstPtrArray af = a.getFields();
FieldConstPtrArray bf = b.getFields();
for (int i = 0; i < nflds; i++)
if (*(af[i].get()) != *(bf[i].get()))
return false;
return true;
}
bool operator==(const StructureArray& a, const StructureArray& b)
{
return a.structure() == b.structure();
}
namespace nconvert {
} // namespace nconvert
}} // namespace epics::pvData

File diff suppressed because it is too large Load Diff

View File

@@ -1,251 +0,0 @@
/*PVStructureArray.cpp*/
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvDataCPP is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
#include <cstddef>
#include <cstdlib>
#include <string>
#include <cstdio>
#include <pv/pvData.h>
#include <pv/convert.h>
#include <pv/factory.h>
#include <pv/serializeHelper.h>
#include "DefaultPVStructureArray.h"
using std::tr1::static_pointer_cast;
using std::tr1::const_pointer_cast;
namespace epics { namespace pvData {
BasePVStructureArray::BasePVStructureArray(
PVStructure *parent,StructureArrayConstPtr structureArray)
: PVStructureArray(parent,structureArray),
structureArray(structureArray),
structureArrayData(new StructureArrayData()),
value(new PVStructurePtr[0])
{
}
BasePVStructureArray::~BasePVStructureArray()
{
delete structureArrayData;
int number = getCapacity();
for(int i=0; i<number; i++) {
if(value[i]!=0) {
delete value[i];
}
}
delete[] value;
}
int BasePVStructureArray::append(int number)
{
int currentLength = getCapacity();
int newLength = currentLength + number;
setCapacity(newLength);
StructureConstPtr structure = structureArray->getStructure();
for(int i=currentLength; i<newLength; i++) {
value[i] = getPVDataCreate()->createPVStructure(0,structure);
}
return newLength;
}
bool BasePVStructureArray::remove(int offset,int number)
{
int length = getCapacity();
if(offset+number>length) return false;
for(int i=offset;i<offset+number;i++) {
if(value[i]!=0) {
delete value[i];
value[i] = 0;
}
}
return true;
}
void BasePVStructureArray::compress() {
int length = getCapacity();
int newLength = 0;
for(int i=0; i<length; i++) {
if(value[i]!=0) {
newLength++;
continue;
}
// find first non 0
int notNull = 0;
for(int j=i+1;j<length;j++) {
if(value[j]!=0) {
notNull = j;
break;
}
}
if(notNull!=0) {
value[i] = value[notNull];
value[notNull] = 0;
newLength++;
continue;
}
break;
}
setCapacity(newLength);
}
void BasePVStructureArray::setCapacity(int capacity) {
if(getCapacity()==capacity) return;
if(!isCapacityMutable()) {
std::string message("not capacityMutable");
PVField::message(message, errorMessage);
return;
}
int length = getCapacity();
int numRemove = length - capacity;
if(numRemove>0) remove(length,numRemove);
PVStructurePtrArray newValue = new PVStructurePtr[capacity];
int limit = length;
if(length>capacity) limit = capacity;
for(int i=0; i<limit; i++) newValue[i] = value[i];
for(int i=limit; i<capacity; i++) newValue[i] = 0;
if(length>capacity) length = capacity;
delete[] value;
value = newValue;
setCapacityLength(capacity,length);
}
StructureArrayConstPtr BasePVStructureArray::getStructureArray()
{
return structureArray;
}
int BasePVStructureArray::get(
int offset, int len, StructureArrayData *data)
{
int n = len;
int length = getLength();
if(offset+len > length) {
n = length - offset;
if(n<0) n = 0;
}
data->data = value;
data->offset = offset;
return n;
}
int BasePVStructureArray::put(int offset,int len,
PVStructurePtrArray from, int fromOffset)
{
if(isImmutable()) {
message(String("field is immutable"), errorMessage);
return 0;
}
if(from==value) return len;
if(len<1) return 0;
int length = getLength();
int capacity = getCapacity();
if(offset+len > length) {
int newlength = offset + len;
if(newlength>capacity) {
setCapacity(newlength);
capacity = getCapacity();
newlength = capacity;
len = newlength - offset;
if(len<=0) return 0;
}
length = newlength;
setLength(length);
}
StructureConstPtr structure = structureArray->getStructure();
for(int i=0; i<len; i++) {
if(value[i+offset]!=0) delete value[i+offset];
PVStructurePtr frompv = from[i+fromOffset];
if(frompv==0) {
value[i+offset] = 0;
continue;
}
if(frompv->getStructure()!=structure) {
throw std::invalid_argument(String(
"Element is not a compatible structure"));
}
value[i+offset] = frompv;
}
postPut();
return len;
}
void BasePVStructureArray::shareData(
PVStructurePtrArray newValue,int capacity,int length)
{
for(int i=0; i<getLength(); i++) {
if(value[i]!=0) delete value[i];
}
delete[] value;
value = newValue;
setCapacity(capacity);
setLength(length);
}
void BasePVStructureArray::serialize(ByteBuffer *pbuffer,
SerializableControl *pflusher) const {
serialize(pbuffer, pflusher, 0, getLength());
}
void BasePVStructureArray::deserialize(ByteBuffer *pbuffer,
DeserializableControl *pcontrol) {
int size = SerializeHelper::readSize(pbuffer, pcontrol);
if(size>=0) {
// prepare array, if necessary
if(size>getCapacity()) setCapacity(size);
for(int i = 0; i<size; i++) {
pcontrol->ensureData(1);
int8 temp = pbuffer->getByte();
if(temp==0) {
if (value[i]) {
delete value[i];
value[i] = NULL;
}
}
else {
if(value[i]==NULL) {
value[i] = getPVDataCreate()->createPVStructure(
NULL, structureArray->getStructure());
}
value[i]->deserialize(pbuffer, pcontrol);
}
}
setLength(size);
postPut();
}
}
void BasePVStructureArray::serialize(ByteBuffer *pbuffer,
SerializableControl *pflusher, int offset, int count) const {
// cache
int length = getLength();
// check bounds
if(offset<0)
offset = 0;
else if(offset>length) offset = length;
if(count<0) count = length;
int maxCount = length-offset;
if(count>maxCount) count = maxCount;
// write
SerializeHelper::writeSize(count, pbuffer, pflusher);
for(int i = 0; i<count; i++) {
if(pbuffer->getRemaining()<1) pflusher->flushSerializeBuffer();
PVStructure* pvStructure = value[i+offset];
if(pvStructure==NULL) {
pbuffer->putByte(0);
}
else {
pbuffer->putByte(1);
pvStructure->serialize(pbuffer, pflusher);
}
}
}
}}

View File

@@ -1,48 +0,0 @@
/*DefaultPVStructureArray.h*/
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvDataCPP is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
#ifndef DEFAULTPVSTRUCTUREARRAY_H
#define DEFAULTPVSTRUCTUREARRAY_H
#include <cstddef>
#include <cstdlib>
#include <string>
#include <cstdio>
#include <pv/pvData.h>
#include <pv/convert.h>
#include <pv/factory.h>
#include <pv/serializeHelper.h>
namespace epics { namespace pvData {
class BasePVStructureArray : public PVStructureArray {
public:
BasePVStructureArray(PVStructure *parent,
StructureArrayConstPtr structureArray);
virtual ~BasePVStructureArray();
virtual StructureArrayConstPtr getStructureArray();
virtual int append(int number);
virtual bool remove(int offset,int number);
virtual void compress();
virtual void setCapacity(int capacity);
virtual int get(int offset, int length,
StructureArrayData *data);
virtual int put(int offset,int length,
PVStructurePtrArray from, int fromOffset);
virtual void shareData( PVStructurePtrArray value,int capacity,int length);
virtual void serialize(ByteBuffer *pbuffer,
SerializableControl *pflusher) const;
virtual void deserialize(ByteBuffer *buffer,
DeserializableControl *pflusher);
virtual void serialize(ByteBuffer *pbuffer,
SerializableControl *pflusher, int offset, int count) const;
private:
StructureArrayConstPtr structureArray;
StructureArrayData *structureArrayData;
PVStructurePtrArray value;
};
}}
#endif /*DEFAULTPVSTRUCTUREARRAY_H*/

View File

@@ -1,260 +0,0 @@
/*FieldCreateFactory.cpp*/
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvDataCPP is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
#include <cstddef>
#include <cstdlib>
#include <string>
#include <cstdio>
#include <pv/lock.h>
#include <pv/pvIntrospect.h>
#include <pv/convert.h>
#include <pv/factory.h>
#include <pv/CDRMonitor.h>
using std::tr1::static_pointer_cast;
namespace epics { namespace pvData {
static DebugLevel debugLevel = lowDebug;
static void newLine(StringBuilder buffer, int indentLevel)
{
*buffer += "\n";
for(int i=0; i<indentLevel; i++) *buffer += " ";
}
PVDATA_REFCOUNT_MONITOR_DEFINE(field);
Field::Field(String fieldName,Type type)
:m_fieldName(fieldName)
,m_type(type)
{
PVDATA_REFCOUNT_MONITOR_CONSTRUCT(field);
}
Field::~Field() {
PVDATA_REFCOUNT_MONITOR_DESTRUCT(field);
// note that compiler automatically calls destructor for fieldName
if(debugLevel==highDebug) printf("~Field %s\n",m_fieldName.c_str());
}
void Field::renameField(String newName)
{
m_fieldName = newName;
}
void Field::toString(StringBuilder buffer,int indentLevel) const{
*buffer += " ";
*buffer += m_fieldName.c_str();
}
Scalar::Scalar(String fieldName,ScalarType scalarType)
: Field(fieldName,scalar),scalarType(scalarType){}
Scalar::~Scalar(){}
void Scalar::toString(StringBuilder buffer,int indentLevel) const{
ScalarTypeFunc::toString(buffer,scalarType);
Field::toString(buffer,indentLevel);
}
ScalarArray::ScalarArray(String fieldName,ScalarType elementType)
: Field(fieldName,scalarArray),elementType(elementType){}
ScalarArray::~ScalarArray() {}
void ScalarArray::toString(StringBuilder buffer,int indentLevel) const{
ScalarTypeFunc::toString(buffer,elementType);
*buffer += "[]";
Field::toString(buffer,indentLevel);
}
StructureArray::StructureArray(String fieldName,StructureConstPtr structure)
: Field(fieldName,structureArray),pstructure(structure)
{
}
StructureArray::~StructureArray() {
if(debugLevel==highDebug) printf("~StructureArray\n");
}
void StructureArray::toString(StringBuilder buffer,int indentLevel) const {
*buffer += "structure[]";
Field::toString(buffer,indentLevel);
newLine(buffer,indentLevel + 1);
pstructure->toString(buffer,indentLevel + 1);
}
Structure::Structure (String fieldName,
int numberFields, FieldConstPtrArray infields)
: Field(fieldName,structure),
numberFields(numberFields),
fields(infields)
{
for(int i=0; i<numberFields; i++) {
String name = fields[i]->getFieldName();
// look for duplicates
for(int j=i+1; j<numberFields; j++) {
String otherName = fields[j]->getFieldName();
int result = name.compare(otherName);
if(result==0) {
String message("duplicate fieldName ");
message += name;
delete[] fields;
throw std::invalid_argument(message);
}
}
}
}
Structure::~Structure() {
if(debugLevel==highDebug)
printf("~Structure %s\n",Field::getFieldName().c_str());
delete[] fields;
}
FieldConstPtr Structure::getField(String fieldName) const {
for(int i=0; i<numberFields; i++) {
FieldConstPtr pfield = fields[i];
int result = fieldName.compare(pfield->getFieldName());
if(result==0) return pfield;
}
return FieldConstPtr();
}
int Structure::getFieldIndex(String fieldName) const {
for(int i=0; i<numberFields; i++) {
FieldConstPtr pfield = fields[i];
int result = fieldName.compare(pfield->getFieldName());
if(result==0) return i;
}
return -1;
}
void Structure::appendField(FieldConstPtr field)
{
FieldConstPtr *newFields = new FieldConstPtr[numberFields+1];
for(int i=0; i<numberFields; i++) newFields[i] = fields[i];
newFields[numberFields] = field;
delete[] fields;
fields = newFields;
numberFields++;
}
void Structure::appendFields(int numberNew,FieldConstPtrArray nfields)
{
FieldConstPtr *newFields = new FieldConstPtr[numberFields+numberNew];
for(int i=0; i<numberFields; i++) newFields[i] = fields[i];
for(int i=0; i<numberNew; i++) newFields[numberFields+i] = nfields[i];
delete[] fields;
fields = newFields;
numberFields += numberNew;
}
void Structure::removeField(int index)
{
if(index<0 || index>=numberFields) {
throw std::invalid_argument(
String("Structure::removeField index out of bounds"));
}
FieldConstPtr *newFields = new FieldConstPtr[numberFields-1];
int ind=0;
for(int i=0; i<numberFields; i++) {
if(i==index) continue;
newFields[ind++] = fields[i];
}
delete[] fields;
fields = newFields;
--numberFields;
}
void Structure::toString(StringBuilder buffer,int indentLevel) const{
*buffer += "structure";
Field::toString(buffer,indentLevel);
newLine(buffer,indentLevel+1);
for(int i=0; i<numberFields; i++) {
FieldConstPtr pfield = fields[i];
pfield->toString(buffer,indentLevel+1);
if(i<numberFields-1) newLine(buffer,indentLevel+1);
}
}
ScalarConstPtr FieldCreate::createScalar(String fieldName,
ScalarType scalarType) const
{
ScalarConstPtr scalar(new Scalar(fieldName,scalarType), Field::Deleter());
return scalar;
}
ScalarArrayConstPtr FieldCreate::createScalarArray(
String fieldName,ScalarType elementType) const
{
ScalarArrayConstPtr scalarArray(new ScalarArray(fieldName,elementType), Field::Deleter());
return scalarArray;
}
StructureConstPtr FieldCreate::createStructure (
String fieldName,int numberFields,
FieldConstPtr fields[]) const
{
StructureConstPtr structure(new Structure(
fieldName,numberFields,fields), Field::Deleter());
return structure;
}
StructureArrayConstPtr FieldCreate::createStructureArray(
String fieldName,StructureConstPtr structure) const
{
StructureArrayConstPtr structureArray(new StructureArray(fieldName,structure), Field::Deleter());
return structureArray;
}
FieldConstPtr FieldCreate::create(String fieldName,
FieldConstPtr pfield) const
{
FieldConstPtr ret;
Type type = pfield->getType();
switch(type) {
case scalar: {
ScalarConstPtr pscalar = static_pointer_cast<const Scalar>(pfield);
return createScalar(fieldName,pscalar->getScalarType());
}
case scalarArray: {
ScalarArrayConstPtr pscalarArray = static_pointer_cast<const ScalarArray>(pfield);
return createScalarArray(fieldName,pscalarArray->getElementType());
}
case structure: {
StructureConstPtr pstructure = static_pointer_cast<const Structure>(pfield);
return createStructure(fieldName,pstructure->getNumberFields(),pstructure->getFields());
}
case structureArray: {
StructureArrayConstPtr pstructureArray = static_pointer_cast<const StructureArray>(pfield);
return createStructureArray(fieldName,pstructureArray->getStructure());
}
}
String message("field ");
message += fieldName;
THROW_EXCEPTION2(std::logic_error, message);
}
static FieldCreate* fieldCreate = 0;
FieldCreate::FieldCreate()
{
}
FieldCreate * getFieldCreate() {
static Mutex mutex;
Lock xx(mutex);
if(fieldCreate==0) fieldCreate = new FieldCreate();
return fieldCreate;
}
}}

View File

@@ -1,89 +0,0 @@
/*PVArray.cpp*/
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvDataCPP is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
#include <cstddef>
#include <cstdlib>
#include <string>
#include <cstdio>
#include <pv/pvData.h>
#include <pv/factory.h>
namespace epics { namespace pvData {
class PVArrayPvt {
public:
PVArrayPvt() : length(0),capacity(0),capacityMutable(true)
{}
int length;
int capacity;
bool capacityMutable;
};
PVArray::PVArray(PVStructure *parent,FieldConstPtr field)
: PVField(parent,field),pImpl(new PVArrayPvt())
{ }
PVArray::~PVArray()
{
delete pImpl;
}
int PVArray::getLength() const {return pImpl->length;}
int PVArray::getCapacity() const {return pImpl->capacity;}
static String fieldImmutable("field is immutable");
void PVArray::setLength(int length) {
if(length==pImpl->length) return;
if(PVField::isImmutable()) {
PVField::message(fieldImmutable,errorMessage);
return;
}
if(length>pImpl->capacity) this->setCapacity(length);
if(length>pImpl->capacity) length = pImpl->capacity;
pImpl->length = length;
}
void PVArray::setCapacityLength(int capacity,int length) {
pImpl->capacity = capacity;
pImpl->length = length;
}
bool PVArray::isCapacityMutable()
{
if(PVField::isImmutable()) {
return false;
}
return pImpl->capacityMutable;
}
void PVArray::setCapacityMutable(bool isMutable)
{
if(isMutable && PVField::isImmutable()) {
PVField::message(fieldImmutable,errorMessage);
return;
}
pImpl->capacityMutable = isMutable;
}
static String capacityImmutable("capacity is immutable");
void PVArray::setCapacity(int capacity) {
if(PVField::isImmutable()) {
PVField::message(fieldImmutable,errorMessage);
return;
}
if(pImpl->capacityMutable==false) {
PVField::message(capacityImmutable,errorMessage);
return;
}
pImpl->capacity = capacity;
}
}}

View File

@@ -1,102 +0,0 @@
/*PVAuxInfo.cpp*/
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvDataCPP is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
#include <cstddef>
#include <cstdlib>
#include <string>
#include <cstdio>
#include <pv/noDefaultMethods.h>
#include <pv/pvData.h>
#include <pv/convert.h>
#include <pv/factory.h>
#include <pv/lock.h>
#include <pv/CDRMonitor.h>
namespace epics { namespace pvData {
PVDATA_REFCOUNT_MONITOR_DEFINE(pvAuxInfo);
PVAuxInfo::PVAuxInfo(PVField *pvField)
: pvField(pvField),lengthInfo(1),numberInfo(0),
pvInfos(new PVScalar *[1])
{
PVDATA_REFCOUNT_MONITOR_CONSTRUCT(pvAuxInfo);
}
PVAuxInfo::~PVAuxInfo()
{
PVDATA_REFCOUNT_MONITOR_DESTRUCT(pvAuxInfo);
for(int i=0; i<numberInfo; i++) delete pvInfos[i];
delete[] pvInfos;
}
PVField * PVAuxInfo::getPVField() {
return pvField;
}
PVScalar * PVAuxInfo::createInfo(String key,ScalarType scalarType)
{
for(int i=0; i<numberInfo; i++) {
PVScalar *pvScalar = pvInfos[i];
if(key.compare(pvScalar->getField()->getFieldName())==0) {
String message("AuxoInfo:create key ");
message += key.c_str();
message += " already exists with scalarType ";
ScalarTypeFunc::toString(&message,scalarType);
pvField->message(message,errorMessage);
return 0;
}
}
if(lengthInfo==numberInfo) {
int newLength = lengthInfo+4;
PVScalar ** newInfos = new PVScalar *[newLength];
lengthInfo = newLength;
for(int i=0; i<numberInfo; i++) newInfos[i] = pvInfos[i];
for(int i= numberInfo; i<lengthInfo; i++) newInfos[i] = 0;
delete[] pvInfos;
pvInfos = newInfos;
}
PVScalar *pvScalar = getPVDataCreate()->createPVScalar(0,key,scalarType);
pvInfos[numberInfo++] = pvScalar;
return pvScalar;
}
PVScalar * PVAuxInfo::getInfo(String key)
{
for(int i=0; i<numberInfo; i++) {
PVScalar *pvScalar = pvInfos[i];
if(key.compare(pvScalar->getField()->getFieldName())==0) return pvScalar;
}
return 0;
}
PVScalar * PVAuxInfo::getInfo(int index)
{
if(index<0 || index>=numberInfo) return 0;
return pvInfos[index];
}
int PVAuxInfo::getNumberInfo() { return numberInfo;}
void PVAuxInfo::toString(StringBuilder buf)
{
PVAuxInfo::toString(buf,0);
}
void PVAuxInfo::toString(StringBuilder buf,int indentLevel)
{
if(numberInfo==0) return;
Convert *convert = getConvert();
convert->newLine(buf,indentLevel);
*buf += "auxInfo";
for(int i=0; i<numberInfo; i++) {
convert->newLine(buf,indentLevel+1);
PVScalar *value = pvInfos[i];
value->toString(buf,indentLevel + 1);
}
}
}}

View File

@@ -1,601 +0,0 @@
/*PVDataCreateFactory.cpp*/
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvDataCPP is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
#ifdef _WIN32
#define NOMINMAX
#endif
#include <cstddef>
#include <cstdlib>
#include <string>
#include <cstdio>
#include <pv/lock.h>
#include <pv/pvIntrospect.h>
#include <pv/pvData.h>
#include <pv/convert.h>
#include <pv/factory.h>
#include <pv/serializeHelper.h>
#include "DefaultPVStructureArray.h"
using std::tr1::static_pointer_cast;
using std::tr1::const_pointer_cast;
namespace epics { namespace pvData {
static Convert* convert = 0;
static FieldCreate * fieldCreate = 0;
static PVDataCreate* pvDataCreate = 0;
/** Default storage for scalar values
*/
template<typename T>
class BasePVScalar : public PVScalarValue<T> {
public:
typedef T value_type;
typedef T* pointer;
typedef const T* const_pointer;
BasePVScalar(PVStructure *parent,ScalarConstPtr scalar);
virtual ~BasePVScalar();
virtual T get();
virtual void put(T val);
virtual void serialize(ByteBuffer *pbuffer,
SerializableControl *pflusher) const;
virtual void deserialize(ByteBuffer *pbuffer,
DeserializableControl *pflusher);
private:
T value;
};
template<typename T>
BasePVScalar<T>::BasePVScalar(PVStructure *parent,ScalarConstPtr scalar)
: PVScalarValue<T>(parent,scalar),value(0)
{}
//Note: '0' is a suitable default for all POD types (not String)
template<typename T>
BasePVScalar<T>::~BasePVScalar() {}
template<typename T>
T BasePVScalar<T>::get() { return value;}
template<typename T>
void BasePVScalar<T>::put(T val){value = val;}
template<typename T>
void BasePVScalar<T>::serialize(ByteBuffer *pbuffer,
SerializableControl *pflusher) const {
pflusher->ensureBuffer(sizeof(T));
pbuffer->put<T>(value);
}
template<typename T>
void BasePVScalar<T>::deserialize(ByteBuffer *pbuffer,
DeserializableControl *pflusher)
{
pflusher->ensureData(sizeof(T));
value = pbuffer->get<T>();
}
typedef BasePVScalar<bool> BasePVBoolean;
typedef BasePVScalar<int8> BasePVByte;
typedef BasePVScalar<int16> BasePVShort;
typedef BasePVScalar<int32> BasePVInt;
typedef BasePVScalar<int64> BasePVLong;
typedef BasePVScalar<float> BasePVFloat;
typedef BasePVScalar<double> BasePVDouble;
// BasePVString is special case, since it implements SerializableArray
class BasePVString : public PVString {
public:
typedef String value_type;
typedef String* pointer;
typedef const String* const_pointer;
BasePVString(PVStructure *parent,ScalarConstPtr scalar);
virtual ~BasePVString();
virtual String get();
virtual void put(String val);
virtual void serialize(ByteBuffer *pbuffer,
SerializableControl *pflusher) const;
virtual void deserialize(ByteBuffer *pbuffer,
DeserializableControl *pflusher);
virtual void serialize(ByteBuffer *pbuffer,
SerializableControl *pflusher, int offset, int count) const;
private:
String value;
};
BasePVString::BasePVString(PVStructure *parent,ScalarConstPtr scalar)
: PVString(parent,scalar),value()
{}
BasePVString::~BasePVString() {}
String BasePVString::get() { return value;}
void BasePVString::put(String val){value = val;}
void BasePVString::serialize(ByteBuffer *pbuffer,
SerializableControl *pflusher) const
{
SerializeHelper::serializeString(value, pbuffer, pflusher);
}
void BasePVString::deserialize(ByteBuffer *pbuffer,
DeserializableControl *pflusher)
{
value = SerializeHelper::deserializeString(pbuffer, pflusher);
}
void BasePVString::serialize(ByteBuffer *pbuffer,
SerializableControl *pflusher, int offset, int count) const
{
// check bounds
const int length = /*(value == null) ? 0 :*/ value.length();
if (offset < 0) offset = 0;
else if (offset > length) offset = length;
if (count < 0) count = length;
const int maxCount = length - offset;
if (count > maxCount)
count = maxCount;
// write
SerializeHelper::serializeSubstring(value, offset, count, pbuffer, pflusher);
}
/** Default storage for arrays
*/
template<typename T>
class DefaultPVArray : public PVValueArray<T> {
public:
typedef T value_type;
typedef T* pointer;
typedef const T* const_pointer;
DefaultPVArray(PVStructure *parent,ScalarArrayConstPtr scalarArray);
virtual ~DefaultPVArray();
virtual void setCapacity(int capacity);
virtual int get(int offset, int length, PVArrayData<T> *data) ;
virtual int put(int offset,int length, pointer from,
int fromOffset);
virtual void shareData(pointer value,int capacity,int length);
// from Serializable
virtual void serialize(ByteBuffer *pbuffer,SerializableControl *pflusher) const;
virtual void deserialize(ByteBuffer *pbuffer,DeserializableControl *pflusher);
virtual void serialize(ByteBuffer *pbuffer,
SerializableControl *pflusher, int offset, int count) const;
private:
pointer value;
};
template<typename T>
DefaultPVArray<T>::DefaultPVArray(PVStructure *parent,
ScalarArrayConstPtr scalarArray)
: PVValueArray<T>(parent,scalarArray),value(new T[0])
{ }
template<typename T>
DefaultPVArray<T>::~DefaultPVArray()
{
delete[] value;
}
template<typename T>
void DefaultPVArray<T>::setCapacity(int capacity)
{
if(PVArray::getCapacity()==capacity) return;
if(!PVArray::isCapacityMutable()) {
std::string message("not capacityMutable");
PVField::message(message, errorMessage);
return;
}
int length = PVArray::getLength();
if(length>capacity) length = capacity;
T *newValue = new T[capacity];
for(int i=0; i<length; i++) newValue[i] = value[i];
delete[]value;
value = newValue;
PVArray::setCapacityLength(capacity,length);
}
template<typename T>
int DefaultPVArray<T>::get(int offset, int len, PVArrayData<T> *data)
{
int n = len;
int length = this->getLength();
if(offset+len > length) {
n = length-offset;
if(n<0) n = 0;
}
data->data = value;
data->offset = offset;
return n;
}
template<typename T>
int DefaultPVArray<T>::put(int offset,int len,
pointer from,int fromOffset)
{
if(PVField::isImmutable()) {
PVField::message("field is immutable",errorMessage);
return 0;
}
if(from==value) return len;
if(len<1) return 0;
int length = this->getLength();
int capacity = this->getCapacity();
if(offset+len > length) {
int newlength = offset + len;
if(newlength>capacity) {
setCapacity(newlength);
newlength = this->getCapacity();
len = newlength - offset;
if(len<=0) return 0;
}
length = newlength;
}
for(int i=0;i<len;i++) {
value[i+offset] = from[i+fromOffset];
}
this->setLength(length);
this->postPut();
return len;
}
template<typename T>
void DefaultPVArray<T>::shareData(pointer shareValue,int capacity,int length)
{
delete[] value;
value = shareValue;
PVArray::setCapacityLength(capacity,length);
}
template<typename T>
void DefaultPVArray<T>::serialize(ByteBuffer *pbuffer,
SerializableControl *pflusher) const {
serialize(pbuffer, pflusher, 0, this->getLength());
}
template<typename T>
void DefaultPVArray<T>::deserialize(ByteBuffer *pbuffer,
DeserializableControl *pcontrol) {
int size = SerializeHelper::readSize(pbuffer, pcontrol);
// if (size>0) { pcontrol->ensureData(sizeof(T)-1); pbuffer->align(sizeof(T)); }
if(size>=0) {
// prepare array, if necessary
if(size>this->getCapacity()) this->setCapacity(size);
// retrieve value from the buffer
int i = 0;
while(true) {
/*
int maxIndex = std::min(size-i, (int)(pbuffer->getRemaining()/sizeof(T)))+i;
for(; i<maxIndex; i++)
value[i] = pbuffer->get<T>();
*/
int maxCount = std::min(size-i, (int)(pbuffer->getRemaining()/sizeof(T)));
pbuffer->getArray<T>(&value[i], maxCount);
i += maxCount;
if(i<size)
pcontrol->ensureData(sizeof(T)); // this is not OK since can exceen max local buffer (size-i)*sizeof(T));
else
break;
}
// set new length
this->setLength(size);
PVField::postPut();
}
// TODO null arrays (size == -1) not supported
}
template<typename T>
void DefaultPVArray<T>::serialize(ByteBuffer *pbuffer,
SerializableControl *pflusher, int offset, int count) const {
// cache
int length = this->getLength();
// check bounds
if(offset<0)
offset = 0;
else if(offset>length) offset = length;
if(count<0) count = length;
int maxCount = length-offset;
if(count>maxCount) count = maxCount;
// write
SerializeHelper::writeSize(count, pbuffer, pflusher);
//if (count == 0) return; pcontrol->ensureData(sizeof(T)-1); pbuffer->align(sizeof(T));
int end = offset+count;
int i = offset;
while(true) {
/*
int maxIndex = std::min<int>(end-i, (int)(pbuffer->getRemaining()/sizeof(T)))+i;
for(; i<maxIndex; i++)
pbuffer->put<T>(value[i]);
*/
int maxCount = std::min<int>(end-i, (int)(pbuffer->getRemaining()/sizeof(T)));
pbuffer->putArray<T>(&value[i], maxCount);
i += maxCount;
if(i<end)
pflusher->flushSerializeBuffer();
else
break;
}
}
// specializations for String
template<>
void DefaultPVArray<String>::deserialize(ByteBuffer *pbuffer,
DeserializableControl *pcontrol) {
int size = SerializeHelper::readSize(pbuffer, pcontrol);
if(size>=0) {
// prepare array, if necessary
if(size>getCapacity()) setCapacity(size);
// retrieve value from the buffer
for(int i = 0; i<size; i++)
value[i] = SerializeHelper::deserializeString(pbuffer,
pcontrol);
// set new length
setLength(size);
postPut();
}
// TODO null arrays (size == -1) not supported
}
template<>
void DefaultPVArray<String>::serialize(ByteBuffer *pbuffer,
SerializableControl *pflusher, int offset, int count) const {
int length = getLength();
// check bounds
if(offset<0)
offset = 0;
else if(offset>length) offset = length;
if(count<0) count = length;
int maxCount = length-offset;
if(count>maxCount) count = maxCount;
// write
SerializeHelper::writeSize(count, pbuffer, pflusher);
int end = offset+count;
for(int i = offset; i<end; i++)
SerializeHelper::serializeString(value[i], pbuffer, pflusher);
}
typedef DefaultPVArray<bool> DefaultPVBooleanArray;
typedef DefaultPVArray<int8> BasePVByteArray;
typedef DefaultPVArray<int16> BasePVShortArray;
typedef DefaultPVArray<int32> BasePVIntArray;
typedef DefaultPVArray<int64> BasePVLongArray;
typedef DefaultPVArray<float> BasePVFloatArray;
typedef DefaultPVArray<double> BasePVDoubleArray;
typedef DefaultPVArray<String> BasePVStringArray;
// Factory
PVDataCreate::PVDataCreate(){ }
PVField *PVDataCreate::createPVField(PVStructure *parent,
FieldConstPtr field)
{
switch(field->getType()) {
case scalar: {
ScalarConstPtr xx = static_pointer_cast<const Scalar>(field);
return createPVScalar(parent,xx);
}
case scalarArray: {
ScalarArrayConstPtr xx = static_pointer_cast<const ScalarArray>(field);
return (PVField *)createPVScalarArray(parent,xx);
}
case structure: {
StructureConstPtr xx = static_pointer_cast<const Structure>(field);
return (PVField *)createPVStructure(parent,xx);
}
case structureArray: {
StructureArrayConstPtr xx = static_pointer_cast<const StructureArray>(field);
return createPVStructureArray(parent,xx);
}
}
String message("PVDataCreate::createPVField should never get here");
throw std::logic_error(message);
}
PVField *PVDataCreate::createPVField(PVStructure *parent,
String fieldName,PVField * fieldToClone)
{
switch(fieldToClone->getField()->getType()) {
case scalar:
return createPVScalar(parent,fieldName,(PVScalar*)fieldToClone);
case scalarArray:
return (PVField *)createPVScalarArray(parent,fieldName,
(PVScalarArray *)fieldToClone);
case structure:
return (PVField *)createPVStructure(parent,fieldName,
(PVStructure *)fieldToClone);
case structureArray:
String message(
"PVDataCreate::createPVField structureArray not valid fieldToClone");
throw std::invalid_argument(message);
}
String message("PVDataCreate::createPVField should never get here");
throw std::logic_error(message);
}
PVScalar *PVDataCreate::createPVScalar(PVStructure *parent,ScalarConstPtr scalar)
{
ScalarType scalarType = scalar->getScalarType();
switch(scalarType) {
case pvBoolean:
return new BasePVBoolean(parent,scalar);
case pvByte:
return new BasePVByte(parent,scalar);
case pvShort:
return new BasePVShort(parent,scalar);
case pvInt:
return new BasePVInt(parent,scalar);
case pvLong:
return new BasePVLong(parent,scalar);
case pvFloat:
return new BasePVFloat(parent,scalar);
case pvDouble:
return new BasePVDouble(parent,scalar);
case pvString:
return new BasePVString(parent,scalar);
}
String message("PVDataCreate::createPVScalar should never get here");
throw std::logic_error(message);
}
PVScalar *PVDataCreate::createPVScalar(PVStructure *parent,
String fieldName,ScalarType scalarType)
{
ScalarConstPtr scalar = fieldCreate->createScalar(fieldName,scalarType);
return createPVScalar(parent,scalar);
}
PVScalar *PVDataCreate::createPVScalar(PVStructure *parent,
String fieldName,PVScalar * scalarToClone)
{
PVScalar *pvScalar = createPVScalar(parent,fieldName,
scalarToClone->getScalar()->getScalarType());
convert->copyScalar(scalarToClone, pvScalar);
PVAuxInfo *from = scalarToClone->getPVAuxInfo();
PVAuxInfo *to = pvScalar->getPVAuxInfo();
int numberInfo = from->getNumberInfo();
for(int i=0; i<numberInfo; i++) {
PVScalar *pvFrom = from->getInfo(i);
ScalarConstPtr scalar = pvFrom->getScalar();
PVScalar *pvTo = to->createInfo(scalar->getFieldName(),scalar->getScalarType());
convert->copyScalar(pvFrom,pvTo);
}
return pvScalar;
}
PVScalarArray *PVDataCreate::createPVScalarArray(PVStructure *parent,
ScalarArrayConstPtr scalarArray)
{
switch(scalarArray->getElementType()) {
case pvBoolean:
return new DefaultPVBooleanArray(parent,scalarArray);
case pvByte:
return new BasePVByteArray(parent,scalarArray);
case pvShort:
return new BasePVShortArray(parent,scalarArray);
case pvInt:
return new BasePVIntArray(parent,scalarArray);
case pvLong:
return new BasePVLongArray(parent,scalarArray);
case pvFloat:
return new BasePVFloatArray(parent,scalarArray);
case pvDouble:
return new BasePVDoubleArray(parent,scalarArray);
case pvString:
return new BasePVStringArray(parent,scalarArray);
}
String message("PVDataCreate::createPVScalarArray should never get here");
throw std::logic_error(message);
}
PVScalarArray *PVDataCreate::createPVScalarArray(PVStructure *parent,
String fieldName,ScalarType elementType)
{
return createPVScalarArray(parent,
fieldCreate->createScalarArray(fieldName, elementType));
}
PVScalarArray *PVDataCreate::createPVScalarArray(PVStructure *parent,
String fieldName,PVScalarArray * arrayToClone)
{
PVScalarArray *pvArray = createPVScalarArray(parent,fieldName,
arrayToClone->getScalarArray()->getElementType());
convert->copyScalarArray(arrayToClone,0, pvArray,0,arrayToClone->getLength());
PVAuxInfo *from = arrayToClone->getPVAuxInfo();
PVAuxInfo *to = pvArray->getPVAuxInfo();
int numberInfo = from->getNumberInfo();
for(int i=0; i<numberInfo; i++) {
PVScalar *pvFrom = from->getInfo(i);
ScalarConstPtr scalar = pvFrom->getScalar();
PVScalar *pvTo = to->createInfo(scalar->getFieldName(),scalar->getScalarType());
convert->copyScalar(pvFrom,pvTo);
}
return pvArray;
}
PVStructureArray *PVDataCreate::createPVStructureArray(PVStructure *parent,
StructureArrayConstPtr structureArray)
{
return new BasePVStructureArray(parent,structureArray);
}
PVStructure *PVDataCreate::createPVStructure(PVStructure *parent,
StructureConstPtr structure)
{
PVStructure *pvStructure = new PVStructure(parent,structure);
return pvStructure;
}
PVStructure *PVDataCreate::createPVStructure(PVStructure *parent,
String fieldName,int numberFields,FieldConstPtrArray fields)
{
StructureConstPtr structure = fieldCreate->createStructure(
fieldName,numberFields, fields);
return new PVStructure(parent,structure);
}
PVStructure *PVDataCreate::createPVStructure(PVStructure *parent,
String fieldName,int numberFields,PVFieldPtrArray pvFields)
{
FieldConstPtrArray fields = new FieldConstPtr[numberFields];
for(int i=0; i<numberFields;i++) {
fields[i] = pvFields[i]->getField();
}
StructureConstPtr structure = fieldCreate->createStructure(
fieldName,numberFields,fields);
PVStructure *pvStructure = new PVStructure(parent,structure,pvFields);
return pvStructure;
}
PVStructure *PVDataCreate::createPVStructure(PVStructure *parent,
String fieldName,PVStructure *structToClone)
{
FieldConstPtrArray fields = 0;
int numberFields = 0;
PVStructure *pvStructure = 0;;
if(structToClone==0) {
fields = new FieldConstPtr[0];
StructureConstPtr structure = fieldCreate->createStructure(
fieldName,numberFields,fields);
pvStructure = new PVStructure(parent,structure);
} else {
StructureConstPtr structure = structToClone->getStructure();
pvStructure = new PVStructure(parent,structure);
convert->copyStructure(structToClone,pvStructure);
}
return pvStructure;
}
PVDataCreate * getPVDataCreate() {
static Mutex mutex;
Lock xx(mutex);
if(pvDataCreate==0){
pvDataCreate = new PVDataCreate();
convert = getConvert();
fieldCreate = getFieldCreate();
}
return pvDataCreate;
}
}}

View File

@@ -1,255 +0,0 @@
/*PVField.cpp*/
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvDataCPP is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
#include <cstddef>
#include <cstdlib>
#include <string>
#include <cstdio>
#include <pv/lock.h>
#include <pv/pvData.h>
#include <pv/factory.h>
#include <pv/convert.h>
#include <pv/CDRMonitor.h>
using std::tr1::const_pointer_cast;
namespace epics { namespace pvData {
static String notImplemented("not implemented");
PVDATA_REFCOUNT_MONITOR_DEFINE(pvField);
class PVFieldPvt {
public:
PVFieldPvt(PVStructure *parent,FieldConstPtr field);
~PVFieldPvt();
PVStructure *parent;
FieldConstPtr field;
int fieldOffset;
int nextFieldOffset;
PVAuxInfo *pvAuxInfo;
bool immutable;
Requester *requester;
PostHandler *postHandler;
Convert *convert;
};
PVFieldPvt::PVFieldPvt(PVStructure *parent,FieldConstPtr field)
: parent(parent),field(field),
fieldOffset(0), nextFieldOffset(0),
pvAuxInfo(0),
immutable(false),requester(0),postHandler(0),
convert(getConvert())
{
}
PVFieldPvt::~PVFieldPvt()
{
if(pvAuxInfo!=0) delete pvAuxInfo;
}
PVField::PVField(PVStructure *parent,FieldConstPtr field)
: pImpl(new PVFieldPvt(parent,field))
{
PVDATA_REFCOUNT_MONITOR_CONSTRUCT(pvField);
}
PVField::~PVField()
{
PVDATA_REFCOUNT_MONITOR_DESTRUCT(pvField);
delete pImpl;
}
void PVField::message(String fieldName,String message,MessageType messageType)
{
if(pImpl->parent!=0) {
String parentName = pImpl->parent->getField()->getFieldName();
if(parentName.length()>0) {
fieldName = parentName + "." + fieldName;
}
pImpl->parent->message(fieldName,message,messageType);
return;
}
if(pImpl->requester) {
String mess = fieldName + " " + message;
pImpl->requester->message(mess,messageType);
} else {
printf("%s %s %s\n",
messageTypeName[messageType].c_str(),
fieldName.c_str(),
message.c_str());
}
}
void PVField::message(String message,MessageType messageType)
{
PVField::message(pImpl->field->getFieldName(),message,messageType);
}
void PVField::setRequester(Requester *requester)
{
if(pImpl->parent!=0) {
throw std::logic_error(String(
"PVField::setRequester only legal for top level structure"));
}
if(pImpl->requester!=0) {
if(pImpl->requester==requester) return;
throw std::logic_error(String(
"PVField::setRequester requester is already present"));
}
pImpl->requester = requester;
}
int PVField::getFieldOffset()
{
if(pImpl->nextFieldOffset==0) computeOffset(this);
return pImpl->fieldOffset;
}
int PVField::getNextFieldOffset()
{
if(pImpl->nextFieldOffset==0) computeOffset(this);
return pImpl->nextFieldOffset;
}
int PVField::getNumberFields()
{
if(pImpl->nextFieldOffset==0) computeOffset(this);
return (pImpl->nextFieldOffset - pImpl->fieldOffset);
}
PVAuxInfo * PVField::getPVAuxInfo(){
if(pImpl->pvAuxInfo==0) {
pImpl->pvAuxInfo = new PVAuxInfo(this);
}
return pImpl->pvAuxInfo;
}
bool PVField::isImmutable() {return pImpl->immutable;}
void PVField::setImmutable() {pImpl->immutable = true;}
FieldConstPtr PVField::getField() {return pImpl->field;}
PVStructure * PVField::getParent() {return pImpl->parent;}
bool PVField::renameField(String newName)
{
if(pImpl->parent!=0) {
StructureConstPtr structure = pImpl->parent->getStructure();
int index = structure->getFieldIndex(newName);
if(index>=0) return false;
}
Field::shared_pointer field(const_pointer_cast<Field>(pImpl->field));
field->renameField(newName);
return true;
}
void PVField::postPut()
{
if(pImpl->postHandler!=0) pImpl->postHandler->postPut();
}
void PVField::setPostHandler(PostHandler *postHandler)
{
if(pImpl->postHandler!=0) {
if(postHandler==pImpl->postHandler) return;
String message(
"PVField::setPostHandler a postHandler is already registered");
throw std::logic_error(message);
}
pImpl->postHandler = postHandler;
}
void PVField::setParent(PVStructure * parent)
{
pImpl->parent = parent;
}
bool PVField::equals(PVField &pv)
{
return pImpl->convert->equals(*this,pv);
}
void PVField::toString(StringBuilder buf) {toString(buf,0);}
void PVField::toString(StringBuilder buf,int indentLevel)
{
pImpl->convert->getString(buf,this,indentLevel);
if(pImpl->pvAuxInfo==0) return;
pImpl->pvAuxInfo->toString(buf,indentLevel);
}
void PVField::computeOffset(PVField * pvField) {
PVStructure *pvTop = pvField->getParent();
if(pvTop==0) {
if(pvField->getField()->getType()!=structure) {
pvField->pImpl->fieldOffset = 0;
pvField->pImpl->nextFieldOffset = 1;
return;
}
pvTop = static_cast<PVStructure *>(pvField);
} else {
while(pvTop->getParent()!=0) pvTop = pvTop->getParent();
}
int offset = 0;
int nextOffset = 1;
PVFieldPtrArray pvFields = pvTop->getPVFields();
for(int i=0; i < pvTop->getStructure()->getNumberFields(); i++) {
offset = nextOffset;
PVField *pvField = pvFields[i];
FieldConstPtr field = pvField->getField();
switch(field->getType()) {
case scalar:
case scalarArray:
case structureArray:{
nextOffset++;
pvField->pImpl->fieldOffset = offset;
pvField->pImpl->nextFieldOffset = nextOffset;
break;
}
case structure: {
pvField->computeOffset(pvField,offset);
nextOffset = pvField->getNextFieldOffset();
}
}
}
PVField *top = (PVField *)pvTop;
top->pImpl->fieldOffset = 0;
top->pImpl->nextFieldOffset = nextOffset;
}
void PVField::computeOffset(PVField * pvField,int offset) {
int beginOffset = offset;
int nextOffset = offset + 1;
PVStructure *pvStructure = static_cast<PVStructure *>(pvField);
PVFieldPtrArray pvFields = pvStructure->getPVFields();
for(int i=0; i < pvStructure->getStructure()->getNumberFields(); i++) {
offset = nextOffset;
PVField *pvSubField = pvFields[i];
FieldConstPtr field = pvSubField->getField();
switch(field->getType()) {
case scalar:
case scalarArray:
case structureArray: {
nextOffset++;
pvSubField->pImpl->fieldOffset = offset;
pvSubField->pImpl->nextFieldOffset = nextOffset;
break;
}
case structure: {
pvSubField->computeOffset(pvSubField,offset);
nextOffset = pvSubField->getNextFieldOffset();
}
}
}
pvField->pImpl->fieldOffset = beginOffset;
pvField->pImpl->nextFieldOffset = nextOffset;
}
}}

View File

@@ -1,28 +0,0 @@
/*PVScalar.cpp*/
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvDataCPP is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
#include <cstddef>
#include <cstdlib>
#include <string>
#include <cstdio>
#include <pv/pvData.h>
#include <pv/factory.h>
using std::tr1::static_pointer_cast;
namespace epics { namespace pvData {
PVScalar::~PVScalar() {}
PVScalar::PVScalar(PVStructure *parent,ScalarConstPtr scalar)
: PVField(parent,scalar) {}
ScalarConstPtr PVScalar::getScalar()
{
return static_pointer_cast<const Scalar>(PVField::getField());
}
}}

View File

@@ -1,29 +0,0 @@
/*PVScalarArray.cpp*/
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvDataCPP is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
#include <cstddef>
#include <cstdlib>
#include <string>
#include <cstdio>
#include <pv/pvData.h>
#include <pv/factory.h>
using std::tr1::static_pointer_cast;using std::tr1::static_pointer_cast;
namespace epics { namespace pvData {
PVScalarArray::~PVScalarArray() {}
PVScalarArray::PVScalarArray(PVStructure *parent,
ScalarArrayConstPtr scalarArray)
: PVArray(parent,scalarArray) {}
ScalarArrayConstPtr PVScalarArray::getScalarArray()
{
return static_pointer_cast<const ScalarArray>(PVField::getField());
}
}}

View File

@@ -1,567 +0,0 @@
/*PVStructure.cpp*/
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvDataCPP is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
#include <cstddef>
#include <cstdlib>
#include <string>
#include <cstdio>
#include <vector>
#include <pv/pvData.h>
#include <pv/pvIntrospect.h>
#include <pv/convert.h>
#include <pv/factory.h>
#include <pv/bitSet.h>
using std::tr1::static_pointer_cast;
using std::tr1::const_pointer_cast;
namespace epics { namespace pvData {
class PVStructurePvt {
public:
PVStructurePvt();
~PVStructurePvt();
int numberFields;
PVFieldPtrArray pvFields;
String extendsStructureName;
};
PVStructurePvt::PVStructurePvt()
: numberFields(0), pvFields(0),extendsStructureName("")
{
}
PVStructurePvt::~PVStructurePvt()
{
for(int i=0; i<numberFields; i++) {
delete pvFields[i];
}
if (pvFields) delete[] pvFields;
}
static PVField *findSubField(String fieldName,PVStructure *pvStructure);
PVStructure::PVStructure(PVStructure *parent,StructureConstPtr structurePtr)
: PVField(parent,structurePtr),pImpl(new PVStructurePvt())
{
int numberFields = structurePtr->getNumberFields();
FieldConstPtrArray fields = structurePtr->getFields();
pImpl->numberFields = numberFields;
pImpl->pvFields = new PVFieldPtr[numberFields];
PVFieldPtrArray pvFields = pImpl->pvFields;
PVDataCreate *pvDataCreate = getPVDataCreate();
for(int i=0; i<numberFields; i++) {
pvFields[i] = pvDataCreate->createPVField(this,fields[i]);
}
}
PVStructure::PVStructure(PVStructure *parent,StructureConstPtr structurePtr,
PVFieldPtrArray pvFields
)
: PVField(parent,structurePtr),pImpl(new PVStructurePvt())
{
int numberFields = structurePtr->getNumberFields();
pImpl->numberFields = numberFields;
pImpl->pvFields = pvFields;
for(int i=0; i<numberFields; i++) {
PVField *pvField = pvFields[i];
setParentPvt(pvField,this);
}
}
void PVStructure::setParentPvt(PVField *pvField,PVStructure *parent)
{
pvField->setParent(parent);
if(pvField->getField()->getType()==structure) {
PVStructure *subStructure = static_cast<PVStructure*>(pvField);
PVFieldPtr *subFields = subStructure->getPVFields();
int numberFields = subStructure->getStructure()->getNumberFields();
for(int i=0; i<numberFields; i++) {
PVField *subField = static_cast<PVField*>(subFields[i]);
setParentPvt(subField,subStructure);
}
}
}
PVStructure::~PVStructure()
{
delete pImpl;
}
StructureConstPtr PVStructure::getStructure()
{
return static_pointer_cast<const Structure>(PVField::getField());
}
PVFieldPtrArray PVStructure::getPVFields()
{
return pImpl->pvFields;
}
PVFieldPtr PVStructure::getSubField(String fieldName)
{
return findSubField(fieldName,this);
}
PVFieldPtr PVStructure::getSubField(int fieldOffset)
{
if(fieldOffset<=getFieldOffset()) {
if(fieldOffset==getFieldOffset()) return this;
return 0;
}
if(fieldOffset>getNextFieldOffset()) return 0;
int numFields = pImpl->numberFields;
PVFieldPtrArray pvFields = pImpl->pvFields;
for(int i=0; i<numFields; i++) {
PVField *pvField = pvFields[i];
if(pvField->getFieldOffset()==fieldOffset) return pvField;
if(pvField->getNextFieldOffset()<=fieldOffset) continue;
if(pvField->getField()->getType()==structure) {
return ((PVStructure*)pvField)->getSubField(fieldOffset);
}
}
String message("PVStructure.getSubField: Logic error");
throw std::logic_error(message);
}
void PVStructure::appendPVField(PVFieldPtr pvField)
{
Structure::shared_pointer structure = const_pointer_cast<Structure>(getStructure());
structure->appendField(pvField->getField());
int origLength = pImpl->numberFields;
PVFieldPtrArray oldPVFields = pImpl->pvFields;
PVFieldPtrArray newPVFields = new PVFieldPtr[origLength + 1];
for(int i=0; i<origLength; i++) {
newPVFields[i] = oldPVFields[i];
}
// note that origLength IS new element
newPVFields[origLength] = pvField;
delete[] pImpl->pvFields;
pImpl->pvFields = newPVFields;
pImpl->numberFields = origLength + 1;
}
void PVStructure::appendPVFields(int numberNewFields,PVFieldPtrArray pvFields)
{
if (numberNewFields<0)
throw std::logic_error("Number of fields must be >=0");
Structure::shared_pointer structure = const_pointer_cast<Structure>(getStructure());
std::vector<FieldConstPtr> fields(numberNewFields);
for(int i=0; i<numberNewFields; i++) fields[i] = pvFields[i]->getField();
structure->appendFields(numberNewFields,&fields[0]);
int origLength = pImpl->numberFields;
PVFieldPtrArray oldPVFields = pImpl->pvFields;
int numberFields = origLength + numberNewFields;
PVFieldPtrArray newPVFields = new PVFieldPtr[numberFields];
for(int i=0; i<origLength; i++) {
newPVFields[i] = oldPVFields[i];
}
for(int i=0; i<numberNewFields; i++) {
newPVFields[i+origLength] = pvFields[i];
}
delete[] pImpl->pvFields;
pImpl->pvFields = newPVFields;
pImpl->numberFields = numberFields;
}
void PVStructure::removePVField(String fieldName)
{
PVField *pvField = getSubField(fieldName);
if(pvField==0) {
String message("removePVField ");
message += fieldName + " does not exist";
this->message(message, errorMessage);
return;
}
int origLength = pImpl->numberFields;
int newLength = origLength - 1;
PVFieldPtrArray origPVFields = pImpl->pvFields;
PVFieldPtrArray newPVFields = new PVFieldPtr[newLength];
int newIndex = 0;
int indRemove = -1;
for(int i=0; i<origLength; i++) {
if(origPVFields[i]==pvField) {
indRemove = i;
} else {
newPVFields[newIndex++] = origPVFields[i];
}
}
Structure *structure = const_cast<Structure *>(getStructure().get());
structure->removeField(indRemove);
delete origPVFields[indRemove];
delete[] pImpl->pvFields;
pImpl->pvFields = newPVFields;
pImpl->numberFields = newLength;
}
PVBoolean *PVStructure::getBooleanField(String fieldName)
{
PVField *pvField = findSubField(fieldName,this);
if(pvField==0) {
String message("fieldName ");
message += fieldName + " does not exist";
this->message(message, errorMessage);
return 0;
}
if(pvField->getField()->getType()==scalar) {
ScalarConstPtr pscalar = static_pointer_cast<const Scalar>(
pvField->getField());
if(pscalar->getScalarType()==pvBoolean) {
return (PVBoolean*)pvField;
}
}
String message("fieldName ");
message += fieldName + " does not have type boolean ";
this->message(message, errorMessage);
return 0;
}
PVByte *PVStructure::getByteField(String fieldName)
{
PVField *pvField = findSubField(fieldName,this);
if(pvField==0) {
String message("fieldName ");
message += fieldName + " does not exist";
this->message(message, errorMessage);
return 0;
}
if(pvField->getField()->getType()==scalar) {
ScalarConstPtr pscalar = static_pointer_cast<const Scalar>(
pvField->getField());
if(pscalar->getScalarType()==pvByte) {
return (PVByte*)pvField;
}
}
String message("fieldName ");
message += fieldName + " does not have type byte ";
this->message(message, errorMessage);
return 0;
}
PVShort *PVStructure::getShortField(String fieldName)
{
PVField *pvField = findSubField(fieldName,this);
if(pvField==0) {
String message("fieldName ");
message += fieldName + " does not exist";
this->message(message, errorMessage);
return 0;
}
if(pvField->getField()->getType()==scalar) {
ScalarConstPtr pscalar = static_pointer_cast<const Scalar>(
pvField->getField());
if(pscalar->getScalarType()==pvShort) {
return (PVShort*)pvField;
}
}
String message("fieldName ");
message += fieldName + " does not have type short ";
this->message(message, errorMessage);
return 0;
}
PVInt *PVStructure::getIntField(String fieldName)
{
PVField *pvField = findSubField(fieldName,this);
if(pvField==0) {
String message("fieldName ");
message += fieldName + " does not exist";
this->message(message, errorMessage);
return 0;
}
if(pvField->getField()->getType()==scalar) {
ScalarConstPtr pscalar = static_pointer_cast<const Scalar>(
pvField->getField());
if(pscalar->getScalarType()==pvInt) {
return (PVInt*)pvField;
}
}
String message("fieldName ");
message += fieldName + " does not have type int ";
this->message(message, errorMessage);
return 0;
}
PVLong *PVStructure::getLongField(String fieldName)
{
PVField *pvField = findSubField(fieldName,this);
if(pvField==0) {
String message("fieldName ");
message += fieldName + " does not exist";
this->message(message, errorMessage);
return 0;
}
if(pvField->getField()->getType()==scalar) {
ScalarConstPtr pscalar = static_pointer_cast<const Scalar>(
pvField->getField());
if(pscalar->getScalarType()==pvLong) {
return (PVLong*)pvField;
}
}
String message("fieldName ");
message += fieldName + " does not have type long ";
this->message(message, errorMessage);
return 0;
}
PVFloat *PVStructure::getFloatField(String fieldName)
{
PVField *pvField = findSubField(fieldName,this);
if(pvField==0) {
String message("fieldName ");
message += fieldName + " does not exist";
this->message(message, errorMessage);
return 0;
}
if(pvField->getField()->getType()==scalar) {
ScalarConstPtr pscalar = static_pointer_cast<const Scalar>(
pvField->getField());
if(pscalar->getScalarType()==pvFloat) {
return (PVFloat*)pvField;
}
}
String message("fieldName ");
message += fieldName + " does not have type float ";
this->message(message, errorMessage);
return 0;
}
PVDouble *PVStructure::getDoubleField(String fieldName)
{
PVField *pvField = findSubField(fieldName,this);
if(pvField==0) {
String message("fieldName ");
message += fieldName + " does not exist";
this->message(message, errorMessage);
return 0;
}
if(pvField->getField()->getType()==scalar) {
ScalarConstPtr pscalar = static_pointer_cast<const Scalar>(
pvField->getField());
if(pscalar->getScalarType()==pvDouble) {
return (PVDouble*)pvField;
}
}
String message("fieldName ");
message += fieldName + " does not have type double ";
this->message(message, errorMessage);
return 0;
}
PVString *PVStructure::getStringField(String fieldName)
{
PVField *pvField = findSubField(fieldName,this);
if(pvField==0) {
String message("fieldName ");
message += fieldName + " does not exist";
this->message(message, errorMessage);
return 0;
}
if(pvField->getField()->getType()==scalar) {
ScalarConstPtr pscalar = static_pointer_cast<const Scalar>(
pvField->getField());
if(pscalar->getScalarType()==pvString) {
return (PVString*)pvField;
}
}
String message("fieldName ");
message += fieldName + " does not have type string ";
this->message(message, errorMessage);
return 0;
}
PVStructure *PVStructure::getStructureField(String fieldName)
{
PVField *pvField = findSubField(fieldName,this);
if(pvField==0) {
String message("fieldName ");
message += fieldName + " does not exist";
this->message(message, errorMessage);
return 0;
}
if(pvField->getField()->getType()==structure) {
return((PVStructure *)pvField);
}
String message("fieldName ");
message += fieldName + " does not have type structure ";
this->message(message, errorMessage);
return 0;
}
PVScalarArray *PVStructure::getScalarArrayField(
String fieldName,ScalarType elementType)
{
PVField *pvField = findSubField(fieldName,this);
if(pvField==0) {
String message("fieldName ");
message += fieldName + " does not exist";
this->message(message, errorMessage);
return 0;
}
FieldConstPtr field = pvField->getField();
Type type = field->getType();
if(type!=scalarArray) {
String message("fieldName ");
message += fieldName + " does not have type array ";
this->message(message, errorMessage);
return 0;
}
ScalarArrayConstPtr pscalarArray
= static_pointer_cast<const ScalarArray>(pvField->getField());
if(pscalarArray->getElementType()!=elementType) {
String message("fieldName ");
message += fieldName + " is array but does not have elementType ";
ScalarTypeFunc::toString(&message,elementType);
this->message(message, errorMessage);
return 0;
}
return (PVScalarArray*)pvField;
}
PVStructureArray *PVStructure::getStructureArrayField(
String fieldName)
{
PVField *pvField = findSubField(fieldName,this);
if(pvField==0) {
String message("fieldName ");
message += fieldName + " does not exist";
this->message(message, errorMessage);
return 0;
}
if(pvField->getField()->getType()==structureArray) {
return((PVStructureArray *)pvField);
}
String message("fieldName ");
message += fieldName + " does not have type structureArray ";
this->message(message, errorMessage);
return 0;
}
String PVStructure::getExtendsStructureName()
{
return pImpl->extendsStructureName;
}
bool PVStructure::putExtendsStructureName(
String extendsStructureName)
{
if(pImpl->extendsStructureName.length()!=0) return false;
pImpl->extendsStructureName = extendsStructureName;
return true;
}
void PVStructure::serialize(ByteBuffer *pbuffer,
SerializableControl *pflusher) const {
for(int i = 0; i<pImpl->numberFields; i++)
pImpl->pvFields[i]->serialize(pbuffer, pflusher);
}
void PVStructure::deserialize(ByteBuffer *pbuffer,
DeserializableControl *pcontrol) {
for(int i = 0; i<pImpl->numberFields; i++)
pImpl->pvFields[i]->deserialize(pbuffer, pcontrol);
}
void PVStructure::serialize(ByteBuffer *pbuffer,
SerializableControl *pflusher, BitSet *pbitSet) const {
int offset = const_cast<PVStructure*>(this)->getFieldOffset();
int numberFields = const_cast<PVStructure*>(this)->getNumberFields();
int next = pbitSet->nextSetBit(offset);
// no more changes or no changes in this structure
if(next<0||next>=offset+numberFields) return;
// entire structure
if(offset==next) {
serialize(pbuffer, pflusher);
return;
}
for(int i = 0; i<pImpl->numberFields; i++) {
PVField* pvField = pImpl->pvFields[i];
offset = pvField->getFieldOffset();
numberFields = pvField->getNumberFields();
next = pbitSet->nextSetBit(offset);
// no more changes
if(next<0) return;
// no change in this pvField
if(next>=offset+numberFields) continue;
// serialize field or fields
if(numberFields==1)
pvField->serialize(pbuffer, pflusher);
else
((PVStructure*)pvField)->serialize(pbuffer, pflusher,
pbitSet);
}
}
void PVStructure::deserialize(ByteBuffer *pbuffer,
DeserializableControl *pcontrol, BitSet *pbitSet) {
int offset = getFieldOffset();
int numberFields = getNumberFields();
int next = pbitSet->nextSetBit(offset);
// no more changes or no changes in this structure
if(next<0||next>=offset+numberFields) return;
// entire structure
if(offset==next) {
deserialize(pbuffer, pcontrol);
return;
}
for(int i = 0; i<pImpl->numberFields; i++) {
PVField* pvField = pImpl->pvFields[i];
offset = pvField->getFieldOffset();
numberFields = pvField->getNumberFields();
next = pbitSet->nextSetBit(offset);
// no more changes
if(next<0) return;
// no change in this pvField
if(next>=offset+numberFields) continue;
// deserialize field or fields
if(numberFields==1)
pvField->deserialize(pbuffer, pcontrol);
else
((PVStructure*)pvField)->deserialize(pbuffer, pcontrol,
pbitSet);
}
}
static PVField *findSubField(String fieldName,PVStructure *pvStructure) {
if( fieldName.length()<1) return 0;
String::size_type index = fieldName.find('.');
String name = fieldName;
String restOfName = String();
if(index>0) {
name = fieldName.substr(0, index);
if(fieldName.length()>index) {
restOfName = fieldName.substr(index+1);
}
}
PVFieldPtrArray pvFields = pvStructure->getPVFields();
PVField *pvField = 0;
int numFields = pvStructure->getStructure()->getNumberFields();
for(int i=0; i<numFields; i++) {
PVField *pvf = pvFields[i];
int result = pvf->getField()->getFieldName().compare(name);
if(result==0) {
pvField = pvf;
break;
}
}
if(pvField==0) return 0;
if(restOfName.length()==0) return pvField;
if(pvField->getField()->getType()!=structure) return 0;
return findSubField(restOfName,(PVStructure*)pvField);
}
}}

View File

@@ -1,501 +0,0 @@
/* StandardField.cpp */
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvDataCPP is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
#include <string>
#include <cstdio>
#include <stdexcept>
#include <epicsThread.h>
#include <epicsExit.h>
#include <pv/lock.h>
#include <pv/pvIntrospect.h>
#include <pv/standardField.h>
#include <pv/CDRMonitor.h>
using std::tr1::static_pointer_cast;
namespace epics { namespace pvData {
static StandardField* standardField = 0;
static String notImplemented("not implemented");
static FieldCreate* fieldCreate = 0;
static String valueFieldName("value");
// following are preallocated structures
static StructureConstPtr alarmField;
static StructureConstPtr timeStampField;
static StructureConstPtr displayField;
static StructureConstPtr controlField;
static StructureConstPtr booleanAlarmField;
static StructureConstPtr byteAlarmField;
static StructureConstPtr shortAlarmField;
static StructureConstPtr intAlarmField;
static StructureConstPtr longAlarmField;
static StructureConstPtr floatAlarmField;
static StructureConstPtr doubleAlarmField;
static StructureConstPtr enumeratedAlarmField;
static void createAlarm() {
FieldConstPtrArray fields = new FieldConstPtr[3];
fields[0] = fieldCreate->createScalar(String("severity"),pvInt);
fields[1] = fieldCreate->createScalar(String("status"),pvInt);
fields[2] = fieldCreate->createScalar(String("message"),pvString);
alarmField = fieldCreate->createStructure(String("alarm"),3,fields);
}
static void createTimeStamp() {
FieldConstPtrArray fields = new FieldConstPtr[3];
fields[0] = fieldCreate->createScalar(String("secondsPastEpoch"),pvLong);
fields[1] = fieldCreate->createScalar(String("nanoSeconds"),pvInt);
fields[2] = fieldCreate->createScalar(String("userTag"),pvInt);
timeStampField = fieldCreate->createStructure(String("timeStamp"),3,fields);
}
static void createDisplay() {
FieldConstPtrArray limitFields = new FieldConstPtr[2];
limitFields[0] = fieldCreate->createScalar(String("low"),pvDouble);
limitFields[1] = fieldCreate->createScalar(String("high"),pvDouble);
FieldConstPtrArray fields = new FieldConstPtr[4];
fields[0] = fieldCreate->createScalar(String("description"),pvString);
fields[1] = fieldCreate->createScalar(String("format"),pvString);
fields[2] = fieldCreate->createScalar(String("units"),pvString);
fields[3] = fieldCreate->createStructure(String("limit"),2,limitFields);
displayField = fieldCreate->createStructure(String("display"),4,fields);
}
static void createControl() {
FieldConstPtrArray limitFields = new FieldConstPtr[2];
limitFields[0] = fieldCreate->createScalar(String("low"),pvDouble);
limitFields[1] = fieldCreate->createScalar(String("high"),pvDouble);
FieldConstPtrArray fields = new FieldConstPtr[2];
fields[0] = fieldCreate->createStructure(String("limit"),2,limitFields);
fields[1] = fieldCreate->createScalar(String("minStep"),pvDouble);
controlField = fieldCreate->createStructure(String("control"),2,fields);
}
static void createBooleanAlarm() {
FieldConstPtrArray fields = new FieldConstPtr[4];
fields[0] = fieldCreate->createScalar(String("active"),pvBoolean);
fields[1] = fieldCreate->createScalar(String("falseSeverity"),pvInt);
fields[2] = fieldCreate->createScalar(String("trueSeverity"),pvInt);
fields[3] = fieldCreate->createScalar(String("changeStateSeverity"),pvInt);
booleanAlarmField = fieldCreate->createStructure(String("valueAlarm"),4,fields);
}
static void createByteAlarm() {
int numFields = 10;
FieldConstPtrArray fields = new FieldConstPtr[numFields];
fields[0] = fieldCreate->createScalar(String("active"),pvBoolean);
fields[1] = fieldCreate->createScalar(String("lowAlarmLimit"),pvByte);
fields[2] = fieldCreate->createScalar(String("lowWarningLimit"),pvByte);
fields[3] = fieldCreate->createScalar(String("highWarningLimit"),pvByte);
fields[4] = fieldCreate->createScalar(String("highAlarmLimit"),pvByte);
fields[5] = fieldCreate->createScalar(String("lowAlarmSeverity"),pvInt);
fields[6] = fieldCreate->createScalar(String("lowWarningSeverity"),pvInt);
fields[7] = fieldCreate->createScalar(String("highWarningSeverity"),pvInt);
fields[8] = fieldCreate->createScalar(String("highAlarmSeverity"),pvInt);
fields[9] = fieldCreate->createScalar(String("hystersis"),pvByte);
byteAlarmField = fieldCreate->createStructure(String("valueAlarm"),numFields,fields);
}
static void createShortAlarm() {
int numFields = 10;
FieldConstPtrArray fields = new FieldConstPtr[numFields];
fields[0] = fieldCreate->createScalar(String("active"),pvBoolean);
fields[1] = fieldCreate->createScalar(String("lowAlarmLimit"),pvShort);
fields[2] = fieldCreate->createScalar(String("lowWarningLimit"),pvShort);
fields[3] = fieldCreate->createScalar(String("highWarningLimit"),pvShort);
fields[4] = fieldCreate->createScalar(String("highAlarmLimit"),pvShort);
fields[5] = fieldCreate->createScalar(String("lowAlarmSeverity"),pvInt);
fields[6] = fieldCreate->createScalar(String("lowWarningSeverity"),pvInt);
fields[7] = fieldCreate->createScalar(String("highWarningSeverity"),pvInt);
fields[8] = fieldCreate->createScalar(String("highAlarmSeverity"),pvInt);
fields[9] = fieldCreate->createScalar(String("hystersis"),pvShort);
shortAlarmField = fieldCreate->createStructure(String("valueAlarm"),numFields,fields);
}
static void createIntAlarm() {
int numFields = 10;
FieldConstPtrArray fields = new FieldConstPtr[numFields];
fields[0] = fieldCreate->createScalar(String("active"),pvBoolean);
fields[1] = fieldCreate->createScalar(String("lowAlarmLimit"),pvInt);
fields[2] = fieldCreate->createScalar(String("lowWarningLimit"),pvInt);
fields[3] = fieldCreate->createScalar(String("highWarningLimit"),pvInt);
fields[4] = fieldCreate->createScalar(String("highAlarmLimit"),pvInt);
fields[5] = fieldCreate->createScalar(String("lowAlarmSeverity"),pvInt);
fields[6] = fieldCreate->createScalar(String("lowWarningSeverity"),pvInt);
fields[7] = fieldCreate->createScalar(String("highWarningSeverity"),pvInt);
fields[8] = fieldCreate->createScalar(String("highAlarmSeverity"),pvInt);
fields[9] = fieldCreate->createScalar(String("hystersis"),pvInt);
intAlarmField = fieldCreate->createStructure(String("valueAlarm"),numFields,fields);
}
static void createLongAlarm() {
int numFields = 10;
FieldConstPtrArray fields = new FieldConstPtr[numFields];
fields[0] = fieldCreate->createScalar(String("active"),pvBoolean);
fields[1] = fieldCreate->createScalar(String("lowAlarmLimit"),pvLong);
fields[2] = fieldCreate->createScalar(String("lowWarningLimit"),pvLong);
fields[3] = fieldCreate->createScalar(String("highWarningLimit"),pvLong);
fields[4] = fieldCreate->createScalar(String("highAlarmLimit"),pvLong);
fields[5] = fieldCreate->createScalar(String("lowAlarmSeverity"),pvInt);
fields[6] = fieldCreate->createScalar(String("lowWarningSeverity"),pvInt);
fields[7] = fieldCreate->createScalar(String("highWarningSeverity"),pvInt);
fields[8] = fieldCreate->createScalar(String("highAlarmSeverity"),pvInt);
fields[9] = fieldCreate->createScalar(String("hystersis"),pvLong);
longAlarmField = fieldCreate->createStructure(String("valueAlarm"),numFields,fields);
}
static void createFloatAlarm() {
int numFields = 10;
FieldConstPtrArray fields = new FieldConstPtr[numFields];
fields[0] = fieldCreate->createScalar(String("active"),pvBoolean);
fields[1] = fieldCreate->createScalar(String("lowAlarmLimit"),pvFloat);
fields[2] = fieldCreate->createScalar(String("lowWarningLimit"),pvFloat);
fields[3] = fieldCreate->createScalar(String("highWarningLimit"),pvFloat);
fields[4] = fieldCreate->createScalar(String("highAlarmLimit"),pvFloat);
fields[5] = fieldCreate->createScalar(String("lowAlarmSeverity"),pvInt);
fields[6] = fieldCreate->createScalar(String("lowWarningSeverity"),pvInt);
fields[7] = fieldCreate->createScalar(String("highWarningSeverity"),pvInt);
fields[8] = fieldCreate->createScalar(String("highAlarmSeverity"),pvInt);
fields[9] = fieldCreate->createScalar(String("hystersis"),pvFloat);
floatAlarmField = fieldCreate->createStructure(String("valueAlarm"),numFields,fields);
}
static void createDoubleAlarm() {
int numFields = 10;
FieldConstPtrArray fields = new FieldConstPtr[numFields];
fields[0] = fieldCreate->createScalar(String("active"),pvBoolean);
fields[1] = fieldCreate->createScalar(String("lowAlarmLimit"),pvDouble);
fields[2] = fieldCreate->createScalar(String("lowWarningLimit"),pvDouble);
fields[3] = fieldCreate->createScalar(String("highWarningLimit"),pvDouble);
fields[4] = fieldCreate->createScalar(String("highAlarmLimit"),pvDouble);
fields[5] = fieldCreate->createScalar(String("lowAlarmSeverity"),pvInt);
fields[6] = fieldCreate->createScalar(String("lowWarningSeverity"),pvInt);
fields[7] = fieldCreate->createScalar(String("highWarningSeverity"),pvInt);
fields[8] = fieldCreate->createScalar(String("highAlarmSeverity"),pvInt);
fields[9] = fieldCreate->createScalar(String("hystersis"),pvDouble);
doubleAlarmField = fieldCreate->createStructure(String("valueAlarm"),numFields,fields);
}
static void createEnumeratedAlarm() {
int numFields = 3;
FieldConstPtrArray fields = new FieldConstPtr[numFields];
fields[0] = fieldCreate->createScalar(String("active"),pvBoolean);
fields[1] = fieldCreate->createScalar(String("stateSeverity"),pvInt);
fields[2] = fieldCreate->createScalar(String("changeStateSeverity"),pvInt);
enumeratedAlarmField = fieldCreate->createStructure(String("valueAlarm"),numFields,fields);
}
static StructureConstPtr createProperties(String fieldName,FieldConstPtr field,String properties) {
bool gotAlarm = false;
bool gotTimeStamp = false;
bool gotDisplay = false;
bool gotControl = false;
bool gotValueAlarm = false;
int numProp = 0;
if(properties.find("alarm")!=String::npos) { gotAlarm = true; numProp++; }
if(properties.find("timeStamp")!=String::npos) { gotTimeStamp = true; numProp++; }
if(properties.find("display")!=String::npos) { gotDisplay = true; numProp++; }
if(properties.find("control")!=String::npos) { gotControl = true; numProp++; }
if(properties.find("valueAlarm")!=String::npos) { gotValueAlarm = true; numProp++; }
StructureConstPtr valueAlarm;
Type type= field->getType();
while(gotValueAlarm) {
if(type==scalar) {
ScalarConstPtr scalar = static_pointer_cast<const Scalar>(field);
ScalarType scalarType = scalar->getScalarType();
switch(scalarType) {
case pvBoolean: valueAlarm = booleanAlarmField; break;
case pvByte: valueAlarm = byteAlarmField; break;
case pvShort: valueAlarm = shortAlarmField; break;
case pvInt: valueAlarm = intAlarmField; break;
case pvLong: valueAlarm = longAlarmField; break;
case pvFloat: valueAlarm = floatAlarmField; break;
case pvDouble: valueAlarm = doubleAlarmField; break;
default:
throw std::logic_error(String("valueAlarm property for illegal type"));
}
break;
}
if(type==structure) {
StructureConstPtr structurePtr = static_pointer_cast<const Structure>(field);
if(structurePtr->getNumberFields()==2) {
FieldConstPtrArray fields = structurePtr->getFields();
FieldConstPtr first = fields[0];
FieldConstPtr second = fields[1];
String nameFirst = first->getFieldName();
String nameSecond = second->getFieldName();
int compareFirst = nameFirst.compare("index");
int compareSecond = nameSecond.compare("choices");
if(compareFirst==0 && compareSecond==0) {
if(first->getType()==scalar
&& second->getType()==scalarArray) {
ScalarConstPtr scalarFirst = static_pointer_cast<const Scalar>(first);
ScalarArrayConstPtr scalarArraySecond =
static_pointer_cast<const ScalarArray>(second);
if(scalarFirst->getScalarType()==pvInt
&& scalarArraySecond->getElementType()==pvString) {
valueAlarm = enumeratedAlarmField;
break;
}
}
}
}
}
throw std::logic_error(String("valueAlarm property for illegal type"));
}
int numFields = numProp+1;
FieldConstPtrArray fields = new FieldConstPtr[numFields];
int next = 0;
fields[next++] = field;
if(gotAlarm) {fields[next++] = alarmField;}
if(gotTimeStamp) {fields[next++] = timeStampField;}
if(gotDisplay) {fields[next++] = displayField;}
if(gotControl) {fields[next++] = controlField;}
if(gotValueAlarm) {fields[next++] = valueAlarm;}
return fieldCreate->createStructure(fieldName,numFields,fields);
}
ScalarConstPtr StandardField::scalar(String fieldName,ScalarType type)
{
return fieldCreate->createScalar(fieldName,type);
}
StructureConstPtr StandardField::scalar(
String fieldName,ScalarType type,String properties)
{
ScalarConstPtr field = fieldCreate->createScalar(valueFieldName,type);
return createProperties(fieldName,field,properties);
}
ScalarArrayConstPtr StandardField::scalarArray(
String fieldName,ScalarType elementType)
{
return fieldCreate->createScalarArray(fieldName,elementType);
}
StructureConstPtr StandardField::scalarArray(
String fieldName,ScalarType elementType, String properties)
{
ScalarArrayConstPtr field = fieldCreate->createScalarArray(
valueFieldName,elementType);
return createProperties(fieldName,field,properties);
}
StructureArrayConstPtr StandardField::structureArray(
String fieldName,StructureConstPtr structure)
{
return fieldCreate->createStructureArray(fieldName,structure);
}
StructureConstPtr StandardField::structureArray(
String fieldName,StructureConstPtr structure,String properties)
{
StructureArrayConstPtr field = fieldCreate->createStructureArray(
valueFieldName,structure);
return createProperties(fieldName,field,properties);
}
StructureConstPtr StandardField::structure(
String fieldName,int numFields,FieldConstPtrArray fields)
{
return fieldCreate->createStructure(fieldName,numFields,fields);
}
StructureConstPtr StandardField::enumerated(String fieldName)
{
FieldConstPtrArray fields = new FieldConstPtr[2];
fields[0] = fieldCreate->createScalar(String("index"),pvInt);
fields[1] = fieldCreate->createScalarArray(String("choices"),pvString);
return fieldCreate->createStructure(fieldName,2,fields);
}
StructureConstPtr StandardField::enumerated(
String fieldName,String properties)
{
StructureConstPtr field = standardField->enumerated(valueFieldName);
return createProperties(fieldName,field,properties);
}
ScalarConstPtr StandardField::scalarValue(ScalarType type)
{
return fieldCreate->createScalar(valueFieldName,type);
}
StructureConstPtr StandardField::scalarValue(ScalarType type,String properties)
{
ScalarConstPtr field = fieldCreate->createScalar(valueFieldName,type);
return createProperties(valueFieldName,field,properties);
}
ScalarArrayConstPtr StandardField::scalarArrayValue(ScalarType elementType)
{
return fieldCreate->createScalarArray(valueFieldName,elementType);
}
StructureConstPtr StandardField::scalarArrayValue(
ScalarType elementType, String properties)
{
ScalarArrayConstPtr field = fieldCreate->createScalarArray(
valueFieldName,elementType);
return createProperties(valueFieldName,field,properties);
}
StructureArrayConstPtr StandardField::structureArrayValue(
StructureConstPtr structure)
{
return fieldCreate->createStructureArray(valueFieldName,structure);
}
StructureConstPtr StandardField::structureArrayValue(
StructureConstPtr structure,String properties)
{
StructureArrayConstPtr field = fieldCreate->createStructureArray(
valueFieldName,structure);
return createProperties(valueFieldName,field,properties);
}
StructureConstPtr StandardField::structureValue(
int numFields,FieldConstPtrArray fields)
{
return fieldCreate->createStructure(valueFieldName,numFields,fields);
}
StructureConstPtr StandardField::enumeratedValue()
{
FieldConstPtrArray fields = new FieldConstPtr[2];
fields[0] = fieldCreate->createScalar(String("index"),pvInt);
fields[1] = fieldCreate->createScalarArray(String("choices"),pvString);
return fieldCreate->createStructure(valueFieldName,2,fields);
}
StructureConstPtr StandardField::enumeratedValue( String properties)
{
StructureConstPtr field = standardField->enumerated(valueFieldName);
return createProperties(valueFieldName,field,properties);
}
StructureConstPtr StandardField::alarm()
{
return alarmField;
}
StructureConstPtr StandardField::timeStamp()
{
return timeStampField;
}
StructureConstPtr StandardField::display()
{
return displayField;
}
StructureConstPtr StandardField::control()
{
return controlField;
}
StructureConstPtr StandardField::booleanAlarm()
{
return booleanAlarmField;
}
StructureConstPtr StandardField::byteAlarm()
{
return byteAlarmField;
}
StructureConstPtr StandardField::shortAlarm()
{
return shortAlarmField;
}
StructureConstPtr StandardField::intAlarm()
{
return intAlarmField;
}
StructureConstPtr StandardField::longAlarm()
{
return longAlarmField;
}
StructureConstPtr StandardField::floatAlarm()
{
return floatAlarmField;
}
StructureConstPtr StandardField::doubleAlarm()
{
return doubleAlarmField;
}
StructureConstPtr StandardField::enumeratedAlarm()
{
return enumeratedAlarmField;
}
void StandardField::init()
{
createAlarm();
createTimeStamp();
createDisplay();
createControl();
createBooleanAlarm();
createByteAlarm();
createShortAlarm();
createIntAlarm();
createLongAlarm();
createFloatAlarm();
createDoubleAlarm();
createEnumeratedAlarm();
}
StandardField::StandardField(){init();}
StandardField::~StandardField(){
}
static void myDeleteStatic(void*)
{
alarmField.reset();
timeStampField.reset();
displayField.reset();
controlField.reset();
booleanAlarmField.reset();
byteAlarmField.reset();
shortAlarmField.reset();
intAlarmField.reset();
longAlarmField.reset();
floatAlarmField.reset();
doubleAlarmField.reset();
enumeratedAlarmField.reset();
}
static void myInitStatic(void*)
{
standardField = new StandardField();
fieldCreate = getFieldCreate();
epicsAtExit(&myDeleteStatic,0);
}
static
epicsThreadOnceId myInitOnce = EPICS_THREAD_ONCE_INIT;
StandardField * getStandardField() {
epicsThreadOnce(&myInitOnce,&myInitStatic,0);
return standardField;
}
}}

View File

@@ -1,353 +0,0 @@
/* StandardPVField.cpp */
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvDataCPP is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
#include <string>
#include <stdexcept>
#include <epicsThread.h>
#include <epicsExit.h>
#include <pv/lock.h>
#include <pv/pvIntrospect.h>
#include <pv/pvData.h>
#include <pv/convert.h>
#include <pv/standardField.h>
#include <pv/standardPVField.h>
#include <pv/CDRMonitor.h>
namespace epics { namespace pvData {
static StandardField *standardField = 0;
static String notImplemented("not implemented");
static FieldCreate* fieldCreate = 0;
static PVDataCreate* pvDataCreate = 0;
static StandardPVField *standardPVField = 0;
static void addExtendsStructureName(PVStructure *pvStructure,String properties)
{
bool gotAlarm = false;
bool gotTimeStamp = false;
bool gotDisplay = false;
bool gotControl = false;
if(properties.find("alarm")!=String::npos) gotAlarm = true;
if(properties.find("timeStamp")!=String::npos) gotTimeStamp = true;
if(properties.find("display")!=String::npos) gotDisplay = true;
if(properties.find("control")!=String::npos) gotControl = true;
if(gotAlarm) {
PVStructure *pv = pvStructure->getStructureField(String("alarm"));
if(pv!=0) pv->putExtendsStructureName(String("alarm"));
}
if(gotTimeStamp) {
PVStructure *pv = pvStructure->getStructureField(String("timeStamp"));
if(pv!=0) pv->putExtendsStructureName(String("timeStamp"));
}
if(gotDisplay) {
PVStructure *pv = pvStructure->getStructureField(String("display"));
if(pv!=0) pv->putExtendsStructureName(String("display"));
}
if(gotControl) {
PVStructure *pv = pvStructure->getStructureField(String("control"));
if(pv!=0) pv->putExtendsStructureName(String("control"));
}
}
StandardPVField::StandardPVField(){}
StandardPVField::~StandardPVField(){}
PVScalar * StandardPVField::scalar(PVStructure *parent,
String fieldName,ScalarType type)
{
ScalarConstPtr field = standardField->scalar(fieldName,type);
return pvDataCreate->createPVScalar(parent,field);
}
PVStructure * StandardPVField::scalar(PVStructure *parent,
String fieldName,ScalarType type,String properties)
{
StructureConstPtr field = standardField->scalar(fieldName,type,properties);
PVStructure * pvStructure = pvDataCreate->createPVStructure(parent,field);
addExtendsStructureName(pvStructure,properties);
return pvStructure;
}
PVScalarArray * StandardPVField::scalarArray(PVStructure *parent,
String fieldName,ScalarType elementType)
{
ScalarArrayConstPtr field = standardField->scalarArray(
fieldName,elementType);
return pvDataCreate->createPVScalarArray(parent,field);
}
PVStructure * StandardPVField::scalarArray(PVStructure *parent,
String fieldName,ScalarType elementType, String properties)
{
StructureConstPtr field = standardField->scalarArray(
fieldName,elementType,properties);
PVStructure * pvStructure = pvDataCreate->createPVStructure(parent,field);
addExtendsStructureName(pvStructure,properties);
return pvStructure;
}
PVStructureArray * StandardPVField::structureArray(PVStructure *parent,
String fieldName,StructureConstPtr structure)
{
StructureArrayConstPtr field = standardField->structureArray(
fieldName,structure);
return pvDataCreate->createPVStructureArray(parent,field);
}
PVStructure* StandardPVField::structureArray(PVStructure *parent,
String fieldName,StructureConstPtr structure,String properties)
{
StructureConstPtr field = standardField->structureArray(
fieldName,structure,properties);
PVStructure * pvStructure = pvDataCreate->createPVStructure(parent,field);
addExtendsStructureName(pvStructure,properties);
return pvStructure;
}
PVStructure * StandardPVField::enumerated(PVStructure *parent,
String fieldName,StringArray choices,int number)
{
StructureConstPtr field = standardField->enumerated(fieldName);
PVStructure *pvStructure = pvDataCreate->createPVStructure(parent,field);
PVScalarArray *pvScalarArray = pvStructure->getScalarArrayField(
"choices",pvString);
if(pvScalarArray==0) {
throw std::logic_error(String("StandardPVField::enumerated"));
}
PVStringArray *pvChoices = static_cast<PVStringArray *>(pvScalarArray);
pvChoices->put(0,number,choices,0);
return pvStructure;
}
PVStructure * StandardPVField::enumerated(PVStructure *parent,
String fieldName,StringArray choices,int number, String properties)
{
StructureConstPtr field = standardField->enumerated(
fieldName,properties);
PVStructure *pvStructure = pvDataCreate->createPVStructure(parent,field);
addExtendsStructureName(pvStructure,properties);
PVScalarArray *pvScalarArray = pvStructure->getScalarArrayField(
fieldName += ".choices",pvString);
if(pvScalarArray==0) {
throw std::logic_error(String("StandardPVField::enumerated"));
}
PVStringArray *pvChoices = static_cast<PVStringArray *>(pvScalarArray);
pvChoices->put(0,number,choices,0);
return pvStructure;
}
PVScalar * StandardPVField::scalarValue(PVStructure *parent,
ScalarType scalarType)
{
ScalarConstPtr field = standardField->scalarValue(scalarType);
return pvDataCreate->createPVScalar(parent,field);
}
PVStructure * StandardPVField::scalarValue(PVStructure *parent,
ScalarType type,String properties)
{
StructureConstPtr field = standardField->scalarValue(type,properties);
PVStructure * pvStructure = pvDataCreate->createPVStructure(parent,field);
addExtendsStructureName(pvStructure,properties);
return pvStructure;
}
PVScalarArray * StandardPVField::scalarArrayValue(PVStructure *parent,
ScalarType elementType)
{
ScalarArrayConstPtr scalarArray =
standardField->scalarArrayValue(elementType);
return pvDataCreate->createPVScalarArray(0,scalarArray);
}
PVStructure * StandardPVField::scalarArrayValue(PVStructure *parent,
ScalarType elementType, String properties)
{
StructureConstPtr field = standardField->scalarArrayValue(
elementType,properties);
PVStructure * pvStructure = pvDataCreate->createPVStructure(parent,field);
addExtendsStructureName(pvStructure,properties);
return pvStructure;
}
PVStructureArray * StandardPVField::structureArrayValue(PVStructure *parent,
StructureConstPtr structure)
{
StructureArrayConstPtr field = standardField->structureArrayValue(
structure);
return pvDataCreate->createPVStructureArray(parent,field);
}
PVStructure * StandardPVField::structureArrayValue(PVStructure *parent,
StructureConstPtr structure,String properties)
{
StructureConstPtr field = standardField->structureArrayValue(
structure,properties);
PVStructure * pvStructure = pvDataCreate->createPVStructure(parent,field);
addExtendsStructureName(pvStructure,properties);
return pvStructure;
}
PVStructure * StandardPVField::enumeratedValue(PVStructure *parent,
StringArray choices,int number)
{
StructureConstPtr field = standardField->enumeratedValue();
PVStructure *pvStructure = pvDataCreate->createPVStructure(parent,field);
PVScalarArray *pvScalarArray = pvStructure->getScalarArrayField(
"choices",pvString);
if(pvScalarArray==0) {
throw std::logic_error(String("StandardPVField::enumerated"));
}
PVStringArray *pvChoices = static_cast<PVStringArray *>(pvScalarArray);
pvChoices->put(0,number,choices,0);
return pvStructure;
}
PVStructure * StandardPVField::enumeratedValue(PVStructure *parent,
StringArray choices, int number,String properties)
{
StructureConstPtr field = standardField->enumeratedValue( properties);
PVStructure *pvStructure = pvDataCreate->createPVStructure(parent,field);
addExtendsStructureName(pvStructure,properties);
PVScalarArray *pvScalarArray = pvStructure->getScalarArrayField(
String("value.choices"),pvString);
if(pvScalarArray==0) {
throw std::logic_error(String("StandardPVField::enumerated"));
}
PVStringArray *pvChoices = static_cast<PVStringArray *>(pvScalarArray);
pvChoices->put(0,number,choices,0);
return pvStructure;
}
PVStructure * StandardPVField::alarm(PVStructure *parent)
{
StructureConstPtr field = standardField->alarm();
return pvDataCreate->createPVStructure(parent,field);
}
PVStructure * StandardPVField::timeStamp(PVStructure *parent)
{
StructureConstPtr field = standardField->timeStamp();
return pvDataCreate->createPVStructure(parent,field);
}
PVStructure * StandardPVField::display(PVStructure *parent)
{
StructureConstPtr field = standardField->display();
return pvDataCreate->createPVStructure(parent,field);
}
PVStructure * StandardPVField::control(PVStructure *parent)
{
StructureConstPtr field = standardField->control();
return pvDataCreate->createPVStructure(parent,field);
}
PVStructure * StandardPVField::booleanAlarm(PVStructure *parent)
{
StructureConstPtr field = standardField->booleanAlarm();
return pvDataCreate->createPVStructure(parent,field);
}
PVStructure * StandardPVField::byteAlarm(PVStructure *parent)
{
StructureConstPtr field = standardField->byteAlarm();
return pvDataCreate->createPVStructure(parent,field);
}
PVStructure * StandardPVField::shortAlarm(PVStructure *parent)
{
StructureConstPtr field = standardField->shortAlarm();
return pvDataCreate->createPVStructure(parent,field);
}
PVStructure * StandardPVField::intAlarm(PVStructure *parent)
{
StructureConstPtr field = standardField->intAlarm();
return pvDataCreate->createPVStructure(parent,field);
}
PVStructure * StandardPVField::longAlarm(PVStructure *parent)
{
StructureConstPtr field = standardField->longAlarm();
return pvDataCreate->createPVStructure(parent,field);
}
PVStructure * StandardPVField::floatAlarm(PVStructure *parent)
{
StructureConstPtr field = standardField->floatAlarm();
return pvDataCreate->createPVStructure(parent,field);
}
PVStructure * StandardPVField::doubleAlarm(PVStructure *parent)
{
StructureConstPtr field = standardField->doubleAlarm();
return pvDataCreate->createPVStructure(parent,field);
}
PVStructure * StandardPVField::enumeratedAlarm(PVStructure *parent)
{
StructureConstPtr field = standardField->enumeratedAlarm();
return pvDataCreate->createPVStructure(parent,field);
}
PVStructure * StandardPVField::powerSupply(PVStructure *parent)
{
StructureConstPtr alarmField = standardField->alarm();
StructureConstPtr timeStampField = standardField->timeStamp();
StructureConstPtr voltageField = standardField->scalar(
String("voltage"),pvDouble,String("alarm"));
StructureConstPtr powerField = standardField->scalar(
String("power"),pvDouble,String("alarm"));
StructureConstPtr currentField = standardField->scalar(
String("current"),pvDouble,String("alarm"));
FieldConstPtr fields[3];
fields[0] = voltageField;
fields[1] = powerField;
fields[2] = currentField;
StructureConstPtr valueField = standardField->structureValue( 3,fields);
fields[0] = alarmField;
fields[1] = timeStampField;
fields[2] = valueField;
StructureConstPtr structureField = standardField->structureValue(3,fields);
return pvDataCreate->createPVStructure(parent,structureField);
}
class StandardPVFieldExt : public StandardPVField {
public:
StandardPVFieldExt(): StandardPVField(){};
};
static void myDeleteStatic(void*)
{
delete standardPVField;
}
static void myInitStatic(void*)
{
fieldCreate = getFieldCreate();
pvDataCreate = getPVDataCreate();
standardField = getStandardField();
standardPVField = new StandardPVFieldExt();
epicsAtExit(&myDeleteStatic, 0);
}
static
epicsThreadOnceId myInitOnce = EPICS_THREAD_ONCE_INIT;
StandardPVField * getStandardPVField() {
epicsThreadOnce(&myInitOnce, &myInitStatic, 0);
return standardPVField;
}
}}

View File

@@ -1,73 +0,0 @@
/*TypeFunc.cpp*/
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvDataCPP is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
#include <cstddef>
#include <cstdlib>
#include <string>
#include <cstdio>
#include <pv/pvIntrospect.h>
#include <pv/epicsException.h>
#include "dbDefs.h" // for NELEMENTS
namespace epics { namespace pvData {
namespace TypeFunc {
static const char* names[] = {
"scalar", "scalarArray", "structure", "structureArray",
};
const char* name(Type t) {
if (t<int(pvBoolean) || t>int(pvString))
THROW_EXCEPTION2(std::invalid_argument, "logic error unknown Type");
return names[t];
}
void toString(StringBuilder buf,const Type type) {
*buf += name(type);
}
} // namespace TypeFunc
namespace ScalarTypeFunc {
bool isInteger(ScalarType type) {
if(type>=pvByte && type<=pvLong) return true;
return false;
}
bool isNumeric(ScalarType type) {
if(type>=pvByte && type<=pvDouble) return true;
return false;
}
bool isPrimitive(ScalarType type) {
if(type>=pvBoolean && type<=pvDouble) return true;
return false;
}
static const char* names[] = {
"boolean", "byte", "short", "int", "long",
"float", "double", "string",
};
ScalarType getScalarType(String pvalue) {
for(size_t i=0; i<NELEMENTS(names); i++)
if(pvalue==names[i])
return ScalarType(i);
THROW_EXCEPTION2(std::invalid_argument, "error unknown ScalarType");
}
const char* name(ScalarType t) {
if (t<pvBoolean || t>pvString)
THROW_EXCEPTION2(std::invalid_argument, "error unknown ScalarType");
return names[t];
}
void toString(StringBuilder buf,const ScalarType scalarType) {
*buf += name(scalarType);
}
} // namespace ScalarTypeFunc
}}

View File

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

View File

@@ -1,160 +0,0 @@
/* CDRMonitor.cpp */
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvDataCPP is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
#include <stddef.h>
#include <stdlib.h>
#include <stddef.h>
#include <string.h>
#include <stdio.h>
#include <stdexcept>
#include <epicsThread.h>
#include <pv/noDefaultMethods.h>
#include <pv/lock.h>
#include <pv/pvType.h>
#include <pv/linkedList.h>
#include <pv/CDRMonitor.h>
#ifdef _WIN32
#include <BaseTsd.h>
typedef SSIZE_T ssize_t;
#endif
namespace epics { namespace pvData {
static
epicsThreadOnceId monitorInit = EPICS_THREAD_ONCE_INIT;
// Must use a pointer w/ lazy init due to lack of
// initialization order guarantees
CDRMonitor* CDRMonitor::theone = 0;
CDRMonitor&
CDRMonitor::get()
{
epicsThreadOnce(&monitorInit, &CDRMonitor::init, 0);
assert(theone);
return *theone;
}
void
CDRMonitor::init(void *)
{
//BUG: No idea how to handle allocation failure at this stage.
theone=new CDRMonitor;
}
void
CDRMonitor::destroy()
{
if (theone)
{
CDRNode *node = theone->first();
while (node)
{
CDRNode* tmp = node;
node = node->next();
delete tmp;
}
delete theone;
theone = 0;
}
}
CDRMonitor::CDRMonitor()
:firstNode(0)
{}
CDRCount
CDRMonitor::current()
{
CDRCount total;
for(CDRNode *cur=first(); !!cur; cur=cur->next())
{
total+=cur->get();
}
return total;
}
void
CDRMonitor::show(FILE *fd, bool destroy)
{
for(CDRNode *cur=first(); !!cur; cur=cur->next())
{
cur->show(fd);
}
if (destroy)
CDRMonitor::destroy();
}
void
CDRMonitor::show(std::ostream& out, bool destroy) const
{
for(CDRNode *cur=first(); !!cur; cur=cur->next())
{
cur->show(out);
}
if (destroy)
CDRMonitor::destroy();
}
void
CDRNode::show(FILE *fd)
{
Lock x(guard);
if(!current.cons && !current.dtys && !current.refs)
return;
fprintf(fd,"%s: totalConstruct %lu totalDestruct %lu",
nodeName.c_str(), (unsigned long)current.cons,
(unsigned long)current.dtys);
ssize_t alive=current.cons;
alive-=current.dtys;
if(current.refs)
fprintf(fd," totalReference %ld", current.refs);
if(alive)
fprintf(fd," ACTIVE %ld\n", (long)alive);
else
fprintf(fd,"\n");
}
void
CDRNode::show(std::ostream& out) const
{
Lock x(guard);
if(!current.cons && !current.dtys && !current.refs)
return;
out<<nodeName<<" totalConstruct "<<current.cons
<<" totalDestruct "<<current.dtys;
ssize_t alive=current.cons;
alive-=current.dtys;
if(current.refs)
out<<" totalReference "<<current.refs;
if(alive)
out<<" ACTIVE "<<alive;
out<<"\n";
}
void
onceNode(void* raw)
{
CDRNodeInstance* inst=static_cast<CDRNodeInstance*>(raw);
inst->node=new CDRNode(inst->name);
}
}} // namespace epics::pvData
std::ostream& operator<<(std::ostream& out,const epics::pvData::CDRMonitor& mon)
{
mon.show(out);
return out;
}
std::ostream& operator<<(std::ostream& out,const epics::pvData::CDRNode& node)
{
node.show(out);
return out;
}

View File

@@ -1,140 +0,0 @@
/* CDRMonitor.h */
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvDataCPP is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
#ifndef CDRMONITOR_H
#define CDRMONITOR_H
#include <ostream>
#include <cstddef>
#include <cstdlib>
#include <string>
#include <cstdio>
#include <epicsThread.h>
#include <pv/noDefaultMethods.h>
#include <pv/lock.h>
#include <pv/pvType.h>
namespace epics { namespace pvData {
//! Used to pass around snapshots
struct CDRCount { // default copy and assignment are ok
size_t cons, dtys;
long refs;
CDRCount():cons(0),dtys(0),refs(0){}
CDRCount& operator+=(const CDRCount& o)
{cons+=o.cons; dtys+=o.dtys; refs+=o.refs; return *this;}
CDRCount& operator=(size_t count) // reset counters
{cons=count; dtys=count; refs=count; return *this;}
};
class CDRNode;
//! @brief Global registrar for CDRNodes
class CDRMonitor : private NoDefaultMethods {
public:
static CDRMonitor& get();
static void destroy();
CDRNode* addNode(CDRNode& next)
{
CDRNode *ret=firstNode;
firstNode=&next;
return ret;
}
CDRCount current(); //!< current global count
CDRNode* first() const{return firstNode;}
void show(FILE*, bool destroy = false);
void show(std::ostream&, bool destroy = false) const;
private:
// Private ctor for singleton
CDRMonitor();
CDRNode *firstNode;
static CDRMonitor *theone;
static void init(void*);
};
//! Counters for Construction, Destruction, and References of one class
class CDRNode : private NoDefaultMethods {
public:
CDRNode(const String& name)
:nodeName(name)
,current()
,guard()
,nextNode(CDRMonitor::get().addNode(*this))
{}
void construct(){Lock x(guard); current.cons++;}
void destruct(){Lock x(guard); current.dtys++;}
void incRef(){Lock x(guard); current.refs++;}
void decRef(){Lock x(guard); current.refs--;}
CDRNode* next() const{return nextNode;}
CDRCount get() const{Lock x(guard); return current;}
void show(FILE*);
void show(std::ostream&) const;
private:
const String nodeName;
CDRCount current;
mutable Mutex guard;
CDRNode * const nextNode;
};
struct CDRNodeInstance
{
CDRNode *node;
epicsThreadOnceId once;
const char* const name;
};
void onceNode(void* raw);
static inline
CDRNode*
getNode(CDRNodeInstance *inst)
{
epicsThreadOnce(&inst->once,&onceNode,
static_cast<void*>(inst));
return inst->node;
}
#ifndef NDEBUG
#define PVDATA_REFCOUNT_MONITOR_DEFINE(NAME) \
static CDRNodeInstance NAME ## _node={0,EPICS_THREAD_ONCE_INIT,#NAME}
#define PVDATA_REFCOUNT_MONITOR_DESTRUCT(NAME) \
getNode(&NAME ## _node)->destruct()
#define PVDATA_REFCOUNT_MONITOR_CONSTRUCT(NAME) \
getNode(&NAME ## _node)->construct()
#define PVDATA_REFCOUNT_MONITOR_INCREF(NAME) \
getNode(&NAME ## _node)->incRef()
#define PVDATA_REFCOUNT_MONITOR_DECREF(NAME) \
getNode(&NAME ## _node)->decRef()
#else
#define PVDATA_REFCOUNT_MONITOR_DEFINE(NAME)
#define PVDATA_REFCOUNT_MONITOR_DESTRUCT(NAME)
#define PVDATA_REFCOUNT_MONITOR_CONSTRUCT(NAME)
#define PVDATA_REFCOUNT_MONITOR_INCREF(NAME)
#define PVDATA_REFCOUNT_MONITOR_DECREF(NAME)
#endif
}}
std::ostream& operator<<(std::ostream&,const epics::pvData::CDRMonitor&);
std::ostream& operator<<(std::ostream&,const epics::pvData::CDRNode&);
#endif /* CDRMONITOR_H */

View File

@@ -1,395 +0,0 @@
/* bitSet.cpp */
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvDataCPP is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
#include "string.h"
#include "stdio.h"
#include <pv/bitSet.h>
#include <pv/lock.h>
#include <pv/CDRMonitor.h>
#include <pv/serializeHelper.h>
namespace epics { namespace pvData {
PVDATA_REFCOUNT_MONITOR_DEFINE(bitSet);
BitSet::BitSet() : words(0), wordsLength(0), wordsInUse(0) {
initWords(BITS_PER_WORD);
PVDATA_REFCOUNT_MONITOR_CONSTRUCT(bitSet);
}
BitSet::BitSet(uint32 nbits) : words(0), wordsLength(0), wordsInUse(0) {
initWords(nbits);
PVDATA_REFCOUNT_MONITOR_CONSTRUCT(bitSet);
}
BitSet::~BitSet() {
delete[] words;
PVDATA_REFCOUNT_MONITOR_DESTRUCT(bitSet);
}
void BitSet::initWords(uint32 nbits) {
uint32 length = (nbits <= 0) ? 1 : wordIndex(nbits-1) + 1;
if (words) delete[] words;
words = new uint64[length];
memset(words, 0, sizeof(uint64)*length);
wordsLength = length;
}
void BitSet::recalculateWordsInUse() {
// wordsInUse is unsigned
if (wordsInUse == 0)
return;
// Traverse the bitset until a used word is found
int32 i;
for (i = (int32)wordsInUse-1; i >= 0; i--)
if (words[i] != 0)
break;
wordsInUse = i+1; // The new logical size
}
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;
}
}
void BitSet::expandTo(uint32 wordIndex) {
uint32 wordsRequired = wordIndex+1;
if (wordsInUse < wordsRequired) {
ensureCapacity(wordsRequired);
wordsInUse = wordsRequired;
}
}
void BitSet::flip(uint32 bitIndex) {
uint32 wordIdx = wordIndex(bitIndex);
expandTo(wordIdx);
words[wordIdx] ^= (((uint64)1) << (bitIndex % BITS_PER_WORD));
recalculateWordsInUse();
}
void BitSet::set(uint32 bitIndex) {
uint32 wordIdx = wordIndex(bitIndex);
expandTo(wordIdx);
words[wordIdx] |= (((uint64)1) << (bitIndex % BITS_PER_WORD));
}
void BitSet::clear(uint32 bitIndex) {
uint32 wordIdx = wordIndex(bitIndex);
if (wordIdx >= wordsInUse)
return;
words[wordIdx] &= ~(((uint64)1) << (bitIndex % BITS_PER_WORD));
recalculateWordsInUse();
}
void BitSet::set(uint32 bitIndex, bool value) {
if (value)
set(bitIndex);
else
clear(bitIndex);
}
bool BitSet::get(uint32 bitIndex) const {
uint32 wordIdx = wordIndex(bitIndex);
return ((wordIdx < wordsInUse)
&& ((words[wordIdx] & (((uint64)1) << (bitIndex % BITS_PER_WORD))) != 0));
}
void BitSet::clear() {
while (wordsInUse > 0)
words[--wordsInUse] = 0;
}
uint32 BitSet::numberOfTrailingZeros(uint64 i) {
// HD, Figure 5-14
uint32 x, y;
if (i == 0) return 64;
uint32 n = 63;
y = (uint32)i; if (y != 0) { n = n -32; x = y; } else x = (uint32)(i>>32);
y = x <<16; if (y != 0) { n = n -16; x = y; }
y = x << 8; if (y != 0) { n = n - 8; x = y; }
y = x << 4; if (y != 0) { n = n - 4; x = y; }
y = x << 2; if (y != 0) { n = n - 2; x = y; }
return n - ((x << 1) >> 31);
}
uint32 BitSet::bitCount(uint64 i) {
// HD, Figure 5-14
i = i - ((i >> 1) & 0x5555555555555555LL);
i = (i & 0x3333333333333333LL) + ((i >> 2) & 0x3333333333333333LL);
i = (i + (i >> 4)) & 0x0f0f0f0f0f0f0f0fLL;
i = i + (i >> 8);
i = i + (i >> 16);
i = i + (i >> 32);
return (uint32)(i & 0x7f);
}
int32 BitSet::nextSetBit(uint32 fromIndex) const {
uint32 u = wordIndex(fromIndex);
if (u >= wordsInUse)
return -1;
uint64 word = words[u] & (WORD_MASK << (fromIndex % BITS_PER_WORD));
while (true) {
if (word != 0)
return (u * BITS_PER_WORD) + numberOfTrailingZeros(word);
if (++u == wordsInUse)
return -1;
word = words[u];
}
}
int32 BitSet::nextClearBit(uint32 fromIndex) const {
// Neither spec nor implementation handle bitsets of maximal length.
uint32 u = wordIndex(fromIndex);
if (u >= wordsInUse)
return fromIndex;
uint64 word = ~words[u] & (WORD_MASK << (fromIndex % BITS_PER_WORD));
while (true) {
if (word != 0)
return (u * BITS_PER_WORD) + numberOfTrailingZeros(word);
if (++u == wordsInUse)
return wordsInUse * BITS_PER_WORD;
word = ~words[u];
}
}
bool BitSet::isEmpty() const {
return (wordsInUse == 0);
}
uint32 BitSet::cardinality() const {
uint32 sum = 0;
for (uint32 i = 0; i < wordsInUse; i++)
sum += bitCount(words[i]);
return sum;
}
BitSet& BitSet::operator&=(const BitSet& set) {
while (wordsInUse > set.wordsInUse)
words[--wordsInUse] = 0;
// Perform logical AND on words in common
for (uint32 i = 0; i < wordsInUse; i++)
words[i] &= set.words[i];
recalculateWordsInUse();
return *this;
}
BitSet& BitSet::operator|=(const BitSet& set) {
uint32 wordsInCommon;
if (wordsInUse < set.wordsInUse) {
wordsInCommon = wordsInUse;
//ensureCapacity(set.wordsInUse);
//wordsInUse = set.wordsInUse;
}
else
wordsInCommon = set.wordsInUse;
// Perform logical OR on words in common
uint32 i = 0;
for (; i < wordsInCommon; i++)
words[i] |= set.words[i];
// TODO what to do if BitSets are not the same size !!!
// recalculateWordsInUse() is not needed
return *this;
}
BitSet& BitSet::operator^=(const BitSet& set) {
uint32 wordsInCommon;
if (wordsInUse < set.wordsInUse) {
wordsInCommon = wordsInUse;
//ensureCapacity(set.wordsInUse);
//wordsInUse = set.wordsInUse;
}
else
wordsInCommon = set.wordsInUse;
// Perform logical XOR on words in common
uint32 i = 0;
for (; i < wordsInCommon; i++)
words[i] ^= set.words[i];
// TODO what to do if BitSets are not the same size !!!
recalculateWordsInUse();
return *this;
}
BitSet& BitSet::operator-=(const BitSet& set) {
uint32 wordsInCommon;
if (wordsInUse < set.wordsInUse) {
wordsInCommon = wordsInUse;
//ensureCapacity(set.wordsInUse);
//wordsInUse = set.wordsInUse;
}
else
wordsInCommon = set.wordsInUse;
// Perform logical (a & !b) on words in common
uint32 i = 0;
for (; i < wordsInCommon; i++)
words[i] &= ~set.words[i];
recalculateWordsInUse();
return *this;
}
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;
}
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;
ensureCapacity(inUse);
wordsInUse = inUse;
// Perform logical AND on words in common
for (uint32 i = 0; i < inUse; i++)
words[i] |= (set1.words[i] & set2.words[i]);
// recalculateWordsInUse()...
}
bool BitSet::operator==(const BitSet &set) const
{
if (this == &set)
return true;
if (wordsInUse != set.wordsInUse)
return false;
// Check words in use by both BitSets
for (uint32 i = 0; i < wordsInUse; i++)
if (words[i] != set.words[i])
return false;
return true;
}
bool BitSet::operator!=(const BitSet &set) const
{
return !(*this == set);
}
void BitSet::toString(StringBuilder buffer, int indentLevel) const
{
*buffer += '{';
int32 i = nextSetBit(0);
char tmp[30];
if (i != -1) {
sprintf(tmp,"%d",i); *buffer += tmp;
for (i = nextSetBit(i+1); i >= 0; i = nextSetBit(i+1)) {
int32 endOfRun = nextClearBit(i);
do { *buffer += ", "; sprintf(tmp,"%d",i); *buffer += tmp; } while (++i < endOfRun);
}
}
*buffer += '}';
}
void BitSet::serialize(ByteBuffer* buffer, SerializableControl* flusher) const {
uint32 n = wordsInUse;
if (n == 0) {
SerializeHelper::writeSize(0, buffer, flusher);
return;
}
uint32 len = 8 * (n-1);
for (uint64 x = words[n - 1]; x != 0; x >>= 8)
len++;
SerializeHelper::writeSize(len, buffer, flusher);
flusher->ensureBuffer(len);
for (uint32 i = 0; i < n - 1; i++)
buffer->putLong(words[i]);
for (uint64 x = words[n - 1]; x != 0; x >>= 8)
buffer->putByte((int8) (x & 0xff));
}
void BitSet::deserialize(ByteBuffer* buffer, DeserializableControl* control) {
uint32 bytes = SerializeHelper::readSize(buffer, control); // in bytes
wordsInUse = (bytes + 7) / 8;
if (wordsInUse > wordsLength)
{
if (words) delete[] words;
words = new uint64[wordsInUse];
wordsLength = wordsInUse;
}
if (wordsInUse == 0)
return;
control->ensureData(bytes);
uint32 i = 0;
uint32 longs = bytes / 8;
while (i < longs)
words[i++] = buffer->getLong();
for (uint32 j = i; j < wordsInUse; j++)
words[j] = 0;
for (uint32 remaining = (bytes - longs * 8), j = 0; j < remaining; j++)
words[i] |= (buffer->getByte() & 0xffL) << (8 * j);
}
}};

View File

@@ -1,5 +0,0 @@
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvDataCPP is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/

View File

@@ -1,850 +0,0 @@
/* byteBuffer.h */
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvDataCPP is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
#ifndef BYTEBUFFER_H
#define BYTEBUFFER_H
#include <string>
#include <pv/pvType.h>
#include <epicsEndian.h>
#include <string.h>
#include <pv/epicsException.h>
namespace epics {
namespace pvData {
/*
TODO can be used:
MS Visual C++:
You include intrin.h and call the following functions:
For 16 bit numbers:
unsigned short _byteswap_ushort(unsigned short value);
For 32 bit numbers:
unsigned long _byteswap_ulong(unsigned long value);
For 64 bit numbers:
unsigned __int64 _byteswap_uint64(unsigned __int64 value);
*/
/*
For floats and doubles it's more difficult as with plain integers as these may or not may be in the host machines byte-order.
You can get little-endian floats on big-endian machines and vice versa.
*/
#define GCC_VERSION_SINCE(major, minor, patchlevel) \
(defined(__GNUC__) && !defined(__INTEL_COMPILER) && \
((__GNUC__ > (major)) || \
(__GNUC__ == (major) && __GNUC_MINOR__ > (minor)) || \
(__GNUC__ == (major) && __GNUC_MINOR__ == (minor) && __GNUC_PATCHLEVEL__ >= (patchlevel))))
#if GCC_VERSION_SINCE(4,3,0)
#define swap32(x) __builtin_bswap32(x)
#define swap64(x) __builtin_bswap64(x)
#define __byte_swap16(x) \
(((x) >> 8) | \
((x) << 8))
static inline uint16_t
swap16(uint16_t _x)
{
return (__byte_swap16(_x));
}
#else
#define __byte_swap16(x) \
(((x) >> 8) | \
((x) << 8))
#define __byte_swap32(x) \
((((x) & 0xff000000) >> 24) | \
(((x) & 0x00ff0000) >> 8) | \
(((x) & 0x0000ff00) << 8) | \
(((x) & 0x000000ff) << 24))
#define __byte_swap64(x) \
(((x) >> 56) | \
(((x) >> 40) & 0xff00) | \
(((x) >> 24) & 0xff0000) | \
(((x) >> 8) & 0xff000000) | \
(((x) << 8) & ((uint64_t)0xff << 32)) | \
(((x) << 24) & ((uint64_t)0xff << 40)) | \
(((x) << 40) & ((uint64_t)0xff << 48)) | \
(((x) << 56)))
static inline uint16_t
swap16(uint16_t _x)
{
return (__byte_swap16(_x));
}
static inline uint32_t
swap32(uint32_t _x)
{
return (__byte_swap32(_x));
}
static inline uint64_t
swap64(uint64_t _x)
{
return (__byte_swap64(_x));
}
#endif
template<typename T>
inline T swap(T val) { return val; } // not valid
template<>
inline int16 swap(int16 val)
{
return swap16(val);
}
template<>
inline int32 swap(int32 val)
{
return swap32(val);
}
template<>
inline int64 swap(int64 val)
{
return swap64(val);
}
template<>
inline float swap(float val)
{
union {
int32 i;
float f;
} conv;
conv.f = val;
conv.i = swap32(conv.i);
return conv.f;
}
template<>
inline double swap(double val)
{
union {
int64 i;
double d;
} conv;
conv.d = val;
conv.i = swap64(conv.i);
return conv.d;
}
#define is_aligned(POINTER, BYTE_COUNT) \
(((uintptr_t)(const void *)(POINTER)) % (BYTE_COUNT) == 0)
/*template <bool ENDIANESS_SUPPORT = false,
bool UNALIGNED_ACCESS = false,
bool ADAPTIVE_ACCESS = true,
bool USE_INLINE_MEMCPY = true>*/
#define ENDIANESS_SUPPORT true
#define UNALIGNED_ACCESS true
#define ADAPTIVE_ACCESS true
#define USE_INLINE_MEMCPY true
/**
* This class implements {@code Bytebuffer} that is like the {@code java.nio.ByteBuffer}.
* <p>A {@code BitSet} is not safe for multithreaded use without
* external synchronization.
*
* Based on Java implementation.
*/
class ByteBuffer
{
public:
/**
* Constructor.
*
* @param size The number of bytes.
* @param byteOrder The byte order.
* Must be one of EPICS_BYTE_ORDER,EPICS_ENDIAN_LITTLE,EPICS_ENDIAN_BIG,
*/
ByteBuffer(uintptr_t size, int byteOrder = EPICS_BYTE_ORDER) :
_buffer(0), _size(size),
_reverseEndianess(byteOrder != EPICS_BYTE_ORDER),
_reverseFloatEndianess(byteOrder != EPICS_FLOAT_WORD_ORDER)
{
_buffer = (char*)malloc(size);
clear();
}
/**
* Destructor
*/
~ByteBuffer()
{
if (_buffer) free(_buffer);
}
/**
* Set the byte order.
*
* @param byteOrder The byte order.
* Must be one of EPICS_BYTE_ORDER,EPICS_ENDIAN_LITTLE,EPICS_ENDIAN_BIG,
*/
inline void setEndianess(int byteOrder)
{
_reverseEndianess = (byteOrder != EPICS_BYTE_ORDER);
_reverseFloatEndianess = (byteOrder != EPICS_FLOAT_WORD_ORDER);
}
/**
* Get the raw buffer data.
* @return the raw buffer data.
*/
inline const char* getBuffer()
{
return _buffer;
}
/**
* Makes a buffer ready for a new sequence of channel-read or relative put operations:
* It sets the limit to the capacity and the position to zero.
*/
inline void clear()
{
_position = _buffer;
_limit = _buffer + _size;
}
/**
* Makes a buffer ready for a new sequence of channel-write or relative get operations:
* It sets the limit to the current position and then sets the position to zero.
*/
inline void flip() {
_limit = _position;
_position = _buffer;
}
/**
* Makes a buffer ready for re-reading the data that it already contains:
* It leaves the limit unchanged and sets the position to zero.
*/
inline void rewind() {
_position = _buffer;
}
/**
* Returns the current position.
* @return The current position in the raw data.
*/
inline uintptr_t getPosition()
{
return (((uintptr_t)(const void *)_position) - ((uintptr_t)(const void *)_buffer));
}
/**
* Sets the buffer position.
* If the mark is defined and larger than the new position then it is discarded.
*
* @param pos The offset into the raw buffer.
* The new position value; must be no larger than the current limit
*/
inline void setPosition(uintptr_t pos)
{
_position = _buffer + pos;
}
/**
* Returns this buffer's limit.
*
* @return The offset into the raw buffer.
*/
inline uintptr_t getLimit()
{
return (((uintptr_t)(const void *)_limit) - ((uintptr_t)(const void *)_buffer));
}
/**
* Sets this buffer's limit.
* If the position is larger than the new limit then it is set to the new limit.s
* If the mark is defined and larger than the new limit then it is discarded.
*
* @param limit The new position value;
* must be no larger than the current limit
*/
inline void setLimit(uintptr_t limit)
{
_limit = _buffer + limit;
}
/**
* Returns the number of elements between the current position and the limit.
*
* @return The number of elements remaining in this buffer.
*/
inline uintptr_t getRemaining()
{
return (((uintptr_t)(const void *)_limit) - ((uintptr_t)(const void *)_position));
}
/**
* Returns The size, i.e. capacity of the raw data buffer in bytes.
*
* @return The size of the raw data buffer.
*/
inline uintptr_t getSize()
{
return _size;
}
/**
* Put the value into the raw buffer as a byte stream in the current byte order.
*
* @param value The value to be put into the byte buffer.
*/
template<typename T>
inline void put(T value)
{
// this avoids int8 specialization, compiler will take care if optimization, -O2 or more
if (sizeof(T) == 1)
{
*(_position++) = (int8)value;
return;
}
if (ENDIANESS_SUPPORT && reverse<T>())
{
value = swap<T>(value);
}
if (UNALIGNED_ACCESS)
{
// NOTE: some CPU handle unaligned access pretty good (e.g. x86)
*((T*)_position) = value;
_position += sizeof(T);
}
else
{
// NOTE: this check and branching does not always payoff
if (ADAPTIVE_ACCESS && is_aligned(_position, sizeof(T)))
{
*((T*)_position) = value;
_position += sizeof(T);
}
else
{
if (USE_INLINE_MEMCPY)
{
// NOTE: it turns out that this compiler can optimize this with inline code, e.g. gcc
memcpy(_position, &value, sizeof(T));
_position += sizeof(T);
}
else
{
// NOTE: compiler should optimize this and unroll the loop
for (size_t i = 0; i < sizeof(T); i++)
_position[i] = ((char*)&value)[i];
_position += sizeof(T);
}
}
}
}
/**
* Put the value into the raw buffer at the specified index as a byte stream in the current byte order.
*
* @param index Offset in the byte buffer.
* @param value The value to be put into the byte buffer.
*/
template<typename T>
inline void put(uintptr_t index, T value)
{
// this avoids int8 specialization, compiler will take care if optimization, -O2 or more
if (sizeof(T) == 1)
{
*(_buffer + index) = (int8)value;
return;
}
if (ENDIANESS_SUPPORT && reverse<T>())
{
value = swap<T>(value);
}
if (UNALIGNED_ACCESS)
{
// NOTE: some CPU handle unaligned access preety good (e.g. x86)
*((T*)(_buffer + index)) = value;
}
else
{
// NOTE: this check and branching does not always payoff
if (ADAPTIVE_ACCESS && is_aligned(_position, sizeof(T)))
{
*((T*)(_buffer + index)) = value;
}
else
{
if (USE_INLINE_MEMCPY)
{
// NOTE: it turns out that this compiler can optimize this with inline code, e.g. gcc
memcpy(_buffer + index, &value, sizeof(T));
}
else
{
// NOTE: compiler should optimize this and unroll the loop
char *p = _buffer + index;
for (size_t i = 0; i < sizeof(T); i++)
p[i] = ((char*)&value)[i];
}
}
}
}
/**
* Get the new object from the byte buffer. The item MUST have type {@code T}.
* The position is adjusted based on the type.
*
* @return The object.
*/
template<typename T>
inline T get()
{
// this avoids int8 specialization, compiler will take care if optimization, -O2 or more
if (sizeof(T) == 1)
{
return (int8)(*(_position++));
}
T value;
if (UNALIGNED_ACCESS)
{
// NOTE: some CPU handle unaligned access preety good (e.g. x86)
value = *((T*)_position);
_position += sizeof(T);
}
else
{
// NOTE: this check and branching does not always payoff
if (ADAPTIVE_ACCESS && is_aligned(_position, sizeof(T)))
{
value = *((T*)_position);
_position += sizeof(T);
}
else
{
if (USE_INLINE_MEMCPY)
{
// NOTE: it turns out that this compiler can optimize this with inline code, e.g. gcc
memcpy(&value, _position, sizeof(T));
_position += sizeof(T);
}
else
{
// NOTE: compiler should optimize this and unroll the loop
for (size_t i = 0; i < sizeof(T); i++)
((char*)&value)[i] = _position[i];
_position += sizeof(T);
}
}
}
if (ENDIANESS_SUPPORT && reverse<T>())
{
value = swap<T>(value);
}
return value;
}
/**
* Get the new object from the byte buffer at the specified index.
* The item MUST have type {@code T}.
* The position is adjusted based on the type.
*
* @param index The location in the byte buffer.
* @return The object.
*/
template<typename T>
inline T get(uintptr_t index)
{
// this avoids int8 specialization, compiler will take care if optimization, -O2 or more
if (sizeof(T) == 1)
{
return (int8)(*(_buffer + index));
}
T value;
if (UNALIGNED_ACCESS)
{
// NOTE: some CPU handle unaligned access preety good (e.g. x86)
value = *((T*)(_buffer + index));
}
else
{
// NOTE: this check and branching does not always payoff
if (ADAPTIVE_ACCESS && is_aligned(_position, sizeof(T)))
{
value = *((T*)(_buffer + index));
}
else
{
if (USE_INLINE_MEMCPY)
{
// NOTE: it turns out that this compiler can optimize this with inline code, e.g. gcc
memcpy(&value, _buffer + index, sizeof(T));
}
else
{
// NOTE: compiler should optimize this and unroll the loop
char* p = _buffer + index;
for (size_t i = 0; i < sizeof(T); i++)
((char*)&value)[i] = p[i];
}
}
}
if (ENDIANESS_SUPPORT && reverse<T>())
{
value = swap<T>(value);
}
return value;
}
/**
* Put a sub-array of bytes into the byte buffer.
* The position is increased by the count.
*
* @param src The source array.
* @param offset The starting position within src.
* @param count The number of bytes to put into the byte buffer,
*/
inline void put(const char* src, uintptr_t src_offset, uintptr_t count) {
//if(count>getRemaining()) THROW_BASE_EXCEPTION("buffer overflow");
memcpy(_position, src + src_offset, count);
_position += count;
}
/**
* Get a sub-array of bytes from the byte buffer.
* The position is increased by the count.
*
* @param dest The destination array.
* @param offset The starting position within src.
* @param count The number of bytes to put into the byte buffer,
*/
inline void get(char* dest, uintptr_t dest_offset, uintptr_t count) {
//if(count>getRemaining()) THROW_BASE_EXCEPTION("buffer overflow");
memcpy(dest + dest_offset, _position, count);
_position += count;
}
/**
* Put an array of type {@code T} into the byte buffer.
* The position is adjusted.
*
* @param values The input array.
* @param count The number of elements.
*/
template<typename T>
inline void putArray(T* values, uintptr_t count)
{
// this avoids int8 specialization, compiler will take care if optimization, -O2 or more
if (sizeof(T) == 1)
{
put((const char*)values, 0, count);
return;
}
T* start = (T*)_position;
size_t n = sizeof(T)*count;
// we require aligned arrays...
memcpy(_position, values, n);
_position += n;
// ... so that we can be fast changing endianess
if (ENDIANESS_SUPPORT && reverse<T>())
{
for (uintptr_t i = 0; i < count; i++)
{
*start = swap<T>(*start);
start++;
}
}
}
/**
* Get an array of type {@code T} from the byte buffer.
* The position is adjusted.
*
* @param values The destination array.
* @param count The number of elements.
*/
template<typename T>
inline void getArray(T* values, uintptr_t count)
{
// this avoids int8 specialization, compiler will take care if optimization, -O2 or more
if (sizeof(T) == 1)
{
get((char*)values, 0, count);
return;
}
T* start = (T*)values;
size_t n = sizeof(T)*count;
// we require aligned arrays...
memcpy(values, _position, n);
_position += n;
// ... so that we can be fast changing endianess
if (ENDIANESS_SUPPORT && reverse<T>())
{
for (uintptr_t i = 0; i < count; i++)
{
*start = swap<T>(*start);
start++;
}
}
}
/**
* Is the byte order the EPICS_BYTE_ORDER
* @return (false,true) if (is, is not) the EPICS_BYTE_ORDER
*/
template<typename T>
inline bool reverse()
{
return _reverseEndianess;
}
/**
* Adjust position so that it is aligned to the specified size.
* Size MUST be a power of 2.
* @param size The alignment requirement.
*/
inline void align(int size)
{
const uintptr_t k = size - 1;
_position = (char*)((((uintptr_t)(const void *)_position) + k) & ~(k));
}
/**
* Put a boolean value into the byte buffer.
*
* @param value The value.
*/
inline void putBoolean( bool value) { put< int8>(value ? 1 : 0); }
/**
* Put a byte value into the byte buffer.
*
* @param value The value.
*/
inline void putByte ( int8 value) { put< int8>(value); }
/**
* Put a short value into the byte buffer.
*
* @param value The value.
*/
inline void putShort ( int16 value) { put< int16>(value); }
/**
* Put an int value into the byte buffer.
*
* @param value The value.
*/
inline void putInt ( int32 value) { put< int32>(value); }
/**
* Put a long value into the byte buffer.
*
* @param value The value.
*/
inline void putLong ( int64 value) { put< int64>(value); }
/**
* Put a float value into the byte buffer.
*
* @param value The value.
*/
inline void putFloat ( float value) { put< float>(value); }
/**
* Put a double value into the byte buffer.
*
* @param value The value.
*/
inline void putDouble (double value) { put<double>(value); }
/**
* Put a boolean value into the byte buffer at the specified index.
*
* @param index The offset in the byte buffer,
* @param value The value.
*/
inline void putBoolean(uintptr_t index, bool value) { put< int8>(index, value); }
/**
* Put a byte value into the byte buffer at the specified index.
*
* @param index The offset in the byte buffer,
* @param value The value.
*/
inline void putByte (uintptr_t index, int8 value) { put< int8>(index, value); }
/**
* Put a short value into the byte buffer at the specified index.
*
* @param index The offset in the byte buffer,
* @param value The value.
*/
inline void putShort (uintptr_t index, int16 value) { put< int16>(index, value); }
/**
* Put an int value into the byte buffer at the specified index.
*
* @param index The offset in the byte buffer,
* @param value The value.
*/
inline void putInt (uintptr_t index, int32 value) { put< int32>(index, value); }
/**
* Put a long value into the byte buffer at the specified index.
*
* @param index The offset in the byte buffer,
* @param value The value.
*/
inline void putLong (uintptr_t index, int64 value) { put< int64>(index, value); }
/**
* Put a float value into the byte buffer at the specified index.
*
* @param index The offset in the byte buffer,
* @param value The value.
*/
inline void putFloat (uintptr_t index, float value) { put< float>(index, value); }
/**
* Put a double value into the byte buffer at the specified index.
*
* @param index The offset in the byte buffer,
* @param value The value.
*/
inline void putDouble (uintptr_t index,double value) { put<double>(index, value); }
/**
* Get a boolean value from the byte buffer.
*
* @return The value.
*/
inline bool getBoolean() { return get< int8>() != 0; }
/**
* Get a byte value from the byte buffer.
*
* @return The value.
*/
inline int8 getByte () { return get< int8>(); }
/**
* Get a short value from the byte buffer.
*
* @return The value.
*/
inline int16 getShort () { return get< int16>(); }
/**
* Get a int value from the byte buffer.
*
* @return The value.
*/
inline int32 getInt () { return get< int32>(); }
/**
* Get a long value from the byte buffer.
*
* @return The value.
*/
inline int64 getLong () { return get< int64>(); }
/**
* Get a float value from the byte buffer.
*
* @return The value.
*/
inline float getFloat () { return get< float>(); }
/**
* Get a double value from the byte buffer.
*
* @return The value.
*/
inline double getDouble () { return get<double>(); }
/**
* Get a boolean value from the byte buffer at the specified index.
*
* @param index The offset in the byte buffer.
* @return The value.
*/
inline bool getBoolean(uintptr_t index) { return get< int8>(index) != 0; }
/**
* Get a byte value from the byte buffer at the specified index.
*
* @param index The offset in the byte buffer.
* @return The value.
*/
inline int8 getByte (uintptr_t index) { return get< int8>(index); }
/**
* Get a short value from the byte buffer at the specified index.
*
* @param index The offset in the byte buffer.
* @return The value.
*/
inline int16 getShort (uintptr_t index) { return get< int16>(index); }
/**
* Get an int value from the byte buffer at the specified index.
*
* @param index The offset in the byte buffer.
* @return The value.
*/
inline int32 getInt (uintptr_t index) { return get< int32>(index); }
/**
* Get a long value from the byte buffer at the specified index.
*
* @param index The offset in the byte buffer.
* @return The value.
*/
inline int64 getLong (uintptr_t index) { return get< int64>(index); }
/**
* Get a float value from the byte buffer at the specified index.
*
* @param index The offset in the byte buffer.
* @return The value.
*/
inline float getFloat (uintptr_t index) { return get< float>(index); }
/**
* Get a boolean value from the byte buffer at the specified index.
*
* @param double The offset in the byte buffer.
* @return The value.
*/
inline double getDouble (uintptr_t index) { return get<double>(index); }
// TODO remove
inline const char* getArray()
{
return _buffer;
}
private:
char* _buffer;
char* _position;
char* _limit;
uintptr_t _size;
bool _reverseEndianess;
bool _reverseFloatEndianess;
};
template<>
inline bool ByteBuffer::reverse<float>()
{
return _reverseFloatEndianess;
}
template<>
inline bool ByteBuffer::reverse<double>()
{
return _reverseFloatEndianess;
}
}
}
#endif /* BYTEBUFFER_H */

View File

@@ -1,35 +0,0 @@
/* destroyable.h */
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvDataCPP is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
#ifndef DESTROYABLE_H
#define DESTROYABLE_H
#include <pv/sharedPtr.h>
namespace epics { namespace pvData {
/**
* Instance declaring destroy method.
* @author mse
*/
class Destroyable {
public:
POINTER_DEFINITIONS(Destroyable);
/**
* Destroy this instance.
*/
virtual void destroy() = 0;
protected:
/**
* Do not allow delete on this instance and derived classes, destroy() must be used instead.
*/
virtual ~Destroyable() {};
};
}}
#endif /* DESTROYABLE_H */

View File

@@ -1,30 +0,0 @@
/* event.h */
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvDataCPP is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
#ifndef EVENT_H
#define EVENT_H
#include <memory>
#include <vector>
#include <epicsEvent.h>
#include <pv/noDefaultMethods.h>
#include <pv/pvType.h>
namespace epics { namespace pvData {
class Event : private NoDefaultMethods {
public:
explicit Event(bool = false);
~Event();
void signal();
bool wait (); /* blocks until full */
bool wait ( double timeOut ); /* false if empty at time out */
bool tryWait (); /* false if empty */
private:
epicsEventId id;
};
}}
#endif /* EVENT_H */

View File

@@ -1,162 +0,0 @@
/* executor.cpp */
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvDataCPP is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
#include <cstddef>
#include <cstdlib>
#include <cstddef>
#include <string>
#include <cstdio>
#include <memory>
#include <vector>
#include <pv/linkedList.h>
#include <pv/lock.h>
#include <pv/thread.h>
#include <pv/event.h>
#include <pv/executor.h>
#include <pv/CDRMonitor.h>
namespace epics { namespace pvData {
// special instance to stop the executor thread
static
class ExecutorShutdown : public Command {
virtual void command(){};
} executorShutdown;
static
Command *shutdown=&executorShutdown;
PVDATA_REFCOUNT_MONITOR_DEFINE(executor);
typedef LinkedListNode<ExecutorNode> ExecutorListNode;
typedef LinkedList<ExecutorNode> ExecutorList;
class ExecutorNode {
public:
ExecutorNode(Command *command);
Command *command;
ExecutorListNode node;
ExecutorListNode runNode;
};
ExecutorNode::ExecutorNode(Command *command)
: command(command),
node(*this),
runNode(*this)
{}
class ExecutorPvt : public Runnable{
public:
ExecutorPvt(String threadName,ThreadPriority priority);
~ExecutorPvt();
ExecutorNode * createNode(Command *command);
void execute(ExecutorNode *node);
virtual void run();
private:
ExecutorList executorList;
ExecutorList runList;
Event moreWork;
Event stopped;
Mutex mutex;
Thread thread;
};
ExecutorPvt::ExecutorPvt(String threadName,ThreadPriority priority)
: executorList(),
runList(),
moreWork(),
stopped(),
mutex(),
thread(threadName,priority,this)
{}
ExecutorPvt::~ExecutorPvt()
{
ExecutorNode shutdownNode(shutdown);
execute(&shutdownNode);
stopped.wait();
// The thread signals 'stopped' while still holding
// the lock. By taking it we wait for the run() function
// to actually return
Lock xx(mutex);
ExecutorListNode *node;
while((node=executorList.removeHead())!=0) {
delete &node->getObject();
}
}
void ExecutorPvt::run()
{
Lock xx(mutex);
while(true) {
ExecutorListNode * executorListNode = 0;
while(runList.isEmpty()) {
xx.unlock();
moreWork.wait();
xx.lock();
}
executorListNode = runList.removeHead();
if(!executorListNode) continue;
Command *cmd=executorListNode->getObject().command;
if(cmd==shutdown) break;
xx.unlock();
try {
executorListNode->getObject().command->command();
}catch(std::exception& e){
//TODO: feed into logging mechanism
fprintf(stderr, "Executor: Unhandled exception: %s",e.what());
}catch(...){
fprintf(stderr, "Executor: Unhandled exception");
}
xx.lock();
}
stopped.signal();
}
ExecutorNode * ExecutorPvt::createNode(Command *command)
{
Lock xx(mutex);
ExecutorNode *executorNode = new ExecutorNode(command);
executorList.addTail(executorNode->node);
return executorNode;
}
void ExecutorPvt::execute(ExecutorNode *node)
{
Lock xx(mutex);
if(node->runNode.isOnList()) return;
bool isEmpty = runList.isEmpty();
runList.addTail(node->runNode);
if(isEmpty) moreWork.signal();
}
Executor::Executor(String threadName,ThreadPriority priority)
: pImpl(new ExecutorPvt(threadName,priority))
{
PVDATA_REFCOUNT_MONITOR_CONSTRUCT(executor);
}
Executor::~Executor() {
delete pImpl;
PVDATA_REFCOUNT_MONITOR_DESTRUCT(executor);
}
ExecutorNode * Executor::createNode(Command*command)
{return pImpl->createNode(command);}
void Executor::execute(ExecutorNode *node) {pImpl->execute(node);}
}}

View File

@@ -1,37 +0,0 @@
/* executor.h */
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvDataCPP is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
#ifndef EXECUTOR_H
#define EXECUTOR_H
#include <memory>
#include <vector>
#include <pv/noDefaultMethods.h>
#include <pv/pvType.h>
#include <pv/thread.h>
namespace epics { namespace pvData {
// This is created by Executor.createNode and passed to Executor.execute
class ExecutorNode;
class Command {
public:
virtual ~Command(){}
virtual void command() = 0;
};
class Executor : private NoDefaultMethods {
public:
Executor(String threadName,ThreadPriority priority);
~Executor();
ExecutorNode * createNode(Command *command);
void execute(ExecutorNode *node);
private:
class ExecutorPvt *pImpl;
};
}}
#endif /* EXECUTOR_H */

View File

@@ -1,84 +0,0 @@
/* linkedList.h */
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvDataCPP is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
#ifndef LINKEDLIST_H
#define LINKEDLIST_H
#include <pv/linkedListVoid.h>
namespace epics { namespace pvData {
template <typename T>
class LinkedList;
template <typename T>
class LinkedListNode : private LinkedListVoidNode {
public:
LinkedListNode(T &object) : LinkedListVoidNode(&object){}
~LinkedListNode() {}
T &getObject() { return *static_cast<T *>(LinkedListVoidNode::getObject());}
bool isOnList() {return LinkedListVoidNode::isOnList();}
friend class LinkedList<T>;
};
template <typename T>
class LinkedList : private LinkedListVoid {
public:
LinkedList() : LinkedListVoid() {}
~LinkedList() {}
int getLength() {return LinkedListVoid::getLength();}
void addTail(LinkedListNode<T> &listNode)
{
LinkedListVoid::addTail(static_cast<LinkedListVoidNode &>(listNode));
}
void addHead(LinkedListNode<T> &listNode)
{
LinkedListVoid::addHead(static_cast<LinkedListVoidNode &>(listNode));
}
void insertAfter(LinkedListNode<T> &listNode,
LinkedListNode<T> &addNode)
{
LinkedListVoid::insertAfter(
static_cast<LinkedListVoidNode &>(listNode),
static_cast<LinkedListVoidNode &>(addNode));
}
void insertBefore(LinkedListNode<T> &listNode,
LinkedListNode<T> &addNode)
{
LinkedListVoid::insertBefore(
static_cast<LinkedListVoidNode &>(listNode),
static_cast<LinkedListVoidNode &>(addNode));
}
LinkedListNode<T> *removeTail(){
return static_cast<LinkedListNode<T> *>(LinkedListVoid::removeTail());
}
LinkedListNode<T> *removeHead(){
return static_cast<LinkedListNode<T> *>(LinkedListVoid::removeHead());
}
void remove(LinkedListNode<T> &listNode){
LinkedListVoid::remove(static_cast<LinkedListVoidNode &>(listNode));
}
LinkedListNode<T> *getHead(){
return static_cast<LinkedListNode<T> *>(LinkedListVoid::getHead());
}
LinkedListNode<T> *getTail(){
return static_cast<LinkedListNode<T> *>(LinkedListVoid::getTail());
}
LinkedListNode<T> *getNext(LinkedListNode<T> &listNode){
return static_cast<LinkedListNode<T> *>(LinkedListVoid::getNext(
static_cast<LinkedListVoidNode &>(listNode)));
}
LinkedListNode<T> *getPrev(LinkedListNode<T> &listNode){
return static_cast<LinkedListNode<T> *>(LinkedListVoid::getPrev(
static_cast<LinkedListVoidNode &>(listNode)));
}
bool isEmpty() { return LinkedListVoid::isEmpty();}
};
}}
#endif /* LINKEDLIST_H */

View File

@@ -1,210 +0,0 @@
/* linkedListVoid.cpp */
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvDataCPP is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
#include <cstddef>
#include <cstdlib>
#include <cstddef>
#include <string>
#include <cstdio>
#include <stdexcept>
#include <pv/lock.h>
#include <pv/pvType.h>
#include <pv/linkedListVoid.h>
#include <pv/CDRMonitor.h>
namespace epics { namespace pvData {
static String alreadyOnList("already on list");
PVDATA_REFCOUNT_MONITOR_DEFINE(LinkedListNode);
PVDATA_REFCOUNT_MONITOR_DEFINE(LinkedList);
LinkedListVoidNode::LinkedListVoidNode(void *object)
: object(object),before(0),after(0),linkedListVoid(0)
{
PVDATA_REFCOUNT_MONITOR_CONSTRUCT(LinkedListNode);
}
LinkedListVoidNode::LinkedListVoidNode(bool isHead)
: object(this),before(this),after(this)
{
PVDATA_REFCOUNT_MONITOR_CONSTRUCT(LinkedListNode);
}
LinkedListVoidNode::~LinkedListVoidNode()
{
PVDATA_REFCOUNT_MONITOR_DESTRUCT(LinkedListNode);
}
void *LinkedListVoidNode::getObject() {
return object;
}
bool LinkedListVoidNode::isOnList()
{
if(before==0 && after==0) return false;
return true;
}
LinkedListVoid::LinkedListVoid()
: head(new LinkedListVoidNode(true)),length(0)
{
PVDATA_REFCOUNT_MONITOR_CONSTRUCT(LinkedList);
}
LinkedListVoid::~LinkedListVoid()
{
delete head;
PVDATA_REFCOUNT_MONITOR_DESTRUCT(LinkedList);
}
int LinkedListVoid::getLength()
{
return length;
}
void LinkedListVoid::addTail(LinkedListVoidNode &node)
{
if(node.before!=0 || node.after!=0) {
throw std::logic_error(alreadyOnList);
}
node.linkedListVoid = this;
node.before = head->before;
node.after = head;
head->before->after = &node;
head->before = &node;
++length;
}
void LinkedListVoid::addHead(LinkedListVoidNode &node)
{
if(node.before!=0 || node.after!=0) {
throw std::logic_error(alreadyOnList);
}
node.linkedListVoid = this;
node.after = head->after;
node.before = head;
head->after->before = &node;
head->after = &node;
++length;
}
void LinkedListVoid::insertAfter(LinkedListVoidNode &node,
LinkedListVoidNode &addNode)
{
LinkedListVoidNode *existingNode = &node;
LinkedListVoidNode *newNode = &addNode;
if(existingNode->after==0 || existingNode->before==0) {
throw std::logic_error(String("listNode not on list"));
}
if(newNode->before!=0 || newNode->after!=0) {
throw std::logic_error(alreadyOnList);
}
if(node.linkedListVoid!=this) {
throw std::logic_error(String("node not on this list"));
}
newNode->linkedListVoid = this;
newNode->after = existingNode->after;
newNode->before = existingNode;
existingNode->after->before = newNode;
existingNode->after = newNode;
++length;
}
void LinkedListVoid::insertBefore(LinkedListVoidNode &node,
LinkedListVoidNode &addNode)
{
LinkedListVoidNode *existingNode = &node;
LinkedListVoidNode *newNode = &addNode;
if(existingNode->after==0 || existingNode->before==0) {
throw std::logic_error(String("listNode not on list"));
}
if(newNode->before!=0 || newNode->after!=0) {
throw std::logic_error(alreadyOnList);
}
if(node.linkedListVoid!=this) {
throw std::logic_error(String("node not on this list"));
}
newNode->linkedListVoid = this;
newNode->after = existingNode;
newNode->before = existingNode->before;
existingNode->before->after = newNode;
existingNode->before = newNode;
++length;
}
LinkedListVoidNode *LinkedListVoid::removeTail()
{
if(head->after==head) return 0;
LinkedListVoidNode *node = head->before;
remove(*head->before);
return node;
}
LinkedListVoidNode *LinkedListVoid::removeHead()
{
if(head->after==head) return 0;
LinkedListVoidNode *node = head->after;
remove(*head->after);
return node;
}
void LinkedListVoid::remove(LinkedListVoidNode &node)
{
if(node.before==0 || node.after==0) {
throw std::logic_error(String("node not on list"));
}
if(node.linkedListVoid!=this) {
throw std::logic_error(String("node not on this list"));
}
node.linkedListVoid = 0;
LinkedListVoidNode *prev = node.before;
LinkedListVoidNode *next = node.after;
node.after = node.before = 0;
prev->after = next;
next->before = prev;
length--;
}
LinkedListVoidNode *LinkedListVoid::getHead()
{
if(head->after==head) return 0;
return head->after;
}
LinkedListVoidNode *LinkedListVoid::getTail()
{
if(head->after==head) return 0;
return head->before;
}
LinkedListVoidNode *LinkedListVoid::getNext(LinkedListVoidNode &listNode)
{
if(listNode.linkedListVoid!=this) {
throw std::logic_error(String("node not on this list"));
}
if(listNode.after==head) return 0;
return listNode.after;
}
LinkedListVoidNode *LinkedListVoid::getPrev(LinkedListVoidNode &listNode)
{
if(listNode.linkedListVoid!=this) {
throw std::logic_error(String("node not on this list"));
}
if(listNode.before==head) return 0;
return listNode.before;
}
bool LinkedListVoid::isEmpty()
{
if(head->after==head) return true;
return false;
}
}}

View File

@@ -1,68 +0,0 @@
/* linkedListVoid.h */
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvDataCPP is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
#ifndef LINKEDLISTVOID_H
#define LINKEDLISTVOID_H
#include <pv/pvType.h>
namespace epics { namespace pvData {
class LinkedListVoid;
class LinkedListVoidNode;
class LinkedListVoidNode {
public:
~LinkedListVoidNode();
void *getObject();
bool isOnList();
protected:
LinkedListVoidNode(void *object);
private:
LinkedListVoidNode(bool isHead);
friend class LinkedListVoid;
void *object;
LinkedListVoidNode *before;
LinkedListVoidNode *after;
LinkedListVoid *linkedListVoid;
// do not implement the following
LinkedListVoidNode(const LinkedListVoidNode&);
LinkedListVoidNode & operator=(const LinkedListVoidNode&);
};
class LinkedListVoid {
public:
~LinkedListVoid();
int getLength();
void addTail(LinkedListVoidNode &listNode);
void addHead(LinkedListVoidNode &listNode);
void insertAfter(LinkedListVoidNode &listNode,
LinkedListVoidNode &addNode);
void insertBefore(LinkedListVoidNode &listNode,
LinkedListVoidNode &addNode);
LinkedListVoidNode *removeTail();
LinkedListVoidNode *removeHead();
void remove(LinkedListVoidNode &listNode);
LinkedListVoidNode *getHead();
LinkedListVoidNode *getTail();
LinkedListVoidNode *getNext(LinkedListVoidNode &listNode);
LinkedListVoidNode *getPrev(LinkedListVoidNode &listNode);
bool isEmpty();
protected:
LinkedListVoid();
private:
friend class LinkedListVoidNode;
LinkedListVoidNode *head;
int length;
// do not implement the following
LinkedListVoid(const LinkedListVoid&);
LinkedListVoid & operator=(const LinkedListVoid&);
};
}}
#endif /* LINKEDLISTVOID_H */

View File

@@ -1,52 +0,0 @@
/* lock.h */
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvDataCPP is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
#ifndef LOCK_H
#define LOCK_H
#include <stdexcept>
#include <epicsMutex.h>
#include <pv/noDefaultMethods.h>
/* This is based on item 14 of
* Effective C++, Third Edition, Scott Meyers
*/
// TODO reference counting lock to allow recursions
namespace epics { namespace pvData {
typedef epicsMutex Mutex;
class Lock : private NoDefaultMethods {
public:
explicit Lock(Mutex &m)
: mutexPtr(m), locked(true)
{ mutexPtr.lock();}
~Lock(){unlock();}
void lock()
{
if(!locked)
{
mutexPtr.lock();
locked = true;
}
}
void unlock()
{
if(locked)
{
mutexPtr.unlock();
locked=false;
}
}
bool ownsLock() const{return locked;}
private:
Mutex &mutexPtr;
bool locked;
};
}}
#endif /* LOCK_H */

View File

@@ -1,136 +0,0 @@
/* messageQueue.cpp */
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvDataCPP is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
#include <cstddef>
#include <cstdlib>
#include <cstddef>
#include <string>
#include <cstdio>
#include <stdexcept>
#include <pv/pvType.h>
#include <pv/lock.h>
#include <pv/requester.h>
#include <pv/noDefaultMethods.h>
#include <pv/CDRMonitor.h>
#include <pv/queue.h>
#include <pv/messageQueue.h>
namespace epics { namespace pvData {
PVDATA_REFCOUNT_MONITOR_DEFINE(messageQueue);
typedef MessageNode * MessageNodePtr;
typedef QueueElement<MessageNode> MessageElement;
typedef MessageElement *MessageElementPtr;
typedef Queue<MessageNode> MessageNodeQueue;
MessageNode::MessageNode()
: message(String()),messageType(infoMessage){}
MessageNode::~MessageNode() {
}
String MessageNode::getMessage() const { return message;};
MessageType MessageNode::getMessageType() const { return messageType;}
void MessageNode::setMessageNull() {message = String();}
class MessageQueuePvt {
public:
MessageNodePtr *messageNodeArray;
MessageNodeQueue *queue;
MessageNodePtr lastPut;
MessageElementPtr lastGet;
int size;
int overrun;
};
MessageQueue::MessageQueue(int size)
: pImpl(new MessageQueuePvt)
{
PVDATA_REFCOUNT_MONITOR_CONSTRUCT(messageQueue);
pImpl->size = size;
pImpl->overrun = 0;
pImpl->lastPut = 0;
pImpl->lastGet = 0;
pImpl->messageNodeArray = new MessageNodePtr[size];
for(int i=0; i<size; i++) {
pImpl->messageNodeArray[i] = new MessageNode();
}
pImpl->queue = new MessageNodeQueue(pImpl->messageNodeArray,size);
}
MessageQueue::~MessageQueue()
{
delete pImpl->queue;
for(int i=0; i< pImpl->size; i++) {
delete pImpl->messageNodeArray[i];
}
delete[] pImpl->messageNodeArray;
PVDATA_REFCOUNT_MONITOR_DESTRUCT(messageQueue);
}
MessageNode *MessageQueue::get() {
if(pImpl->lastGet!=0) {
throw std::logic_error(
String("MessageQueue::get() but did not release last"));
}
MessageElementPtr element = pImpl->queue->getUsed();
if(element==0) return 0;
pImpl->lastGet = element;
return element->getObject();
}
void MessageQueue::release() {
if(pImpl->lastGet==0) return;
pImpl->queue->releaseUsed(pImpl->lastGet);
pImpl->lastGet = 0;
}
bool MessageQueue::put(String message,MessageType messageType,bool replaceLast)
{
MessageElementPtr element = pImpl->queue->getFree();
if(element!=0) {
MessageNodePtr node = element->getObject();
node->message = message;
node->messageType = messageType;
pImpl->lastPut = node;
pImpl->queue->setUsed(element);
return true;
}
pImpl->overrun++;
if(replaceLast) {
MessageNodePtr node = pImpl->lastPut;
node->message = message;
node->messageType = messageType;
}
return false;
}
bool MessageQueue::isEmpty() const
{
int free = pImpl->queue->getNumberFree();
if(free==pImpl->size) return true;
return false;
}
bool MessageQueue::isFull() const
{
if(pImpl->queue->getNumberFree()==0) return true;
return false;
}
int MessageQueue::getClearOverrun()
{
int num = pImpl->overrun;
pImpl->overrun = 0;
return num;
}
}}

View File

@@ -1,48 +0,0 @@
/* messageQueue.h */
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvDataCPP is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
#ifndef MESSAGEQUEUE_H
#define MESSAGEQUEUE_H
#include <pv/pvType.h>
#include <pv/requester.h>
#include <pv/noDefaultMethods.h>
namespace epics { namespace pvData {
class MessageNode {
public:
String getMessage() const;
MessageType getMessageType() const;
void setMessageNull();
private:
MessageNode();
~MessageNode();
friend class MessageQueue;
String message;
MessageType messageType;
};
class MessageQueue : private NoDefaultMethods {
public:
MessageQueue(int size);
~MessageQueue();
MessageNode *get();
// must call release before next get
void release();
// return (false,true) if message (was not, was) put into queue
bool put(String message,MessageType messageType,bool replaceLast);
bool isEmpty() const;
bool isFull() const;
int getClearOverrun();
private:
class MessageQueuePvt *pImpl;
};
}}
#endif /* MESSAGEQUEUE_H */

View File

@@ -1,27 +0,0 @@
/* noDefaultMethods.h */
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvDataCPP is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
#ifndef NO_DEFAULT_METHODS_H
#define NO_DEFAULT_METHODS_H
namespace epics { namespace pvData {
/* This is based on Item 6 of
* Effective C++, Third Edition, Scott Meyers
*/
class NoDefaultMethods {
protected:
// allow by derived objects
NoDefaultMethods(){};
~NoDefaultMethods(){}
private:
// do not implment
NoDefaultMethods(const NoDefaultMethods&);
NoDefaultMethods & operator=(const NoDefaultMethods &);
};
}}
#endif /* NO_DEFAULT_METHODS_H */

View File

@@ -1,54 +0,0 @@
/* queue.h */
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvDataCPP is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
#ifndef QUEUE_H
#define QUEUE_H
#include <pv/queueVoid.h>
namespace epics { namespace pvData {
template <typename T>
class Queue;
template <typename T>
class QueueElement;
template <typename T>
class QueueElement : private QueueElementVoid {
public:
T *getObject() { return static_cast<T *>(QueueElementVoid::getObject());}
protected:
QueueElement(T *object) : QueueElementVoid(static_cast<void *>(object)){}
~QueueElement() {}
friend class Queue<T>;
};
template <typename T>
class Queue : private QueueVoid {
public:
Queue(T *array[],int number)
: QueueVoid((ObjectPtr*)array,number)
//: QueueVoid(static_cast<ObjectPtr*>(array),number)
{}
~Queue() {}
void clear() {QueueVoid::clear();}
int getNumberFree() {return QueueVoid::getNumberFree();}
int capacity() {return QueueVoid::capacity();}
QueueElement<T> *getFree() {
return static_cast<QueueElement<T> *>(QueueVoid::getFree());}
void setUsed(QueueElement<T> *queueElement) {
QueueVoid::setUsed(static_cast<QueueElementVoid *>(queueElement));}
QueueElement<T> *getUsed() {
return static_cast<QueueElement<T> *>(QueueVoid::getUsed());}
void releaseUsed(QueueElement<T> *queueElement) {
QueueVoid::releaseUsed(static_cast<QueueElementVoid *>(queueElement));}
};
}}
#endif /* QUEUE_H */

View File

@@ -1,120 +0,0 @@
/* queueVoid.cpp */
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvDataCPP is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
#include <cstddef>
#include <cstdlib>
#include <cstddef>
#include <string>
#include <cstdio>
#include <stdexcept>
#include <pv/lock.h>
#include <pv/pvType.h>
#include <pv/queueVoid.h>
#include <pv/CDRMonitor.h>
namespace epics { namespace pvData {
PVDATA_REFCOUNT_MONITOR_DEFINE(queueElement);
PVDATA_REFCOUNT_MONITOR_DEFINE(queue);
QueueElementVoid::QueueElementVoid(ObjectPtr object)
: object(object)
{
PVDATA_REFCOUNT_MONITOR_CONSTRUCT(queueElement);
}
QueueElementVoid::~QueueElementVoid()
{
PVDATA_REFCOUNT_MONITOR_DESTRUCT(queueElement);
}
ObjectPtr QueueElementVoid::getObject() {
return object;
}
QueueVoid::QueueVoid(ObjectPtr object[],int number)
: array(new QueueElementVoidPtr[number]),number(number),
numberFree(number),numberUsed(0),
nextGetFree(0),nextSetUsed(),
nextGetUsed(0),nextReleaseUsed(0)
{
for(int i=0; i<number; i++) {
array[i] = new QueueElementVoid(object[i]);
}
PVDATA_REFCOUNT_MONITOR_CONSTRUCT(queue);
}
QueueVoid::~QueueVoid()
{
for(int i=0; i<number; i++) {
delete array[i];
}
delete[]array;
PVDATA_REFCOUNT_MONITOR_DESTRUCT(queue);
}
void QueueVoid::clear()
{
numberFree = number;
numberUsed = 0;
nextGetFree = 0;
nextSetUsed = 0;
nextGetUsed = 0;
nextReleaseUsed = 0;
}
int QueueVoid::getNumberFree()
{
return numberFree;
}
int QueueVoid::capacity()
{
return number;
}
QueueElementVoid * QueueVoid::getFree()
{
if(numberFree==0) return 0;
numberFree--;
QueueElementVoid *queueElement = array[nextGetFree++];
if(nextGetFree>=number) nextGetFree = 0;
return queueElement;
}
void QueueVoid::setUsed(QueueElementVoid *queueElement)
{
if(queueElement!=array[nextSetUsed++]) {
throw std::logic_error(String("not correct queueElement"));
}
numberUsed++;
if(nextSetUsed>=number) nextSetUsed = 0;
}
QueueElementVoid * QueueVoid::getUsed()
{
if(numberUsed==0) return 0;
QueueElementVoid *queueElement = array[nextGetUsed++];
if(nextGetUsed>=number) nextGetUsed = 0;
return queueElement;
}
void QueueVoid::releaseUsed(QueueElementVoid *queueElement)
{
if(queueElement!=array[nextReleaseUsed++]) {
throw std::logic_error(String(
"not queueElement returned by last call to getUsed"));
}
if(nextReleaseUsed>=number) nextReleaseUsed = 0;
numberUsed--;
numberFree++;
}
}}

View File

@@ -1,56 +0,0 @@
/* queueVoid.h */
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvDataCPP is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
#ifndef QUEUEVOID_H
#define QUEUEVOID_H
namespace epics { namespace pvData {
class QueueVoid;
class QueueElementVoid;
typedef void * ObjectPtr;
typedef QueueElementVoid * QueueElementVoidPtr;
typedef QueueElementVoidPtr * QueueElementVoidPtrArray;
class QueueElementVoid {
protected:
ObjectPtr getObject();
QueueElementVoid(ObjectPtr object);
~QueueElementVoid();
ObjectPtr object;
friend class QueueVoid;
};
class QueueVoid {
protected:
QueueVoid(ObjectPtr array[],int number);
~QueueVoid();
void clear();
int getNumberFree();
int capacity();
QueueElementVoidPtr getFree();
void setUsed(QueueElementVoid *queueElement);
QueueElementVoid *getUsed();
void releaseUsed(QueueElementVoid *queueElement);
private:
friend class QueueElementVoid;
QueueElementVoidPtrArray array;
int number;
int numberFree;
int numberUsed;
int nextGetFree;
int nextSetUsed;
int nextGetUsed;
int nextReleaseUsed;
};
}}
#endif /* QUEUEVOID_H */

View File

@@ -1,20 +0,0 @@
/* requester.cpp */
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvDataCPP is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
#include <string>
#include <pv/requester.h>
namespace epics { namespace pvData {
const size_t messageTypeCount = 4;
static std::string typeName[messageTypeCount] = {
String("info"),
String("warning"),
String("error"),
String("fatalError")
};
StringArray messageTypeName = typeName;
}}

View File

@@ -1,33 +0,0 @@
/* requester.h */
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvDataCPP is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
#ifndef REQUESTER_H
#define REQUESTER_H
#include <string>
#include <pv/pvType.h>
#include <pv/sharedPtr.h>
namespace epics { namespace pvData {
class Requester;
enum MessageType {
infoMessage,warningMessage,errorMessage,fatalErrorMessage
};
extern StringArray messageTypeName;
extern const size_t messageTypeCount;
class Requester {
public:
POINTER_DEFINITIONS(Requester);
virtual ~Requester(){}
virtual String getRequesterName() = 0;
virtual void message(String message,MessageType messageType) = 0;
};
}}
#endif /* REQUESTER_H */

View File

@@ -1,61 +0,0 @@
/* serialize.h */
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvDataCPP is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
#ifndef SERIALIZE_H
#define SERIALIZE_H
#include <pv/byteBuffer.h>
namespace epics { namespace pvData {
class SerializableControl;
class DeserializableControl;
class Serializable;
class BitSetSerializable;
class SerializableArray;
class BitSet;
class SerializableControl {
public:
virtual ~SerializableControl(){}
virtual void flushSerializeBuffer() =0;
virtual void ensureBuffer(int size) =0;
virtual void alignBuffer(int alignment) =0;
};
class DeserializableControl {
public:
virtual ~DeserializableControl(){}
virtual void ensureData(int size) =0;
virtual void alignData(int alignment) =0;
};
class Serializable {
public:
virtual ~Serializable(){}
virtual void serialize(ByteBuffer *buffer,
SerializableControl *flusher) const = 0;
virtual void deserialize(ByteBuffer *buffer,
DeserializableControl *flusher) = 0;
};
class BitSetSerializable {
public:
virtual ~BitSetSerializable(){}
virtual void serialize(ByteBuffer *buffer,
SerializableControl *flusher,BitSet *bitSet) const = 0;
virtual void deserialize(ByteBuffer *buffer,
DeserializableControl *flusher,BitSet *bitSet) = 0;
};
class SerializableArray : virtual public Serializable {
public:
virtual ~SerializableArray(){}
virtual void serialize(ByteBuffer *buffer,
SerializableControl *flusher, int offset, int count) const = 0;
};
}}
#endif /* SERIALIZE_H */

View File

@@ -1,144 +0,0 @@
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvDataCPP is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
/*
* serializeHelper.cpp
*
* Created on: Oct 22, 2010
* Author: Miha vitorovic
*/
#include <algorithm>
#include <pv/pvType.h>
#include <pv/epicsException.h>
#include <pv/byteBuffer.h>
#include <pv/serializeHelper.h>
using namespace std;
namespace epics {
namespace pvData {
void SerializeHelper::writeSize(int s, ByteBuffer* buffer,
SerializableControl* flusher) {
flusher->ensureBuffer(sizeof(int64)+1);
SerializeHelper::writeSize(s, buffer);
}
void SerializeHelper::writeSize(int s, ByteBuffer* buffer) {
if(s==-1) // null
buffer->putByte(-1);
else if(s<254)
buffer->putByte(s);
else
{
buffer->putByte(-2);
buffer->putInt(s); // (byte)-2 + size
}
}
int SerializeHelper::readSize(ByteBuffer* buffer,
DeserializableControl* control) {
control->ensureData(1);
int8 b = buffer->getByte();
if(b==-1)
return -1;
else if(b==-2) {
control->ensureData(sizeof(int32));
int32 s = buffer->getInt();
if(s<0) THROW_BASE_EXCEPTION("negative size");
return s;
}
else
return (int)(b<0 ? b+256 : b);
}
void SerializeHelper::serializeString(const String& value,
ByteBuffer* buffer, SerializableControl* flusher) {
int len = value.length();
SerializeHelper::writeSize(len, buffer, flusher);
if (len<=0) return;
int i = 0;
while(true) {
int maxToWrite = min(len-i, (int)buffer->getRemaining());
buffer->put(value.data(), i, maxToWrite); // ASCII
i += maxToWrite;
if(i<len)
flusher->flushSerializeBuffer();
else
break;
}
}
void SerializeHelper::serializeSubstring(const String& value,
int offset, int count, ByteBuffer* buffer,
SerializableControl* flusher) {
if(offset<0)
offset = 0;
else if(offset>(int)value.length()) offset = value.length();
if(offset+count>(int)value.length()) count = value.length()-offset;
SerializeHelper::writeSize(count, buffer, flusher);
if (count<=0) return;
int i = 0;
while(true) {
int maxToWrite = min(count-i, (int)buffer->getRemaining());
buffer->put(value.data(), offset+i, maxToWrite); // ASCII
i += maxToWrite;
if(i<count)
flusher->flushSerializeBuffer();
else
break;
}
}
static String emptyString;
String SerializeHelper::deserializeString(ByteBuffer* buffer,
DeserializableControl* control) {
int size = SerializeHelper::readSize(buffer, control);
if(size>0)
{
if ((int)buffer->getRemaining()>=size)
{
// entire string is in buffer, simply create a string out of it (copy)
int pos = buffer->getPosition();
String str(buffer->getArray()+pos, size);
buffer->setPosition(pos+size);
return str;
}
else
{
String str;
str.reserve(size);
try {
int i = 0;
while(true) {
int toRead = min(size-i, (int)buffer->getRemaining());
int pos = buffer->getPosition();
str.append(buffer->getArray()+pos, toRead);
buffer->setPosition(pos+toRead);
i += toRead;
if(i<size)
control->ensureData(1); // at least one
else
break;
}
return str;
} catch(...) {
throw;
}
}
}
else
return emptyString;
}
}
}

View File

@@ -1,73 +0,0 @@
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvDataCPP is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
#ifndef SHAREDPTR_H
#define SHAREDPTR_H
/*
* Pulls in the std::tr1 namespace with the following names
*
* class shared_ptr
* class weak_ptr
* class bad_weak_ptr
* function static_pointer_cast;
* function dynamic_pointer_cast
* function const_pointer_cast
* function swap
* function get_deleter
* function enable_shared_from_this
*/
// where should we look?
#if defined(__GNUC__) && __GNUC__>=4
// GCC >=4.0.0
# define SHARED_FROM_TR1
#elif defined(_MSC_VER) && (_MSC_VER>1500 || defined(_HAS_TR1))
// MSVC > 2008, or 2008 w/ SP1
# define SHARED_FROM_TR1
#else
# define SHARED_FROM_BOOST
#endif
#if defined(_MSC_VER) && (_MSC_VER>=1600)
// MSVC 2010 has it in <memory>
# undef SHARED_FROM_BOOST
# undef SHARED_FROM_TR1
#endif
// go and get it
#if defined(SHARED_FROM_TR1)
# include <tr1/memory>
#elif defined(SHARED_FROM_BOOST)
# include <boost/tr1/memory.hpp>
#else
// eventually...
# include <memory>
#endif
// cleanup
#ifdef SHARED_FROM_TR1
# undef SHARED_FROM_TR1
#endif
#ifdef SHARED_FROM_BOOST
# undef SHARED_FROM_BOOST
#endif
#define POINTER_DEFINITIONS(clazz) \
typedef std::tr1::shared_ptr<clazz> shared_pointer; \
typedef std::tr1::shared_ptr<const clazz> const_shared_pointer; \
typedef std::tr1::weak_ptr<clazz> weak_pointer; \
typedef std::tr1::weak_ptr<const clazz> const_weak_pointer;
#endif // SHAREDPTR_H

View File

@@ -1,135 +0,0 @@
/*pvData.cpp*/
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvDataCPP is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
#include <pv/status.h>
#include <pv/epicsException.h>
#include <pv/serializeHelper.h>
namespace epics { namespace pvData {
const char* Status::StatusTypeName[] = { "OK", "WARNING", "ERROR", "FATAL" };
epics::pvData::String Status::m_emptyString;
Status Status::OK;
//PVDATA_REFCOUNT_MONITOR_DEFINE(status);
Status::Status() :
m_type(STATUSTYPE_OK)
{
}
Status::Status(StatusType type, String message) :
m_type(type), m_message(message)
{
if (type == STATUSTYPE_OK)
throw std::invalid_argument("type == STATUSTYPE_OK");
//PVDATA_REFCOUNT_MONITOR_CONSTRUCT(status);
}
Status::Status(StatusType type, String message, String stackDump) :
m_type(type), m_message(message), m_stackDump(stackDump)
{
if (type == STATUSTYPE_OK)
throw std::invalid_argument("type == STATUSTYPE_OK");
//PVDATA_REFCOUNT_MONITOR_CONSTRUCT(status);
}
Status::~Status() {
//PVDATA_REFCOUNT_MONITOR_DESTRUCT(status);
}
Status::StatusType Status::getType() const
{
return m_type;
}
epics::pvData::String Status::getMessage() const
{
return m_message;
}
epics::pvData::String Status::getStackDump() const
{
return m_stackDump;
}
bool Status::isOK() const
{
return (m_type == STATUSTYPE_OK);
}
bool Status::isSuccess() const
{
return (m_type == STATUSTYPE_OK || m_type == STATUSTYPE_WARNING);
}
void Status::serialize(ByteBuffer *buffer, SerializableControl *flusher) const
{
flusher->ensureBuffer(1);
if (m_type == STATUSTYPE_OK)
{
// special code for okStatus (optimization)
buffer->putByte((int8)-1);
}
else
{
buffer->putByte((int8)m_type);
SerializeHelper::serializeString(m_message, buffer, flusher);
SerializeHelper::serializeString(m_stackDump, buffer, flusher);
}
}
void Status::deserialize(ByteBuffer *buffer, DeserializableControl *flusher)
{
flusher->ensureData(1);
int8 typeCode = buffer->getByte();
if (typeCode == (int8)-1)
{
// in most of the cases status will be OK, we statistically optimize
if (m_type != STATUSTYPE_OK)
{
m_type = STATUSTYPE_OK;
m_message = m_stackDump = m_emptyString;
}
}
else
{
m_type = (StatusType)typeCode;
m_message = SerializeHelper::deserializeString(buffer, flusher);
m_stackDump = SerializeHelper::deserializeString(buffer, flusher);
}
}
String Status::toString() const
{
String str;
toString(&str, 0);
return str;
}
void Status::toString(StringBuilder buffer, int indentLevel) const
{
*buffer += "Status [type=";
*buffer += StatusTypeName[m_type];
if (!m_message.empty())
{
*buffer += ", message=";
*buffer += m_message;
}
if (!m_stackDump.empty())
{
*buffer += ", stackDump=";
*buffer += '\n';
*buffer += m_stackDump;
}
*buffer += ']';
}
}}

View File

@@ -1,107 +0,0 @@
/* status.h */
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvDataCPP is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
#ifndef STATUS_H
#define STATUS_H
#include <pv/serialize.h>
#include <pv/byteBuffer.h>
#include <pv/sharedPtr.h>
namespace epics { namespace pvData {
/**
* Status.
* @author mse
*/
class Status : public epics::pvData::Serializable {
public:
POINTER_DEFINITIONS(Status);
/**
* Status type enum.
*/
enum StatusType {
/** Operation completed successfully. */
STATUSTYPE_OK,
/** Operation completed successfully, but there is a warning message. */
STATUSTYPE_WARNING,
/** Operation failed due to an error. */
STATUSTYPE_ERROR,
/** Operation failed due to an unexpected error. */
STATUSTYPE_FATAL
};
static const char* StatusTypeName[];
static Status OK;
/**
* Creates OK status; STATUSTYPE_OK, empty message and stackDump.
*/
Status();
/**
* Create non-OK status.
*/
Status(StatusType type, epics::pvData::String message);
/**
* Create non-OK status.
*/
Status(StatusType type, epics::pvData::String message, epics::pvData::String stackDump);
~Status();
/**
* Get status type.
* @return status type, non-<code>null</code>.
*/
StatusType getType() const;
/**
* Get error message describing an error. Required if error status.
* @return error message.
*/
epics::pvData::String getMessage() const;
/**
* Get stack dump where error (exception) happened. Optional.
* @return stack dump.
*/
epics::pvData::String getStackDump() const;
/**
* Convenient OK test. Same as <code>(getType() == StatusType.OK)</code>.
* NOTE: this will return <code>false</code> on WARNING message although operation succeeded.
* To check if operation succeeded, use <code>isSuccess</code>.
* @return OK status.
* @see #isSuccess()
*/
bool isOK() const;
/**
* Check if operation succeeded.
* @return operation success status.
*/
bool isSuccess() const;
String toString() const;
void toString(StringBuilder buffer, int indentLevel = 0) const;
void serialize(ByteBuffer *buffer, SerializableControl *flusher) const;
void deserialize(ByteBuffer *buffer, DeserializableControl *flusher);
private:
static epics::pvData::String m_emptyString;
StatusType m_type;
String m_message;
String m_stackDump;
};
}}
#endif /* STATUS_H */

View File

@@ -1,63 +0,0 @@
/* thread.h */
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvDataCPP is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
#ifndef THREAD_H
#define THREAD_H
#include <memory>
#include <pv/noDefaultMethods.h>
#include <pv/pvType.h>
#include <epicsThread.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
};
typedef epicsThreadRunable Runnable;
class Thread : public epicsThread, private NoDefaultMethods {
public:
Thread(String name,
ThreadPriority priority,
Runnable *runnable,
epicsThreadStackSizeClass stkcls=epicsThreadStackSmall)
:epicsThread(*runnable,
name.c_str(),
epicsThreadGetStackSize(stkcls),
priority)
{
this->start();
}
Thread(Runnable &runnable,
String name,
unsigned int stksize,
unsigned int priority=lowestPriority)
:epicsThread(runnable,
name.c_str(),
stksize,
priority)
{
this->start();
}
~Thread()
{
this->exitWait();
}
};
}}
#endif /* THREAD_H */

View File

@@ -1,41 +0,0 @@
/* timeFunction.cpp */
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvDataCPP is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
#include <pv/noDefaultMethods.h>
#include <pv/pvType.h>
#include <pv/timeStamp.h>
#include <pv/timeFunction.h>
namespace epics { namespace pvData {
TimeFunction::TimeFunction(TimeFunctionRequester *requester)
: requester(requester) {}
TimeFunction::~TimeFunction() {}
double TimeFunction::timeCall()
{
TimeStamp startTime;
TimeStamp endTime;
double perCall = 0.0;
long ntimes = 1;
while(true) {
startTime.getCurrent();
for(long i=0; i<ntimes; i++) requester->function();
endTime.getCurrent();
double diff = TimeStamp::diff(endTime,startTime);
if(diff>=1.0) {
perCall = diff/(double)ntimes;
break;
}
ntimes *= 2;
}
return perCall;
}
}}

View File

@@ -1,31 +0,0 @@
/* timeFunction.h */
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvDataCPP is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
#ifndef TIMEFUNCTION_H
#define TIMEFUNCTION_H
#include <pv/noDefaultMethods.h>
#include <pv/pvType.h>
namespace epics { namespace pvData {
class TimeFunctionRequester {
public:
virtual ~TimeFunctionRequester(){}
virtual void function() = 0;
};
class TimeFunction : private NoDefaultMethods {
public:
TimeFunction(TimeFunctionRequester *requester);
~TimeFunction();
double timeCall();
private:
TimeFunctionRequester *requester;
};
}}
#endif /* TIMEFUNCTION_H */

View File

@@ -1,234 +0,0 @@
/* timer.cpp */
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvDataCPP is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
#include <stddef.h>
#include <stdlib.h>
#include <stddef.h>
#include <string.h>
#include <stdio.h>
#include <stdexcept>
#include <pv/pvType.h>
#include <pv/lock.h>
#include <pv/noDefaultMethods.h>
#include <pv/CDRMonitor.h>
#include <pv/linkedList.h>
#include <pv/thread.h>
#include <pv/timeStamp.h>
#include <pv/timer.h>
#include <pv/event.h>
namespace epics { namespace pvData {
PVDATA_REFCOUNT_MONITOR_DEFINE(timerNode);
PVDATA_REFCOUNT_MONITOR_DEFINE(timer);
typedef LinkedListNode<TimerNode::Pvt> TimerListNode;
typedef LinkedList<TimerNode::Pvt> TimerList;
class TimerNode::Pvt {
public:
TimerNode *timerNode;
TimerCallback *callback;
TimerListNode timerListNode;
TimeStamp timeToRun;
Timer::Pvt *timerPvt;
double period;
Pvt(TimerNode &timerNode,TimerCallback &callback);
~Pvt(){}
private:
};
TimerNode::Pvt::Pvt(TimerNode &timerNode,TimerCallback &callback)
: timerNode(&timerNode),callback(&callback),
timerListNode(*this),timeToRun(),
timerPvt(0), period(0.0)
{}
struct Timer::Pvt : public Runnable{
public:
Pvt(String threadName,ThreadPriority priority);
virtual void run();
public: // only used by this source module
TimerList timerList;
Mutex mutex;
Event waitForWork;
Event waitForDone;
bool alive;
Thread thread;
void addElement(TimerNode::Pvt &node);
};
Timer::Pvt::Pvt(String threadName,ThreadPriority priority)
: timerList(),
mutex(),
waitForWork(false),
waitForDone(false),
alive(true),
thread(threadName,priority,this)
{}
void Timer::Pvt::addElement(TimerNode::Pvt &node)
{
TimerListNode *nextNode = timerList.getHead();
if(nextNode==0) {
timerList.addTail(node.timerListNode);
return;
}
while(true) {
TimerNode::Pvt &timerListNode = nextNode->getObject();
if((node.timeToRun)<(timerListNode.timeToRun)) {
timerList.insertBefore(timerListNode.timerListNode,node.timerListNode);
return;
}
nextNode = timerList.getNext(timerListNode.timerListNode);
if(nextNode==0) {
timerList.addTail(node.timerListNode);
return;
}
}
}
TimerNode::TimerNode(TimerCallback &callback)
: pImpl(new Pvt(*this,callback))
{
PVDATA_REFCOUNT_MONITOR_CONSTRUCT(timerNode);
}
TimerNode::~TimerNode()
{
cancel();
PVDATA_REFCOUNT_MONITOR_DESTRUCT(timerNode);
}
void TimerNode::cancel()
{
Timer::Pvt *timerPvt = pImpl->timerPvt;
if(timerPvt==0) return;
Lock xx(timerPvt->mutex);
if(pImpl->timerPvt==0) return;
pImpl->timerPvt->timerList.remove(pImpl->timerListNode);
pImpl->timerPvt = 0;
}
bool TimerNode::isScheduled()
{
Timer::Pvt *pvt = pImpl->timerPvt;
if(pvt==0) return false;
Lock xx(pvt->mutex);
return pImpl->timerListNode.isOnList();
}
void Timer::Pvt::run()
{
TimeStamp currentTime;
while(true) {
currentTime.getCurrent();
TimeStamp *timeToRun = 0;
double period = 0.0;
TimerNode::Pvt *nodeToCall = 0;
{
Lock xx(mutex);
if (!alive) break;
TimerListNode *timerListNode = timerList.getHead();
if(timerListNode!=0) {
TimerNode::Pvt *timerNodePvt = &timerListNode->getObject();
timeToRun = &timerNodePvt->timeToRun;
double diff = TimeStamp::diff(
*timeToRun,currentTime);
if(diff<=0.0) {
nodeToCall = timerNodePvt;
timerList.removeHead();
period = timerNodePvt->period;
if(period>0.0) {
timerNodePvt->timeToRun += period;
addElement(*timerNodePvt);
} else {
timerNodePvt->timerPvt = 0;
}
timerListNode = timerList.getHead();
if(timerListNode!=0) {
timerNodePvt = &timerListNode->getObject();
timeToRun = &timerNodePvt->timeToRun;
} else {
timeToRun = 0;
}
}
}
}
if(nodeToCall!=0) {
nodeToCall->callback->callback();
}
{
Lock xx(mutex);
if(!alive) break;
}
if(timeToRun==0) {
waitForWork.wait();
} else {
double delay = TimeStamp::diff(*timeToRun,currentTime);
waitForWork.wait(delay);
}
}
waitForDone.signal();
}
Timer::Timer(String threadName, ThreadPriority priority)
: pImpl(new Pvt(threadName,priority))
{
PVDATA_REFCOUNT_MONITOR_CONSTRUCT(timer);
}
Timer::~Timer() {
{
Lock xx(pImpl->mutex);
pImpl->alive = false;
}
pImpl->waitForWork.signal();
pImpl->waitForDone.wait();
TimerListNode *node = 0;
while((node = pImpl->timerList.removeHead())!=0) {
node->getObject().callback->timerStopped();
}
PVDATA_REFCOUNT_MONITOR_DESTRUCT(timer);
}
void Timer::scheduleAfterDelay(TimerNode &timerNode,double delay)
{
schedulePeriodic(timerNode,delay,0.0);
}
void Timer::schedulePeriodic(TimerNode &timerNode,double delay,double period)
{
TimerNode::Pvt *timerNodePvt = timerNode.pImpl.get();
if(timerNodePvt->timerListNode.isOnList()) {
throw std::logic_error(String("already queued"));
}
{
Lock xx(pImpl->mutex);
if(!pImpl->alive) {
timerNodePvt->callback->timerStopped();
return;
}
}
TimeStamp *timeStamp = &timerNodePvt->timeToRun;
timeStamp->getCurrent();
*timeStamp += delay;
timerNodePvt->period = period;
bool isFirst = false;
{
Lock xx(pImpl->mutex);
timerNodePvt->timerPvt = pImpl.get();
pImpl->addElement(*timerNodePvt);
TimerNode::Pvt *first = &pImpl->timerList.getHead()->getObject();
if(first==timerNodePvt) isFirst = true;
}
if(isFirst) pImpl->waitForWork.signal();
}
}}

View File

@@ -1,59 +0,0 @@
/* timer.h */
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvDataCPP is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
#ifndef TIMER_H
#define TIMER_H
#include <memory>
#include <stddef.h>
#include <stdlib.h>
#include <stddef.h>
#include <string.h>
#include <stdio.h>
#include <pv/pvType.h>
#include <pv/thread.h>
#include <pv/noDefaultMethods.h>
#include <pv/sharedPtr.h>
namespace epics { namespace pvData {
class Timer;
class TimerCallback {
public:
virtual ~TimerCallback(){}
virtual void callback() = 0;
virtual void timerStopped() = 0;
};
class TimerNode {
public:
TimerNode(TimerCallback &timerCallback);
~TimerNode();
void cancel();
bool isScheduled();
class Pvt;
private:
std::auto_ptr<Pvt> pImpl;
friend class Timer;
};
class Timer : private NoDefaultMethods {
public:
POINTER_DEFINITIONS(Timer);
Timer(String threadName, ThreadPriority priority);
~Timer();
void scheduleAfterDelay(TimerNode &timerNode,double delay);
void schedulePeriodic(TimerNode &timerNode,double delay,double period);
class Pvt;
private:
std::auto_ptr<Pvt> pImpl;
};
}}
#endif /* TIMER_H */

View File

@@ -1,106 +0,0 @@
/* monitor.h */
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvDataCPP is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
#ifndef MONITOR_H
#define MONITOR_H
#include <pv/status.h>
#include <pv/destroyable.h>
#include <pv/pvData.h>
#include <pv/sharedPtr.h>
#include <pv/bitSet.h>
namespace epics { namespace pvData {
/**
* Class instance representing monitor element.
* @author mrk
*/
class MonitorElement {
public:
POINTER_DEFINITIONS(MonitorElement);
virtual ~MonitorElement(){}
/**
* Get the PVStructure.
* @return The PVStructure.
*/
virtual PVStructure::shared_pointer const & getPVStructure() = 0;
/**
* Get the bitSet showing which fields have changed.
* @return The bitSet.
*/
virtual BitSet::shared_pointer const & getChangedBitSet() = 0;
/**
* Get the bitSet showing which fields have been changed more than once.
* @return The bitSet.
*/
virtual BitSet::shared_pointer const & getOverrunBitSet() = 0;
};
/**
* Interface for Monitor.
* @author mrk
*/
class Monitor : public Destroyable, private NoDefaultMethods {
public:
POINTER_DEFINITIONS(Monitor);
virtual ~Monitor(){}
/**
* Start monitoring.
* @return completion status.
*/
virtual Status start() = 0;
/**
* Stop Monitoring.
* @return completion status.
*/
virtual Status stop() = 0;
/**
* If monitor has occurred return data.
* @return monitorElement for modified data.
* Must call get to determine if data is available.
*/
virtual MonitorElement::shared_pointer const & poll() = 0;
/**
* Release a MonitorElement that was returned by poll.
* @param monitorElement
*/
virtual void release(MonitorElement::shared_pointer const & monitorElement) = 0;
};
/**
* Requester for ChannelMonitor.
* @author mrk
*/
class MonitorRequester : public virtual Requester {
public:
POINTER_DEFINITIONS(MonitorRequester);
virtual ~MonitorRequester(){}
/**
* The client and server have both completed the createMonitor request.
* @param status Completion status.
* @param monitor The monitor
* @param structure The structure defining the data.
*/
virtual void monitorConnect(Status const &status,
Monitor::shared_pointer const & monitor, StructureConstPtr const & structure) = 0;
/**
* A monitor event has occurred.
* The requester must call Monitor.poll to get data.
* @param monitor The monitor.
*/
virtual void monitorEvent(Monitor::shared_pointer const &monitor) = 0;
/**
* The data source is no longer available.
* @param monitor The monitor.
*/
virtual void unlisten(Monitor::shared_pointer const &monitor) = 0;
};
}}
#endif /* MONITOR_H */

View File

@@ -1,160 +0,0 @@
/* monitorQueue.cpp */
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvDataCPP is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
/* Marty Kraimer 2011.03 */
#include <pv/bitSet.h>
#include <pv/monitorQueue.h>
namespace epics { namespace pvData {
typedef QueueElement<MonitorElement::shared_pointer> MonitorQueueElement;
class MonitorElementImpl : public MonitorElement {
public:
MonitorElementImpl(PVStructure::shared_pointer pvStructure);
~MonitorElementImpl(){}
virtual PVStructure::shared_pointer const & getPVStructure();
virtual BitSet::shared_pointer const & getChangedBitSet();
virtual BitSet::shared_pointer const & getOverrunBitSet();
void setQueueElement(MonitorQueueElement *queueElement);
MonitorQueueElement *getQueueElement();
private:
PVStructure::shared_pointer pvStructure;
BitSet::shared_pointer changedBitSet;
BitSet::shared_pointer overrunBitSet;
MonitorQueueElement *queueElement;
};
MonitorElementImpl::MonitorElementImpl(PVStructure::shared_pointer pvStructure)
: pvStructure(pvStructure),
changedBitSet(BitSet::shared_pointer(
new BitSet(pvStructure->getNumberFields()))),
overrunBitSet(BitSet::shared_pointer(
new BitSet(pvStructure->getNumberFields()))),
queueElement(0)
{}
PVStructure::shared_pointer const & MonitorElementImpl::getPVStructure()
{
return pvStructure;
}
BitSet::shared_pointer const & MonitorElementImpl::getChangedBitSet()
{
return changedBitSet;
}
BitSet::shared_pointer const & MonitorElementImpl::getOverrunBitSet()
{
return overrunBitSet;
}
void MonitorElementImpl::setQueueElement(MonitorQueueElement *queueElement)
{
this->queueElement = queueElement;
}
MonitorQueueElement *MonitorElementImpl::getQueueElement()
{
return queueElement;
}
MonitorQueue::MonitorQueue(PVStructureSharedPointerPtrArray structures,int number)
: number(number),
structures(structures),
queue(0),
queueElements(new MonitorElement::shared_pointer*[number]),
nullElement(MonitorElement::shared_pointer())
{
if(number<2) {
throw std::logic_error(String("queueSize must be >=2"));
}
for(int i=0; i<number; i++) {
queueElements[i] = new MonitorElement::shared_pointer(
new MonitorElementImpl(*structures[i]));
}
queue = new Queue<MonitorElement::shared_pointer>(queueElements,number);
MonitorQueueElement *queueElement;
for(int i=0; i<number;i++) {
queueElement = queue->getFree();
MonitorElementImpl * element = static_cast<MonitorElementImpl *>(
queueElement->getObject()->get());
element->setQueueElement(queueElement);
queue->setUsed(queueElement);
queue->releaseUsed(queueElement);
}
}
MonitorQueue::~MonitorQueue()
{
delete queue;
for(int i=0; i<number; i++) {
delete queueElements[i];
}
delete[] queueElements;
for(int i=0; i<number; i++) delete structures[i];
delete[] structures;
}
PVStructureSharedPointerPtrArray MonitorQueue::createStructures(
PVStructurePtrArray array,int number)
{
PVStructureSharedPointerPtrArray elements =
new PVStructureSharedPointerPtr[number];
for(int i=0; i<number; i++){
elements[i] = new PVStructure::shared_pointer(array[i]);
}
delete[] array;
return elements;
}
void MonitorQueue::clear()
{
queue->clear();
}
int MonitorQueue::getNumberFree()
{
return queue->getNumberFree();
}
int MonitorQueue::capacity()
{
return number;
}
MonitorElement::shared_pointer const & MonitorQueue::getFree()
{
MonitorQueueElement *queueElement = queue->getFree();
if(queueElement==0) return nullElement;
return *queueElement->getObject();
}
void MonitorQueue::setUsed(MonitorElement::shared_pointer const & element)
{
MonitorElementImpl *impl = static_cast<MonitorElementImpl *>(element.get());
queue->setUsed(impl->getQueueElement());
}
MonitorElement::shared_pointer const & MonitorQueue::getUsed()
{
MonitorQueueElement *queueElement = queue->getUsed();
if(queueElement==0) return nullElement;
return *queueElement->getObject();
}
void MonitorQueue::releaseUsed(MonitorElement::shared_pointer const & element)
{
MonitorElementImpl *impl = static_cast<MonitorElementImpl *>(element.get());
queue->releaseUsed(impl->getQueueElement());
}
}}

View File

@@ -1,48 +0,0 @@
/* monitorQueue.h */
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvDataCPP is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
/* Marty Kraimer 2011.03 */
#ifndef MONITORQUEUE_H
#define MONITORQUEUE_H
#include <string>
#include <stdexcept>
#include <memory>
#include <vector>
#include <pv/pvData.h>
#include <pv/monitor.h>
#include <pv/queue.h>
#include <pv/sharedPtr.h>
namespace epics { namespace pvData {
typedef PVStructure::shared_pointer* PVStructureSharedPointerPtr;
typedef PVStructureSharedPointerPtr* PVStructureSharedPointerPtrArray;
class MonitorQueue {
public:
MonitorQueue(PVStructureSharedPointerPtrArray structures,int number);
~MonitorQueue();
static PVStructureSharedPointerPtrArray createStructures(
PVStructurePtrArray array,int number);
void clear();
int getNumberFree();
int capacity();
MonitorElement::shared_pointer const & getFree();
void setUsed(MonitorElement::shared_pointer const & element);
MonitorElement::shared_pointer const & getUsed();
void releaseUsed(MonitorElement::shared_pointer const & element);
private:
int number;
PVStructureSharedPointerPtrArray structures;
Queue<MonitorElement::shared_pointer> *queue;
MonitorElement::shared_pointer **queueElements;
MonitorElement::shared_pointer nullElement;
};
}}
#endif /* MONITORQUEUE_H */

View File

@@ -1,108 +0,0 @@
/* alarm.cpp */
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvDataCPP is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
#include <string>
#include <stdexcept>
#include <pv/pvType.h>
#include <pv/pvIntrospect.h>
#include <pv/pvData.h>
#include <pv/alarm.h>
namespace epics { namespace pvData {
const size_t severityCount = 5;
static String severityNames[severityCount] =
{
String("NONE"),
String("MINOR"),
String("MAJOR"),
String("INVALID"),
String("UNDEFINED")
};
AlarmSeverity AlarmSeverityFunc::getSeverity(int value)
{
if(value<0 || value>4) {
throw std::logic_error(String("getSeverity value is illegal"));
}
switch (value) {
case 0: return noAlarm;
case 1: return minorAlarm;
case 2: return majorAlarm;
case 3: return invalidAlarm;
case 4: return undefinedAlarm;
}
throw std::logic_error(String("should never get here"));
}
StringArray AlarmSeverityFunc::getSeverityNames()
{
return severityNames;
}
AlarmSeverity Alarm::getSeverity() const
{
switch(severity) {
case 0: return noAlarm;
case 1: return minorAlarm;
case 2: return majorAlarm;
case 3: return invalidAlarm;
case 4: return undefinedAlarm;
}
throw std::logic_error(String("should never get here"));
}
const size_t statusCount = 8;
static String statusNames[statusCount] =
{
String("NONE"),
String("DEVICE"),
String("DRIVER"),
String("RECORD"),
String("DB"),
String("CONF"),
String("UNDEFINED"),
String("CLIENT")
};
AlarmStatus AlarmStatusFunc::getStatus(int value)
{
if(value<0 || value>7) {
throw std::logic_error(String("getStatus value is illegal"));
}
switch (value) {
case 0: return noStatus;
case 1: return deviceStatus;
case 2: return driverStatus;
case 3: return recordStatus;
case 4: return dbStatus;
case 5: return confStatus;
case 6: return undefinedStatus;
case 7: return clientStatus;
}
throw std::logic_error(String("should never get here"));
}
StringArray AlarmStatusFunc::getStatusNames()
{
return statusNames;
}
AlarmStatus Alarm::getStatus() const
{
switch(status) {
case 0: return noStatus;
case 1: return deviceStatus;
case 2: return driverStatus;
case 3: return recordStatus;
case 4: return dbStatus;
case 5: return confStatus;
case 6: return undefinedStatus;
case 7: return clientStatus;
}
throw std::logic_error(String("should never get here"));
}
}}

View File

@@ -1,54 +0,0 @@
/* alarm.h */
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvDataCPP is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
#include <string>
#include <pv/pvType.h>
#ifndef ALARM_H
#define ALARM_H
namespace epics { namespace pvData {
enum AlarmSeverity {
noAlarm,minorAlarm,majorAlarm,invalidAlarm,undefinedAlarm
};
enum AlarmStatus {
noStatus,deviceStatus,driverStatus,recordStatus,
dbStatus,confStatus,undefinedStatus,clientStatus
};
extern const size_t severityCount;
class AlarmSeverityFunc {
public:
static AlarmSeverity getSeverity(int value);
static StringArray getSeverityNames();
};
extern const size_t statusCount;
class AlarmStatusFunc {
public:
static AlarmStatus getStatus(int value);
static StringArray getStatusNames();
};
class Alarm {
public:
Alarm() : severity(0),status(0), message(String("")) {}
//default constructors and destructor are OK
String getMessage() const {return message;}
void setMessage(String value) {message = value;}
AlarmSeverity getSeverity() const;
void setSeverity(AlarmSeverity value) {severity = value;}
AlarmStatus getStatus() const;
void setStatus(AlarmStatus value) { status = value;}
private:
int32 severity;
int32 status;
String message;
};
}}
#endif /* ALARM_H */

View File

@@ -1,25 +0,0 @@
/* control.h */
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvDataCPP is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
#ifndef CONTROL_H
#define CONTROL_H
namespace epics { namespace pvData {
class Control {
public:
Control() : low(0.0), high(0.0) {}
//default constructors and destructor are OK
double getLow() const {return low;}
double getHigh() const {return high;}
void setLow(double value) {low = value;}
void setHigh(double value) {high = value;}
private:
double low;
double high;
};
}}
#endif /* CONTROL_H */

View File

@@ -1,39 +0,0 @@
/* display.h */
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvDataCPP is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
#include <string>
#include <pv/pvType.h>
#include <pv/pvData.h>
#ifndef DISPLAY_H
#define DISPLAY_H
namespace epics { namespace pvData {
class Display {
public:
Display()
: description(String("")),format(String("")),units(String("")),
low(0.0),high(0.0) {}
//default constructors and destructor are OK
double getLow() const {return low;}
double getHigh() const{ return high;}
void setLow(double value){low = value;}
void setHigh(double value){high = value;}
String getDescription() const {return description;}
void setDescription(String value) {description = value;}
String getFormat() const {return format;}
void setFormat(String value) {format = value;}
String getUnits() const {return units;}
void setUnits(String value) {units = value;}
private:
String description;
String format;
String units;
double low;
double high;
};
}}
#endif /* DISPLAY_H */

View File

@@ -1,99 +0,0 @@
/* pvAlarm.cpp */
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvDataCPP is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
#include <string>
#include <stdexcept>
#include <pv/pvType.h>
#include <pv/pvIntrospect.h>
#include <pv/pvData.h>
#include <pv/pvAlarm.h>
namespace epics { namespace pvData {
static String noAlarmFound("No alarm structure found");
static String notAttached("Not attached to an alarm structure");
bool PVAlarm::attach(PVField *pvField)
{
PVStructure *pvStructure = 0;
if(pvField->getField()->getFieldName().compare("alarm")!=0) {
if(pvField->getField()->getFieldName().compare("value")!=0) {
pvField->message(noAlarmFound,errorMessage);
return false;
}
PVStructure *pvParent = pvField->getParent();
if(pvParent==0) {
pvField->message(noAlarmFound,errorMessage);
return false;
}
pvStructure = pvParent->getStructureField(String("alarm"));
if(pvStructure==0) {
pvField->message(noAlarmFound,errorMessage);
return false;
}
} else {
if(pvField->getField()->getType()!=structure) {
pvField->message(noAlarmFound,errorMessage);
return false;
}
pvStructure = static_cast<PVStructure*>(pvField);
}
PVInt *pvInt = pvStructure->getIntField(String("severity"));
if(pvInt==0) {
pvField->message(noAlarmFound,errorMessage);
return false;
}
pvSeverity = pvInt;
pvInt = pvStructure->getIntField(String("status"));
if(pvInt==0) {
pvField->message(noAlarmFound,errorMessage);
return false;
}
pvStatus = pvInt;
PVString *pvString = pvStructure->getStringField(String("message"));
if(pvInt==0) {
pvField->message(noAlarmFound,errorMessage);
return false;
}
pvMessage = pvString;
return true;
}
void PVAlarm::detach()
{
pvSeverity = 0;
pvStatus = 0;
pvMessage = 0;
}
bool PVAlarm::isAttached()
{
if(pvSeverity==0 || pvMessage==0) return false;
return true;
}
void PVAlarm::get(Alarm & alarm) const
{
if(pvSeverity==0 || pvMessage==0) {
throw std::logic_error(notAttached);
}
alarm.setSeverity(AlarmSeverityFunc::getSeverity(pvSeverity->get()));
alarm.setStatus(AlarmStatusFunc::getStatus(pvStatus->get()));
alarm.setMessage(pvMessage->get());
}
bool PVAlarm::set(Alarm const & alarm)
{
if(pvSeverity==0 || pvMessage==0) {
throw std::logic_error(notAttached);
}
if(pvSeverity->isImmutable() || pvMessage->isImmutable()) return false;
pvSeverity->put(alarm.getSeverity());
pvStatus->put(alarm.getStatus());
pvMessage->put(alarm.getMessage());
return true;
}
}}

View File

@@ -1,36 +0,0 @@
/* pvAlarm.h */
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvDataCPP is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
#ifndef PVALARM_H
#define PVALARM_H
#include <string>
#include <pv/pvType.h>
#include <pv/alarm.h>
#include <pv/pvData.h>
namespace epics { namespace pvData {
class PVAlarm {
public:
PVAlarm() : pvSeverity(0),pvStatus(0),pvMessage(0) {}
//default constructors and destructor are OK
//returns (false,true) if pvField(isNot, is valid enumerated structure
//An automatic detach is issued if already attached.
bool attach(PVField *pvField);
void detach();
bool isAttached();
// each of the following throws logic_error is not attached to PVField
// set returns false if field is immutable
void get(Alarm & alarm) const;
bool set(Alarm const & alarm);
private:
PVInt *pvSeverity;
PVInt *pvStatus;
PVString *pvMessage;
};
}}
#endif /* PVALARM_H */

View File

@@ -1,90 +0,0 @@
/* pvControl.cpp */
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvDataCPP is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
#include <string>
#include <stdexcept>
#include <pv/pvType.h>
#include <pv/pvIntrospect.h>
#include <pv/pvData.h>
#include <pv/pvControl.h>
namespace epics { namespace pvData {
static String noControlFound("No control structure found");
static String notAttached("Not attached to an control structure");
bool PVControl::attach(PVField *pvField)
{
PVStructure *pvStructure = 0;
if(pvField->getField()->getFieldName().compare("control")!=0) {
if(pvField->getField()->getFieldName().compare("value")!=0) {
pvField->message(noControlFound,errorMessage);
return false;
}
PVStructure *pvParent = pvField->getParent();
if(pvParent==0) {
pvField->message(noControlFound,errorMessage);
return false;
}
pvStructure = pvParent->getStructureField(String("control"));
if(pvStructure==0) {
pvField->message(noControlFound,errorMessage);
return false;
}
} else {
if(pvField->getField()->getType()!=structure) {
pvField->message(noControlFound,errorMessage);
return false;
}
pvStructure = static_cast<PVStructure*>(pvField);
}
PVDouble *pvDouble = pvStructure->getDoubleField(String("limit.low"));
if(pvDouble==0) {
pvField->message(noControlFound,errorMessage);
return false;
}
pvLow = pvDouble;
pvDouble = pvStructure->getDoubleField(String("limit.high"));
if(pvDouble==0) {
pvLow = 0;
pvField->message(noControlFound,errorMessage);
return false;
}
pvHigh = pvDouble;
return true;
}
void PVControl::detach()
{
pvLow = 0;
pvHigh = 0;
}
bool PVControl::isAttached(){
if(pvLow==0 || pvHigh==0) return false;
return true;
}
void PVControl::get(Control &control) const
{
if(pvLow==0 || pvHigh==0) {
throw std::logic_error(notAttached);
}
control.setLow(pvLow->get());
control.setHigh(pvHigh->get());
}
bool PVControl::set(Control const & control)
{
if(pvLow==0 || pvHigh==0) {
throw std::logic_error(notAttached);
}
if(pvLow->isImmutable() || pvHigh->isImmutable()) return false;
pvLow->put(control.getLow());
pvHigh->put(control.getHigh());
return true;
}
}}

View File

@@ -1,32 +0,0 @@
/* pvControl.h */
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvDataCPP is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
#include <pv/control.h>
#include <pv/pvData.h>
#ifndef PVCONTROL_H
#define PVCONTROL_H
namespace epics { namespace pvData {
class PVControl {
public:
PVControl() : pvLow(0),pvHigh(0) {}
//default constructors and destructor are OK
//returns (false,true) if pvField(isNot, is valid enumerated structure
//An automatic detach is issued if already attached.
bool attach(PVField *pvField);
void detach();
bool isAttached();
// each of the following throws logic_error is not attached to PVField
// set returns false if field is immutable
void get(Control &) const;
bool set(Control const & control);
private:
PVDouble *pvLow;
PVDouble *pvHigh;
};
}}
#endif /* PVCONTROL_H */

View File

@@ -1,119 +0,0 @@
/* pvDisplay.cpp */
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvDataCPP is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
#include <string>
#include <stdexcept>
#include <pv/pvType.h>
#include <pv/pvIntrospect.h>
#include <pv/pvData.h>
#include <pv/pvDisplay.h>
namespace epics { namespace pvData {
static String noDisplayFound("No display structure found");
static String notAttached("Not attached to an display structure");
bool PVDisplay::attach(PVField *pvField)
{
PVStructure *pvStructure = 0;
if(pvField->getField()->getFieldName().compare("display")!=0) {
if(pvField->getField()->getFieldName().compare("value")!=0) {
pvField->message(noDisplayFound,errorMessage);
return false;
}
PVStructure *pvParent = pvField->getParent();
if(pvParent==0) {
pvField->message(noDisplayFound,errorMessage);
return false;
}
pvStructure = pvParent->getStructureField(String("display"));
if(pvStructure==0) {
pvField->message(noDisplayFound,errorMessage);
return false;
}
} else {
if(pvField->getField()->getType()!=structure) {
pvField->message(noDisplayFound,errorMessage);
return false;
}
pvStructure = static_cast<PVStructure*>(pvField);
}
pvDescription = pvStructure->getStringField(String("description"));
if(pvDescription==0) {
pvField->message(noDisplayFound,errorMessage);
return false;
}
pvFormat = pvStructure->getStringField(String("format"));
if(pvFormat==0) {
pvField->message(noDisplayFound,errorMessage);
detach();
return false;
}
pvUnits = pvStructure->getStringField(String("units"));
if(pvUnits==0) {
pvField->message(noDisplayFound,errorMessage);
detach();
return false;
}
pvLow = pvStructure->getDoubleField(String("limit.low"));
if(pvLow==0) {
pvField->message(noDisplayFound,errorMessage);
detach();
return false;
}
pvHigh = pvStructure->getDoubleField(String("limit.high"));
if(pvHigh==0) {
pvField->message(noDisplayFound,errorMessage);
detach();
return false;
}
return true;
}
void PVDisplay::detach()
{
pvDescription = 0;
pvFormat = 0;
pvUnits = 0;
pvLow = 0;
pvHigh = 0;
}
bool PVDisplay::isAttached() {
if(pvDescription==0 || pvFormat==0 || pvUnits==0 || pvLow==0 || pvHigh==0)
return false;
return true;
}
void PVDisplay::get(Display & display) const
{
if(pvDescription==0 || pvFormat==0 || pvUnits==0 || pvLow==0 || pvHigh==0) {
throw std::logic_error(notAttached);
}
display.setDescription(pvDescription->get());
display.setFormat(pvFormat->get());
display.setUnits(pvUnits->get());
display.setLow(pvLow->get());
display.setHigh(pvHigh->get());
}
bool PVDisplay::set(Display const & display)
{
if(pvDescription==0 || pvFormat==0 || pvUnits==0 || pvLow==0 || pvHigh==0) {
throw std::logic_error(notAttached);
}
if(pvDescription->isImmutable() || pvFormat->isImmutable()) return false;
if(pvUnits->isImmutable() || pvLow->isImmutable() || pvHigh->isImmutable())
return false;
pvDescription->put(display.getDescription());
pvFormat->put(display.getFormat());
pvUnits->put(display.getUnits());
pvLow->put(display.getLow());
pvHigh->put(display.getHigh());
return true;
}
}}

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