Remove the implicit cast from non-const to const.
Require the use of freeze/thaw when
changing between const and non-const.
Change argument of const_shared_vector_cast
to a non-const shared_vector reference
to allow it to be cleared by freeze/thaw.
* md/master:
added
minor changes
comparison between implementations
Proposed pvData.h interface
added pvArray.html; made queue.h and bitSetUtil.* compatible with pvDataCPP.
Allow converting of shared_vector between types
Conversion utilizes castUnsafe<TO,FROM>().
Converting to/from void is supported. Convert to void
is an alias for static_shared_vector_cast<void>().
Convert from void utilizes shared_vector<void>::original_type()
and throws std::runtime_error if this is not valid.
Casting now handles 'const void'
is most places where 'void' can be used.
Move the parts of ScalarTypeFunc which
deal with untyped shared_vector s
to sharedVector.h to allow sharedVector.h
to include pvIntrospect.h w/o creating
an include loop...
Combine as much as possible with scalar array handling.
PVStructureArray becomes PVValueArray<shared_ptr<PVStructure> >
Bulk of shared implementation moved the PVVectorStorage
which has a parametrized base to avoid using multiple inheritance.
It seems that shared_ptr::use_count() does
not include weak_ptr instances. Therefore
shared_ptr::use_count()==1 (aka unique())
does *not* ensure exclusive ownership!
This breaks the assumption used by
shared_vector::make_unique() to avoid
allocating a new array in some cases.
pass values by reference where appropriate.
When reallocating arrays of shared_ptr
"move" with swap() instead of operator=
to avoid ref counter inc and dec for each
element.
Only re-use the existing reference if
it is large enough to hold all the new data.
If it isn't then throw it away to avoid
copying its current contents during
the resize().
Call when appropriate (putFrom(), copyIn(), and replace()).
Not called by swap(), take(), reuse(), or shareData().
Users of the second set of methods are expected to call
one of the methods in the first set, or call postPut() directly.
Document when postPut is (not) called.
* In PVScalarArray
Add methods assign, getAs/putFrom, and copyOut/copyIn to allow get/put
with implicit convert.
assign() copys on PVScalarArray to another converting as necessary.
If the types do not match then an allocate and convert is done.
getAs/putFrom work with shared_vector<T> and can avoid a allocate
and convert operation if the types match.
copyOut/copyIn use plain C arrays will do either a copy if the types
match, and a convert otherwise. No allocation is performed.
* In PVValueArray<T>
All array operations re-implemented in terms of
two virtual methods
virtual const shared_vector<T>& viewUnsafe() const;
virtual void swap(shared_vector<T>&);
Some convienence methods are also included:
shared_vector<const T> view() const
shared_vector<T> take()
shared_vector<T> reuse()
Deprecate get(...), put(...), and shareData(...)
Remove getVector() and getSharedVector()
Adjust DefaultPVArray accordingly
Shared ownership of a single C array.
Tracks offset and length for each instance
allowing each owner to "view" a different
piece of the array.
Parts of shared_vector<T> which can work
for T=void are in shared_vector_base<T>.
Specializations shared_vector<void>
and shared_vector<const void> handle
un-typed arrays.
Allow casting to/from typed vector
Offsets and sizes of untyped vectors are tracked in
bytes. Therefore casting to types where sizeof(T)>1
is undefined if the offset is not a multiple of
sizeof(T).