diff --git a/vcg/container/container_allocation_table.h b/vcg/container/container_allocation_table.h index 2e6926f5..c0c190c2 100644 --- a/vcg/container/container_allocation_table.h +++ b/vcg/container/container_allocation_table.h @@ -20,34 +20,7 @@ * for more details. * * * ****************************************************************************/ -/**************************************************************************** - History -$Log: not supported by cvs2svn $ -Revision 1.9 2006/12/03 18:01:01 ganovelli -versione compliant vs2005 - -Revision 1.8 2006/06/08 20:28:57 ganovelli -aggiunto qualche const sui parametri - -Revision 1.7 2005/10/15 16:21:48 ganovelli -Working release (compilata solo su MSVC), vector_occ � migrato da component_opt - -Revision 1.6 2005/07/07 13:33:51 ganovelli -some comment - -Revision 1.5 2005/07/06 15:28:10 ganovelli -aggiornamento di alcuni path - -Revision 1.4 2004/04/05 18:20:50 ganovelli -Aggiunto typename -Eliminata bug di ricorsione nell'istanzazione dei template - -Revision 1.3 2004/03/31 22:36:44 ganovelli -First Working Release (with this comment) - - -****************************************************************************/ #ifndef __VCGLIB_CAT__ #define __VCGLIB_CAT__ @@ -347,25 +320,6 @@ New(){ } -//--------------------------------------------------------------------------------------------- -//---------------------------------------------------------------------------------- -// TempData implements a handle to one of the vector od data stored in EntryCATMulti -template -class TempData{ -public: - TempData(std::vector *d):item(d){}; - typedef ATTR_TYPE attr_type; - - std::vector * Item(){return item;}; - std::vector * item; - ATTR_TYPE & operator []( typename STL_CONT::value_type * v) - { - int pos = CATEntry >::Ord(v); - return (*item)[pos]; - } - }; -//---------------------------------------------------------------------------------- - };//end namespace vcg #endif diff --git a/vcg/container/entries_allocation_table.h b/vcg/container/entries_allocation_table.h index ce591969..306cc6cd 100644 --- a/vcg/container/entries_allocation_table.h +++ b/vcg/container/entries_allocation_table.h @@ -21,27 +21,6 @@ * * ****************************************************************************/ -/**************************************************************************** - History - -$Log: not supported by cvs2svn $ -Revision 1.7 2007/01/18 01:31:12 cignoni -Many small syntax changes for mac compiling - -Revision 1.6 2006/12/03 18:01:01 ganovelli -versione compliant vs2005 - -Revision 1.5 2005/07/06 15:28:11 ganovelli -aggiornamento di alcuni path - -Revision 1.4 2004/04/05 13:53:37 ganovelli -Aggiunto typename - -Revision 1.3 2004/03/31 22:36:44 ganovelli -First Working Release (with this comment) - - -****************************************************************************/ #ifndef __VCGLIB_ENTRIES__ #define __VCGLIB_ENTRIES__ @@ -101,56 +80,6 @@ template -// ----------------------------------------------------------------------------------------- -// WrapBase: used to implement a list of pointers to std::vector of different types -// Wrap: derived from WrapBase (to take the function and from std::vector) -struct WrapBase{ -virtual void Push_back(const int & n)=0; -virtual void Reserve(const int & n)=0; -virtual void Resize(const int & n)=0; - }; -// (note) double hineritance is not necessary, just handy -template -struct Wrap: public WrapBase,std::vector{ - virtual void Push_back(const int & n){for (int i = 0 ; i < n; ++i) push_back( ATTR_TYPE());} - virtual void Reserve(const int & n){this->reserve(n);} - virtual void Resize(const int & n){this->resize(n);} - }; -//------------------------------------------------------------------------------------------- - -// ----------------------------------------------------------------------------------------- -// EntryCATMulti: entry type for multiple user data -template -class EntryCATMulti: public EntryCATBase{ -public: -EntryCATMulti(STL_CONT & _c) : EntryCATBase(_c){}; -std::list & Data(){return data;} -void push_back(const int & n ){ - std::list::iterator ite; - for(ite = data.begin(); ite != data.end(); ++ite) - (*ite)->Push_back(n); - } -virtual bool Empty(){return data.empty();}; - -virtual void Reserve(const int & n){ - std::list::iterator ite; - for(ite = data.begin(); ite != data.end(); ++ite) - (*ite)->Reserve(n); - }; -virtual void Resize(const int & n){ - std::list::iterator ite; - for(ite = data.begin(); ite != data.end(); ++ite) - (*ite)->Resize(n); - }; - -private: - std::list< WrapBase * > data; -}; -//---------------------------------------------------------------------------------- - - - - }; // end namespace vcg #endif diff --git a/vcg/container/vector_occ.h b/vcg/container/vector_occ.h index 43454a72..a6a45b25 100644 --- a/vcg/container/vector_occ.h +++ b/vcg/container/vector_occ.h @@ -62,7 +62,7 @@ public: /// this function enable the use of an optional attribute (see...) template - void EnableAttribute(){ + void Enable(){ CAT * cat = CAT::New(); cat->Insert(*this); attributes.push_back(cat); @@ -71,7 +71,7 @@ public: /// this function returns true if the attribute in the template parameter is enabled /// Note: once an attribute is disabled, its data is lost (the memory freed) template - bool IsEnabledAttribute() const{ + bool IsEnabled() const{ typename std::list < CATBase * >::const_iterator ia; for(ia = attributes.begin(); ia != attributes.end(); ++ia) if((*ia)->Id() == CAT::Id()) @@ -83,7 +83,7 @@ public: /// this function disable the use of an optional attribute (see...) /// Note: once an attribute is disabled, its data is lost (the memory freed) template - void DisableAttribute(){ + void Disable(){ typename std::list < CATBase * >::iterator ia; for(ia = attributes.begin(); ia != attributes.end(); ++ia) if((*ia)->Id() == CAT::Id()) @@ -95,39 +95,6 @@ public: } } - /// this function create a new attribute of type ATTR_TYPE and return an handle to - /// access the value of the attribute. Ex: - /// vector_occ tv; - /// TempData handle = tv.NewTempData(); - /// // now handle[&tv[123]] is the value of integer attribute associate with the position 123 on the vector - /// // NOTE: it works also if you do some push_back, resize, pop_back, reserve that cause the relocation - /// // of the vector_occ - template - TempData NewTempData(){ - typedef typename CATEntry >::EntryType EntryTypeMulti; - CATEntry::Insert(*this); - EntryTypeMulti entry = CATEntry::GetEntry(Pointer2begin()); - entry.Data().push_back(new Wrap< ATTR_TYPE>); - - ((Wrap*)entry.Data().back())->reserve(TT::capacity()); - ((Wrap*)entry.Data().back())->resize(TT::size()); - - return TempData((Wrap*) entry.Data().back()); - } - - /// reciprocal of NewTempData - template - void DeleteTempData(TempData & td){ - typedef typename CATEntry >::EntryType EntryTypeMulti; - CATEntry::RemoveIfEmpty(*this); - EntryTypeMulti - entry = CATEntry >::GetEntry(Pointer2begin); - - entry.Data().remove((Wrap*)td.Item()); - delete ((Wrap*)td.Item()); - } - - private: VALUE_TYPE * old_start; int id;