versione compliant vs2005

This commit is contained in:
ganovelli 2006-12-03 18:01:01 +00:00
parent b2bfe8dc1b
commit 5765847abe
3 changed files with 23 additions and 13 deletions

View File

@ -24,6 +24,9 @@
History History
$Log: not supported by cvs2svn $ $Log: not supported by cvs2svn $
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 Revision 1.7 2005/10/15 16:21:48 ganovelli
Working release (compilata solo su MSVC), vector_occ è migrato da component_opt Working release (compilata solo su MSVC), vector_occ è migrato da component_opt
@ -82,7 +85,7 @@ static int & Id(){
}; };
/// CATEntry: first derivation templated on the type of entry /// CATEntry: first derivation templated on the type of entry
/// It implements all the methods to trace and access TVector element /// It implements all the methods to trace and access vector_occ's elements
template <typename STL_CONT, class ENTRY_TYPE> template <typename STL_CONT, class ENTRY_TYPE>
class CATEntry: public CATBase<STL_CONT>{ class CATEntry: public CATBase<STL_CONT>{
public: public:
@ -165,9 +168,6 @@ typename std::list<ENTRY_TYPE>::iterator CATEntry<STL_CONT,ENTRY_TYPE>::
FindBase(const ValueType * pt) FindBase(const ValueType * pt)
{ {
//DEBUG
int sz = AT().size();
//
std::list<ENTRY_TYPE>::iterator ite,curr_base,_; std::list<ENTRY_TYPE>::iterator ite,curr_base,_;
ite = AT().begin(); ite = AT().begin();
curr_base = AT().end(); curr_base = AT().end();
@ -270,7 +270,7 @@ Insert( STL_CONT & c,bool cond )
{ {
ENTRY_TYPE entry(c); ENTRY_TYPE entry(c);
std::list<ENTRY_TYPE>::iterator lower_ite,upper_ite; std::list<ENTRY_TYPE>::iterator lower_ite,upper_ite;
upper_ite = FindBase(&*c.begin()); upper_ite = FindBase( c.Pointer2begin());
bool isIn = (upper_ite != AT().end()); bool isIn = (upper_ite != AT().end());
if(isIn){ if(isIn){
if((*upper_ite).C() != &c ) if((*upper_ite).C() != &c )

View File

@ -25,6 +25,9 @@
History History
$Log: not supported by cvs2svn $ $Log: not supported by cvs2svn $
Revision 1.5 2005/07/06 15:28:11 ganovelli
aggiornamento di alcuni path
Revision 1.4 2004/04/05 13:53:37 ganovelli Revision 1.4 2004/04/05 13:53:37 ganovelli
Aggiunto typename Aggiunto typename
@ -81,7 +84,7 @@ const bool EntryCATBase<STL_CONT>:: operator < (const EntryCATBase<STL_CONT> & o
template <class STL_CONT> template <class STL_CONT>
typename typename STL_CONT::value_type * EntryCATBase<STL_CONT>::Start()const { typename typename STL_CONT::value_type * EntryCATBase<STL_CONT>::Start()const {
return &(*(c.begin())); return c.Pointer2begin();
} }
template <class STL_CONT> template <class STL_CONT>

View File

@ -24,6 +24,9 @@
History History
$Log: not supported by cvs2svn $ $Log: not supported by cvs2svn $
Revision 1.2 2006/06/08 20:28:38 ganovelli
Corretto IsEnabledAttribute
Revision 1.1 2005/10/15 16:21:49 ganovelli Revision 1.1 2005/10/15 16:21:49 ganovelli
Working release (compilata solo su MSVC), vector_occ è migrato da component_opt Working release (compilata solo su MSVC), vector_occ è migrato da component_opt
@ -62,10 +65,12 @@ class vector_occ: public std::vector<VALUE_TYPE>{
typedef typename vector_occ<VALUE_TYPE> ThisType; typedef typename vector_occ<VALUE_TYPE> ThisType;
public: public:
vector_occ():std::vector<VALUE_TYPE>(){reserve(1);} vector_occ():std::vector<VALUE_TYPE>(){id = ID(); ID()=ID()+1; reserve(1);}
~vector_occ(); ~vector_occ();
VALUE_TYPE * Pointer2begin(){
if(empty()) return (VALUE_TYPE *)id; else return &*std::vector<VALUE_TYPE>::begin();
}
std::list < CATBase<ThisType>* > attributes; std::list < CATBase<ThisType>* > attributes;
// override di tutte le funzioni che possono spostare // override di tutte le funzioni che possono spostare
// l'allocazione in memoria del container // l'allocazione in memoria del container
@ -120,7 +125,7 @@ public:
TempData<ThisType,ATTR_TYPE> NewTempData(){ TempData<ThisType,ATTR_TYPE> NewTempData(){
typedef typename CATEntry<ThisType,EntryCATMulti<ThisType> >::EntryType EntryTypeMulti; typedef typename CATEntry<ThisType,EntryCATMulti<ThisType> >::EntryType EntryTypeMulti;
CATEntry<ThisType,EntryTypeMulti>::Insert(*this); CATEntry<ThisType,EntryTypeMulti>::Insert(*this);
EntryTypeMulti entry = CATEntry<ThisType,EntryTypeMulti >::GetEntry(&*begin()); EntryTypeMulti entry = CATEntry<ThisType,EntryTypeMulti >::GetEntry(Pointer2begin());
entry.Data().push_back(new Wrap< ATTR_TYPE>); entry.Data().push_back(new Wrap< ATTR_TYPE>);
((Wrap<ATTR_TYPE>*)entry.Data().back())->reserve(capacity()); ((Wrap<ATTR_TYPE>*)entry.Data().back())->reserve(capacity());
@ -135,7 +140,7 @@ public:
typedef typename CATEntry<ThisType,EntryCATMulti<ThisType> >::EntryType EntryTypeMulti; typedef typename CATEntry<ThisType,EntryCATMulti<ThisType> >::EntryType EntryTypeMulti;
CATEntry<ThisType,EntryTypeMulti >::RemoveIfEmpty(*this); CATEntry<ThisType,EntryTypeMulti >::RemoveIfEmpty(*this);
EntryTypeMulti EntryTypeMulti
entry = CATEntry<ThisType,EntryCATMulti<ThisType> >::GetEntry(&*begin()); entry = CATEntry<ThisType,EntryCATMulti<ThisType> >::GetEntry(Pointer2begin);
entry.Data().remove((Wrap<ATTR_TYPE>*)td.Item()); entry.Data().remove((Wrap<ATTR_TYPE>*)td.Item());
delete ((Wrap<ATTR_TYPE>*)td.Item()); delete ((Wrap<ATTR_TYPE>*)td.Item());
@ -144,6 +149,8 @@ public:
private: private:
VALUE_TYPE * old_start; VALUE_TYPE * old_start;
int id;
static int & ID(){static int id; return id;}
void Update(); void Update();
}; };
@ -184,11 +191,11 @@ template <class VALUE_TYPE>
void vector_occ<VALUE_TYPE>:: void vector_occ<VALUE_TYPE>::
Update(){ Update(){
std::list < CATBase<ThisType> * >::iterator ia; std::list < CATBase<ThisType> * >::iterator ia;
if(&(*begin()) != old_start) if(Pointer2begin() != old_start)
for(ia = attributes.begin(); ia != attributes.end(); ++ia) for(ia = attributes.begin(); ia != attributes.end(); ++ia)
(*ia)->Resort(old_start,&(*begin())); (*ia)->Resort(old_start,Pointer2begin());
old_start = &(*begin()); old_start = Pointer2begin();
} }