Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

IDMapC< Typ > Class Template Reference

#include <idmapc.h>

Inheritance diagram for IDMapC< Typ >:

Inheritance graph
[legend]
Collaboration diagram for IDMapC< Typ >:

Collaboration graph
[legend]
List of all members.

Public Methods

 IDMapC ()
 IDMapC (const IDMapC< Typ > &a)
long size () const
long add (const Typ &t)
const Typ & get (long i) const
void set (long i, const Typ &t)
long GetID (const Typ &t) const
void Remove (long ix)
const IDMapC< Typ > & operator= (const IDMapC< Typ > &a)
void SetBlanc (const Typ &t)

Protected Attributes

ArrayC< long > m_freeIndexes
ArrayC< short > m_occupied
ArrayC< Typ > m_type
Typ m_blanc

template<class Typ>
class IDMapC< Typ >


Constructor & Destructor Documentation

template<class Typ>
IDMapC< Typ >::IDMapC   [inline]
 

Definition at line 42 of file idmapc.h.

00042           {
00043     m_occupied.SetBlankAndClear(0);
00044   }

template<class Typ>
IDMapC< Typ >::IDMapC const IDMapC< Typ > &    a [inline]
 

Definition at line 46 of file idmapc.h.

00047   {
00048     m_freeIndexes = a.m_freeIndexes;
00049     m_occupied=a.m_occupied;
00050     m_type = a.m_type;
00051   }


Member Function Documentation

template<class Typ>
long IDMapC< Typ >::add const Typ &    t [inline]
 

Definition at line 55 of file idmapc.h.

00055                         {
00056     long ix;
00057     if(m_freeIndexes.size()>0){
00058       m_freeIndexes.pop_back(ix);
00059       m_type[ix]=t;
00060       m_occupied[ix]=1;
00061     }else{
00062       ix=m_type.size();
00063       m_type.push_back(t);
00064       m_occupied.push_back(1);
00065     }
00066     return ix;
00067   }

template<class Typ>
const Typ& IDMapC< Typ >::get long    i const [inline]
 

Definition at line 69 of file idmapc.h.

Referenced by CybProtoC::GetNodeToIDProto().

00069                                      {
00070     if((i>=0)&&(i<m_occupied.size())){
00071       if(m_occupied.get(i)){return m_type.get(i);}
00072     }
00073     return m_blanc;
00074   }

template<class Typ>
long IDMapC< Typ >::GetID const Typ &    t const [inline]
 

Definition at line 93 of file idmapc.h.

00093                                        {
00094     return m_type.GetIndexOf(t);
00095   }

template<class Typ>
const IDMapC<Typ>& IDMapC< Typ >::operator= const IDMapC< Typ > &    a [inline]
 

Definition at line 104 of file idmapc.h.

00104                                                       {
00105     if (this == &a) return *this;
00106     m_occupied.push_back(1);
00107     m_occupied.push_back(1);
00108     m_occupied=a.m_occupied;
00109     m_type = a.m_type;
00110     m_freeIndexes = a.m_freeIndexes;
00111     return *this;
00112   }

template<class Typ>
void IDMapC< Typ >::Remove long    ix [inline]
 

Definition at line 97 of file idmapc.h.

00097                       {
00098     if(ix>=m_occupied.size()){return;}
00099     m_occupied[ix]=0;
00100     m_type[ix]=m_blanc;
00101     m_freeIndexes.push_back(ix);
00102   }

template<class Typ>
void IDMapC< Typ >::set long    i,
const Typ &    t
[inline]
 

Definition at line 77 of file idmapc.h.

00077                                       {
00078     if(i<m_occupied.size()){
00079       m_occupied[i]=1;
00080       m_type[i]=t;
00081       m_freeIndexes.RemoveElement(i);
00082     }else{
00083       long l = m_occupied.size();
00084       m_occupied.set(i,1);
00085       m_type.set(i,t);
00086       long j;
00087       for(j=l;j<m_occupied.size()-1;j++){
00088         m_freeIndexes.push_back(j);
00089       }
00090     }
00091   }

template<class Typ>
void IDMapC< Typ >::SetBlanc const Typ &    t [inline]
 

Definition at line 115 of file idmapc.h.

00115                              {
00116     m_type.SetBlankAndClear(m_blanc);
00117     m_blanc = t;
00118   }

template<class Typ>
long IDMapC< Typ >::size   const [inline]
 

Definition at line 53 of file idmapc.h.

00053 {return m_type.size();}


Member Data Documentation

template<class Typ>
Typ IDMapC< Typ >::m_blanc [protected]
 

Definition at line 124 of file idmapc.h.

Referenced by IDMapC< CybNodeC * >::get(), IDMapC< CybNodeC * >::Remove(), and IDMapC< CybNodeC * >::SetBlanc().

template<class Typ>
ArrayC<long> IDMapC< Typ >::m_freeIndexes [protected]
 

Definition at line 121 of file idmapc.h.

Referenced by IDMapC< CybNodeC * >::add(), IDMapC< CybNodeC * >::IDMapC(), IDMapC< CybNodeC * >::operator=(), IDMapC< CybNodeC * >::Remove(), and IDMapC< CybNodeC * >::set().

template<class Typ>
ArrayC<short> IDMapC< Typ >::m_occupied [protected]
 

Definition at line 122 of file idmapc.h.

Referenced by IDMapC< CybNodeC * >::add(), IDMapC< CybNodeC * >::get(), IDMapC< CybNodeC * >::IDMapC(), IDMapC< CybNodeC * >::operator=(), IDMapC< CybNodeC * >::Remove(), and IDMapC< CybNodeC * >::set().

template<class Typ>
ArrayC<Typ> IDMapC< Typ >::m_type [protected]
 

Definition at line 123 of file idmapc.h.

Referenced by IDMapC< CybNodeC * >::add(), IDMapC< CybNodeC * >::get(), IDMapC< CybNodeC * >::GetID(), IDMapC< CybNodeC * >::IDMapC(), IDMapC< CybNodeC * >::operator=(), IDMapC< CybNodeC * >::Remove(), IDMapC< CybNodeC * >::set(), IDMapC< CybNodeC * >::SetBlanc(), and IDMapC< CybNodeC * >::size().


The documentation for this class was generated from the following file:
Generated on Tue Jul 29 14:30:46 2003 for Open ActiveWrl by doxygen1.3-rc2