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

d_Collection.h

Go to the documentation of this file.
00001 
00002 #ifndef d_Collection_h
00003 #define d_Collection_h 1
00004 //------------------------------------------------------------------------------
00005 
00006 #include "oDynaObject.h"
00007 #include "d_Ref.h"
00008 #include "d_Object.h"
00009 
00010 //------------------------------------------------------------------------------
00011 template <class T> class _ODLL oCollBlock;
00012 template< class T > class _ODLL d_Iterator;
00013 class _ODLL d_Database;
00014 //------------------------------------------------------------------------------
00015 
00016 /**
00017  * This is the base-abstract class for all collection classes.
00018  *
00019  * Thus you can't use this class directly, but use real container classes.
00020  *
00021  * SEE ALSO:
00022  * d_Bag, d_Dictionary, d_Iterator, d_List, d_Set, d_Varray
00023  *
00024  * ODMG:
00025  * Compliant
00026  */
00027 
00028 template <class T>
00029 class _ODLL d_Collection : public d_Object
00030 {
00031   public:
00032     /**
00033      * Default constructor.
00034      *
00035      * <iBlockSize> is the optional preallocated size (default is
00036      * 64 elements).
00037      *
00038      * ODMG    :  Compliant
00039      */
00040     d_Collection (oUInt2 iBlockSize = dBlockSize);
00041 
00042     /**
00043      * Destructor.
00044      *
00045      * ODMG    :  Compliant
00046      */
00047     virtual ~d_Collection();
00048 
00049     virtual void d_deactivate();
00050 
00051     /**
00052      * Insert an element.
00053      *
00054      * ODMG    :  Compliant
00055      */
00056     void insert_element (const T& iElem);
00057 
00058     /**
00059      * Returns an iterator that points to the first element.
00060      *
00061      * SEE ALSO:  begin()
00062      * ODMG    :  Compliant
00063      */
00064     d_Iterator<T> create_iterator () const;
00065 
00066     /**
00067      * Returns an iterator that points to the first element.
00068      *
00069      * Permits to handle the container by STL classes.
00070      *
00071      * SEE ALSO:  create_iterator()
00072      * ODMG    :  Compliant
00073      */
00074     d_Iterator<T> begin () const;
00075 
00076     /**
00077      * Returns an iterator that points to the last element.
00078      *
00079      * Permits to handle the container by STL classes.
00080      *
00081      * SEE ALSO:  begin()
00082      * ODMG    :  Compliant
00083      */
00084     d_Iterator<T> end () const;
00085 
00086     /**
00087      * Remove all the elements in the collection.
00088      *
00089      * ODMG    :  Compliant
00090      */
00091     void remove_all ();
00092 
00093     /**
00094      * Returns the number of elements in the collection.
00095      *
00096      * ODMG    :  Compliant
00097      */
00098     d_ULong cardinality () const;
00099 
00100     virtual d_Boolean allows_duplicates () const = 0;
00101     virtual d_Boolean is_ordered () const = 0;
00102 
00103     /**
00104      * Returns true if the collection doesn't contain elements, otherwise
00105      * true.
00106      *
00107      * ODMG    :  Compliant 
00108      */
00109     d_Boolean is_empty () const;
00110 
00111     // Internal.
00112     oUInt2 blockSize;
00113     // Internal.
00114     d_Ref<oCollBlock<T> > head;
00115     // Internal.
00116     d_Ref<oCollBlock<T> > tail;
00117 
00118   protected:
00119     // Internal.
00120     oUInt2 blocks;
00121     // Internal.
00122     oUInt4 total;
00123     // Internal.
00124     oDynaObject* dynaObject;
00125 
00126   private:
00127     // Internal.
00128     static oUInt2 dBlockSize;
00129 };
00130 
00131 //------------------------------------------------------------------------------
00132 template <class T>
00133 inline d_ULong d_Collection<T>::cardinality () const
00134 {
00135   return total;
00136 }
00137 
00138 //------------------------------------------------------------------------------
00139 #include "d_Collection.cti"
00140 
00141 //------------------------------------------------------------------------------
00142 //------------------------------------------------------------------------------
00143 
00144 #endif

Generated on Fri Nov 29 17:12:13 2002 for Orient ODBMS Just Edition v. 2.0e by doxygen1.3-rc1