Changes between Initial Version and Version 1 of FDORfc9


Ignore:
Timestamp:
08/10/07 11:26:54 (17 years ago)
Author:
jacklee
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • FDORfc9

    v1 v1  
     1= FDO RFC 9 - Add new class !FdoLiteralValueCollection  and new method to !FdoLiteralValue =
     2
     3This page contains a request for comments document (RFC) for the FDO Open Source project. 
     4More FDO RFCs can be found on the [wiki:FDORfcs RFCs] page.
     5
     6== Status ==
     7 
     8||RFC Template Version||(1.0)||
     9||Submission Date||Aug 10, 2007||
     10||Last Modified|| Jack Lee [[Timestamp]]||
     11||Author|| Jack Lee||
     12||RFC Status|| Draft ||
     13||Implementation Status|| Under Development||
     14||Proposed Milestone|| 3.3.0.0 ||
     15||Assigned PSC guide(s)|| Greg Boone||
     16||'''Voting History'''||TBD||
     17||+1|| ||
     18||+0|| ||
     19||-0|| ||
     20||-1|| ||
     21 
     22== Overview ==
     23
     24The purpose of this RFC is
     25
     26* add the !GetLiteralValueType method to !FdoLiteralvalue class
     27
     28* add the !FdoLiteralValueCollection class
     29
     30
     31== Motivation ==
     32
     331) Currently, a !FdoDataValue or !FdoGeometryValue can be derived from !FdoLiteralValue.
     34
     35The only way to determine the type of object is to use a dynamic cast:
     36
     37{{{
     38if (dynamic_cast<FdoDataValue*>(literalValue) != NULL)
     39{
     40    // DataValue
     41    ...
     42}
     43else if (dynamic_cast<FdoGeometryValue*>(literalValue) != NULL)
     44{
     45    // GeometryValue
     46    ...
     47}
     48}}}
     49
     502) The !FdoLiteralValue class exists but the collection of !FdoLiteralValue objects does not exist.
     51
     52
     53== Proposed Solution ==
     54
     551) Add !GetLiteralValueType method to !FdoLiteralValue class
     56
     57This methods returns the literal type(data or geometry).
     58
     59For the unmanaged code:
     60
     61{{{
     62enum FdoLiteralValueType
     63{
     64    FdoLiteralValueType_Data,
     65
     66    FdoLiteralValueType_Geometry,
     67
     68};
     69
     70class FdoLiteralValue : public FdoValueExpression
     71{
     72public:
     73      FDO_API virtual FdoLiteralValueType GetLiteralValueType() = 0;
     74};
     75
     76}}}
     77
     78The following
     79
     80{{{
     81if (dynamic_cast<FdoDataValue*>(literalValue) != NULL)
     82{
     83    // DataValue
     84    ...
     85}
     86else if (dynamic_cast<FdoGeometryValue*>(literalValue) != NULL)
     87{
     88    // GeometryValue
     89    ...
     90}
     91}}}
     92
     93can be changed to :
     94
     95{{{
     96if (literalValue->GetLiteralValueType() == FdoLiteralValueType_Data)
     97{
     98   // DataValue
     99   ...
     100}
     101else if (literalValue->GetLiteralValueType() == FdoLiteralValueType_Geometry)
     102{
     103   // GeometryValue
     104   ...
     105}
     106}}}
     107
     108For the managed code:
     109
     110{{{
     111public __value enum LiteralValueType
     112{
     113      LiteralValueType_Data = FdoLiteralValueType_Data,
     114
     115      LiteralValueType_Geometry = FdoLiteralValueType_Geometry
     116
     117};
     118
     119public __gc class LiteralValue : public NAMESPACE_OSGEO_FDO_EXPRESSION::ValueExpression
     120{
     121public:
     122    __property NAMESPACE_OSGEO_FDO_EXPRESSION::LiteralValueType get_LiteralValueType();
     123
     124public private:
     125      inline FdoLiteralValue* GetImpObj();
     126};
     127}}}
     128
     1292) Add the !FdoLiteralValueCollection class
     130
     131
     132For the unmanaged code:
     133{{{
     134class FdoLiteralValueCollection : public FdoCollection<FdoLiteralValue, FdoExpressionException>
     135{
     136protected:
     137    FdoLiteralValueCollection() : FdoCollection<FdoLiteralValue, FdoExpressionException>()
     138    {
     139    }
     140
     141    virtual ~FdoLiteralValueCollection()
     142    {
     143    }
     144
     145    virtual void Dispose()
     146    {
     147        delete this;
     148    }
     149
     150public:
     151    /// \brief
     152    /// Constructs a default instance of an FdoLiteralValueCollection.
     153    ///
     154    /// \return
     155    /// Returns FdoDataValueCollection
     156    ///
     157    FDO_API static FdoLiteralValueCollection* Create();
     158};
     159}}}
     160
     161For the managed code:
     162
     163{{{
     164public __sealed __gc class LiteralValueCollection : public NAMESPACE_OSGEO_RUNTIME::Disposable, public System::Collections::IList
     165{
     166/// \cond DOXYGEN-IGNORE
     167public private:
     168      inline FdoLiteralValueCollection* GetImpObj();
     169
     170public:
     171    /// \brief
     172    /// The defaut constructor for the object
     173    ///
     174      LiteralValueCollection();
     175
     176    /// \brief
     177    /// Constructs a LiteralValueCollection object based on an unmanaged instance of the object
     178    ///
     179    /// \param unmanaged
     180    /// Input A Pointer to the unmanaged object.
     181    ///
     182    /// \param autoDelete
     183    /// Input Indicates if the constructed object should be automatically deleted
     184    /// once it no longer referenced.
     185    ///
     186      LiteralValueCollection(System::IntPtr unmanaged, System::Boolean autoDelete);
     187
     188    /// \brief
     189    /// Gets the count of items in collection.
     190    ///
     191    /// \return
     192    /// Returns the number of items in the collection.
     193    ///
     194      __property System::Int32 get_Count(System::Void);
     195
     196    /// \brief
     197    /// Gets an enumerator that can iterate through a collection.
     198    ///
     199    /// \return
     200    /// Returns an enumerator on the dictionary.
     201    ///
     202      __sealed System::Collections::IEnumerator* GetEnumerator(System::Void);
     203
     204    /// \brief
     205    /// Removes the index-th ArgumentDefinition from this collection.
     206    ///
     207    /// \param index
     208    /// Input index of the element to remove.
     209    ///
     210      System::Void RemoveAt(System::Int32 index);
     211
     212    /// \brief
     213    /// Removes all elements from the collection.
     214    ///
     215      System::Void  Clear();
     216
     217    /// \brief
     218    /// Adds a ArgumentDefinition object into the collection.
     219    ///
     220    /// \param value
     221    /// Input the ArgumentDefinition object to add.
     222    ///
     223    /// \return
     224    /// Returns the position into which the new element was inserted.
     225    ///
     226      System::Int32 Add(LiteralValue* value);
     227
     228    /// \brief
     229    /// Determines the index of a specific ArgumentDefinition object.
     230    ///
     231    /// \param value
     232    /// Input the ArgumentDefinition object to locate in the collection.
     233    ///
     234    /// \return
     235    /// The index of value if found in the collection; otherwise, -1.
     236    ///
     237      System::Int32 IndexOf(NAMESPACE_OSGEO_FDO_EXPRESSION::LiteralValue* value);
     238
     239    /// \brief
     240    /// Inserts a ArgumentDefinition object into the collection at the specified position.
     241    ///
     242    /// \param index
     243    /// Input the zero-based index at which value should be inserted.
     244    /// \param value
     245    /// Input the ArgumentDefinition object to insert.
     246    ///
     247      System::Void Insert(System::Int32 index, NAMESPACE_OSGEO_FDO_EXPRESSION::LiteralValue* value);
     248
     249    /// \brief
     250    /// Removes the first occurrence of a specific ArgumentDefinition object.
     251    ///
     252    /// \param value
     253    /// Input the ArgumentDefinition object to remove from the collection.
     254    ///
     255      System::Void Remove(NAMESPACE_OSGEO_FDO_EXPRESSION::LiteralValue* value);
     256
     257    /// \brief
     258    /// Determines whether the collection contains a specific ArgumentDefinition object.
     259    ///
     260    /// \param value
     261    /// Input The ArgumentDefinition object to search in the collection.
     262    ///
     263    /// \return
     264    /// Returns true if the value is found in the collection; otherwise, false.
     265    ///
     266      System::Boolean Contains(NAMESPACE_OSGEO_FDO_EXPRESSION::LiteralValue* value);
     267
     268    /// \brief
     269    /// Copies the elements of the collection to an array.
     270    ///
     271    /// \param array
     272    /// Output the one-dimensional Array that is the destination of the elements copied from this collection.
     273    ///
     274    /// \param startAt
     275    /// Input an integer that represents the index in array at which copying begins.
     276    ///
     277      System::Void CopyTo(NAMESPACE_OSGEO_FDO_EXPRESSION::LiteralValue* array[],System::Int32 startAt);
     278
     279    /// \brief
     280    /// Gets the item in the collection at the specified index.
     281    ///
     282    /// \param index
     283    /// The index of the item in the collection. The index is 0 based.
     284    ///
     285    /// \return
     286    /// Returns an instance of a the collected item.
     287    /// Throws an instance of Exception if the index is out of range or an error occurs.
     288    ///
     289      __property NAMESPACE_OSGEO_FDO_EXPRESSION::LiteralValue* get_RealTypeItem(System::Int32 index);
     290
     291    /// \brief
     292    /// Sets the value of the item at the specified index
     293    ///
     294    /// \param index
     295    /// Input index of the item to set.
     296    ///
     297    /// \param value
     298    /// Input the value of the item
     299    ///
     300      __property System::Void  set_RealTypeItem(System::Int32 index, NAMESPACE_OSGEO_FDO_EXPRESSION::LiteralValue* value);
     301
     302    /// \brief
     303    /// Gets an item in the collection.
     304    ///
     305    /// \param index
     306    /// Input index of the item to retrieve.
     307    ///
     308    /// \return
     309    /// Returns the item at the specified index
     310    ///
     311      __property NAMESPACE_OSGEO_FDO_EXPRESSION::LiteralValue* get_Item(System::Int32 index);
     312
     313    /// \brief
     314    /// Sets the value of the item at the specified index
     315    ///
     316    /// \param index
     317    /// Input index of the item to set.
     318    ///
     319    /// \param value
     320    /// Input the value of the item
     321    ///
     322      __property System::Void  set_Item(System::Int32 index, NAMESPACE_OSGEO_FDO_EXPRESSION::LiteralValue* value);
     323
     324/// \cond DOXYGEN-IGNORE
     325/// \endcond
     326};
     327}}}
     328
     329
     330== Implications ==
     331
     332This change will not cause any functional or performance side effects.
     333
     334== Test Plan ==
     335
     336Existing unit tests will be expanded to test the proposed enhancements defined above.
     337
     338== Funding/Resources ==
     339
     340Autodesk to provide resources / funding to update the FDO API.