removed unused classes for allocation of temporary data
This commit is contained in:
parent
8ca2013615
commit
9026213628
|
@ -20,34 +20,7 @@
|
||||||
* for more details. *
|
* 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 <EFBFBD> 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__
|
#ifndef __VCGLIB_CAT__
|
||||||
#define __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 STL_CONT, class ATTR_TYPE>
|
|
||||||
class TempData{
|
|
||||||
public:
|
|
||||||
TempData(std::vector<ATTR_TYPE> *d):item(d){};
|
|
||||||
typedef ATTR_TYPE attr_type;
|
|
||||||
|
|
||||||
std::vector<ATTR_TYPE> * Item(){return item;};
|
|
||||||
std::vector<ATTR_TYPE> * item;
|
|
||||||
ATTR_TYPE & operator []( typename STL_CONT::value_type * v)
|
|
||||||
{
|
|
||||||
int pos = CATEntry<STL_CONT, EntryCATMulti<STL_CONT> >::Ord(v);
|
|
||||||
return (*item)[pos];
|
|
||||||
}
|
|
||||||
};
|
|
||||||
//----------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
};//end namespace vcg
|
};//end namespace vcg
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -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__
|
#ifndef __VCGLIB_ENTRIES__
|
||||||
#define __VCGLIB_ENTRIES__
|
#define __VCGLIB_ENTRIES__
|
||||||
|
|
||||||
|
@ -101,56 +80,6 @@ template <class STL_CONT>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------------------
|
|
||||||
// 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 <class ATTR_TYPE>
|
|
||||||
struct Wrap: public WrapBase,std::vector<ATTR_TYPE>{
|
|
||||||
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 STL_CONT>
|
|
||||||
class EntryCATMulti: public EntryCATBase<STL_CONT>{
|
|
||||||
public:
|
|
||||||
EntryCATMulti(STL_CONT & _c) : EntryCATBase<STL_CONT>(_c){};
|
|
||||||
std::list<WrapBase * > & Data(){return data;}
|
|
||||||
void push_back(const int & n ){
|
|
||||||
std::list<WrapBase * >::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<WrapBase * >::iterator ite;
|
|
||||||
for(ite = data.begin(); ite != data.end(); ++ite)
|
|
||||||
(*ite)->Reserve(n);
|
|
||||||
};
|
|
||||||
virtual void Resize(const int & n){
|
|
||||||
std::list<WrapBase * >::iterator ite;
|
|
||||||
for(ite = data.begin(); ite != data.end(); ++ite)
|
|
||||||
(*ite)->Resize(n);
|
|
||||||
};
|
|
||||||
|
|
||||||
private:
|
|
||||||
std::list< WrapBase * > data;
|
|
||||||
};
|
|
||||||
//----------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}; // end namespace vcg
|
}; // end namespace vcg
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -62,7 +62,7 @@ public:
|
||||||
|
|
||||||
/// this function enable the use of an optional attribute (see...)
|
/// this function enable the use of an optional attribute (see...)
|
||||||
template <class ATTR_TYPE>
|
template <class ATTR_TYPE>
|
||||||
void EnableAttribute(){
|
void Enable(){
|
||||||
CAT<ThisType,ATTR_TYPE> * cat = CAT<ThisType,ATTR_TYPE>::New();
|
CAT<ThisType,ATTR_TYPE> * cat = CAT<ThisType,ATTR_TYPE>::New();
|
||||||
cat->Insert(*this);
|
cat->Insert(*this);
|
||||||
attributes.push_back(cat);
|
attributes.push_back(cat);
|
||||||
|
@ -71,7 +71,7 @@ public:
|
||||||
/// this function returns true if the attribute in the template parameter is enabled
|
/// 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)
|
/// Note: once an attribute is disabled, its data is lost (the memory freed)
|
||||||
template <class ATTR_TYPE>
|
template <class ATTR_TYPE>
|
||||||
bool IsEnabledAttribute() const{
|
bool IsEnabled() const{
|
||||||
typename std::list < CATBase<ThisType> * >::const_iterator ia;
|
typename std::list < CATBase<ThisType> * >::const_iterator ia;
|
||||||
for(ia = attributes.begin(); ia != attributes.end(); ++ia)
|
for(ia = attributes.begin(); ia != attributes.end(); ++ia)
|
||||||
if((*ia)->Id() == CAT<ThisType,ATTR_TYPE>::Id())
|
if((*ia)->Id() == CAT<ThisType,ATTR_TYPE>::Id())
|
||||||
|
@ -83,7 +83,7 @@ public:
|
||||||
/// this function disable the use of an optional attribute (see...)
|
/// this function disable the use of an optional attribute (see...)
|
||||||
/// Note: once an attribute is disabled, its data is lost (the memory freed)
|
/// Note: once an attribute is disabled, its data is lost (the memory freed)
|
||||||
template <class ATTR_TYPE>
|
template <class ATTR_TYPE>
|
||||||
void DisableAttribute(){
|
void Disable(){
|
||||||
typename std::list < CATBase<ThisType> * >::iterator ia;
|
typename std::list < CATBase<ThisType> * >::iterator ia;
|
||||||
for(ia = attributes.begin(); ia != attributes.end(); ++ia)
|
for(ia = attributes.begin(); ia != attributes.end(); ++ia)
|
||||||
if((*ia)->Id() == CAT<ThisType,ATTR_TYPE>::Id())
|
if((*ia)->Id() == CAT<ThisType,ATTR_TYPE>::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<float> tv;
|
|
||||||
/// TempData<TVect,int> handle = tv.NewTempData<int>();
|
|
||||||
/// // 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 <class ATTR_TYPE>
|
|
||||||
TempData<ThisType,ATTR_TYPE> NewTempData(){
|
|
||||||
typedef typename CATEntry<ThisType,EntryCATMulti<ThisType> >::EntryType EntryTypeMulti;
|
|
||||||
CATEntry<ThisType,EntryTypeMulti>::Insert(*this);
|
|
||||||
EntryTypeMulti entry = CATEntry<ThisType,EntryTypeMulti >::GetEntry(Pointer2begin());
|
|
||||||
entry.Data().push_back(new Wrap< ATTR_TYPE>);
|
|
||||||
|
|
||||||
((Wrap<ATTR_TYPE>*)entry.Data().back())->reserve(TT::capacity());
|
|
||||||
((Wrap<ATTR_TYPE>*)entry.Data().back())->resize(TT::size());
|
|
||||||
|
|
||||||
return TempData<ThisType,ATTR_TYPE>((Wrap<ATTR_TYPE>*) entry.Data().back());
|
|
||||||
}
|
|
||||||
|
|
||||||
/// reciprocal of NewTempData
|
|
||||||
template <class ATTR_TYPE>
|
|
||||||
void DeleteTempData(TempData<ThisType,ATTR_TYPE> & td){
|
|
||||||
typedef typename CATEntry<ThisType,EntryCATMulti<ThisType> >::EntryType EntryTypeMulti;
|
|
||||||
CATEntry<ThisType,EntryTypeMulti >::RemoveIfEmpty(*this);
|
|
||||||
EntryTypeMulti
|
|
||||||
entry = CATEntry<ThisType,EntryCATMulti<ThisType> >::GetEntry(Pointer2begin);
|
|
||||||
|
|
||||||
entry.Data().remove((Wrap<ATTR_TYPE>*)td.Item());
|
|
||||||
delete ((Wrap<ATTR_TYPE>*)td.Item());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
VALUE_TYPE * old_start;
|
VALUE_TYPE * old_start;
|
||||||
int id;
|
int id;
|
||||||
|
|
Loading…
Reference in New Issue