g++ compliance:

begin() -> (*this).begin() and for end(), size(), Base(), Index()
This commit is contained in:
Federico Ponchio 2006-02-28 11:59:55 +00:00
parent d1bdc88911
commit 40e4a353bd
2 changed files with 66 additions and 60 deletions

View File

@ -24,6 +24,9 @@
History History
$Log: not supported by cvs2svn $ $Log: not supported by cvs2svn $
Revision 1.10 2006/01/30 08:47:40 cignoni
Corrected HasPerWedgeTexture
Revision 1.9 2006/01/05 15:46:06 cignoni Revision 1.9 2006/01/05 15:46:06 cignoni
Removed a syntax error (double >) in HasPerWedgeTexture/HasPerFaceColor Removed a syntax error (double >) in HasPerWedgeTexture/HasPerFaceColor
@ -119,11 +122,11 @@ public:
// l'allocazione in memoria del container // l'allocazione in memoria del container
void push_back(const VALUE_TYPE & v) void push_back(const VALUE_TYPE & v)
{ {
ThisTypeIterator oldbegin=begin(); ThisTypeIterator oldbegin=(*this).begin();
ThisTypeIterator oldend=end(); ThisTypeIterator oldend=(*this).end();
BaseType::push_back(v); BaseType::push_back(v);
if(oldbegin!=begin()) _updateOVP(begin(),end()); if(oldbegin!=(*this).begin()) _updateOVP((*this).begin(),(*this).end());
else _updateOVP(oldend, end()); else _updateOVP(oldend, (*this).end());
if(NormalEnabled) NV.push_back(typename VALUE_TYPE::NormalType()); if(NormalEnabled) NV.push_back(typename VALUE_TYPE::NormalType());
if(VFAdjacencyEnabled) AV.push_back(AdjTypePack()); if(VFAdjacencyEnabled) AV.push_back(AdjTypePack());
@ -133,11 +136,11 @@ public:
void pop_back(); void pop_back();
void resize(const unsigned int & _size) void resize(const unsigned int & _size)
{ {
ThisTypeIterator oldbegin=begin(); ThisTypeIterator oldbegin=(*this).begin();
ThisTypeIterator oldend=end(); ThisTypeIterator oldend=(*this).end();
BaseType::resize(_size); BaseType::resize(_size);
if(oldbegin!=begin()) _updateOVP(begin(),end()); if(oldbegin!=(*this).begin()) _updateOVP((*this).begin(),(*this).end());
else _updateOVP(oldend, end()); else _updateOVP(oldend, (*this).end());
if(ColorEnabled) CV.resize(_size); if(ColorEnabled) CV.resize(_size);
if(NormalEnabled) NV.resize(_size); if(NormalEnabled) NV.resize(_size);
if(VFAdjacencyEnabled) AV.resize(_size); if(VFAdjacencyEnabled) AV.resize(_size);
@ -147,20 +150,20 @@ public:
} }
void reserve(const unsigned int & _size) void reserve(const unsigned int & _size)
{ {
ThisTypeIterator oldbegin=begin(); ThisTypeIterator oldbegin=(*this).begin();
BaseType::reserve(_size); BaseType::reserve(_size);
if (ColorEnabled) CV.reserve(_size); if (ColorEnabled) CV.reserve(_size);
if (NormalEnabled) NV.reserve(_size); if (NormalEnabled) NV.reserve(_size);
if (VFAdjacencyEnabled) AV.reserve(_size); if (VFAdjacencyEnabled) AV.reserve(_size);
if (FFAdjacencyEnabled) AF.reserve(_size); if (FFAdjacencyEnabled) AF.reserve(_size);
if (WedgeTexEnabled) WTV.reserve(_size); if (WedgeTexEnabled) WTV.reserve(_size);
if(oldbegin!=begin()) _updateOVP(begin(),end()); if(oldbegin!=(*this).begin()) _updateOVP((*this).begin(),(*this).end());
} }
void _updateOVP(ThisTypeIterator lbegin, ThisTypeIterator lend) void _updateOVP(ThisTypeIterator lbegin, ThisTypeIterator lend)
{ {
ThisTypeIterator fi; ThisTypeIterator fi;
//for(fi=begin();vi!=end();++vi) //for(fi=(*this).begin();vi!=(*this).end();++vi)
for(fi=lbegin;fi!=lend;++fi) for(fi=lbegin;fi!=lend;++fi)
(*fi)._ovp=this; (*fi)._ovp=this;
} }
@ -171,7 +174,7 @@ bool IsColorEnabled() const {return ColorEnabled;}
void EnableColor() { void EnableColor() {
assert(VALUE_TYPE::HasFaceColorOcf()); assert(VALUE_TYPE::HasFaceColorOcf());
ColorEnabled=true; ColorEnabled=true;
CV.resize(size()); CV.resize((*this).size());
} }
void DisableColor() { void DisableColor() {
@ -184,7 +187,7 @@ bool IsNormalEnabled() const {return NormalEnabled;}
void EnableNormal() { void EnableNormal() {
assert(VALUE_TYPE::HasFaceNormalOcf()); assert(VALUE_TYPE::HasFaceNormalOcf());
NormalEnabled=true; NormalEnabled=true;
NV.resize(size()); NV.resize((*this).size());
} }
void DisableNormal() { void DisableNormal() {
@ -197,7 +200,7 @@ bool IsVFAdjacencyEnabled() const {return VFAdjacencyEnabled;}
void EnableVFAdjacency() { void EnableVFAdjacency() {
assert(VALUE_TYPE::HasVFAdjacencyOcf()); assert(VALUE_TYPE::HasVFAdjacencyOcf());
VFAdjacencyEnabled=true; VFAdjacencyEnabled=true;
AV.resize(size()); AV.resize((*this).size());
} }
void DisableVFAdjacency() { void DisableVFAdjacency() {
@ -211,7 +214,7 @@ bool IsFFAdjacencyEnabled() const {return FFAdjacencyEnabled;}
void EnableFFAdjacency() { void EnableFFAdjacency() {
assert(VALUE_TYPE::HasFFAdjacencyOcf()); assert(VALUE_TYPE::HasFFAdjacencyOcf());
FFAdjacencyEnabled=true; FFAdjacencyEnabled=true;
AF.resize(size()); AF.resize((*this).size());
} }
void DisableFFAdjacency() { void DisableFFAdjacency() {
@ -224,7 +227,7 @@ bool IsWedgeTexEnabled() const {return WedgeTexEnabled;}
void EnableWedgeTex() { void EnableWedgeTex() {
assert(VALUE_TYPE::HasWedgeTextureOcf()); assert(VALUE_TYPE::HasWedgeTextureOcf());
WedgeTexEnabled=true; WedgeTexEnabled=true;
WTV.resize(size(),WedgeTexTypePack()); WTV.resize((*this).size(),WedgeTexTypePack());
} }
void DisableWedgeTex() { void DisableWedgeTex() {
@ -257,18 +260,18 @@ public:
template <class T> class VFAdjOcf: public T { template <class T> class VFAdjOcf: public T {
public: public:
typename T::FacePointer &VFp(const int j) { typename T::FacePointer &VFp(const int j) {
assert(Base().VFAdjacencyEnabled); assert((*this).Base().VFAdjacencyEnabled);
return Base().AV[Index()]._fp[j]; return (*this).Base().AV[(*this).Index()]._fp[j];
} }
typename T::FacePointer cVFp(const int j) const { typename T::FacePointer cVFp(const int j) const {
if(! Base().VFAdjacencyEnabled ) return 0; if(! (*this).Base().VFAdjacencyEnabled ) return 0;
else return Base().AV[Index()]._fp[j]; else return (*this).Base().AV[(*this).Index()]._fp[j];
} }
char &VFi(const int j) { char &VFi(const int j) {
assert(Base().VFAdjacencyEnabled); assert((*this).Base().VFAdjacencyEnabled);
return Base().AV[Index()]._zp[j]; return (*this).Base().AV[(*this).Index()]._zp[j];
} }
static bool HasVFAdjacency() { return true; } static bool HasVFAdjacency() { return true; }
static bool HasVFAdjacencyOcf() { return true; } static bool HasVFAdjacencyOcf() { return true; }
@ -281,23 +284,23 @@ private:
template <class T> class FFAdjOcf: public T { template <class T> class FFAdjOcf: public T {
public: public:
typename T::FacePointer &FFp(const int j) { typename T::FacePointer &FFp(const int j) {
assert(Base().FFAdjacencyEnabled); assert((*this).Base().FFAdjacencyEnabled);
return Base().AF[Index()]._fp[j]; return (*this).Base().AF[(*this).Index()]._fp[j];
} }
typename T::FacePointer const FFp(const int j) const { return cFFp(j);} typename T::FacePointer const FFp(const int j) const { return cFFp(j);}
typename T::FacePointer const cFFp(const int j) const { typename T::FacePointer const cFFp(const int j) const {
if(! Base().FFAdjacencyEnabled ) return 0; if(! (*this).Base().FFAdjacencyEnabled ) return 0;
else return Base().AF[Index()]._fp[j]; else return (*this).Base().AF[(*this).Index()]._fp[j];
} }
char &FFi(const int j) { char &FFi(const int j) {
assert(Base().FFAdjacencyEnabled); assert((*this).Base().FFAdjacencyEnabled);
return Base().AF[Index()]._zp[j]; return (*this).Base().AF[(*this).Index()]._zp[j];
} }
const char cFFi(const int j) const { const char cFFi(const int j) const {
assert(Base().FFAdjacencyEnabled); assert((*this).Base().FFAdjacencyEnabled);
return Base().AF[Index()]._zp[j]; return (*this).Base().AF[(*this).Index()]._zp[j];
} }
static bool HasFFAdjacency() { return true; } static bool HasFFAdjacency() { return true; }
static bool HasFFAdjacencyOcf() { return true; } static bool HasFFAdjacencyOcf() { return true; }
@ -315,12 +318,12 @@ public:
NormalType &N() { NormalType &N() {
// you cannot use Normals before enabling them with: yourmesh.face.EnableNormal() // you cannot use Normals before enabling them with: yourmesh.face.EnableNormal()
assert(Base().NormalEnabled); assert((*this).Base().NormalEnabled);
return Base().NV[Index()]; } return (*this).Base().NV[(*this).Index()]; }
const NormalType &cN() const { const NormalType &cN() const {
// you cannot use Normals before enabling them with: yourmesh.face.EnableNormal() // you cannot use Normals before enabling them with: yourmesh.face.EnableNormal()
assert(Base().NormalEnabled); assert((*this).Base().NormalEnabled);
return Base().NV[Index()]; } return (*this).Base().NV[(*this).Index()]; }
}; };
@ -334,7 +337,7 @@ template <class T> class Normal3dOcf: public NormalOcf<vcg::Point3d, T> {};
template <class A, class T> class ColorOcf: public T { template <class A, class T> class ColorOcf: public T {
public: public:
typedef A ColorType; typedef A ColorType;
ColorType &C() { assert(Base().NormalEnabled); return Base().CV[Index()]; } ColorType &C() { assert((*this).Base().NormalEnabled); return (*this).Base().CV[(*this).Index()]; }
static bool HasFaceColor() { return true; } static bool HasFaceColor() { return true; }
static bool HasFaceColorOcf() { return true; } static bool HasFaceColorOcf() { return true; }
}; };
@ -348,8 +351,8 @@ template <class A, class TT> class WedgeTextureOcf: public TT {
public: public:
WedgeTextureOcf(){ } WedgeTextureOcf(){ }
typedef A TexCoordType; typedef A TexCoordType;
TexCoordType &WT(const int i) { assert(Base().WedgeTexEnabled); return Base().WTV[Index()].wt[i]; } TexCoordType &WT(const int i) { assert((*this).Base().WedgeTexEnabled); return (*this).Base().WTV[(*this).Index()].wt[i]; }
TexCoordType const &cWT(const int i) const { assert(Base().WedgeTexEnabled); return Base().WTV[Index()].wt[i]; } TexCoordType const &cWT(const int i) const { assert((*this).Base().WedgeTexEnabled); return (*this).Base().WTV[(*this).Index()].wt[i]; }
static bool HasWedgeTexture() { return true; } static bool HasWedgeTexture() { return true; }
static bool HasWedgeTextureOcf() { return true; } static bool HasWedgeTextureOcf() { return true; }
}; };

View File

@ -24,6 +24,9 @@
History History
$Log: not supported by cvs2svn $ $Log: not supported by cvs2svn $
Revision 1.2 2005/12/12 11:17:32 cignoni
Corrected update function, now only the needed simplexes should be updated.
Revision 1.1 2005/10/14 15:07:59 cignoni Revision 1.1 2005/10/14 15:07:59 cignoni
First Really Working version First Really Working version
@ -67,38 +70,38 @@ public:
// l'allocazione in memoria del container // l'allocazione in memoria del container
void push_back(const VALUE_TYPE & v) void push_back(const VALUE_TYPE & v)
{ {
ThisTypeIterator oldbegin=begin(); ThisTypeIterator oldbegin=(*this).begin();
ThisTypeIterator oldend=end(); ThisTypeIterator oldend=(*this).end();
BaseType::push_back(v); BaseType::push_back(v);
if(oldbegin!=begin()) _updateOVP(begin(),end()); if(oldbegin!=(*this).begin()) _updateOVP((*this).begin(),(*this).end());
else _updateOVP(oldend, end()); else _updateOVP(oldend, (*this).end());
} }
void pop_back(); void pop_back();
void resize(const unsigned int & _size) void resize(const unsigned int & _size)
{ {
ThisTypeIterator oldbegin=begin(); ThisTypeIterator oldbegin=(*this).begin();
ThisTypeIterator oldend=end(); ThisTypeIterator oldend=(*this).end();
BaseType::resize(_size); BaseType::resize(_size);
if(oldbegin!=begin()) _updateOVP(begin(),end()); if(oldbegin!=(*this).begin()) _updateOVP((*this).begin(),(*this).end());
else _updateOVP(oldend, end()); else _updateOVP(oldend, (*this).end());
if(ColorEnabled) CV.resize(_size); if(ColorEnabled) CV.resize(_size);
if(NormalEnabled) NV.resize(_size); if(NormalEnabled) NV.resize(_size);
} }
void reserve(const unsigned int & _size) void reserve(const unsigned int & _size)
{ {
ThisTypeIterator oldbegin=begin(); ThisTypeIterator oldbegin=(*this).begin();
BaseType::reserve(_size); BaseType::reserve(_size);
if (ColorEnabled) CV.reserve(_size); if (ColorEnabled) CV.reserve(_size);
if (NormalEnabled) NV.reserve(_size); if (NormalEnabled) NV.reserve(_size);
if(oldbegin!=begin()) _updateOVP(begin(),end()); if(oldbegin!=(*this).begin()) _updateOVP((*this).begin(),(*this).end());
} }
void _updateOVP(ThisTypeIterator lbegin, ThisTypeIterator lend) void _updateOVP(ThisTypeIterator lbegin, ThisTypeIterator lend)
{ {
ThisTypeIterator vi; ThisTypeIterator vi;
for(vi=lbegin;vi!=lend;++vi) for(vi=lbegin;vi!=lend;++vi)
//for(vi=begin();vi!=end();++vi) //for(vi=(*this).begin();vi!=(*this).end();++vi)
(*vi)._ovp=this; (*vi)._ovp=this;
} }
//////////////////////////////////////// ////////////////////////////////////////
@ -107,7 +110,7 @@ public:
void EnableColor() { void EnableColor() {
assert(VALUE_TYPE::HasColorOcf()); assert(VALUE_TYPE::HasColorOcf());
ColorEnabled=true; ColorEnabled=true;
CV.resize(size()); CV.resize((*this).size());
} }
void DisableColor() { void DisableColor() {
@ -119,7 +122,7 @@ void DisableColor() {
void EnableNormal() { void EnableNormal() {
assert(VALUE_TYPE::HasNormalOcf()); assert(VALUE_TYPE::HasNormalOcf());
NormalEnabled=true; NormalEnabled=true;
NV.resize(size()); NV.resize((*this).size());
} }
void DisableNormal() { void DisableNormal() {
@ -131,7 +134,7 @@ void DisableNormal() {
void EnableVFAdjacency() { void EnableVFAdjacency() {
assert(VALUE_TYPE::HasVFAdjacencyOcf()); assert(VALUE_TYPE::HasVFAdjacencyOcf());
VFAdjacencyEnabled=true; VFAdjacencyEnabled=true;
AV.resize(size()); AV.resize((*this).size());
} }
void DisableVFAdjacency() { void DisableVFAdjacency() {
@ -168,18 +171,18 @@ public:
template <class T> class VFAdjOcf: public T { template <class T> class VFAdjOcf: public T {
public: public:
typename T::FacePointer &VFp() { typename T::FacePointer &VFp() {
assert(Base().VFAdjacencyEnabled); assert((*this).Base().VFAdjacencyEnabled);
return Base().AV[Index()]._fp; return (*this).Base().AV[(*this).Index()()]._fp;
} }
typename T::FacePointer cVFp() const { typename T::FacePointer cVFp() const {
if(! Base().VFAdjacencyEnabled ) return 0; if(! (*this).Base().VFAdjacencyEnabled ) return 0;
else return Base().AV[Index()]._fp; else return (*this).Base().AV[(*this).Index()()]._fp;
} }
int &VFi() { int &VFi() {
assert(Base().VFAdjacencyEnabled); assert((*this).Base().VFAdjacencyEnabled);
return Base().AV[Index()]._zp; return (*this).Base().AV[(*this).Index()()]._zp;
} }
static bool HasVFAdjacency() { return true; } static bool HasVFAdjacency() { return true; }
static bool HasVFAdjacencyOcf() { return true; } static bool HasVFAdjacencyOcf() { return true; }
@ -197,8 +200,8 @@ public:
NormalType &N() { NormalType &N() {
// you cannot use Normals before enabling them with: yourmesh.vert.EnableNormal() // you cannot use Normals before enabling them with: yourmesh.vert.EnableNormal()
assert(Base().NormalEnabled); assert((*this).Base().NormalEnabled);
return Base().NV[Index()]; } return (*this).Base().NV[(*this).Index()()]; }
}; };
template <class T> class Normal3sOcf: public NormalOcf<vcg::Point3s, T> {}; template <class T> class Normal3sOcf: public NormalOcf<vcg::Point3s, T> {};
@ -210,7 +213,7 @@ template <class T> class Normal3dOcf: public NormalOcf<vcg::Point3d, T> {};
template <class A, class T> class ColorOcf: public T { template <class A, class T> class ColorOcf: public T {
public: public:
typedef A ColorType; typedef A ColorType;
ColorType &C() { assert(Base().NormalEnabled); return Base().CV[Index()]; } ColorType &C() { assert((*this).Base().NormalEnabled); return (*this).Base().CV[(*this).Index()()]; }
static bool HasColor() { return true; } static bool HasColor() { return true; }
static bool HasColorOcf() { return true; } static bool HasColorOcf() { return true; }
}; };