Compare commits
33 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5f8fa26bf3 | ||
|
|
a5c835cfeb | ||
|
|
d2a649f5fa | ||
|
|
476f18332a | ||
|
|
a964e3668d | ||
|
|
69be072a07 | ||
|
|
a2ca21a1a6 | ||
|
|
0dd6f01ef6 | ||
|
|
cd95b75563 | ||
|
|
4122e772c1 | ||
|
|
2fbe99909c | ||
|
|
d4f3d6209c | ||
|
|
641a51aa4f | ||
|
|
67afe84593 | ||
|
|
66f7c90c51 | ||
|
|
959117c391 | ||
| 5e810c704f | |||
|
|
675243061d | ||
|
|
246825d672 | ||
|
|
aa1a67d6c1 | ||
|
|
97b1848ba3 | ||
|
|
c4f6132aca | ||
|
|
a0de4f126f | ||
|
|
a8a96def97 | ||
|
|
eaddc30def | ||
|
|
aa17639e20 | ||
|
|
58d7ad494b | ||
|
|
2895f48bd6 | ||
|
|
8f6ea47501 | ||
|
|
3eb6237343 | ||
|
|
cb19940fa7 | ||
|
|
4bc7e9c8fe | ||
|
|
18ba24156c |
20
.hgignore
20
.hgignore
@@ -1,9 +1,11 @@
|
||||
QtC-pvData.creator.user
|
||||
bin
|
||||
lib
|
||||
doc
|
||||
include
|
||||
documentation/html
|
||||
./O.*
|
||||
configure/RELEASE.local
|
||||
configure/CONFIG_SITE.local
|
||||
^QtC-
|
||||
^bin/
|
||||
^lib/
|
||||
^doc/
|
||||
^include/
|
||||
^db/
|
||||
^dbd/
|
||||
^documentation/html
|
||||
envPaths
|
||||
configure/.*\.local
|
||||
/O\..*
|
||||
|
||||
1
.hgtags
1
.hgtags
@@ -4,3 +4,4 @@ d29d84f4c3f389f2accd497185b106c8541f95c9 1.1-SNAPSHOT
|
||||
a29729ca0ecd60b66f2d997031d97911377e44a7 marchtest
|
||||
9c59737f56e71aef641b70d0f72aa768fd7f8414 1.0.1-BETA
|
||||
4559c3de0cb4e3420e26272817f58bab005063ec 1.1-BETA
|
||||
d70c5ad29163306f50979a95b5aebbe9a93cfe76 2.0-BETA
|
||||
|
||||
@@ -1,27 +1,25 @@
|
||||
#RELEASE Location of external products
|
||||
# pvDataCPP 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 this file or any file it includes you must
|
||||
# subsequently do a "gnumake rebuild" in the 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 build process does not check dependencies against files
|
||||
# that are outside this application, thus you should also do a
|
||||
# "gnumake rebuild" in the top level directory after EPICS_BASE
|
||||
# or any other external module pointed to below is rebuilt.
|
||||
#
|
||||
# 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)
|
||||
|
||||
TEMPLATE_TOP=$(EPICS_BASE)/templates/makeBaseApp/top
|
||||
EPICS_BASE=/home/install/epics/base
|
||||
|
||||
# Create a file RELEASE.local containing the
|
||||
# location of your EPICS_BASE, e.g.
|
||||
# EPICS_BASE=/home/install/epics/base
|
||||
# EPICS V4 Developers: Do not edit the locations in this file!
|
||||
#
|
||||
# Create a file RELEASE.local pointing to your EPICS_BASE
|
||||
# and PVCOMMON build directories, e.g.
|
||||
# EPICS_BASE = /home/install/epics/base
|
||||
# PVCOMMON = /home/install/epicsV4/pvCommonCPP
|
||||
|
||||
-include $(TOP)/configure/RELEASE.local
|
||||
-include $(TOP)/../RELEASE.local
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
<h1>EPICS pvDataCPP</h1>
|
||||
<!-- Maturity: Working Draft or Request for Comments, or Recommendation, and date. -->
|
||||
|
||||
<h2 class="nocount">EPICS v4 Working Group, Working Draft, 01-Oct-2012</h2>
|
||||
<h2 class="nocount">EPICS v4 Working Group, Working Draft, 16-May-2013</h2>
|
||||
|
||||
<dl>
|
||||
<dt>Latest version:</dt>
|
||||
@@ -46,11 +46,11 @@
|
||||
</dd>
|
||||
<dt>This version:</dt>
|
||||
<dd><a
|
||||
href="http://epics-pvdata.hg.sourceforge.net/hgweb/epics-pvdata/pvDataCPP/raw-file/tip/documentation/pvDataCPP_20121026html">pvDataCPP_20121026html</a>
|
||||
href="http://epics-pvdata.hg.sourceforge.net/hgweb/epics-pvdata/pvDataCPP/raw-file/tip/documentation/pvDataCPP_20130516.html">pvDataCPP_20130516.html</a>
|
||||
</dd>
|
||||
<dt>Previous version:</dt>
|
||||
<dd><a
|
||||
href="http://epics-pvdata.hg.sourceforge.net/hgweb/epics-pvdata/pvDataCPP/raw-file/tip/documentation/pvDataCPP_20121001.html">pvDataCPP_20121001.html</a>
|
||||
href="http://epics-pvdata.hg.sourceforge.net/hgweb/epics-pvdata/pvDataCPP/raw-file/tip/documentation/pvDataCPP_20121212.html">pvDataCPP_20121212.html</a>
|
||||
</dd>
|
||||
<dt>Editors:</dt>
|
||||
<dd>Marty Kraimer, BNL</dd>
|
||||
@@ -97,7 +97,9 @@ Control System (EPICS).</a></p>
|
||||
|
||||
<h2 class="nocount">Status of this Document</h2>
|
||||
|
||||
<p>This is the 01-Oct-2012 version of the C++ implementation of pvData.</p>
|
||||
<p>This is the 16-May-2013 version of the C++ implementation of pvData.
|
||||
Since the last version changes were made to queue and to bitSetUtil.
|
||||
</p>
|
||||
|
||||
<p> The text describes software which is a complete implementation of pvData as
|
||||
currently planned by the EPICS V4 Working Group. </p> </p>
|
||||
@@ -865,8 +867,7 @@ typedef std::tr1::shared_ptr<PostHandler> PostHandlerPtr</pre>
|
||||
<p>PostHandler is a class that must be implemented by any code that calls
|
||||
setPostHandler. It's single virtual method. postPut is called whenever
|
||||
PVField::postPut is called.</p>
|
||||
<pre>class PostHandler :
|
||||
public std::tr1::enable_shared_from_this<PostHandler>
|
||||
<pre>class PostHandler
|
||||
{
|
||||
public:
|
||||
POINTER_DEFINITIONS(PostHandler);
|
||||
@@ -3037,6 +3038,7 @@ public:
|
||||
~Lock();
|
||||
void lock();
|
||||
void unlock();
|
||||
bool tryLock();
|
||||
bool ownsLock() ;
|
||||
...
|
||||
};</pre>
|
||||
@@ -3179,9 +3181,9 @@ public:
|
||||
int getNumberFree();
|
||||
int getNumberUsed();
|
||||
queueElementPtr & getFree();
|
||||
void setUsed(queueElementPtr &element);
|
||||
void setUsed(queueElementPtr const &element);
|
||||
queueElementPtr & getUsed();
|
||||
void releaseUsed(queueElementPtr &element);
|
||||
void releaseUsed(queueElementPtr const &element);
|
||||
...
|
||||
};</pre>
|
||||
|
||||
@@ -3619,7 +3621,7 @@ be used to schedule multiple callbacks. It has the methods:</p>
|
||||
<p>The following is also provided:</p>
|
||||
<pre>class BitSetUtil : private NoDefaultMethods {
|
||||
public:
|
||||
static bool compress(BitSet *bitSet,PVStructure *pvStructure);
|
||||
static bool compress(BitSet const &bitSet,PVStructure const &pvStructure);
|
||||
};</pre>
|
||||
|
||||
<p>This provides functions that operate on a BitSet for a PVStructure. It
|
||||
|
||||
3646
documentation/pvDataCPP_20121212.html
Normal file
3646
documentation/pvDataCPP_20121212.html
Normal file
File diff suppressed because it is too large
Load Diff
3648
documentation/pvDataCPP_20130516.html
Normal file
3648
documentation/pvDataCPP_20130516.html
Normal file
File diff suppressed because it is too large
Load Diff
29
jenkins/aps_build
Normal file
29
jenkins/aps_build
Normal file
@@ -0,0 +1,29 @@
|
||||
# pvData C++ implementation
|
||||
# Jenkins @ APS 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> and Andrew Johnson <anj@aps.anl.gov>
|
||||
# Copyright (C) 2013 Helmholtz-Zentrum Berlin für Materialien und Energie GmbH
|
||||
# All rights reserved. Use is subject to license terms.
|
||||
|
||||
###########################################
|
||||
# Build
|
||||
|
||||
export EPICS_BASE=${HOME}/jobs/epics-base-3.14/workspace
|
||||
export EPICS_HOST_ARCH=$(${EPICS_BASE}/startup/EpicsHostArch)
|
||||
|
||||
cat > configure/RELEASE.local << EOF
|
||||
PVCOMMON=${HOME}/jobs/epics-pvCommon/workspace
|
||||
EPICS_BASE=${EPICS_BASE}
|
||||
EOF
|
||||
|
||||
make distclean all
|
||||
|
||||
###########################################
|
||||
# Test
|
||||
|
||||
for t in bin/linux-x86_64/test*; do
|
||||
$t
|
||||
done
|
||||
57
jenkins/cloudbees_build
Normal file
57
jenkins/cloudbees_build
Normal file
@@ -0,0 +1,57 @@
|
||||
# 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
|
||||
# All rights reserved. Use is subject to license terms.
|
||||
|
||||
###########################################
|
||||
# Fetch and unpack dependencies
|
||||
|
||||
export STUFF=/tmp/stuff
|
||||
|
||||
rm -fr ${STUFF}
|
||||
mkdir -p ${STUFF}
|
||||
cd ${STUFF}
|
||||
|
||||
wget -nv https://openepics.ci.cloudbees.com/job/Base-3.14.12.3_Build/lastSuccessfulBuild/artifact/baseR3.14.12.3.CB-dist.tar.gz
|
||||
wget -nv https://openepics.ci.cloudbees.com/job/Doxygen-1.8.3_Build/lastSuccessfulBuild/artifact/doxygen-1.8.3.CB-dist.tar.gz
|
||||
tar -xzf baseR3.14.12.3.CB-dist.tar.gz
|
||||
tar -xzf doxygen-1.8.3.CB-dist.tar.gz
|
||||
|
||||
###########################################
|
||||
# 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
|
||||
doxygen
|
||||
|
||||
###########################################
|
||||
# Test
|
||||
|
||||
for t in bin/linux-x86_64/test*; do
|
||||
$t
|
||||
done
|
||||
|
||||
###########################################
|
||||
# Create distribution
|
||||
|
||||
tar czf pvData.CB-dist.tar.gz lib include COPYRIGHT LICENSE
|
||||
|
||||
###########################################
|
||||
# Publish documentation
|
||||
|
||||
rsync -aP --delete -e ssh documentation epics-jenkins@web.sourceforge.net:/home/project-web/epics-pvdata/htdocs/docbuild/pvDataCPP/tip
|
||||
20
jenkins/cloudbees_hgweb
Normal file
20
jenkins/cloudbees_hgweb
Normal file
@@ -0,0 +1,20 @@
|
||||
# pvData C++ implementation
|
||||
# Jenkins @ Cloudbees hgweb sync 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
|
||||
# All rights reserved. Use is subject to license terms.
|
||||
|
||||
###########################################
|
||||
# Fetch complete repo
|
||||
|
||||
rm -fr hgweb
|
||||
hg clone -U http://hg.code.sf.net/p/epics-pvdata/pvDataCPP hgweb
|
||||
|
||||
###########################################
|
||||
# Sync into SF webspace
|
||||
|
||||
rsync -aqP --delete --exclude=\.hg/hgrc -e ssh hgweb/.hg epics-jenkins@web.sourceforge.net:/home/project-web/epics-pvdata/repos/pvDataCPP
|
||||
@@ -92,9 +92,7 @@ LIBSRCS += bitSetUtil.cpp
|
||||
SRC_DIRS += $(PVDATA)/monitor
|
||||
INC += monitor.h
|
||||
|
||||
|
||||
LIBRARY=pvData
|
||||
|
||||
LIBRARY = pvData
|
||||
pvData_LIBS += Com
|
||||
|
||||
include $(TOP)/configure/RULES
|
||||
|
||||
@@ -2721,7 +2721,7 @@ void convertStructure(StringBuilder buffer,PVStructure const *data,int indentLev
|
||||
}
|
||||
}
|
||||
|
||||
void convertArray(StringBuilder buffer,PVScalarArray const * xxx,int indentLevel)
|
||||
void convertArray(StringBuilder buffer,PVScalarArray const * xxx,int /*indentLevel*/)
|
||||
{
|
||||
PVScalarArray *pv = const_cast<PVScalarArray *>(xxx);
|
||||
ScalarArrayConstPtr array = pv->getScalarArray();
|
||||
|
||||
@@ -39,7 +39,7 @@ Field::~Field() {
|
||||
}
|
||||
|
||||
|
||||
void Field::toString(StringBuilder buffer,int indentLevel) const{
|
||||
void Field::toString(StringBuilder /*buffer*/,int /*indentLevel*/) const{
|
||||
}
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ struct ScalarArrayHashFunction {
|
||||
};
|
||||
|
||||
struct StructureHashFunction {
|
||||
size_t operator() (const Structure& structure) const { return 0; }
|
||||
size_t operator() (const Structure& /*structure*/) const { return 0; }
|
||||
// TODO
|
||||
// final int PRIME = 31;
|
||||
// return PRIME * Arrays.hashCode(fieldNames) + Arrays.hashCode(fields);
|
||||
@@ -70,7 +70,7 @@ Scalar::Scalar(ScalarType scalarType)
|
||||
|
||||
Scalar::~Scalar(){}
|
||||
|
||||
void Scalar::toString(StringBuilder buffer,int indentLevel) const{
|
||||
void Scalar::toString(StringBuilder buffer,int /*indentLevel*/) const{
|
||||
*buffer += getID();
|
||||
}
|
||||
|
||||
@@ -94,7 +94,7 @@ String Scalar::getID() const
|
||||
return idScalarLUT[scalarType];
|
||||
}
|
||||
|
||||
const int8 Scalar::getTypeCodeLUT() const
|
||||
int8 Scalar::getTypeCodeLUT() const
|
||||
{
|
||||
static const int8 typeCodeLUT[] = {
|
||||
0x00, // pvBoolean
|
||||
@@ -119,7 +119,7 @@ void Scalar::serialize(ByteBuffer *buffer, SerializableControl *control) const {
|
||||
buffer->putByte(getTypeCodeLUT());
|
||||
}
|
||||
|
||||
void Scalar::deserialize(ByteBuffer *buffer, DeserializableControl *control) {
|
||||
void Scalar::deserialize(ByteBuffer */*buffer*/, DeserializableControl */*control*/) {
|
||||
// must be done via FieldCreate
|
||||
throw std::runtime_error("not valid operation, use FieldCreate::deserialize instead");
|
||||
}
|
||||
@@ -170,7 +170,7 @@ ScalarArray::ScalarArray(ScalarType elementType)
|
||||
|
||||
ScalarArray::~ScalarArray() {}
|
||||
|
||||
const int8 ScalarArray::getTypeCodeLUT() const
|
||||
int8 ScalarArray::getTypeCodeLUT() const
|
||||
{
|
||||
static const int8 typeCodeLUT[] = {
|
||||
0x00, // pvBoolean
|
||||
@@ -213,7 +213,7 @@ String ScalarArray::getID() const
|
||||
return getIDScalarArrayLUT();
|
||||
}
|
||||
|
||||
void ScalarArray::toString(StringBuilder buffer,int indentLevel) const{
|
||||
void ScalarArray::toString(StringBuilder buffer,int /*indentLevel*/) const{
|
||||
*buffer += getID();
|
||||
}
|
||||
|
||||
@@ -222,7 +222,7 @@ void ScalarArray::serialize(ByteBuffer *buffer, SerializableControl *control) co
|
||||
buffer->putByte(0x10 | getTypeCodeLUT());
|
||||
}
|
||||
|
||||
void ScalarArray::deserialize(ByteBuffer *buffer, DeserializableControl *control) {
|
||||
void ScalarArray::deserialize(ByteBuffer */*buffer*/, DeserializableControl */*control*/) {
|
||||
throw std::runtime_error("not valid operation, use FieldCreate::deserialize instead");
|
||||
}
|
||||
|
||||
@@ -252,7 +252,7 @@ void StructureArray::serialize(ByteBuffer *buffer, SerializableControl *control)
|
||||
control->cachedSerialize(pstructure, buffer);
|
||||
}
|
||||
|
||||
void StructureArray::deserialize(ByteBuffer *buffer, DeserializableControl *control) {
|
||||
void StructureArray::deserialize(ByteBuffer */*buffer*/, DeserializableControl */*control*/) {
|
||||
throw std::runtime_error("not valid operation, use FieldCreate::deserialize instead");
|
||||
}
|
||||
|
||||
@@ -357,7 +357,7 @@ void Structure::serialize(ByteBuffer *buffer, SerializableControl *control) cons
|
||||
serializeStructureField(this, buffer, control);
|
||||
}
|
||||
|
||||
void Structure::deserialize(ByteBuffer *buffer, DeserializableControl *control) {
|
||||
void Structure::deserialize(ByteBuffer */*buffer*/, DeserializableControl */*control*/) {
|
||||
throw std::runtime_error("not valid operation, use FieldCreate::deserialize instead");
|
||||
}
|
||||
|
||||
|
||||
@@ -97,4 +97,9 @@ PVArray::~PVArray()
|
||||
pImpl->capacity = capacity;
|
||||
}
|
||||
|
||||
std::ostream& operator<<(format::array_at_internal const& manip, const PVArray& array)
|
||||
{
|
||||
return array.dumpValue(manip.stream, manip.index);
|
||||
}
|
||||
|
||||
}}
|
||||
|
||||
@@ -62,7 +62,11 @@ template<typename T>
|
||||
T BasePVScalar<T>::get() const { return value;}
|
||||
|
||||
template<typename T>
|
||||
void BasePVScalar<T>::put(T val){value = val;}
|
||||
void BasePVScalar<T>::put(T val)
|
||||
{
|
||||
value = val;
|
||||
PVField::postPut();
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void BasePVScalar<T>::serialize(ByteBuffer *pbuffer,
|
||||
@@ -120,7 +124,11 @@ BasePVString::~BasePVString() {}
|
||||
|
||||
String BasePVString::get() const { return value;}
|
||||
|
||||
void BasePVString::put(String val){value = val;}
|
||||
void BasePVString::put(String val)
|
||||
{
|
||||
value = val;
|
||||
postPut();
|
||||
}
|
||||
|
||||
void BasePVString::serialize(ByteBuffer *pbuffer,
|
||||
SerializableControl *pflusher) const
|
||||
@@ -139,9 +147,9 @@ void BasePVString::serialize(ByteBuffer *pbuffer,
|
||||
{
|
||||
// check bounds
|
||||
const size_t length = /*(value == null) ? 0 :*/ value.length();
|
||||
if (offset < 0) offset = 0;
|
||||
else if (offset > length) offset = length;
|
||||
if (count < 0) count = length;
|
||||
/*if (offset < 0) offset = 0;
|
||||
else*/ if (offset > length) offset = length;
|
||||
//if (count < 0) count = length;
|
||||
|
||||
const size_t maxCount = length - offset;
|
||||
if (count > maxCount)
|
||||
@@ -263,7 +271,7 @@ size_t DefaultPVArray<T>::get(size_t offset, size_t len, PVArrayData<T> &data)
|
||||
size_t length = this->getLength();
|
||||
if(offset+len > length) {
|
||||
n = length-offset;
|
||||
if(n<0) n = 0;
|
||||
//if(n<0) n = 0;
|
||||
}
|
||||
data.data = *value.get();
|
||||
data.offset = offset;
|
||||
@@ -323,14 +331,26 @@ template<typename T>
|
||||
void DefaultPVArray<T>::deserialize(ByteBuffer *pbuffer,
|
||||
DeserializableControl *pcontrol) {
|
||||
size_t size = SerializeHelper::readSize(pbuffer, pcontrol);
|
||||
// if (size>0) { pcontrol->ensureData(sizeof(T)-1); pbuffer->align(sizeof(T)); }
|
||||
if(size>=0) {
|
||||
// alignment 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);
|
||||
// set new length
|
||||
this->setLength(size);
|
||||
|
||||
// try to avoid deserializing from the buffer
|
||||
// this is only possible if we do not need to do endian-swapping
|
||||
if (!pbuffer->reverse<T>())
|
||||
if (pcontrol->directDeserialize(pbuffer, (char*)(get()), size, sizeof(T)))
|
||||
{
|
||||
// inform about the change?
|
||||
PVField::postPut();
|
||||
return;
|
||||
}
|
||||
|
||||
// retrieve value from the buffer
|
||||
size_t i = 0;
|
||||
T * pvalue = get();
|
||||
while(true) {
|
||||
/*
|
||||
size_t maxIndex = min(size-i, (int)(pbuffer->getRemaining()/sizeof(T)))+i;
|
||||
@@ -338,7 +358,7 @@ void DefaultPVArray<T>::deserialize(ByteBuffer *pbuffer,
|
||||
value[i] = pbuffer->get<T>();
|
||||
*/
|
||||
size_t maxCount = min(size-i, (pbuffer->getRemaining()/sizeof(T)));
|
||||
pbuffer->getArray(get()+i, maxCount);
|
||||
pbuffer->getArray(pvalue+i, maxCount);
|
||||
i += maxCount;
|
||||
|
||||
if(i<size)
|
||||
@@ -348,7 +368,7 @@ void DefaultPVArray<T>::deserialize(ByteBuffer *pbuffer,
|
||||
}
|
||||
// inform about the change?
|
||||
PVField::postPut();
|
||||
}
|
||||
//}
|
||||
// TODO null arrays (size == -1) not supported
|
||||
}
|
||||
|
||||
@@ -359,10 +379,10 @@ void DefaultPVArray<T>::serialize(ByteBuffer *pbuffer,
|
||||
size_t length = this->getLength();
|
||||
|
||||
// check bounds
|
||||
if(offset<0)
|
||||
/*if(offset<0)
|
||||
offset = 0;
|
||||
else if(offset>length) offset = length;
|
||||
if(count<0) count = length;
|
||||
else*/ if(offset>length) offset = length;
|
||||
//if(count<0) count = length;
|
||||
|
||||
size_t maxCount = length-offset;
|
||||
if(count>maxCount) count = maxCount;
|
||||
@@ -370,8 +390,17 @@ void DefaultPVArray<T>::serialize(ByteBuffer *pbuffer,
|
||||
// write
|
||||
SerializeHelper::writeSize(count, pbuffer, pflusher);
|
||||
//if (count == 0) return; pcontrol->ensureData(sizeof(T)-1); pbuffer->align(sizeof(T));
|
||||
|
||||
|
||||
// try to avoid copying into the buffer
|
||||
// this is only possible if we do not need to do endian-swapping
|
||||
if (!pbuffer->reverse<T>())
|
||||
if (pflusher->directSerialize(pbuffer, (const char*)(get()+offset), count, sizeof(T)))
|
||||
return;
|
||||
|
||||
size_t end = offset+count;
|
||||
size_t i = offset;
|
||||
T * pvalue = const_cast<T *>(get());
|
||||
while(true) {
|
||||
|
||||
/*
|
||||
@@ -381,7 +410,6 @@ void DefaultPVArray<T>::serialize(ByteBuffer *pbuffer,
|
||||
*/
|
||||
|
||||
size_t maxCount = min<int>(end-i, (int)(pbuffer->getRemaining()/sizeof(T)));
|
||||
T * pvalue = const_cast<T *>(get());
|
||||
pbuffer->putArray(pvalue+i, maxCount);
|
||||
i += maxCount;
|
||||
|
||||
@@ -398,7 +426,7 @@ template<>
|
||||
void DefaultPVArray<String>::deserialize(ByteBuffer *pbuffer,
|
||||
DeserializableControl *pcontrol) {
|
||||
size_t size = SerializeHelper::readSize(pbuffer, pcontrol);
|
||||
if(size>=0) {
|
||||
//if(size>=0) {
|
||||
// prepare array, if necessary
|
||||
if(size>getCapacity()) setCapacity(size);
|
||||
// set new length
|
||||
@@ -411,7 +439,7 @@ void DefaultPVArray<String>::deserialize(ByteBuffer *pbuffer,
|
||||
}
|
||||
// inform about the change?
|
||||
postPut();
|
||||
}
|
||||
//}
|
||||
// TODO null arrays (size == -1) not supported
|
||||
}
|
||||
|
||||
@@ -421,10 +449,10 @@ void DefaultPVArray<String>::serialize(ByteBuffer *pbuffer,
|
||||
size_t length = getLength();
|
||||
|
||||
// check bounds
|
||||
if(offset<0)
|
||||
/*if(offset<0)
|
||||
offset = 0;
|
||||
else if(offset>length) offset = length;
|
||||
if(count<0) count = length;
|
||||
else*/ if(offset>length) offset = length;
|
||||
//if(count<0) count = length;
|
||||
|
||||
size_t maxCount = length-offset;
|
||||
if(count>maxCount) count = maxCount;
|
||||
|
||||
@@ -158,7 +158,7 @@ void PVField::renameField(String const & newName)
|
||||
|
||||
void PVField::postPut()
|
||||
{
|
||||
if(postHandler!=NULL) postHandler->postPut();
|
||||
if(postHandler.get()!=NULL) postHandler->postPut();
|
||||
}
|
||||
|
||||
void PVField::setPostHandler(PostHandlerPtr const &handler)
|
||||
@@ -194,17 +194,34 @@ void PVField::toString(StringBuilder buf,int indentLevel)
|
||||
if(pvAuxInfo.get()!=NULL) pvAuxInfo->toString(buf,indentLevel);
|
||||
}
|
||||
|
||||
std::ostream& PVField::dumpValue(std::ostream& o) const
|
||||
std::ostream& operator<<(std::ostream& o, const PVField& f)
|
||||
{
|
||||
// default implementation
|
||||
// each PVField class should implement it to avoid switch statement
|
||||
// and string reallocation
|
||||
String tmp;
|
||||
convert->getString(&tmp,this,0);
|
||||
return o << tmp;
|
||||
}
|
||||
std::ostream& ro = f.dumpValue(o);
|
||||
// TODO I do not want to call getPVAuxInfo() since it lazily creates a new instance of it
|
||||
//if (f.pvAuxInfo.get()!=NULL) ro << *(f.pvAuxInfo.get());
|
||||
return ro;
|
||||
};
|
||||
|
||||
std::ostream& operator<<(std::ostream& o, const PVField& f) { return f.dumpValue(o); };
|
||||
namespace format
|
||||
{
|
||||
std::ostream& operator<<(std::ostream& os, indent_level const& indent)
|
||||
{
|
||||
indent_value(os) = indent.level;
|
||||
return os;
|
||||
}
|
||||
|
||||
std::ostream& operator<<(std::ostream& os, indent const&)
|
||||
{
|
||||
long il = indent_value(os);
|
||||
std::size_t spaces = static_cast<std::size_t>(il) * 4;
|
||||
return os << std::string(spaces, ' ');
|
||||
}
|
||||
|
||||
array_at_internal operator<<(std::ostream& str, array_at const& manip)
|
||||
{
|
||||
return array_at_internal(manip.index, str);
|
||||
}
|
||||
};
|
||||
|
||||
void PVField::computeOffset(const PVField * pvField) {
|
||||
const PVStructure * pvTop = pvField->getParent();
|
||||
|
||||
@@ -702,4 +702,31 @@ static PVFieldPtr findSubField(
|
||||
return PVFieldPtr();
|
||||
}
|
||||
|
||||
std::ostream& PVStructure::dumpValue(std::ostream& o) const
|
||||
{
|
||||
o << format::indent() << getStructure()->getID() << ' ' << getFieldName();
|
||||
String extendsName = getExtendsStructureName();
|
||||
if(extendsName.length()>0) {
|
||||
o << " extends " << extendsName;
|
||||
}
|
||||
o << std::endl;
|
||||
{
|
||||
format::indent_scope s(o);
|
||||
|
||||
PVFieldPtrArray const & fieldsData = getPVFields();
|
||||
if (fieldsData.size() != 0) {
|
||||
size_t length = getStructure()->getNumberFields();
|
||||
for(size_t i=0; i<length; i++) {
|
||||
PVFieldPtr fieldField = fieldsData[i];
|
||||
Type type = fieldField->getField()->getType();
|
||||
if (type == scalar || type == scalarArray)
|
||||
o << format::indent() << fieldField->getField()->getID() << ' ' << fieldField->getFieldName() << ' ' << *(fieldField.get()) << std::endl;
|
||||
else
|
||||
o << *(fieldField.get());
|
||||
}
|
||||
}
|
||||
}
|
||||
return o;
|
||||
}
|
||||
|
||||
}}
|
||||
|
||||
@@ -133,7 +133,7 @@ size_t PVStructureArray::get(
|
||||
size_t length = getLength();
|
||||
if(offset+len > length) {
|
||||
n = length - offset;
|
||||
if(n<0) n = 0;
|
||||
//if(n<0) n = 0;
|
||||
}
|
||||
data.data = *value.get();
|
||||
data.offset = offset;
|
||||
@@ -197,7 +197,7 @@ void PVStructureArray::serialize(ByteBuffer *pbuffer,
|
||||
void PVStructureArray::deserialize(ByteBuffer *pbuffer,
|
||||
DeserializableControl *pcontrol) {
|
||||
size_t size = SerializeHelper::readSize(pbuffer, pcontrol);
|
||||
if(size>=0) {
|
||||
//if(size>=0) {
|
||||
// prepare array, if necessary
|
||||
if(size>getCapacity()) setCapacity(size);
|
||||
setLength(size);
|
||||
@@ -217,7 +217,7 @@ void PVStructureArray::deserialize(ByteBuffer *pbuffer,
|
||||
}
|
||||
}
|
||||
postPut();
|
||||
}
|
||||
//}
|
||||
}
|
||||
|
||||
void PVStructureArray::serialize(ByteBuffer *pbuffer,
|
||||
@@ -226,10 +226,10 @@ void PVStructureArray::serialize(ByteBuffer *pbuffer,
|
||||
size_t length = getLength();
|
||||
|
||||
// check bounds
|
||||
if(offset<0)
|
||||
/*if(offset<0)
|
||||
offset = 0;
|
||||
else if(offset>length) offset = length;
|
||||
if(count<0) count = length;
|
||||
else*/ if(offset>length) offset = length;
|
||||
//if(count<0) count = length;
|
||||
|
||||
size_t maxCount = length-offset;
|
||||
if(count>maxCount) count = maxCount;
|
||||
@@ -250,4 +250,27 @@ void PVStructureArray::serialize(ByteBuffer *pbuffer,
|
||||
}
|
||||
}
|
||||
|
||||
std::ostream& PVStructureArray::dumpValue(std::ostream& o) const
|
||||
{
|
||||
o << format::indent() << getStructureArray()->getID() << ' ' << getFieldName() << std::endl;
|
||||
size_t length = getLength();
|
||||
if (length > 0)
|
||||
{
|
||||
format::indent_scope s(o);
|
||||
|
||||
for (size_t i = 0; i < length; i++)
|
||||
dumpValue(o, i);
|
||||
}
|
||||
|
||||
return o;
|
||||
}
|
||||
|
||||
std::ostream& PVStructureArray::dumpValue(std::ostream& o, std::size_t index) const
|
||||
{
|
||||
PVStructurePtrArray pvArray = *value.get();
|
||||
PVStructurePtr pvStructure = pvArray[index];
|
||||
return o << *(pvStructure.get());
|
||||
return o;
|
||||
}
|
||||
|
||||
}}
|
||||
|
||||
@@ -65,9 +65,10 @@ StructureConstPtr StandardField::createProperties(String id,FieldConstPtr field,
|
||||
StructureConstPtr valueAlarm;
|
||||
Type type= field->getType();
|
||||
while(gotValueAlarm) {
|
||||
if(type==epics::pvData::scalar) {
|
||||
ScalarConstPtr scalar = static_pointer_cast<const Scalar>(field);
|
||||
ScalarType scalarType = scalar->getScalarType();
|
||||
if(type==epics::pvData::scalar || type==epics::pvData::scalarArray) {
|
||||
ScalarType scalarType = (type==epics::pvData::scalar) ?
|
||||
static_pointer_cast<const Scalar>(field)->getScalarType() :
|
||||
static_pointer_cast<const ScalarArray>(field)->getElementType();
|
||||
switch(scalarType) {
|
||||
case pvBoolean: valueAlarm = booleanAlarmField; break;
|
||||
case pvByte: valueAlarm = byteAlarmField; break;
|
||||
|
||||
@@ -331,7 +331,7 @@ namespace epics { namespace pvData {
|
||||
return !(*this == set);
|
||||
}
|
||||
|
||||
void BitSet::toString(StringBuilder buffer, int indentLevel) const
|
||||
void BitSet::toString(StringBuilder buffer, int /*indentLevel*/) const
|
||||
{
|
||||
*buffer += '{';
|
||||
int32 i = nextSetBit(0);
|
||||
|
||||
@@ -608,6 +608,24 @@ private:
|
||||
bool _reverseFloatEndianess;
|
||||
};
|
||||
|
||||
template<>
|
||||
inline bool ByteBuffer::reverse<bool>()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
template<>
|
||||
inline bool ByteBuffer::reverse<int8>()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
template<>
|
||||
inline bool ByteBuffer::reverse<uint8>()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
template<>
|
||||
inline bool ByteBuffer::reverse<float>()
|
||||
{
|
||||
|
||||
@@ -44,6 +44,15 @@ public:
|
||||
locked=false;
|
||||
}
|
||||
}
|
||||
bool tryLock()
|
||||
{
|
||||
if(locked) return true;
|
||||
if(mutexPtr.tryLock()) {
|
||||
locked = true;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
bool ownsLock() const{return locked;}
|
||||
private:
|
||||
Mutex &mutexPtr;
|
||||
|
||||
@@ -29,9 +29,9 @@ public:
|
||||
int getNumberFree();
|
||||
int getNumberUsed();
|
||||
queueElementPtr & getFree();
|
||||
void setUsed(queueElementPtr &element);
|
||||
void setUsed(queueElementPtr const &element);
|
||||
queueElementPtr & getUsed();
|
||||
void releaseUsed(queueElementPtr &element);
|
||||
void releaseUsed(queueElementPtr const &element);
|
||||
private:
|
||||
queueElementPtr nullElement;
|
||||
queueElementPtrArray elements;
|
||||
@@ -92,7 +92,7 @@ std::tr1::shared_ptr<T> & Queue<T>::getFree()
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void Queue<T>::setUsed(std::tr1::shared_ptr<T> &element)
|
||||
void Queue<T>::setUsed(std::tr1::shared_ptr<T> const &element)
|
||||
{
|
||||
if(element!=elements[nextSetUsed++]) {
|
||||
throw std::logic_error("not correct queueElement");
|
||||
@@ -112,7 +112,7 @@ std::tr1::shared_ptr<T> & Queue<T>::getUsed()
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void Queue<T>::releaseUsed(std::tr1::shared_ptr<T> &element)
|
||||
void Queue<T>::releaseUsed(std::tr1::shared_ptr<T> const &element)
|
||||
{
|
||||
if(element!=elements[nextReleaseUsed++]) {
|
||||
throw std::logic_error(
|
||||
|
||||
@@ -27,6 +27,8 @@ namespace epics { namespace pvData {
|
||||
virtual void flushSerializeBuffer() =0;
|
||||
virtual void ensureBuffer(std::size_t size) =0;
|
||||
virtual void alignBuffer(std::size_t alignment) =0;
|
||||
virtual bool directSerialize(ByteBuffer *existingBuffer, const char* toSerialize,
|
||||
std::size_t elementCount, std::size_t elementSize) = 0;
|
||||
virtual void cachedSerialize(std::tr1::shared_ptr<const Field> const & field, ByteBuffer* buffer) = 0;
|
||||
};
|
||||
|
||||
@@ -35,6 +37,8 @@ namespace epics { namespace pvData {
|
||||
virtual ~DeserializableControl(){}
|
||||
virtual void ensureData(std::size_t size) =0;
|
||||
virtual void alignData(std::size_t alignment) =0;
|
||||
virtual bool directDeserialize(ByteBuffer *existingBuffer, char* deserializeTo,
|
||||
std::size_t elementCount, std::size_t elementSize) = 0;
|
||||
virtual std::tr1::shared_ptr<const Field> cachedDeserialize(ByteBuffer* buffer) = 0;
|
||||
};
|
||||
|
||||
|
||||
@@ -77,14 +77,14 @@ namespace epics {
|
||||
void SerializeHelper::serializeSubstring(const String& value,
|
||||
std::size_t offset, std::size_t count, ByteBuffer* buffer,
|
||||
SerializableControl* flusher) {
|
||||
if(offset<0)
|
||||
/*if(offset<0)
|
||||
offset = 0;
|
||||
else if(offset>(std::size_t)value.length()) offset = value.length();
|
||||
else*/ if(offset>value.length()) offset = value.length();
|
||||
|
||||
if(offset+count>(std::size_t)value.length()) count = value.length()-offset;
|
||||
if(offset+count>value.length()) count = value.length()-offset;
|
||||
|
||||
SerializeHelper::writeSize(count, buffer, flusher);
|
||||
if (count<=0) return;
|
||||
/*if (count<=0)*/ return;
|
||||
std::size_t i = 0;
|
||||
while(true) {
|
||||
std::size_t maxToWrite = min(count-i, buffer->getRemaining());
|
||||
|
||||
@@ -117,7 +117,7 @@ String Status::toString() const
|
||||
return str;
|
||||
}
|
||||
|
||||
void Status::toString(StringBuilder buffer, int indentLevel) const
|
||||
void Status::toString(StringBuilder buffer, int /*indentLevel*/) const
|
||||
{
|
||||
*buffer += "Status [type=";
|
||||
*buffer += StatusTypeName[m_statusType];
|
||||
|
||||
@@ -14,10 +14,74 @@
|
||||
#include <stdexcept>
|
||||
#include <algorithm>
|
||||
#include <iterator>
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <pv/pvIntrospect.h>
|
||||
#include <pv/requester.h>
|
||||
namespace epics { namespace pvData {
|
||||
|
||||
|
||||
namespace format {
|
||||
|
||||
struct indent_level
|
||||
{
|
||||
long level;
|
||||
|
||||
indent_level(long l) : level(l) {}
|
||||
};
|
||||
|
||||
inline long& indent_value(std::ios_base& ios)
|
||||
{
|
||||
static int indent_index = std::ios_base::xalloc();
|
||||
return ios.iword(indent_index);
|
||||
}
|
||||
|
||||
std::ostream& operator<<(std::ostream& os, indent_level const& indent);
|
||||
struct indent_scope
|
||||
{
|
||||
long saved_level;
|
||||
std::ios_base& stream;
|
||||
|
||||
indent_scope(std::ios_base& ios) :
|
||||
stream(ios)
|
||||
{
|
||||
long& l = indent_value(ios);
|
||||
saved_level = l;
|
||||
l = saved_level + 1;
|
||||
}
|
||||
|
||||
~indent_scope()
|
||||
{
|
||||
indent_value(stream) = saved_level;
|
||||
}
|
||||
};
|
||||
|
||||
struct indent
|
||||
{
|
||||
};
|
||||
|
||||
std::ostream& operator<<(std::ostream& os, indent const&);
|
||||
|
||||
struct array_at
|
||||
{
|
||||
std::size_t index;
|
||||
|
||||
array_at(std::size_t ix) : index(ix) {}
|
||||
};
|
||||
|
||||
struct array_at_internal
|
||||
{
|
||||
std::size_t index;
|
||||
std::ostream& stream;
|
||||
|
||||
array_at_internal(std::size_t ix, std::ostream& str) : index(ix), stream(str) {}
|
||||
};
|
||||
|
||||
array_at_internal operator<<(std::ostream& str, array_at const& manip);
|
||||
|
||||
};
|
||||
|
||||
|
||||
class PVAuxInfo;
|
||||
class PostHandler;
|
||||
|
||||
@@ -75,6 +139,8 @@ typedef std::vector<PVStructurePtr>::const_iterator PVStructurePtrArray_const__i
|
||||
* typedef for a pointer to a PVStructureArray.
|
||||
*/
|
||||
typedef std::tr1::shared_ptr<PVStructureArray> PVStructureArrayPtr;
|
||||
typedef std::vector<PVStructureArrayPtr> PVStructureArrayPtrArray;
|
||||
typedef std::tr1::shared_ptr<PVStructureArrayPtrArray> PVStructureArrayPtrArrayPtr;
|
||||
|
||||
/**
|
||||
* This class provides auxillary information about a PVField.
|
||||
@@ -140,8 +206,7 @@ private:
|
||||
/**
|
||||
* This class is implemented by code that calls setPostHander
|
||||
*/
|
||||
class PostHandler :
|
||||
public std::tr1::enable_shared_from_this<PostHandler>
|
||||
class PostHandler
|
||||
{
|
||||
public:
|
||||
POINTER_DEFINITIONS(PostHandler);
|
||||
@@ -276,7 +341,7 @@ public:
|
||||
* @param o output stream.
|
||||
* @return The output stream.
|
||||
*/
|
||||
virtual std::ostream& dumpValue(std::ostream& o) const;
|
||||
virtual std::ostream& dumpValue(std::ostream& o) const = 0;
|
||||
|
||||
protected:
|
||||
PVField::shared_pointer getPtrSelf()
|
||||
@@ -358,6 +423,20 @@ public:
|
||||
return o << get();
|
||||
}
|
||||
|
||||
// get operator
|
||||
// double value; doubleField >>= value;
|
||||
void operator>>=(T& value) const
|
||||
{
|
||||
value = get();
|
||||
}
|
||||
|
||||
// put operator
|
||||
// double value = 12.8; doubleField <<= value;
|
||||
void operator<<=(T value)
|
||||
{
|
||||
put(value);
|
||||
}
|
||||
|
||||
protected:
|
||||
PVScalarValue(ScalarConstPtr const & scalar)
|
||||
: PVScalar(scalar) {}
|
||||
@@ -452,6 +531,9 @@ public:
|
||||
* @param The capacity.
|
||||
*/
|
||||
virtual void setCapacity(std::size_t capacity) = 0;
|
||||
|
||||
virtual std::ostream& dumpValue(std::ostream& o, std::size_t index) const = 0;
|
||||
|
||||
protected:
|
||||
PVArray(FieldConstPtr const & field);
|
||||
void setCapacityLength(std::size_t capacity,std::size_t length);
|
||||
@@ -460,6 +542,8 @@ private:
|
||||
friend class PVDataCreate;
|
||||
};
|
||||
|
||||
std::ostream& operator<<(format::array_at_internal const& manip, const PVArray& array);
|
||||
|
||||
/**
|
||||
* Class provided by caller of get
|
||||
*/
|
||||
@@ -504,8 +588,6 @@ public:
|
||||
*/
|
||||
const ScalarArrayConstPtr getScalarArray() const ;
|
||||
|
||||
virtual std::ostream& dumpValue(std::ostream& o, size_t index) const = 0;
|
||||
|
||||
protected:
|
||||
PVScalarArray(ScalarArrayConstPtr const & scalarArray);
|
||||
private:
|
||||
@@ -607,6 +689,10 @@ public:
|
||||
virtual pointer get() const { return &((*value.get())[0]); }
|
||||
virtual vector const & getVector() {return *value;}
|
||||
virtual shared_vector const & getSharedVector() {return value;}
|
||||
|
||||
virtual std::ostream& dumpValue(std::ostream& o) const;
|
||||
virtual std::ostream& dumpValue(std::ostream& o, std::size_t index) const;
|
||||
|
||||
protected:
|
||||
PVStructureArray(StructureArrayConstPtr const & structureArray);
|
||||
private:
|
||||
@@ -815,6 +901,9 @@ public:
|
||||
* @param pvFields The array of fields for the structure.
|
||||
*/
|
||||
PVStructure(StructureConstPtr const & structure,PVFieldPtrArray const & pvFields);
|
||||
|
||||
virtual std::ostream& dumpValue(std::ostream& o) const;
|
||||
|
||||
private:
|
||||
void fixParentStructure();
|
||||
static PVFieldPtr nullPVField;
|
||||
@@ -895,7 +984,7 @@ public:
|
||||
|
||||
std::ostream& dumpValue(std::ostream& o) const
|
||||
{
|
||||
o << "[";
|
||||
o << '[';
|
||||
std::size_t len = getLength();
|
||||
bool first = true;
|
||||
for (std::size_t i = 0; i < len; i++)
|
||||
@@ -903,10 +992,10 @@ public:
|
||||
if (first)
|
||||
first = false;
|
||||
else
|
||||
o << ",";
|
||||
o << ',';
|
||||
dumpValue(o, i);
|
||||
}
|
||||
return o << "]";
|
||||
return o << ']';
|
||||
}
|
||||
|
||||
std::ostream& dumpValue(std::ostream& o, size_t index) const
|
||||
|
||||
@@ -283,7 +283,7 @@ public:
|
||||
protected:
|
||||
Scalar(ScalarType scalarType);
|
||||
private:
|
||||
const int8 getTypeCodeLUT() const;
|
||||
int8 getTypeCodeLUT() const;
|
||||
ScalarType scalarType;
|
||||
friend class FieldCreate;
|
||||
};
|
||||
@@ -330,7 +330,7 @@ protected:
|
||||
*/
|
||||
virtual ~ScalarArray();
|
||||
private:
|
||||
const int8 getTypeCodeLUT() const;
|
||||
int8 getTypeCodeLUT() const;
|
||||
const String getIDScalarArrayLUT() const;
|
||||
ScalarType elementType;
|
||||
friend class FieldCreate;
|
||||
|
||||
@@ -13,25 +13,31 @@
|
||||
|
||||
namespace epics { namespace pvData {
|
||||
|
||||
using std::tr1::static_pointer_cast;
|
||||
using std::size_t;
|
||||
|
||||
static bool checkBitSetPVField(
|
||||
PVField *pvField,BitSet *bitSet,int32 initialOffset)
|
||||
PVFieldPtr const &pvField,BitSetPtr const &bitSet,int32 initialOffset)
|
||||
{
|
||||
bool atLeastOneBitSet = false;
|
||||
bool allBitsSet = true;
|
||||
int32 offset = initialOffset;
|
||||
int32 nbits = pvField->getNumberFields();
|
||||
if(nbits==1) return bitSet->get(offset);
|
||||
int32 nextSetBit = bitSet->nextSetBit(offset);
|
||||
if(nextSetBit>=(offset+nbits)) return false;
|
||||
if(nextSetBit<0) return false;
|
||||
if(bitSet->get(offset)) {
|
||||
if(nbits>1) {
|
||||
for(int32 i=offset+1; i<offset+nbits; i++) bitSet->clear(i);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
PVStructure *pvStructure = static_cast<PVStructure *>(pvField);
|
||||
|
||||
bool atLeastOneBitSet = false;
|
||||
bool allBitsSet = true;
|
||||
PVStructurePtr pvStructure = static_pointer_cast<PVStructure>(pvField);
|
||||
offset = pvStructure->getFieldOffset() + 1;
|
||||
while(offset<initialOffset + nbits) {
|
||||
PVField *pvSubField = pvStructure->getSubField(offset).get();
|
||||
PVFieldPtr pvSubField = pvStructure->getSubField(offset);
|
||||
int32 nbitsNow = pvSubField->getNumberFields();
|
||||
if(nbitsNow==1) {
|
||||
if(bitSet->get(offset)) {
|
||||
@@ -41,24 +47,16 @@ static bool checkBitSetPVField(
|
||||
}
|
||||
offset++;
|
||||
} else {
|
||||
offset++;
|
||||
PVStructure *pvSubStructure = static_cast<PVStructure*>(pvField);
|
||||
PVFieldPtrArray pvSubStructureFields =
|
||||
pvSubStructure->getPVFields();
|
||||
int num = pvSubStructure->getStructure()->getNumberFields();
|
||||
for(int32 i=0; i<num; i++) {
|
||||
PVField *pvSubSubField = pvSubStructureFields[i].get();
|
||||
bool result = checkBitSetPVField(pvSubSubField,bitSet,offset);
|
||||
if(result) {
|
||||
atLeastOneBitSet = true;
|
||||
if(!bitSet->get(offset)) {
|
||||
allBitsSet = false;
|
||||
}
|
||||
} else {
|
||||
bool result = checkBitSetPVField(pvSubField,bitSet,offset);
|
||||
if(result) {
|
||||
atLeastOneBitSet = true;
|
||||
if(!bitSet->get(offset)) {
|
||||
allBitsSet = false;
|
||||
}
|
||||
offset += pvSubSubField->getNumberFields();
|
||||
} else {
|
||||
allBitsSet = false;
|
||||
}
|
||||
offset += pvSubField->getNumberFields();
|
||||
}
|
||||
}
|
||||
if(allBitsSet) {
|
||||
@@ -72,7 +70,7 @@ static bool checkBitSetPVField(
|
||||
return atLeastOneBitSet;
|
||||
}
|
||||
|
||||
bool BitSetUtil::compress(BitSet *bitSet,PVStructure *pvStructure)
|
||||
bool BitSetUtil::compress(BitSetPtr const &bitSet,PVStructurePtr const &pvStructure)
|
||||
{
|
||||
return checkBitSetPVField(pvStructure,bitSet,0);
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace epics { namespace pvData {
|
||||
|
||||
class BitSetUtil : private NoDefaultMethods {
|
||||
public:
|
||||
static bool compress(BitSet *bitSet,PVStructure *pvStructure);
|
||||
static bool compress(BitSetPtr const &bitSet,PVStructurePtr const &pvStructure);
|
||||
};
|
||||
|
||||
}}
|
||||
|
||||
1
pvDataCPP.config
Normal file
1
pvDataCPP.config
Normal file
@@ -0,0 +1 @@
|
||||
// ADD PREDEFINED MACROS HERE!
|
||||
1
pvDataCPP.creator
Normal file
1
pvDataCPP.creator
Normal file
@@ -0,0 +1 @@
|
||||
[General]
|
||||
211
pvDataCPP.files
Normal file
211
pvDataCPP.files
Normal file
@@ -0,0 +1,211 @@
|
||||
configure/CONFIG
|
||||
configure/CONFIG_SITE
|
||||
configure/RELEASE
|
||||
configure/RELEASE.local
|
||||
configure/RULES
|
||||
configure/RULES.ioc
|
||||
configure/RULES_DIRS
|
||||
configure/RULES_TOP
|
||||
documentation/pvDataCPP.html
|
||||
documentation/pvDataCPP_20120927.html
|
||||
documentation/pvDataCPP_20121001.html
|
||||
documentation/pvDataCPP_20121026.html
|
||||
documentation/pvDataCPP_20121212.html
|
||||
jenkins/cloudbees_build
|
||||
pvDataApp/factory/Compare.cpp
|
||||
pvDataApp/factory/Convert.cpp
|
||||
pvDataApp/factory/factory.h
|
||||
pvDataApp/factory/FieldCreateFactory.cpp
|
||||
pvDataApp/factory/PVArray.cpp
|
||||
pvDataApp/factory/PVAuxInfoImpl.cpp
|
||||
pvDataApp/factory/PVDataCreateFactory.cpp
|
||||
pvDataApp/factory/PVDataCreateFactory.cpp.orig
|
||||
pvDataApp/factory/PVField.cpp
|
||||
pvDataApp/factory/PVScalar.cpp
|
||||
pvDataApp/factory/PVScalarArray.cpp
|
||||
pvDataApp/factory/PVStructure.cpp
|
||||
pvDataApp/factory/PVStructureArray.cpp
|
||||
pvDataApp/factory/StandardField.cpp
|
||||
pvDataApp/factory/StandardPVField.cpp
|
||||
pvDataApp/factory/TypeFunc.cpp
|
||||
pvDataApp/misc/bitSet.cpp
|
||||
pvDataApp/misc/bitSet.h
|
||||
pvDataApp/misc/byteBuffer.cpp
|
||||
pvDataApp/misc/byteBuffer.h
|
||||
pvDataApp/misc/destroyable.h
|
||||
pvDataApp/misc/epicsException.cpp
|
||||
pvDataApp/misc/epicsException.h
|
||||
pvDataApp/misc/event.cpp
|
||||
pvDataApp/misc/event.h
|
||||
pvDataApp/misc/executor.cpp
|
||||
pvDataApp/misc/executor.h
|
||||
pvDataApp/misc/localStaticLock.cpp
|
||||
pvDataApp/misc/localStaticLock.h
|
||||
pvDataApp/misc/localStaticLock.h.orig
|
||||
pvDataApp/misc/lock.h
|
||||
pvDataApp/misc/messageQueue.cpp
|
||||
pvDataApp/misc/messageQueue.h
|
||||
pvDataApp/misc/noDefaultMethods.h
|
||||
pvDataApp/misc/queue.h
|
||||
pvDataApp/misc/requester.cpp
|
||||
pvDataApp/misc/requester.h
|
||||
pvDataApp/misc/requester.h.orig
|
||||
pvDataApp/misc/serialize.h
|
||||
pvDataApp/misc/serializeHelper.cpp
|
||||
pvDataApp/misc/serializeHelper.h
|
||||
pvDataApp/misc/sharedPtr.h
|
||||
pvDataApp/misc/status.cpp
|
||||
pvDataApp/misc/status.h
|
||||
pvDataApp/misc/thread.h
|
||||
pvDataApp/misc/timeFunction.cpp
|
||||
pvDataApp/misc/timeFunction.h
|
||||
pvDataApp/misc/timer.cpp
|
||||
pvDataApp/misc/timer.h
|
||||
pvDataApp/monitor/monitor.h
|
||||
pvDataApp/O.linux-x86_64/alarm.d
|
||||
pvDataApp/O.linux-x86_64/bitSet.d
|
||||
pvDataApp/O.linux-x86_64/bitSetUtil.d
|
||||
pvDataApp/O.linux-x86_64/byteBuffer.d
|
||||
pvDataApp/O.linux-x86_64/Compare.d
|
||||
pvDataApp/O.linux-x86_64/Convert.d
|
||||
pvDataApp/O.linux-x86_64/epicsException.d
|
||||
pvDataApp/O.linux-x86_64/event.d
|
||||
pvDataApp/O.linux-x86_64/executor.d
|
||||
pvDataApp/O.linux-x86_64/FieldCreateFactory.d
|
||||
pvDataApp/O.linux-x86_64/libpvData.a
|
||||
pvDataApp/O.linux-x86_64/libpvData.so
|
||||
pvDataApp/O.linux-x86_64/localStaticLock.d
|
||||
pvDataApp/O.linux-x86_64/messageQueue.d
|
||||
pvDataApp/O.linux-x86_64/pvAlarm.d
|
||||
pvDataApp/O.linux-x86_64/PVArray.d
|
||||
pvDataApp/O.linux-x86_64/PVAuxInfoImpl.d
|
||||
pvDataApp/O.linux-x86_64/pvControl.d
|
||||
pvDataApp/O.linux-x86_64/PVDataCreateFactory.d
|
||||
pvDataApp/O.linux-x86_64/pvDisplay.d
|
||||
pvDataApp/O.linux-x86_64/pvEnumerated.d
|
||||
pvDataApp/O.linux-x86_64/PVField.d
|
||||
pvDataApp/O.linux-x86_64/PVScalar.d
|
||||
pvDataApp/O.linux-x86_64/PVScalarArray.d
|
||||
pvDataApp/O.linux-x86_64/PVStructure.d
|
||||
pvDataApp/O.linux-x86_64/PVStructureArray.d
|
||||
pvDataApp/O.linux-x86_64/pvTimeStamp.d
|
||||
pvDataApp/O.linux-x86_64/requester.d
|
||||
pvDataApp/O.linux-x86_64/serializeHelper.d
|
||||
pvDataApp/O.linux-x86_64/StandardField.d
|
||||
pvDataApp/O.linux-x86_64/StandardPVField.d
|
||||
pvDataApp/O.linux-x86_64/status.d
|
||||
pvDataApp/O.linux-x86_64/timeFunction.d
|
||||
pvDataApp/O.linux-x86_64/timer.d
|
||||
pvDataApp/O.linux-x86_64/timeStamp.d
|
||||
pvDataApp/O.linux-x86_64/TypeFunc.d
|
||||
pvDataApp/property/alarm.cpp
|
||||
pvDataApp/property/alarm.h
|
||||
pvDataApp/property/alarm.h.orig
|
||||
pvDataApp/property/control.h
|
||||
pvDataApp/property/display.h
|
||||
pvDataApp/property/pvAlarm.cpp
|
||||
pvDataApp/property/pvAlarm.h
|
||||
pvDataApp/property/pvControl.cpp
|
||||
pvDataApp/property/pvControl.h
|
||||
pvDataApp/property/pvDisplay.cpp
|
||||
pvDataApp/property/pvDisplay.h
|
||||
pvDataApp/property/pvEnumerated.cpp
|
||||
pvDataApp/property/pvEnumerated.h
|
||||
pvDataApp/property/pvTimeStamp.cpp
|
||||
pvDataApp/property/pvTimeStamp.h
|
||||
pvDataApp/property/timeStamp.cpp
|
||||
pvDataApp/property/timeStamp.h
|
||||
pvDataApp/property/timeStamp.h.orig
|
||||
pvDataApp/pv/convert.h
|
||||
pvDataApp/pv/convert.h.orig
|
||||
pvDataApp/pv/pvData.h
|
||||
pvDataApp/pv/pvData.h.orig
|
||||
pvDataApp/pv/pvIntrospect.h
|
||||
pvDataApp/pv/pvIntrospect.h.orig
|
||||
pvDataApp/pv/pvType.h
|
||||
pvDataApp/pv/standardField.h
|
||||
pvDataApp/pv/standardField.h.orig
|
||||
pvDataApp/pv/standardPVField.h
|
||||
pvDataApp/pv/standardPVField.h.orig
|
||||
pvDataApp/pvMisc/bitSetUtil.cpp
|
||||
pvDataApp/pvMisc/bitSetUtil.h
|
||||
testApp/capi/O.linux-x86_64/libtestc.a
|
||||
testApp/capi/O.linux-x86_64/libtestc.so
|
||||
testApp/capi/O.linux-x86_64/testc.d
|
||||
testApp/capi/testc.cpp
|
||||
testApp/capi/testc.py
|
||||
testApp/mb/O.linux-x86_64/mb_test
|
||||
testApp/mb/O.linux-x86_64/mb_test.d
|
||||
testApp/misc/O.linux-x86_64/testBaseException
|
||||
testApp/misc/O.linux-x86_64/testBaseException.d
|
||||
testApp/misc/O.linux-x86_64/testBitSet
|
||||
testApp/misc/O.linux-x86_64/testBitSet.d
|
||||
testApp/misc/O.linux-x86_64/testByteBuffer
|
||||
testApp/misc/O.linux-x86_64/testByteBuffer.d
|
||||
testApp/misc/O.linux-x86_64/testByteOrder
|
||||
testApp/misc/O.linux-x86_64/testByteOrder.d
|
||||
testApp/misc/O.linux-x86_64/testMessageQueue
|
||||
testApp/misc/O.linux-x86_64/testMessageQueue.d
|
||||
testApp/misc/O.linux-x86_64/testQueue
|
||||
testApp/misc/O.linux-x86_64/testQueue.d
|
||||
testApp/misc/O.linux-x86_64/testSerialization
|
||||
testApp/misc/O.linux-x86_64/testSerialization.d
|
||||
testApp/misc/O.linux-x86_64/testThread
|
||||
testApp/misc/O.linux-x86_64/testThread.d
|
||||
testApp/misc/O.linux-x86_64/testTimer
|
||||
testApp/misc/O.linux-x86_64/testTimer.d
|
||||
testApp/misc/O.linux-x86_64/testTimeStamp
|
||||
testApp/misc/O.linux-x86_64/testTimeStamp.d
|
||||
testApp/misc/testBaseException.cpp
|
||||
testApp/misc/testBitSet.cpp
|
||||
testApp/misc/testByteBuffer.cpp
|
||||
testApp/misc/testByteOrder.cpp
|
||||
testApp/misc/testMessageQueue.cpp
|
||||
testApp/misc/testQueue.cpp
|
||||
testApp/misc/testSerialization.cpp
|
||||
testApp/misc/testThread.cpp
|
||||
testApp/misc/testTimer.cpp
|
||||
testApp/misc/testTimeStamp.cpp
|
||||
testApp/monitor/O.linux-x86_64/testMonitor
|
||||
testApp/monitor/O.linux-x86_64/testMonitor.d
|
||||
testApp/monitor/testMonitor.cpp
|
||||
testApp/property/O.linux-x86_64/testProperty
|
||||
testApp/property/O.linux-x86_64/testProperty.d
|
||||
testApp/property/testProperty.cpp
|
||||
testApp/pv/O.linux-x86_64/testConvert
|
||||
testApp/pv/O.linux-x86_64/testConvert.d
|
||||
testApp/pv/O.linux-x86_64/testIntrospect
|
||||
testApp/pv/O.linux-x86_64/testIntrospect.d
|
||||
testApp/pv/O.linux-x86_64/testOperators
|
||||
testApp/pv/O.linux-x86_64/testOperators.d
|
||||
testApp/pv/O.linux-x86_64/testPVAppend
|
||||
testApp/pv/O.linux-x86_64/testPVAppend.d
|
||||
testApp/pv/O.linux-x86_64/testPVAuxInfo
|
||||
testApp/pv/O.linux-x86_64/testPVAuxInfo.d
|
||||
testApp/pv/O.linux-x86_64/testPVData
|
||||
testApp/pv/O.linux-x86_64/testPVData.d
|
||||
testApp/pv/O.linux-x86_64/testPVScalarArray
|
||||
testApp/pv/O.linux-x86_64/testPVScalarArray.d
|
||||
testApp/pv/O.linux-x86_64/testPVStructureArray
|
||||
testApp/pv/O.linux-x86_64/testPVStructureArray.d
|
||||
testApp/pv/O.linux-x86_64/testPVType
|
||||
testApp/pv/O.linux-x86_64/testPVType.d
|
||||
testApp/pv/O.linux-x86_64/testStandardField
|
||||
testApp/pv/O.linux-x86_64/testStandardField.d
|
||||
testApp/pv/O.linux-x86_64/testStandardPVField
|
||||
testApp/pv/O.linux-x86_64/testStandardPVField.d
|
||||
testApp/pv/testConvert.cpp
|
||||
testApp/pv/testIntrospect.cpp
|
||||
testApp/pv/testOperators.cpp
|
||||
testApp/pv/testPVAppend.cpp
|
||||
testApp/pv/testPVAuxInfo.cpp
|
||||
testApp/pv/testPVData.cpp
|
||||
testApp/pv/testPVScalarArray.cpp
|
||||
testApp/pv/testPVStructureArray.cpp
|
||||
testApp/pv/testPVType.cpp
|
||||
testApp/pv/testStandardField.cpp
|
||||
testApp/pv/testStandardPVField.cpp
|
||||
COPYRIGHT
|
||||
Doxyfile
|
||||
LICENSE
|
||||
README.html
|
||||
6
pvDataCPP.includes
Normal file
6
pvDataCPP.includes
Normal file
@@ -0,0 +1,6 @@
|
||||
/home/msekoranja/epicsV4/pvDataCPP/pvDataApp/factory
|
||||
/home/msekoranja/epicsV4/pvDataCPP/pvDataApp/misc
|
||||
/home/msekoranja/epicsV4/pvDataCPP/pvDataApp/monitor
|
||||
/home/msekoranja/epicsV4/pvDataCPP/pvDataApp/property
|
||||
/home/msekoranja/epicsV4/pvDataCPP/pvDataApp/pv
|
||||
/home/msekoranja/epicsV4/pvDataCPP/pvDataApp/pvMisc
|
||||
@@ -24,7 +24,7 @@ testByteBuffer_LIBS += pvData Com
|
||||
|
||||
PROD_HOST += testBaseException
|
||||
testBaseException_SRCS += testBaseException.cpp
|
||||
testBaseException_LIBS += pvData
|
||||
testBaseException_LIBS += pvData Com
|
||||
|
||||
PROD_HOST += testSerialization
|
||||
testSerialization_SRCS += testSerialization.cpp
|
||||
|
||||
@@ -27,11 +27,11 @@ struct Unroller
|
||||
};
|
||||
|
||||
template<>
|
||||
void Unroller::unroll<0>(double d) {
|
||||
void Unroller::unroll<0>(double /*d*/) {
|
||||
THROW_BASE_EXCEPTION("the root cause");
|
||||
}
|
||||
|
||||
void internalTestBaseException(int unused = 0)
|
||||
void internalTestBaseException(int /*unused*/ = 0)
|
||||
{
|
||||
try {
|
||||
// NOTE: 5, 4, 3, 2, 1 calls will be optimized and not shown
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
|
||||
using namespace epics::pvData;
|
||||
|
||||
static void testBasic(FILE * fd,FILE *auxfd ) {
|
||||
static void testBasic(FILE * fd,FILE */*auxfd*/) {
|
||||
int queueSize = 3;
|
||||
StringArray messages;
|
||||
messages.reserve(5);
|
||||
|
||||
@@ -24,22 +24,24 @@
|
||||
|
||||
#include <pv/standardField.h>
|
||||
|
||||
#define BYTE_MAX_VALUE 127
|
||||
#define BYTE_MIN_VALUE -128
|
||||
#define UBYTE_MAX_VALUE 255
|
||||
#define SHORT_MAX_VALUE 32767
|
||||
#define SHORT_MIN_VALUE -32768
|
||||
#define USHORT_MAX_VALUE 65535
|
||||
#define INT_MAX_VALUE 2147483647
|
||||
#define INT_MIN_VALUE (-INT_MAX_VALUE - 1)
|
||||
#define UINT_MAX_VALUE 4294967295ULL
|
||||
#define LONG_MAX_VALUE 9223372036854775807LL
|
||||
#define LONG_MIN_VALUE (-LONG_MAX_VALUE - 1LL)
|
||||
#define ULONG_MAX_VALUE 18446744073709549999ULL
|
||||
#define FLOAT_MAX_VALUE 3.4028235E38
|
||||
#define FLOAT_MIN_VALUE 1.4E-45
|
||||
#define DOUBLE_MAX_VALUE 1.7976931348623157E308
|
||||
#define DOUBLE_MIN_VALUE 4.9E-324
|
||||
#include <limits>
|
||||
|
||||
#define BYTE_MAX_VALUE std::numeric_limits<int8>::max()
|
||||
#define BYTE_MIN_VALUE std::numeric_limits<int8>::min()
|
||||
#define UBYTE_MAX_VALUE std::numeric_limits<uint8>::max()
|
||||
#define SHORT_MAX_VALUE std::numeric_limits<int16>::max()
|
||||
#define SHORT_MIN_VALUE std::numeric_limits<int16>::min()
|
||||
#define USHORT_MAX_VALUE std::numeric_limits<uint16>::max()
|
||||
#define INT_MAX_VALUE std::numeric_limits<int32>::max()
|
||||
#define INT_MIN_VALUE std::numeric_limits<int32>::min()
|
||||
#define UINT_MAX_VALUE std::numeric_limits<uint32>::max()
|
||||
#define LONG_MAX_VALUE std::numeric_limits<int64>::max()
|
||||
#define LONG_MIN_VALUE std::numeric_limits<int64>::min()
|
||||
#define ULONG_MAX_VALUE std::numeric_limits<uint64>::max()
|
||||
#define FLOAT_MAX_VALUE std::numeric_limits<float>::max()
|
||||
#define FLOAT_MIN_VALUE std::numeric_limits<float>::min()
|
||||
#define DOUBLE_MAX_VALUE std::numeric_limits<double>::max()
|
||||
#define DOUBLE_MIN_VALUE std::numeric_limits<double>::min()
|
||||
|
||||
using namespace epics::pvData;
|
||||
|
||||
@@ -54,13 +56,19 @@ public:
|
||||
virtual void flushSerializeBuffer() {
|
||||
}
|
||||
|
||||
virtual void ensureBuffer(std::size_t size) {
|
||||
virtual void ensureBuffer(std::size_t /*size*/) {
|
||||
}
|
||||
|
||||
virtual void alignBuffer(std::size_t alignment) {
|
||||
buffer->align(alignment);
|
||||
}
|
||||
|
||||
virtual bool directSerialize(ByteBuffer */*existingBuffer*/, const char* /*toSerialize*/,
|
||||
std::size_t /*elementCount*/, std::size_t /*elementSize*/)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
virtual void cachedSerialize(std::tr1::shared_ptr<const Field> const & field, ByteBuffer* buffer)
|
||||
{
|
||||
field->serialize(buffer, this);
|
||||
@@ -76,13 +84,19 @@ public:
|
||||
class DeserializableControlImpl : public DeserializableControl,
|
||||
public NoDefaultMethods {
|
||||
public:
|
||||
virtual void ensureData(size_t size) {
|
||||
virtual void ensureData(size_t /*size*/) {
|
||||
}
|
||||
|
||||
virtual void alignData(size_t alignment) {
|
||||
buffer->align(alignment);
|
||||
}
|
||||
|
||||
virtual bool directDeserialize(ByteBuffer */*existingBuffer*/, char* /*deserializeTo*/,
|
||||
std::size_t /*elementCount*/, std::size_t /*elementSize*/)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
virtual std::tr1::shared_ptr<const Field> cachedDeserialize(ByteBuffer* buffer)
|
||||
{
|
||||
return getFieldCreate()->deserialize(buffer, this);
|
||||
|
||||
@@ -50,7 +50,7 @@ public:
|
||||
printf("poll called\n");
|
||||
return emptyElement;
|
||||
}
|
||||
virtual void release(MonitorElementPtr const & monitorElement)
|
||||
virtual void release(MonitorElementPtr const & /*monitorElement*/)
|
||||
{
|
||||
printf("release called\n");
|
||||
}
|
||||
@@ -70,7 +70,7 @@ static void testMonitor()
|
||||
}
|
||||
|
||||
|
||||
int main(int argc,char *argv[])
|
||||
int main(int, char **)
|
||||
{
|
||||
testMonitor();
|
||||
return(0);
|
||||
|
||||
@@ -48,7 +48,7 @@ static String allProperties("alarm,timeStamp,display,control");
|
||||
static PVStructurePtr doubleRecord;
|
||||
static PVStructurePtr enumeratedRecord;
|
||||
|
||||
static void createRecords(FILE * fd,FILE *auxfd)
|
||||
static void createRecords(FILE * fd,FILE */*auxfd*/)
|
||||
{
|
||||
doubleRecord = standardPVField->scalar(pvDouble,allProperties);
|
||||
if(debug) {
|
||||
@@ -70,7 +70,7 @@ static void createRecords(FILE * fd,FILE *auxfd)
|
||||
}
|
||||
}
|
||||
|
||||
static void printRecords(FILE * fd,FILE *auxfd)
|
||||
static void printRecords(FILE * fd,FILE */*auxfd*/)
|
||||
{
|
||||
fprintf(fd,"doubleRecord\n");
|
||||
builder.clear();
|
||||
@@ -82,7 +82,7 @@ static void printRecords(FILE * fd,FILE *auxfd)
|
||||
fprintf(fd,"%s\n",builder.c_str());
|
||||
}
|
||||
|
||||
static void testAlarm(FILE * fd,FILE *auxfd)
|
||||
static void testAlarm(FILE * fd,FILE */*auxfd*/)
|
||||
{
|
||||
if(debug) fprintf(fd,"testAlarm\n");
|
||||
Alarm alarm;
|
||||
@@ -155,7 +155,7 @@ static void testTimeStamp(FILE * fd,FILE *auxfd)
|
||||
fprintf(fd,"testTimeStamp PASSED\n");
|
||||
}
|
||||
|
||||
static void testControl(FILE * fd,FILE *auxfd)
|
||||
static void testControl(FILE * fd,FILE */*auxfd*/)
|
||||
{
|
||||
if(debug) fprintf(fd,"testControl\n");
|
||||
Control control;
|
||||
@@ -182,7 +182,7 @@ static void testControl(FILE * fd,FILE *auxfd)
|
||||
fprintf(fd,"testControl PASSED\n");
|
||||
}
|
||||
|
||||
static void testDisplay(FILE * fd,FILE *auxfd)
|
||||
static void testDisplay(FILE * fd,FILE */*auxfd*/)
|
||||
{
|
||||
if(debug) fprintf(fd,"testDisplay\n");
|
||||
Display display;
|
||||
@@ -215,7 +215,7 @@ static void testDisplay(FILE * fd,FILE *auxfd)
|
||||
fprintf(fd,"testDisplay PASSED\n");
|
||||
}
|
||||
|
||||
static void testEnumerated(FILE * fd,FILE *auxfd)
|
||||
static void testEnumerated(FILE * fd,FILE */*auxfd*/)
|
||||
{
|
||||
if(debug) fprintf(fd,"testEnumerated\n");
|
||||
PVEnumerated pvEnumerated;
|
||||
|
||||
@@ -2,6 +2,10 @@ TOP=../..
|
||||
|
||||
include $(TOP)/configure/CONFIG
|
||||
|
||||
PROD_HOST += testBitSetUtil
|
||||
testBitSetUtil_SRCS += testBitSetUtil.cpp
|
||||
testBitSetUtil_LIBS += pvData Com
|
||||
|
||||
PROD_HOST += testIntrospect
|
||||
testIntrospect_SRCS += testIntrospect.cpp
|
||||
testIntrospect_LIBS += pvData Com
|
||||
@@ -42,6 +46,10 @@ PROD_HOST += testPVStructureArray
|
||||
testPVStructureArray_SRCS += testPVStructureArray.cpp
|
||||
testPVStructureArray_LIBS += pvData Com
|
||||
|
||||
PROD_HOST += testOperators
|
||||
testOperators_SRCS += testOperators.cpp
|
||||
testOperators_LIBS += pvData Com
|
||||
|
||||
include $(TOP)/configure/RULES
|
||||
#----------------------------------------
|
||||
# ADD RULES AFTER THIS LINE
|
||||
|
||||
157
testApp/pv/testBitSetUtil.cpp
Normal file
157
testApp/pv/testBitSetUtil.cpp
Normal file
@@ -0,0 +1,157 @@
|
||||
/* testBitSetUtil.cpp */
|
||||
/**
|
||||
* Copyright - See the COPYRIGHT that is included with this distribution.
|
||||
* EPICS pvData is distributed subject to a Software License Agreement found
|
||||
* in file LICENSE that is included with this distribution.
|
||||
*/
|
||||
/* Author: Marty Kraimer Date: 2013.05 */
|
||||
|
||||
#include <cstddef>
|
||||
#include <cstdlib>
|
||||
#include <cstddef>
|
||||
#include <string>
|
||||
#include <cstdio>
|
||||
|
||||
#include <epicsAssert.h>
|
||||
#include <epicsExit.h>
|
||||
|
||||
#include <pv/requester.h>
|
||||
#include <pv/bitSetUtil.h>
|
||||
#include <pv/convert.h>
|
||||
#include <pv/standardField.h>
|
||||
#include <pv/standardPVField.h>
|
||||
|
||||
using namespace epics::pvData;
|
||||
using std::tr1::static_pointer_cast;
|
||||
|
||||
static bool debug = false;
|
||||
|
||||
static FieldCreatePtr fieldCreate;
|
||||
static PVDataCreatePtr pvDataCreate;
|
||||
static StandardFieldPtr standardField;
|
||||
static StandardPVFieldPtr standardPVField;
|
||||
static ConvertPtr convert;
|
||||
static String builder("");
|
||||
|
||||
static void test(FILE * fd)
|
||||
{
|
||||
if(debug) fprintf(fd,"\ntestBitSetUtil\n");
|
||||
StringArray fieldNames;
|
||||
PVFieldPtrArray pvFields;
|
||||
fieldNames.reserve(5);
|
||||
pvFields.reserve(5);
|
||||
fieldNames.push_back("timeStamp");
|
||||
fieldNames.push_back("alarm");
|
||||
fieldNames.push_back("voltage");
|
||||
fieldNames.push_back("power");
|
||||
fieldNames.push_back("current");
|
||||
pvFields.push_back(
|
||||
pvDataCreate->createPVStructure(standardField->timeStamp()));
|
||||
pvFields.push_back(
|
||||
pvDataCreate->createPVStructure(standardField->alarm()));
|
||||
pvFields.push_back(
|
||||
pvDataCreate->createPVStructure(
|
||||
standardField->scalar(pvDouble,"alarm")));
|
||||
pvFields.push_back(
|
||||
pvDataCreate->createPVStructure(
|
||||
standardField->scalar(pvDouble,"alarm")));
|
||||
pvFields.push_back(
|
||||
pvDataCreate->createPVStructure(
|
||||
standardField->scalar(pvDouble,"alarm")));
|
||||
PVStructurePtr pvs = pvDataCreate->createPVStructure(
|
||||
fieldNames,pvFields);
|
||||
builder.clear();
|
||||
pvs->toString(&builder);
|
||||
if(debug) fprintf(fd,"pvs\n%s\n",builder.c_str());
|
||||
int32 nfields = pvs->getNumberFields();
|
||||
BitSetPtr bitSet = BitSet::create(nfields);
|
||||
for(int32 i=0; i<nfields; i++) bitSet->set(i);
|
||||
builder.clear();
|
||||
bitSet->toString(&builder);
|
||||
if(debug) fprintf(fd,"bitSet\n%s\n",builder.c_str());
|
||||
BitSetUtil::compress(bitSet,pvs);
|
||||
builder.clear();
|
||||
bitSet->toString(&builder);
|
||||
if(debug) fprintf(fd,"bitSet\n%s\n",builder.c_str());
|
||||
bitSet->clear();
|
||||
PVFieldPtr pvField = pvs->getSubField("timeStamp");
|
||||
int32 offsetTimeStamp = pvField->getFieldOffset();
|
||||
pvField = pvs->getSubField("timeStamp.secondsPastEpoch");
|
||||
int32 offsetSeconds = pvField->getFieldOffset();
|
||||
pvField = pvs->getSubField("timeStamp.nanoSeconds");
|
||||
int32 offsetNano = pvField->getFieldOffset();
|
||||
pvField = pvs->getSubField("timeStamp.userTag");
|
||||
int32 offsetUserTag = pvField->getFieldOffset();
|
||||
bitSet->set(offsetSeconds);
|
||||
BitSetUtil::compress(bitSet,pvs);
|
||||
assert(bitSet->get(offsetSeconds)==true);
|
||||
bitSet->set(offsetNano);
|
||||
bitSet->set(offsetUserTag);
|
||||
builder.clear();
|
||||
bitSet->toString(&builder);
|
||||
if(debug) fprintf(fd,"bitSet\n%s\n",builder.c_str());
|
||||
BitSetUtil::compress(bitSet,pvs);
|
||||
assert(bitSet->get(offsetSeconds)==false);
|
||||
assert(bitSet->get(offsetTimeStamp)==true);
|
||||
builder.clear();
|
||||
bitSet->toString(&builder);
|
||||
if(debug) fprintf(fd,"bitSet\n%s\n",builder.c_str());
|
||||
bitSet->clear();
|
||||
|
||||
pvField = pvs->getSubField("current");
|
||||
int32 offsetCurrent = pvField->getFieldOffset();
|
||||
pvField = pvs->getSubField("current.value");
|
||||
int32 offsetValue = pvField->getFieldOffset();
|
||||
pvField = pvs->getSubField("current.alarm");
|
||||
int32 offsetAlarm = pvField->getFieldOffset();
|
||||
pvField = pvs->getSubField("current.alarm.severity");
|
||||
int32 offsetSeverity = pvField->getFieldOffset();
|
||||
pvField = pvs->getSubField("current.alarm.status");
|
||||
int32 offsetStatus = pvField->getFieldOffset();
|
||||
pvField = pvs->getSubField("current.alarm.message");
|
||||
int32 offsetMessage = pvField->getFieldOffset();
|
||||
bitSet->set(offsetValue);
|
||||
bitSet->set(offsetSeverity);
|
||||
bitSet->set(offsetStatus);
|
||||
bitSet->set(offsetMessage);
|
||||
builder.clear();
|
||||
bitSet->toString(&builder);
|
||||
if(debug) fprintf(fd,"bitSet\n%s\n",builder.c_str());
|
||||
BitSetUtil::compress(bitSet,pvs);
|
||||
builder.clear();
|
||||
bitSet->toString(&builder);
|
||||
if(debug) fprintf(fd,"bitSet\n%s\n",builder.c_str());
|
||||
assert(bitSet->get(offsetCurrent)==true);
|
||||
bitSet->clear();
|
||||
bitSet->set(offsetSeverity);
|
||||
bitSet->set(offsetStatus);
|
||||
bitSet->set(offsetMessage);
|
||||
builder.clear();
|
||||
bitSet->toString(&builder);
|
||||
if(debug) fprintf(fd,"bitSet\n%s\n",builder.c_str());
|
||||
BitSetUtil::compress(bitSet,pvs);
|
||||
builder.clear();
|
||||
bitSet->toString(&builder);
|
||||
if(debug) fprintf(fd,"bitSet\n%s\n",builder.c_str());
|
||||
assert(bitSet->get(offsetAlarm)==true);
|
||||
bitSet->clear();
|
||||
fprintf(fd,"testBitSetUtil PASSED\n");
|
||||
}
|
||||
|
||||
int main(int argc,char *argv[])
|
||||
{
|
||||
char *fileName = 0;
|
||||
if(argc>1) fileName = argv[1];
|
||||
FILE * fd = stdout;
|
||||
if(fileName!=0 && fileName[0]!=0) {
|
||||
fd = fopen(fileName,"w+");
|
||||
}
|
||||
fieldCreate = getFieldCreate();
|
||||
pvDataCreate = getPVDataCreate();
|
||||
standardField = getStandardField();
|
||||
standardPVField = getStandardPVField();
|
||||
convert = getConvert();
|
||||
test(fd);
|
||||
return(0);
|
||||
}
|
||||
|
||||
91
testApp/pv/testOperators.cpp
Normal file
91
testApp/pv/testOperators.cpp
Normal file
@@ -0,0 +1,91 @@
|
||||
/* testOperators.cpp */
|
||||
/**
|
||||
* Copyright - See the COPYRIGHT that is included with this distribution.
|
||||
* EPICS pvData is distributed subject to a Software License Agreement found
|
||||
* in file LICENSE that is included with this distribution.
|
||||
*/
|
||||
/* Author: Matej Sekoranja Date: 2013.02 */
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include <pv/pvData.h>
|
||||
#include <pv/standardField.h>
|
||||
#include <pv/standardPVField.h>
|
||||
|
||||
#include <epicsAssert.h>
|
||||
|
||||
using namespace epics::pvData;
|
||||
|
||||
static PVDataCreatePtr pvDataCreate = getPVDataCreate();
|
||||
static StandardFieldPtr standardField = getStandardField();
|
||||
static StandardPVFieldPtr standardPVField = getStandardPVField();
|
||||
|
||||
int main(int, char **)
|
||||
{
|
||||
PVStructurePtr pvStructure = standardPVField->scalar(pvDouble,
|
||||
"alarm,timeStamp,display,control,valueAlarm");
|
||||
|
||||
const double testDV = 12.8;
|
||||
|
||||
PVDoublePtr pvValue = pvStructure->getDoubleField("value");
|
||||
*pvValue <<= testDV;
|
||||
|
||||
double dv;
|
||||
*pvValue >>= dv;
|
||||
assert(testDV == dv);
|
||||
|
||||
|
||||
const std::string testSV = "test message";
|
||||
|
||||
PVStringPtr pvMessage = pvStructure->getStringField("alarm.message");
|
||||
*pvMessage <<= testSV;
|
||||
|
||||
std::string sv;
|
||||
*pvMessage >>= sv;
|
||||
assert(testSV == sv);
|
||||
|
||||
//
|
||||
// to stream tests
|
||||
//
|
||||
|
||||
std::cout << *pvValue << std::endl;
|
||||
std::cout << *pvMessage << std::endl;
|
||||
std::cout << *pvStructure << std::endl;
|
||||
|
||||
|
||||
StringArray choices;
|
||||
choices.reserve(3);
|
||||
choices.push_back("one");
|
||||
choices.push_back("two");
|
||||
choices.push_back("three");
|
||||
pvStructure = standardPVField->enumerated(choices, "alarm,timeStamp,valueAlarm");
|
||||
std::cout << *pvStructure << std::endl;
|
||||
|
||||
|
||||
|
||||
pvStructure = standardPVField->scalarArray(pvDouble,"alarm,timeStamp");
|
||||
std::cout << *pvStructure << std::endl;
|
||||
|
||||
double values[] = { 1.1, 2.2, 3.3 };
|
||||
PVDoubleArrayPtr darray = std::tr1::dynamic_pointer_cast<PVDoubleArray>(pvStructure->getScalarArrayField("value", pvDouble));
|
||||
darray->put(0, 3, values, 0);
|
||||
std::cout << *darray << std::endl;
|
||||
std::cout << format::array_at(1) << *darray << std::endl;
|
||||
|
||||
|
||||
StructureConstPtr structure = standardField->scalar(pvDouble, "alarm,timeStamp");
|
||||
pvStructure = standardPVField->structureArray(structure,"alarm,timeStamp");
|
||||
size_t num = 2;
|
||||
PVStructurePtrArray pvStructures;
|
||||
pvStructures.reserve(num);
|
||||
for(size_t i=0; i<num; i++) {
|
||||
pvStructures.push_back(
|
||||
pvDataCreate->createPVStructure(structure));
|
||||
}
|
||||
PVStructureArrayPtr pvStructureArray = pvStructure->getStructureArrayField("value");
|
||||
pvStructureArray->put(0, num, pvStructures, 0);
|
||||
std::cout << *pvStructure << std::endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ static void testCreatePVStructure(FILE * fd)
|
||||
fprintf(fd,"testCreatePVStructure PASSED\n");
|
||||
}
|
||||
|
||||
static void testPVScalarCommon(FILE * fd,String fieldName,ScalarType stype)
|
||||
static void testPVScalarCommon(FILE * fd,String /*fieldName*/,ScalarType stype)
|
||||
{
|
||||
PVScalarPtr pvScalar = pvDataCreate->createPVScalar(stype);
|
||||
if(stype==pvBoolean) {
|
||||
@@ -91,7 +91,7 @@ static void testPVScalarCommon(FILE * fd,String fieldName,ScalarType stype)
|
||||
}
|
||||
|
||||
static void testPVScalarWithProperties(
|
||||
FILE * fd,String fieldName,ScalarType stype)
|
||||
FILE * fd,String /*fieldName*/,ScalarType stype)
|
||||
{
|
||||
PVStructurePtr pvStructure;
|
||||
bool hasValueAlarm = false;
|
||||
@@ -335,7 +335,7 @@ static void testPVScalar(FILE * fd) {
|
||||
}
|
||||
|
||||
|
||||
static void testScalarArrayCommon(FILE * fd,String fieldName,ScalarType stype)
|
||||
static void testScalarArrayCommon(FILE * fd,String /*fieldName*/,ScalarType stype)
|
||||
{
|
||||
PVStructurePtr pvStructure = standardPVField->scalarArray(
|
||||
stype,alarmTimeStamp);
|
||||
|
||||
@@ -35,7 +35,7 @@ static void print(String name)
|
||||
if(debug) printf("\n%s\n%s\n",name.c_str(),builder.c_str());
|
||||
}
|
||||
|
||||
int main(int argc,char *argv[])
|
||||
int main(int, char **)
|
||||
{
|
||||
StructureConstPtr doubleValue = standardField->scalar(pvDouble,
|
||||
"alarm,timeStamp,display,control,valueAlarm");
|
||||
|
||||
@@ -37,7 +37,7 @@ static void print(String name)
|
||||
if(debug) printf("\n%s\n%s\n",name.c_str(),builder.c_str());
|
||||
}
|
||||
|
||||
int main(int argc,char *argv[])
|
||||
int main(int, char **)
|
||||
{
|
||||
PVStructurePtr pvStructure = standardPVField->scalar(pvDouble,
|
||||
"alarm,timeStamp,display,control,valueAlarm");
|
||||
|
||||
Reference in New Issue
Block a user