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

d_Varray.h

Go to the documentation of this file.
00001 
00002 #ifndef d_Varray_h
00003 #define d_Varray_h 1
00004 
00005 //------------------------------------------------------------------------------
00006 #include "d_Collection.h"
00007 
00008 /**
00009  * It's a container class (see Containers), it's ordered by index and allows
00010  * duplicates.
00011  *
00012  * This class is like the vector of the C++ Library, but is persistent.
00013  *
00014  * LOCATION:
00015  * d_Varray.h
00016  *
00017  * USAGE:
00018  * d_Varray< <type-name> >              <property-name>;
00019  * 
00020  * Where:
00021  * 
00022  * <type-name>:         Type to contain. Can be a literal or a user type
00023  * <PROPERTY-NAME>:     NAME OF PROPERTY
00024  *
00025  * EXAMPLES:
00026  * class Invoice : public d_Object
00027  * {
00028  *    * Relationship 1-n to product objects
00029  *   d_Varray< d_Ref<Product> > products;       
00030  * };
00031  * 
00032  * d_Ref<Invoice>                       myInvoice;               * Ref to Invoice object
00033  *
00034  * SEE ALSO:
00035  * d_Bag, d_Collection, d_Dictionary, d_Iterator, d_List, d_Set
00036  *
00037  * ODMG:
00038  * Compliant
00039  */
00040 
00041 template <class T>
00042 class _ODLL d_Varray : public d_Collection<T>
00043 {
00044   public:
00045     /**
00046      * Default constructor.
00047      *
00048      * ODMG    :  Compliant 
00049      */
00050     d_Varray();
00051 
00052     /**
00053      * Returns the value at any position.
00054      *
00055      * Returns the value at position <iPosition>. If <iPosition> is out of the
00056      * range, an exception d_Error_PositionOutOfRange is raised.
00057      *
00058      * This method permits to handle a d_Varray object as a common C++ array.
00059      *
00060      * SEE ALSO:  retrieve_element_at()
00061      * ODMG    :  Compliant 
00062      */
00063     T operator [] (const oUInt4 iIndex);
00064 
00065     /**
00066      * Returns always true.
00067      *
00068      * ODMG    :  Compliant 
00069      */
00070     virtual d_Boolean allows_duplicates () const;
00071 
00072     /**
00073      * Returns always true.
00074      *
00075      * ODMG    :  Compliant 
00076      */
00077     virtual d_Boolean is_ordered () const;
00078 
00079     /**
00080      * Search the value in the container. 
00081      *
00082      * Search the value <iValue> in the array. If the element is found its
00083      * position is returned in <oPosition> and the method returns true;
00084      * otherwise it returns false.
00085      *
00086      * ODMG    :  Compliant 
00087      */
00088     d_Boolean find_element (const T& iValue, d_ULong& ioPosition);
00089 
00090     /**
00091      * Returns the value at any position.
00092      *
00093      * Returns the value at position <iPosition>. If <iPosition> is out of the
00094      * range, an exception d_Error_PositionOutOfRange is raised.
00095      *
00096      * SEE ALSO:  operator[]()
00097      * ODMG    :  Compliant 
00098      */
00099     T retrieve_element_at (const d_ULong iIndex);
00100 
00101     /**
00102      * Remove an element.
00103      *
00104      * Remove the element at position <iPosition>. If <iPosition> is out of the
00105      * range, an exception d_Error_PositionOutOfRange is raised.
00106      *
00107      * SEE ALSO:  remove_all(), d_Iterator::remove_element ()
00108      * ODMG    :  Compliant 
00109      */
00110     void remove_element_at (const d_ULong iPosition);
00111 
00112     /**
00113      * Replace an element.
00114      *
00115      * Replace the element at position <iPosition> with <iValue>. If
00116      * <iPosition> is out of the range, an exception d_Error_PositionOutOfRange
00117      * is raised.
00118      *
00119      * SEE ALSO:  d_Iterator::replace_element ()
00120      * ODMG    :  Compliant 
00121      */
00122     void replace_element_at (const T& iValue, const d_ULong iPosition);
00123 
00124     // INTERNAL CONSTRUCTOR
00125     d_Varray( d_Object::DynaFactoryConstructor* iObj ){;}
00126 
00127   private:
00128     // Internal.
00129     oCollBlock<T>* getBlockOfElement (const d_ULong iIndex, d_ULong& oPosInBlock);
00130 };
00131 
00132 //------------------------------------------------------------------------------
00133 #include "d_Varray.cti"
00134 
00135 //------------------------------------------------------------------------------
00136 //------------------------------------------------------------------------------
00137 
00138 #endif

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