vesione 2005 compliant

This commit is contained in:
ganovelli 2006-10-31 16:02:59 +00:00
parent 05090aaee1
commit a44013b865
2 changed files with 23 additions and 24 deletions

View File

@ -24,6 +24,9 @@
History
$Log: not supported by cvs2svn $
Revision 1.16 2006/10/27 14:15:10 ganovelli
added overrides to HasFFAddAdjacency and HasVFAddAdjacency
Revision 1.15 2006/10/16 08:49:29 cignoni
Better managment of resize overloading when reducing the size of a vector
@ -140,12 +143,8 @@ public:
// l'allocazione in memoria del container
void push_back(const VALUE_TYPE & v)
{
ThisTypeIterator oldbegin=(*this).begin();
ThisTypeIterator oldend=(*this).end();
BaseType::push_back(v);
if(oldbegin!=(*this).begin()) _updateOVP((*this).begin(),(*this).end());
else _updateOVP(oldend, (*this).end());
BaseType::back()._ovp = this;
if (ColorEnabled) CV.push_back(vcg::Color4b(vcg::Color4b::White));
if (MarkEnabled) MV.push_back(0);
if (NormalEnabled) NV.push_back(typename VALUE_TYPE::NormalType());
@ -156,13 +155,13 @@ public:
void pop_back();
void resize(const unsigned int & _size)
{
ThisTypeIterator oldbegin=(*this).begin();
ThisTypeIterator oldend=(*this).end();
const unsigned int oldsize=(*this).size();
int oldsize = BaseType::size();
BaseType::resize(_size);
if(oldbegin!=(*this).begin()) _updateOVP((*this).begin(),(*this).end());
else if(oldsize<_size) _updateOVP(oldend, (*this).end());
if(oldsize<_size){
ThisTypeIterator firstnew = BaseType::begin();
advance(firstnew,oldsize);
_updateOVP(firstnew,(*this).end());
}
if (ColorEnabled) CV.resize(_size);
if (MarkEnabled) MV.resize(_size);
if (NormalEnabled) NV.resize(_size);

View File

@ -24,6 +24,11 @@
History
$Log: not supported by cvs2svn $
Revision 1.3 2006/02/28 11:59:55 ponchio
g++ compliance:
begin() -> (*this).begin() and for end(), size(), Base(), Index()
Revision 1.2 2005/12/12 11:17:32 cignoni
Corrected update function, now only the needed simplexes should be updated.
@ -70,38 +75,33 @@ public:
// l'allocazione in memoria del container
void push_back(const VALUE_TYPE & v)
{
ThisTypeIterator oldbegin=(*this).begin();
ThisTypeIterator oldend=(*this).end();
BaseType::push_back(v);
if(oldbegin!=(*this).begin()) _updateOVP((*this).begin(),(*this).end());
else _updateOVP(oldend, (*this).end());
BaseType::back()._ovp = this;
}
void pop_back();
void resize(const unsigned int & _size)
{
ThisTypeIterator oldbegin=(*this).begin();
ThisTypeIterator oldend=(*this).end();
int oldsize = BaseType::size();
BaseType::resize(_size);
if(oldbegin!=(*this).begin()) _updateOVP((*this).begin(),(*this).end());
else _updateOVP(oldend, (*this).end());
if(ColorEnabled) CV.resize(_size);
if(oldsize<_size){
ThisTypeIterator firstnew = BaseType::begin();
advance(firstnew,oldsize);
_updateOVP(firstnew,(*this).end());
}
if(ColorEnabled) CV.resize(_size);
if(NormalEnabled) NV.resize(_size);
}
void reserve(const unsigned int & _size)
{
ThisTypeIterator oldbegin=(*this).begin();
BaseType::reserve(_size);
if (ColorEnabled) CV.reserve(_size);
if (NormalEnabled) NV.reserve(_size);
if(oldbegin!=(*this).begin()) _updateOVP((*this).begin(),(*this).end());
}
void _updateOVP(ThisTypeIterator lbegin, ThisTypeIterator lend)
{
ThisTypeIterator vi;
for(vi=lbegin;vi!=lend;++vi)
//for(vi=(*this).begin();vi!=(*this).end();++vi)
(*vi)._ovp=this;
}
////////////////////////////////////////