From b5c1b9178d4838c900a46b3b9bba2e794f5185a0 Mon Sep 17 00:00:00 2001 From: Ralph Lange Date: Tue, 16 Feb 2016 10:18:41 +0100 Subject: [PATCH 01/13] jenkins: switch to Base 3.15.3 --- jenkins/cloudbees_doc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jenkins/cloudbees_doc b/jenkins/cloudbees_doc index 2ade4bf..6875836 100644 --- a/jenkins/cloudbees_doc +++ b/jenkins/cloudbees_doc @@ -12,7 +12,7 @@ ########################################### # Set EPICS Base version and upload target -BASE=3.15.2 +BASE=3.15.3 PUBLISH=${1:-DONT} ########################################### From 5b07ecbd01479d53d0a30279c6c8f6c6c987a534 Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Wed, 17 Feb 2016 10:09:47 -0500 Subject: [PATCH 02/13] testBitSet more diag output --- testApp/misc/testBitSet.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/testApp/misc/testBitSet.cpp b/testApp/misc/testBitSet.cpp index 36fc645..3867062 100644 --- a/testApp/misc/testBitSet.cpp +++ b/testApp/misc/testBitSet.cpp @@ -100,13 +100,13 @@ static void testOperators() b1.set(1); testOk1(!(b1 == b2)); - // different internal length, but the same + testDiag("different internal length, but the same"); b2.set(100); b2.set(1); b2.flip(100); testOk1(b1 == b2); - // OR test + testDiag("OR test"); b2.set(65); b2.set(106); b2.set(105); @@ -118,12 +118,12 @@ static void testOperators() str = toString(b1); testOk1(str == "{1, 65, 105, 106}"); - // AND test + testDiag("AND test"); b1.set(128); b1 &= b2; testOk1(b1 == b2); - // XOR test + testDiag("XOR test"); b1.set(128); b1 ^= b2; testOk1((b1.cardinality() == 1 && b1.get(128) == true)); @@ -135,11 +135,11 @@ static void testOperators() testOk1((b1.cardinality() == 2 && b1.get(1) == true && b1.get(256) == true)); - // assign + testDiag("assign"); b1 = b2; testOk1(b1 == b2); - // or_and + testDiag("or_and"); b1.clear(); b1.set(2); b2.clear(); b2.set(66); b2.set(128); BitSet b3; b3.set(128); b3.set(520); From 62893e33e9cf2da6035ceb3726ab5d6ae91dc784 Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Wed, 17 Feb 2016 10:12:04 -0500 Subject: [PATCH 03/13] testBitSet: demo bug in BitSet::or_and Incorrect handling of wordsInUse truncates if RHS (b1 & b2) is shorter than LHS (b3). --- testApp/misc/testBitSet.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/testApp/misc/testBitSet.cpp b/testApp/misc/testBitSet.cpp index 3867062..005e1ba 100644 --- a/testApp/misc/testBitSet.cpp +++ b/testApp/misc/testBitSet.cpp @@ -146,6 +146,15 @@ static void testOperators() b1.or_and(b2, b3); str = toString(b1); testOk1(str == "{2, 128}"); + + b1.clear(); b1.set(1); + b2.clear(); + b3.clear(); b3.set(1); + std::cout<<"# "< Date: Wed, 17 Feb 2016 10:15:16 -0500 Subject: [PATCH 04/13] 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. --- src/misc/bitSet.cpp | 3 ++- testApp/misc/testBitSet.cpp | 2 -- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/misc/bitSet.cpp b/src/misc/bitSet.cpp index 2da4fd8..2d34591 100644 --- a/src/misc/bitSet.cpp +++ b/src/misc/bitSet.cpp @@ -279,7 +279,8 @@ namespace epics { namespace pvData { uint32 inUse = (set1.wordsInUse < set2.wordsInUse) ? set1.wordsInUse : set2.wordsInUse; ensureCapacity(inUse); - wordsInUse = inUse; + if(inUse>wordsInUse) + wordsInUse = inUse; // Perform logical AND on words in common for (uint32 i = 0; i < inUse; i++) diff --git a/testApp/misc/testBitSet.cpp b/testApp/misc/testBitSet.cpp index 005e1ba..a378201 100644 --- a/testApp/misc/testBitSet.cpp +++ b/testApp/misc/testBitSet.cpp @@ -152,9 +152,7 @@ static void testOperators() b3.clear(); b3.set(1); std::cout<<"# "< Date: Wed, 17 Feb 2016 10:53:32 -0500 Subject: [PATCH 05/13] testBitSet: forgot to update test count --- testApp/misc/testBitSet.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testApp/misc/testBitSet.cpp b/testApp/misc/testBitSet.cpp index a378201..976683a 100644 --- a/testApp/misc/testBitSet.cpp +++ b/testApp/misc/testBitSet.cpp @@ -158,7 +158,7 @@ static void testOperators() MAIN(testBitSet) { - testPlan(29); + testPlan(30); testGetSetClearFlip(); testOperators(); return testDone(); From 336a8b3bc2fb7c3123756a8e93082dbe85ecfaee Mon Sep 17 00:00:00 2001 From: Dave Hickin Date: Thu, 18 Feb 2016 18:56:04 +0000 Subject: [PATCH 06/13] Fix win32 deserialization test fail --- src/misc/bitSet.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/misc/bitSet.cpp b/src/misc/bitSet.cpp index a2110f9..de19ea9 100644 --- a/src/misc/bitSet.cpp +++ b/src/misc/bitSet.cpp @@ -359,7 +359,7 @@ namespace epics { namespace pvData { words[j] = 0; for (uint32 remaining = (bytes - longs * 8), j = 0; j < remaining; j++) - words[i] |= (buffer->getByte() & 0xffL) << (8 * j); + words[i] |= (buffer->getByte() & 0xffLL) << (8 * j); } From dc94b26e50bee25610e3b000f415a2a36463e10f Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Wed, 24 Feb 2016 10:18:47 -0500 Subject: [PATCH 07/13] 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. --- src/misc/pv/sharedVector.h | 78 ++++++++++++++++++++++++------- testApp/misc/testSharedVector.cpp | 31 +++++++++--- testApp/pv/testPVScalarArray.cpp | 24 +++++++++- 3 files changed, 108 insertions(+), 25 deletions(-) diff --git a/src/misc/pv/sharedVector.h b/src/misc/pv/sharedVector.h index e3da8d9..6efcad2 100644 --- a/src/misc/pv/sharedVector.h +++ b/src/misc/pv/sharedVector.h @@ -326,7 +326,7 @@ public: //! Internal for static_shared_vector_cast template shared_vector(const shared_vector &src, - typename meta::is_void::type) + detail::_shared_vector_cast_tag) :base_t(std::tr1::static_pointer_cast(src.dataPtr()), src.dataOffset()/sizeof(E), src.dataCount()/sizeof(E)) @@ -566,7 +566,7 @@ public: //! Internal for static_shared_vector_cast template shared_vector(const shared_vector &src, - typename meta::is_not_void::type) + detail::_shared_vector_cast_tag) :base_t(std::tr1::static_pointer_cast(src.dataPtr()), src.dataOffset()*sizeof(FROM), src.dataCount()*sizeof(FROM)) @@ -602,6 +602,64 @@ public: ScalarType original_type() const {return m_vtype;} }; +namespace detail { + template + struct static_shared_vector_caster { /* no default */ }; + // from void to non-void with same const-ness + template + struct static_shared_vector_caster, meta::is_not_void >::type> { + static inline shared_vector op(const shared_vector& src) { + return shared_vector(src, detail::_shared_vector_cast_tag()); + } + }; + template + struct static_shared_vector_caster, meta::is_not_void >::type> { + static inline shared_vector op(const shared_vector& src) { + return shared_vector(src, detail::_shared_vector_cast_tag()); + } + }; + // from non-void to void with same const-ness + template + struct static_shared_vector_caster, meta::is_not_void >::type> { + static FORCE_INLINE shared_vector op(const shared_vector& src) { + return shared_vector(src, detail::_shared_vector_cast_tag()); + } + }; + template + struct static_shared_vector_caster, meta::is_not_void >::type> { + static FORCE_INLINE shared_vector op(const shared_vector& src) { + return shared_vector(src, detail::_shared_vector_cast_tag()); + } + }; + + // cast to same type, no-op + template + struct static_shared_vector_caster { + static FORCE_INLINE const shared_vector& op(const shared_vector& src) { + return src; + } + }; +} // namespace detail + +/** @brief Allow casting of shared_vector between types + * + * Currently only to/from void is implemented. + * + @warning Casting from void is undefined unless the offset and length + * are integer multiples of the size of the destination type. + */ +template +static FORCE_INLINE +shared_vector +static_shared_vector_cast(const shared_vector& src) +{ + return detail::static_shared_vector_caster::op(src); +} + namespace detail { // Default to type conversion using castUnsafe (C++ type casting) on each element @@ -662,22 +720,6 @@ namespace detail { }; } -/** @brief Allow casting of shared_vector between types - * - * Currently only to/from void is implemented. - * - @warning Casting from void is undefined unless the offset and length - * are integer multiples of the size of the destination type. - */ -template -static FORCE_INLINE -shared_vector -static_shared_vector_cast(const shared_vector& src, - typename meta::same_const::type = 0) -{ - return shared_vector(src, detail::_shared_vector_cast_tag()); -} - /** @brief Allow converting of shared_vector between types * * Conversion utilizes castUnsafe(). diff --git a/testApp/misc/testSharedVector.cpp b/testApp/misc/testSharedVector.cpp index 414e28a..d12ce85 100644 --- a/testApp/misc/testSharedVector.cpp +++ b/testApp/misc/testSharedVector.cpp @@ -360,17 +360,36 @@ static void testVoid() epics::pvData::shared_vector typed(4); - epics::pvData::shared_vector untyped2(epics::pvData::static_shared_vector_cast(typed)); + epics::pvData::shared_vector untyped(epics::pvData::static_shared_vector_cast(typed)); - testOk1(typed.dataPtr().get()==untyped2.dataPtr().get()); - testOk1(typed.size()*sizeof(int)==untyped2.size()); + testOk1(typed.dataPtr().get()==untyped.dataPtr().get()); + testOk1(typed.size()*sizeof(int)==untyped.size()); - untyped2.slice(sizeof(int), 2*sizeof(int)); + untyped.slice(sizeof(int), 2*sizeof(int)); - typed = epics::pvData::static_shared_vector_cast(untyped2); + typed = epics::pvData::static_shared_vector_cast(untyped); testOk1(typed.dataOffset()==1); testOk1(typed.size()==2); + untyped.clear(); + + testDiag("Test vector cast to/from const void"); + + epics::pvData::shared_vector ctyped(4); + + epics::pvData::shared_vector cuntyped(epics::pvData::static_shared_vector_cast(ctyped)); + // case const void to const void + epics::pvData::shared_vector cuntyped2(epics::pvData::static_shared_vector_cast(cuntyped)); + + testOk1(ctyped.dataPtr().get()==cuntyped2.dataPtr().get()); + testOk1(ctyped.size()*sizeof(int)==cuntyped2.size()); + + cuntyped2.slice(sizeof(int), 2*sizeof(int)); + + ctyped = epics::pvData::static_shared_vector_cast(cuntyped2); + + testOk1(ctyped.dataOffset()==1); + testOk1(ctyped.size()==2); } struct dummyStruct {}; @@ -539,7 +558,7 @@ static void testICE() MAIN(testSharedVector) { - testPlan(163); + testPlan(167); testDiag("Tests for shared_vector"); testDiag("sizeof(shared_vector)=%lu", diff --git a/testApp/pv/testPVScalarArray.cpp b/testApp/pv/testPVScalarArray.cpp index 084266e..7085f67 100644 --- a/testApp/pv/testPVScalarArray.cpp +++ b/testApp/pv/testPVScalarArray.cpp @@ -177,11 +177,32 @@ static void testShare() testOk1(!cdata.unique()); } +static void testVoid() +{ + testDiag("Check PVScalarArray put/get from void"); + + PVIntArrayPtr iarr = static_pointer_cast(getPVDataCreate()->createPVScalarArray(pvInt)); + + PVIntArray::const_svector idata(4, 1); + iarr->PVScalarArray::putFrom(idata); + idata.clear(); + + shared_vector cvbuf; + iarr->PVScalarArray::getAs(cvbuf); + + idata = static_shared_vector_cast(cvbuf); + testOk1(idata.size()==4); + + iarr->PVScalarArray::putFrom(cvbuf); + + testOk1(iarr->getLength()==4); +} + } // end namespace MAIN(testPVScalarArray) { - testPlan(156); + testPlan(158); testFactory(); testBasic(); testBasic(); @@ -189,5 +210,6 @@ MAIN(testPVScalarArray) testBasic(); testBasic(); testShare(); + testVoid(); return testDone(); } From b02f7711467ce9a27e9a0f477eee197a441d7469 Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Wed, 24 Feb 2016 11:01:32 -0500 Subject: [PATCH 08/13] shared_vector: vtype lost when freeze/thaw untyped The vtype code is not copied for freeze/thaw of shared_vector to/from shared_vector. --- src/misc/pv/sharedVector.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/misc/pv/sharedVector.h b/src/misc/pv/sharedVector.h index 6efcad2..49b4f6b 100644 --- a/src/misc/pv/sharedVector.h +++ b/src/misc/pv/sharedVector.h @@ -575,12 +575,12 @@ public: shared_vector(shared_vector& O, detail::_shared_vector_freeze_tag t) - :base_t(O,t) + :base_t(O,t), m_vtype(O.m_vtype) {} shared_vector(shared_vector& O, detail::_shared_vector_thaw_tag t) - :base_t(O,t) + :base_t(O,t), m_vtype(O.m_vtype) {} shared_vector& operator=(const shared_vector& o) @@ -692,7 +692,7 @@ namespace detail { return shared_vector(src, detail::_shared_vector_cast_tag()); } }; - + // convert from void uses original type or throws an exception. template struct shared_vector_converter Date: Wed, 24 Feb 2016 11:02:11 -0500 Subject: [PATCH 09/13] note shared_vector casts which should fail --- testApp/misc/testSharedVector.cpp | 58 +++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/testApp/misc/testSharedVector.cpp b/testApp/misc/testSharedVector.cpp index d12ce85..36dfa86 100644 --- a/testApp/misc/testSharedVector.cpp +++ b/testApp/misc/testSharedVector.cpp @@ -556,6 +556,63 @@ static void testICE() } } +static +void testBad() +{ + epics::pvData::shared_vector I; + epics::pvData::shared_vector CI; + epics::pvData::shared_vector F; + epics::pvData::shared_vector CF; + epics::pvData::shared_vector V; + epics::pvData::shared_vector CV; + (void)I; + (void)CI; + (void)F; + (void)CF; + (void)V; + (void)CV; + + // Tests which should result in compile failure. + // as there is no established way to test this automatically, + // uncomment one at a time + + // No copy from const to non-const + //CI = I; + //I = CI; + //epics::pvData::shared_vector CI2(I); + //epics::pvData::shared_vector I2(CI); + + // shared_vector_convert can't thaw() + //I = epics::pvData::shared_vector_convert(CI); + //V = epics::pvData::shared_vector_convert(CV); + + // shared_vector_convert can't freeze() + //CI = epics::pvData::shared_vector_convert(I); + //CV = epics::pvData::shared_vector_convert(V); + + // static_shared_vector_cast can't thaw() + //I = epics::pvData::static_shared_vector_cast(CI); + //V = epics::pvData::static_shared_vector_cast(CV); + + // static_shared_vector_cast can't freeze() + //CI = epics::pvData::static_shared_vector_cast(I); + //CV = epics::pvData::static_shared_vector_cast(V); + + // freeze() can't change type. + // the error here will be with the assignment + //I = epics::pvData::freeze(CV); + //I = epics::pvData::freeze(CF); + //CI = epics::pvData::freeze(V); + //CI = epics::pvData::freeze(F); + + // that() can't change type. + // the error here will be with the assignment + //CI = epics::pvData::thaw(V); + //CI = epics::pvData::thaw(F); + //I = epics::pvData::thaw(CV); + //I = epics::pvData::that(CF); +} + MAIN(testSharedVector) { testPlan(167); @@ -577,5 +634,6 @@ MAIN(testSharedVector) testVectorConvert(); testWeak(); testICE(); + testBad(); return testDone(); } From a90405c25af6d8881229593db298b4c736c30500 Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Wed, 24 Feb 2016 14:01:40 -0500 Subject: [PATCH 10/13] shared_vector update doc --- src/misc/pv/sharedVector.h | 48 ++++++++++++++++++++++++++------------ 1 file changed, 33 insertions(+), 15 deletions(-) diff --git a/src/misc/pv/sharedVector.h b/src/misc/pv/sharedVector.h index 49b4f6b..24dd52d 100644 --- a/src/misc/pv/sharedVector.h +++ b/src/misc/pv/sharedVector.h @@ -432,8 +432,8 @@ public: shared_vector original(...); if(!original.unique()){ - shared_vector temp(myallocator(original.size()), - 0, original.size()); + std::tr1::shared_ptr sptr(myalloc(original.size()), myfree); + shared_vector temp(sptr, 0, original.size()); std::copy(original.begin(), original.end(), temp.begin()); original.swap(temp); } @@ -532,6 +532,20 @@ public: * * Does not allow access or iteration of contents * other than as void* or const void* + * + * In order to support shared_vector_convert<>() + * information about the type of the underlying allocation + * is stored. + * This is implicitly set by static_shared_vector_cast<>() + * and may be explicitly checked/changed using + * original_type()/set_original_type(). + * + * A shared_vector directly constructed + * from a smart pointer does not have an associated + * original_type(). + * Use epics::pvData::ScalarTypeFunc::allocArray() + * to convienently allocate an array with a known + * original_type(). */ template class shared_vector::type > @@ -726,8 +740,10 @@ namespace detail { * * Converting to/from void is supported. Convert to void * is an alias for static_shared_vector_cast(). - * Convert from void utilizes shared_vector::original_type() - * and throws std::runtime_error if this is not valid. + * Convert from void utilizes shared_vector::original_type(). + * + * @throws std::runtime_error if cast is not valid. + * @throws std::bad_alloc for out of memory condition */ template static FORCE_INLINE @@ -903,8 +919,11 @@ std::ostream& operator<<(std::ostream& strm, const epics::pvData::shared_vector< * shared_vector has additional constructors from raw pointers * and shared_ptr s. * - * The copy constructor and assignment operator allow implicit - * casting from type 'shared_vector' to 'shared_vector'. + * Implicit casting is not allowed. Instead use + * const_shared_vector_cast()/freeze()/thaw() (@ref vectorconst) + * to casting between 'T' and 'const T'. + * Use static_shared_vector_cast() to cast between + * void and non-void (same const-ness). * * To facilitate safe modification the methods unique() and * make_unique() are provided. @@ -1006,17 +1025,15 @@ Type #2 is constant reference to a mutable value. Type #3 is a mutable reference to a constant value. Type #4 is a constant reference to a constant value. -Casting between const and non-const references of the same value type -is governed by the normal C++ casting rules. - Casting between const and non-const values does @b not follow the normal -C++ casting rules. +C++ casting rules (no implicit cast). For casting between shared_vector and shared_vector explicit casting operations are required. These operations are @b freeze() (non-const to const) and @b thaw() (const to non-const). -A shared_vector is "frozen" as its value can not be modified. +A 'shared_vector' is "frozen" as its value can not be modified. +However it can still be sliced because the reference is not const. These functions are defined like: @@ -1040,17 +1057,18 @@ The following guarantees are provided by both functions: # The returned reference points to a value which is only referenced by shared_vectors with the same value const-ness as the returned reference. -Please note that the argument of both freeze and thaw is a non-const +@note The argument of both freeze() and thaw() is a non-const reference which will always be cleared. @section vfreeze Freezing The act of freezing a shared_vector requires that the shared_vector -passed in must be unique() or an exception is thrown. This is -done to reduce the possibility of accidental copying. +passed in must be unique() or an exception is thrown. +No copy is made. -This possibility can be avoided by calling the make_unique() on a +The possibility of an exception can be avoided by calling the make_unique() on a shared_vector before passing it to freeze(). +This will make a copy if necessary. @section vthaw Thawing From a8ba831f5eed2a057f9dd946638498a4fc22f28b Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Wed, 24 Feb 2016 14:22:18 -0500 Subject: [PATCH 11/13] fix freeze() of shared_vector --- src/misc/pv/sharedVector.h | 4 ++++ testApp/misc/testSharedVector.cpp | 9 +++++++++ 2 files changed, 13 insertions(+) diff --git a/src/misc/pv/sharedVector.h b/src/misc/pv/sharedVector.h index 24dd52d..b092d91 100644 --- a/src/misc/pv/sharedVector.h +++ b/src/misc/pv/sharedVector.h @@ -553,7 +553,11 @@ class shared_vector::type > { typedef detail::shared_vector_base base_t; ScalarType m_vtype; + + // allow specialization for all E to be friends + template friend class shared_vector; public: + typedef E value_type; typedef E* pointer; typedef ptrdiff_t difference_type; typedef size_t size_type; diff --git a/testApp/misc/testSharedVector.cpp b/testApp/misc/testSharedVector.cpp index 36dfa86..6bdcddc 100644 --- a/testApp/misc/testSharedVector.cpp +++ b/testApp/misc/testSharedVector.cpp @@ -372,7 +372,10 @@ static void testVoid() testOk1(typed.dataOffset()==1); testOk1(typed.size()==2); untyped.clear(); +} +static void testConstVoid() +{ testDiag("Test vector cast to/from const void"); epics::pvData::shared_vector ctyped(4); @@ -390,6 +393,11 @@ static void testVoid() testOk1(ctyped.dataOffset()==1); testOk1(ctyped.size()==2); + + epics::pvData::shared_vector untyped; + // not possible to thaw() void as shared_vector has no make_unique() + //untyped = thaw(cuntyped); + cuntyped = freeze(untyped); } struct dummyStruct {}; @@ -630,6 +638,7 @@ MAIN(testSharedVector) testSlice(); testPush(); testVoid(); + testConstVoid(); testNonPOD(); testVectorConvert(); testWeak(); From 4f499aed01622ad570cea8d80c10dc336b7ccdc4 Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Wed, 24 Feb 2016 16:03:16 -0500 Subject: [PATCH 12/13] remove PVField::notImplemented An unused waste of space in every instance... --- src/factory/PVField.cpp | 3 +-- src/pv/pvData.h | 1 - 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/src/factory/PVField.cpp b/src/factory/PVField.cpp index 04a1769..bb4ff1e 100644 --- a/src/factory/PVField.cpp +++ b/src/factory/PVField.cpp @@ -24,8 +24,7 @@ using std::string; namespace epics { namespace pvData { PVField::PVField(FieldConstPtr field) -: notImplemented("not implemented"), - parent(NULL),field(field), +: parent(NULL),field(field), fieldOffset(0), nextFieldOffset(0), immutable(false) { diff --git a/src/pv/pvData.h b/src/pv/pvData.h index d68eb04..94e30ee 100644 --- a/src/pv/pvData.h +++ b/src/pv/pvData.h @@ -254,7 +254,6 @@ protected: private: static void computeOffset(const PVField *pvField); static void computeOffset(const PVField *pvField,std::size_t offset); - std::string notImplemented; std::string fieldName; PVStructure *parent; FieldConstPtr field; From b0df40d9a64ebce94dbe251a278c43ce6975efb9 Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Tue, 1 Mar 2016 13:25:20 -0500 Subject: [PATCH 13/13] testSharedVector more PG locals --- testApp/misc/testSharedVector.cpp | 42 +++++++++++++++---------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/testApp/misc/testSharedVector.cpp b/testApp/misc/testSharedVector.cpp index 6bdcddc..f0a4b29 100644 --- a/testApp/misc/testSharedVector.cpp +++ b/testApp/misc/testSharedVector.cpp @@ -358,46 +358,46 @@ static void testVoid() { testDiag("Test vector cast to/from void"); - epics::pvData::shared_vector typed(4); + epics::pvData::shared_vector IV(4); - epics::pvData::shared_vector untyped(epics::pvData::static_shared_vector_cast(typed)); + epics::pvData::shared_vector VV(epics::pvData::static_shared_vector_cast(IV)); - testOk1(typed.dataPtr().get()==untyped.dataPtr().get()); - testOk1(typed.size()*sizeof(int)==untyped.size()); + testOk1(IV.dataPtr().get()==VV.dataPtr().get()); + testOk1(IV.size()*sizeof(int)==VV.size()); - untyped.slice(sizeof(int), 2*sizeof(int)); + VV.slice(sizeof(int), 2*sizeof(int)); - typed = epics::pvData::static_shared_vector_cast(untyped); + IV = epics::pvData::static_shared_vector_cast(VV); - testOk1(typed.dataOffset()==1); - testOk1(typed.size()==2); - untyped.clear(); + testOk1(IV.dataOffset()==1); + testOk1(IV.size()==2); + VV.clear(); } static void testConstVoid() { testDiag("Test vector cast to/from const void"); - epics::pvData::shared_vector ctyped(4); + epics::pvData::shared_vector CIV(4); - epics::pvData::shared_vector cuntyped(epics::pvData::static_shared_vector_cast(ctyped)); + epics::pvData::shared_vector CVV(epics::pvData::static_shared_vector_cast(CIV)); // case const void to const void - epics::pvData::shared_vector cuntyped2(epics::pvData::static_shared_vector_cast(cuntyped)); + epics::pvData::shared_vector CVV2(epics::pvData::static_shared_vector_cast(CVV)); - testOk1(ctyped.dataPtr().get()==cuntyped2.dataPtr().get()); - testOk1(ctyped.size()*sizeof(int)==cuntyped2.size()); + testOk1(CIV.dataPtr().get()==CVV2.dataPtr().get()); + testOk1(CIV.size()*sizeof(int)==CVV2.size()); - cuntyped2.slice(sizeof(int), 2*sizeof(int)); + CVV2.slice(sizeof(int), 2*sizeof(int)); - ctyped = epics::pvData::static_shared_vector_cast(cuntyped2); + CIV = epics::pvData::static_shared_vector_cast(CVV2); - testOk1(ctyped.dataOffset()==1); - testOk1(ctyped.size()==2); + testOk1(CIV.dataOffset()==1); + testOk1(CIV.size()==2); - epics::pvData::shared_vector untyped; + epics::pvData::shared_vector VV; // not possible to thaw() void as shared_vector has no make_unique() - //untyped = thaw(cuntyped); - cuntyped = freeze(untyped); + //VV = thaw(CVV); + CVV = freeze(VV); } struct dummyStruct {};