diff --git a/pvDataApp/misc/sharedVector.h b/pvDataApp/misc/sharedVector.h index 073d6a2..718c1ce 100644 --- a/pvDataApp/misc/sharedVector.h +++ b/pvDataApp/misc/sharedVector.h @@ -476,11 +476,13 @@ public: //! Specialization for storing untyped pointers //! Does not allow access or iteration of contents +//! other than as void* or const void* template class shared_vector::type > : public detail::shared_vector_base { typedef detail::shared_vector_base base_t; + ScalarType m_vtype; public: typedef E* pointer; typedef ptrdiff_t difference_type; @@ -488,29 +490,53 @@ public: typedef std::tr1::shared_ptr shared_pointer_type; - shared_vector() :base_t() {} + shared_vector() :base_t(), m_vtype((ScalarType)-1) {} - template - shared_vector(A v, size_t o, size_t c) :base_t(v,o,c) {} + shared_vector(pointer v, size_t o, size_t c) + :base_t(v,o,c), m_vtype((ScalarType)-1) {} + + template + shared_vector(pointer d, B b, size_t o, size_t c) + :base_t(d,b,o,c), m_vtype((ScalarType)-1) {} template shared_vector(const std::tr1::shared_ptr& d, size_t o, size_t c) - :base_t(d,o,c) {} - - template - shared_vector(A d, B b, size_t o, size_t c) - :base_t(d,b,o,c) {} + :base_t(d,o,c), m_vtype((ScalarType)-1) {} template - shared_vector(const shared_vector& o) :base_t(o) {} + shared_vector(const shared_vector& o) + :base_t(o), m_vtype(o.m_vtype) {} - shared_vector(const shared_vector& o) :base_t(o) {} + shared_vector(const shared_vector& o) + :base_t(o), m_vtype(o.m_vtype) {} + + shared_vector& operator=(const shared_vector& o) + { + if(&o!=this) { + this->base_t::operator=(o); + m_vtype = o.m_vtype; + } + return *this; + } + + template + shared_vector& operator=(const shared_vector& o) + { + if(&o!=this) { + this->base_t::operator=(o); + m_vtype = o.m_vtype; + } + return *this; + } size_t max_size() const{return (size_t)-1;} pointer data() const{ return (pointer)(((char*)this->m_data.get())+this->m_offset); } + + shared_vector& set_original_type(ScalarType t) { m_vtype=t; return *this; } + ScalarType original_type() const {return m_vtype;} }; namespace detail {