don't use deprecated PVValueArray<T>::get()

This commit is contained in:
Michael Davidsaver
2013-07-25 17:54:46 -04:00
parent e96b447e37
commit 0860f8e6f9
4 changed files with 18 additions and 27 deletions

View File

@@ -109,7 +109,8 @@ bool compareScalar(const PVScalarValue<T>* left, const PVScalarValue<T>* right)
template<typename T>
bool compareArray(const PVValueArray<T>* left, const PVValueArray<T>* right)
{
return std::equal(left->get(), left->get()+left->getLength(), right->get());
typename PVValueArray<T>::const_svector lhs(left->view()), rhs(right->view());
return std::equal(lhs.begin(), lhs.end(), rhs.begin());
}
// partially typed comparisons

View File

@@ -28,16 +28,4 @@ namespace epics { namespace pvData {
return static_pointer_cast<const ScalarArray>(PVField::getField());
}
template<>
std::ostream& PVValueArray<int8>::dumpValue(std::ostream& o, size_t index) const
{
return o << static_cast<int>(*(get() + index));
}
template<>
std::ostream& PVValueArray<uint8>::dumpValue(std::ostream& o, size_t index) const
{
return o << static_cast<unsigned int>(*(get() + index));
}
}}

View File

@@ -118,13 +118,16 @@ void PrinterBase::impl_print(const PVField& pv)
}
case structureArray: {
const PVStructureArray &fld = *static_cast<const PVStructureArray*>(next);
const PVStructureArray::pointer vals = fld.get();
PVStructureArray::const_svector vals(fld.view());
inprog.push_back(next);
beginStructureArray(fld);
for(size_t i=0, nfld=fld.getLength(); i<nfld; i++)
todo.push_back(vals[i].get());
for(PVStructureArray::const_svector::const_iterator it=vals.begin();
it!=vals.end(); ++it)
{
todo.push_back(it->get());
}
todo.push_back(marker);
break;

View File

@@ -1167,23 +1167,22 @@ public:
std::ostream& dumpValue(std::ostream& o) const
{
const_svector v(this->view());
typename const_svector::const_iterator it(v.begin()),
end(v.end());
o << '[';
std::size_t len = this->getLength();
bool first = true;
for (std::size_t i = 0; i < len; i++)
{
if (first)
first = false;
else
o << ',';
dumpValue(o, i);
}
if(it!=end) {
o << print_cast(*it++);
for(; it!=end; ++it)
o << ',' << print_cast(*it);
}
return o << ']';
}
std::ostream& dumpValue(std::ostream& o, size_t index) const
{
return o << *(this->get() + index);
return o << print_cast(this->view().at(index));
}
protected: