From a1a41a971862df0208906354bff4d9d54e380c6d Mon Sep 17 00:00:00 2001 From: ganovelli Date: Mon, 5 Apr 2004 18:20:08 +0000 Subject: [PATCH] Aggiunto typename --- vcg/container/traced_vector.h | 41 ++++++++++++++++++++--------------- 1 file changed, 24 insertions(+), 17 deletions(-) diff --git a/vcg/container/traced_vector.h b/vcg/container/traced_vector.h index 282f9dc4..21b7bd14 100644 --- a/vcg/container/traced_vector.h +++ b/vcg/container/traced_vector.h @@ -24,6 +24,9 @@ History $Log: not supported by cvs2svn $ +Revision 1.3 2004/03/31 22:36:44 ganovelli +First Working Release (with this comment) + /****************************************************************************/ #ifndef __VCGLIB_TRACED_VECTOR__ @@ -31,20 +34,22 @@ $Log: not supported by cvs2svn $ #include +#include + #include namespace vcg { template class TVector: public std::vector{ - typedef TVector THIS_TYPE; - typedef typename CATEntry >::EntryType EntryTypeMulti; + typedef typename TVector ThisType; + public: TVector():std::vector(){reserve(1);} ~TVector(); - std::list < CATBase* > attributes; + std::list < CATBase* > attributes; // override di tutte le funzioni che possono spostare // l'allocazione in memoria del container void push_back(const VALUE_TYPE & v); @@ -54,16 +59,16 @@ public: template void EnableAttribute(){ - CAT * cat = new CAT(); + CAT * cat = new CAT(); cat->Insert(*this); attributes.push_back(cat); } template void DisableAttribute(){ - std::list < CATBase * >::iterator ia; + std::list < CATBase * >::iterator ia; for(ia = attributes.begin(); ia != attributes.end(); ++ia) - if((*ia)->Id() == CAT::Id()) + if((*ia)->Id() == CAT::Id()) { (*ia)->Remove(*this); delete (*ia); @@ -73,22 +78,24 @@ public: } template - TempData NewTempData(){ - CATEntry::Insert(*this); - EntryTypeMulti entry = CATEntry::GetEntry(&*begin()); + TempData NewTempData(){ + typedef typename CATEntry >::EntryType EntryTypeMulti; + CATEntry::Insert(*this); + EntryTypeMulti entry = CATEntry::GetEntry(&*begin()); entry.Data().push_back(new Wrap< ATTR_TYPE>); ((Wrap*)entry.Data().back())->reserve(capacity()); ((Wrap*)entry.Data().back())->resize(size()); - return TempData((Wrap*) entry.Data().back()); + return TempData((Wrap*) entry.Data().back()); } template - void DeleteTempData(TempData & td){ - CATEntry::RemoveIfEmpty(*this); + void DeleteTempData(TempData & td){ + typedef typename CATEntry >::EntryType EntryTypeMulti; + CATEntry::RemoveIfEmpty(*this); EntryTypeMulti - entry = CATEntry >::GetEntry(&*begin()); + entry = CATEntry >::GetEntry(&*begin()); entry.Data().remove((Wrap*)td.Item()); delete ((Wrap*)td.Item()); @@ -104,7 +111,7 @@ template void TVector::push_back(const VALUE_TYPE & v){ std::vector::push_back(v); Update(); - std::list < CATBase * >::iterator ia; + std::list < CATBase * >::iterator ia; for(ia = attributes.begin(); ia != attributes.end(); ++ia) (*ia)->AddDataElem(&(*(this->begin())),1); @@ -118,7 +125,7 @@ void TVector::pop_back(){ template void TVector::resize(const unsigned int & size){ std::vector::resize(size); - std::list < CATBase * >::iterator ia; + std::list < CATBase * >::iterator ia; for(ia = attributes.begin(); ia != attributes.end(); ++ia) (*ia)-> Update(); @@ -133,7 +140,7 @@ void TVector::reserve(const unsigned int & size){ template void TVector:: Update(){ - std::list < CATBase * >::iterator ia; + std::list < CATBase * >::iterator ia; if(&(*begin()) != old_start) for(ia = attributes.begin(); ia != attributes.end(); ++ia) (*ia)->Resort(old_start,&(*begin())); @@ -145,7 +152,7 @@ template template TVector::~TVector(){ - std::list < CATBase * >::iterator ia; + std::list < CATBase * >::iterator ia; for(ia = attributes.begin(); ia != attributes.end(); ++ia) { (*ia)->Remove(*this);