00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef __VCGLIB_ENTRIES__
00025 #define __VCGLIB_ENTRIES__
00026
00027
00028 namespace vcg {
00029
00030
00031
00032 template <class STL_CONT>
00033 class EntryCATBase{
00034 public:
00035 EntryCATBase(STL_CONT & _c):c(_c){};
00036 typename STL_CONT::value_type * Start() const;
00037 virtual bool Empty(){return true;};
00038 const STL_CONT * C();
00039 virtual void Push_back(const int &){};
00040
00041 virtual void Reserve(const int & s){};
00042 virtual void Resize(const int & s){};
00043
00044 const bool operator < (const EntryCATBase<STL_CONT> & other) const;
00045
00046 private:
00047 STL_CONT & c;
00048 };
00049
00050
00051 template <class STL_CONT,class ATTR_TYPE >
00052 struct EntryCAT: public EntryCATBase<STL_CONT>{
00053 typedef ATTR_TYPE attr_type;
00054 EntryCAT(STL_CONT & _c) : EntryCATBase<STL_CONT>(_c){};
00055 std::vector<ATTR_TYPE> & Data(){return data;}
00056 void Push_back(const int & n){ for(int i = 0; i < n ; ++i) data.push_back(ATTR_TYPE());}
00057 virtual void Reserve(const int & s){data.reserve(s);};
00058 virtual void Resize(const int & s){data.resize(s);};
00059
00060
00061 private:
00062 std::vector<ATTR_TYPE> data;
00063 };
00064
00065
00066 template <class STL_CONT>
00067 const bool EntryCATBase<STL_CONT>:: operator < (const EntryCATBase<STL_CONT> & other) const{
00068 return (Start() < other.Start());
00069 }
00070
00071 template <class STL_CONT>
00072 typename STL_CONT::value_type * EntryCATBase<STL_CONT>::Start()const {
00073 return c.Pointer2begin();
00074 }
00075
00076 template <class STL_CONT>
00077 const STL_CONT * EntryCATBase<STL_CONT>::C(){
00078 return &c;
00079 }
00080
00081
00082
00083 };
00084
00085 #endif