FDO .NET API Reference | Feature Data Objects |
00001 /* 00002 * Copyright (C) 2004-2006 Autodesk, Inc. 00003 * 00004 * This library is free software; you can redistribute it and/or 00005 * modify it under the terms of version 2.1 of the GNU Lesser 00006 * General Public License as published by the Free Software Foundation. 00007 * 00008 * This library is distributed in the hope that it will be useful, 00009 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00010 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00011 * Lesser General Public License for more details. 00012 * 00013 * You should have received a copy of the GNU Lesser General Public 00014 * License along with this library; if not, write to the Free Software 00015 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00016 * 00017 */ 00018 00019 #pragma once 00020 00021 class FdoIDisposableCollection; 00022 00023 BEGIN_NAMESPACE_OSGEO_FDO 00024 00025 /// \ingroup (OSGeoFDO) 00026 /// \brief 00027 /// The IDisposableCollection class represents a collection of IDisposable objects. 00028 [System::Reflection::DefaultMemberAttribute("RealTypeItem")] 00029 public __sealed __gc class IDisposableCollection : public NAMESPACE_OSGEO_RUNTIME::Disposable, public System::Collections::IList 00030 { 00031 /// \cond DOXYGEN-IGNORE 00032 private: 00033 /// \brief 00034 /// A Nested class defined to provide enumeration of Dictionary elements 00035 /// 00036 /// Enumerators can be used to read the data in the collection, 00037 /// but they cannot be used to modify the underlying collection. 00038 /// 00039 /// An enumerator remains valid as long as the collection remains unchanged. 00040 /// If changes are made to the collection, such as adding, modifying, or deleting 00041 /// elements, the enumerator is irrecoverably invalidated and the next call to 00042 /// MoveNext or Reset throws an InvalidOperationException. If the collection is 00043 /// modified between MoveNext and Current, Current returns the element that it is 00044 /// set to, even if the enumerator is already invalidated. 00045 /// 00046 /// The enumerator does not have exclusive access to the collection; therefore, 00047 /// enumerating through a collection is intrinsically not a thread-safe procedure. 00048 /// Even when a collection is synchronized, other threads can still modify the 00049 /// collection, which causes the enumerator to throw an exception. To guarantee 00050 /// thread safety during enumeration, you can either lock the collection during 00051 /// the entire enumeration or catch the exceptions resulting from changes made 00052 /// by other threads. 00053 /// 00054 __gc class Enumerator : public System::Collections::IEnumerator 00055 { 00056 private: 00057 IDisposableCollection* m_pCol; 00058 System::Int32 m_nIdx; 00059 00060 public: 00061 /// \brief 00062 /// Constructs a new Collection Enumerator 00063 /// 00064 /// \param col 00065 /// Input The collection to enumerate. 00066 /// 00067 Enumerator(IDisposableCollection* elements) : m_pCol(elements), m_nIdx(-1) 00068 { 00069 00070 } 00071 00072 /// \brief 00073 /// Retrieves the current object at the enumerator location 00074 /// 00075 /// \return 00076 /// Retuns the current object referenced by the enumerator 00077 /// 00078 __property System::Object *get_Current(); 00079 00080 /// \brief 00081 /// Initially, the enumerator is positioned before the first object in the collection. 00082 /// At this position, calling the Current property throws an exception. 00083 /// Therefore, you must call the MoveNext method to advance the enumerator 00084 /// to the first element of the collection before reading the value of Current. 00085 /// If MoveNext passes the end of the collection, the enumerator is positioned 00086 /// after the last element in the collection and MoveNext returns false. 00087 /// When the enumerator is at this position, subsequent calls to MoveNext also return false. 00088 /// If the last call to MoveNext returned false, calling Current throws an exception. 00089 /// To set Current to the first element of the collection again, you can call Reset 00090 /// followed by MoveNext. 00091 /// 00092 /// \return 00093 /// Retuns true if the Enumerator is able to move to a valid element 00094 /// otherwise false. 00095 /// 00096 System::Boolean MoveNext(); 00097 00098 /// \brief 00099 /// Initially, the enumerator is positioned before the first element in the collection. 00100 /// The Reset method brings the enumerator back to this position. 00101 /// 00102 System::Void Reset(); 00103 }; 00104 00105 public private: 00106 inline FdoIDisposableCollection* GetImpObj(); 00107 00108 private: 00109 // System::Collections::ICollection interface properties 00110 __property System::Object* System::Collections::ICollection::get_SyncRoot(); 00111 __property System::Boolean System::Collections::ICollection::get_IsSynchronized(); 00112 00113 // System::Collections::ICollection interface methods 00114 System::Void System::Collections::ICollection::CopyTo(System::Array* array,System::Int32 index); 00115 00116 // System::Collections::IList interface properties 00117 __property System::Boolean System::Collections::IList::get_IsFixedSize(); 00118 __property System::Boolean System::Collections::IList::get_IsReadOnly(); 00119 __property Object* System::Collections::IList::get_Item(System::Int32 index); 00120 __property System::Void System::Collections::IList::set_Item(System::Int32 index, Object* value); 00121 00122 // System::Collections::IList interface methods 00123 System::Int32 System::Collections::IList::Add(Object* value); 00124 System::Boolean System::Collections::IList::Contains(Object* value); 00125 System::Int32 System::Collections::IList::IndexOf(Object* value); 00126 System::Void System::Collections::IList::Insert(System::Int32 index, Object* value); 00127 System::Void System::Collections::IList::Remove(Object* value); 00128 00129 protected: 00130 System::Void ReleaseUnmanagedObject(); 00131 /// \endcond 00132 00133 public: 00134 /// \brief 00135 /// Default collection constructor. Creates an empty collection. 00136 /// 00137 IDisposableCollection(); 00138 00139 /// \brief 00140 /// Constructs an instance of the object based on an unmanaged instance of the object 00141 /// 00142 /// \param unmanaged 00143 /// Input A Pointer to the unmanaged object. 00144 /// 00145 /// \param autoDelete 00146 /// Input Indicates if the constructed object should be automatically deleted 00147 /// once it no longer referenced. 00148 /// 00149 IDisposableCollection(System::IntPtr unmanaged, System::Boolean autoDelete) : NAMESPACE_OSGEO_RUNTIME::Disposable(unmanaged, autoDelete) 00150 { 00151 00152 } 00153 00154 /// \brief 00155 /// Gets the count of items in collection. 00156 /// 00157 /// \return 00158 /// Returns the number of items in the collection. 00159 /// 00160 __property System::Int32 get_Count(System::Void); 00161 00162 /// \brief 00163 /// Gets an enumerator that can iterate through a collection. 00164 /// 00165 /// \return 00166 /// Returns the collection enumerator interface. 00167 /// 00168 __sealed System::Collections::IEnumerator* GetEnumerator(System::Void); 00169 00170 /// \brief 00171 /// Removes the index-th NAMESPACE_OSGEO_RUNTIME::Disposable from this collection. 00172 /// 00173 /// \param index 00174 /// Input index of the element to remove. 00175 /// 00176 System::Void RemoveAt(System::Int32 index); 00177 00178 /// \brief 00179 /// Removes all elements from the collection. 00180 /// 00181 System::Void Clear(); 00182 00183 /// \brief 00184 /// Adds a Disposable object into the collection. 00185 /// 00186 /// \param value 00187 /// Input the Disposable object to add. 00188 /// 00189 /// \return 00190 /// Returns the position into which the new element was inserted. 00191 /// 00192 System::Int32 Add(NAMESPACE_OSGEO_RUNTIME::Disposable* value); 00193 00194 /// \brief 00195 /// Determines the index of a specific Disposable object. 00196 /// 00197 /// \param value 00198 /// Input the Disposable object to locate in the collection. 00199 /// 00200 /// \return 00201 /// The index of value if found in the collection; otherwise, -1. 00202 /// 00203 System::Int32 IndexOf(NAMESPACE_OSGEO_RUNTIME::Disposable* value); 00204 00205 /// \brief 00206 /// Inserts a Disposable object into the collection at the specified position. 00207 /// 00208 /// \param index 00209 /// Input the zero-based index at which value should be inserted. 00210 /// 00211 /// \param value 00212 /// Input the Disposable object to insert. 00213 /// 00214 System::Void Insert(System::Int32 index, NAMESPACE_OSGEO_RUNTIME::Disposable* value); 00215 00216 /// \brief 00217 /// Removes the first occurrence of a specific Disposable object. 00218 /// 00219 /// \param value 00220 /// Input the Disposable object to remove from the collection. 00221 /// 00222 System::Void Remove(NAMESPACE_OSGEO_RUNTIME::Disposable* value); 00223 00224 /// \brief 00225 /// Determines whether the collection contains a specific Disposable object. 00226 /// 00227 /// \param value 00228 /// Input The Disposable object to search in the collection. 00229 /// 00230 /// \return 00231 /// Returns true if the value is found in the collection; otherwise, false. 00232 /// 00233 System::Boolean Contains(NAMESPACE_OSGEO_RUNTIME::Disposable* value); 00234 00235 /// \brief 00236 /// Copies the elements of the collection to an array. 00237 /// 00238 /// \param array 00239 /// Output the one-dimensional Array that is the destination of the elements copied from this collection. 00240 /// 00241 /// \param index 00242 /// Input an integer that represents the index in array at which copying begins. 00243 /// 00244 System::Void CopyTo(NAMESPACE_OSGEO_RUNTIME::Disposable* array[],System::Int32 index); 00245 00246 /// \brief 00247 /// Gets the item in the collection at the specified index. 00248 /// 00249 /// \param index 00250 /// The index of the item in the collection. The index is 0 based. 00251 /// 00252 /// \return 00253 /// Returns an instance of a the collected item. 00254 /// Throws an instance of Exception if the index is out of range or an error occurs. 00255 /// 00256 __property NAMESPACE_OSGEO_RUNTIME::Disposable* get_RealTypeItem(System::Int32 index); 00257 00258 /// \brief 00259 /// Sets the value of the item at the specified index 00260 /// 00261 /// \param index 00262 /// Input index of the item to set. 00263 /// 00264 /// \param value 00265 /// Input the value of the item 00266 /// 00267 __property System::Void set_RealTypeItem(System::Int32 index, NAMESPACE_OSGEO_RUNTIME::Disposable* value); 00268 00269 /// \brief 00270 /// Gets an item in the collection. 00271 /// 00272 /// \param index 00273 /// Input index of the item to retrieve. 00274 /// 00275 /// \return 00276 /// Returns the item at the specified index 00277 /// 00278 __property NAMESPACE_OSGEO_RUNTIME::Disposable* get_Item(System::Int32 index); 00279 00280 /// \brief 00281 /// Sets the value of the item at the specified index 00282 /// 00283 /// \param index 00284 /// Input index of the item to set. 00285 /// 00286 /// \param value 00287 /// Input the value of the item 00288 /// 00289 __property System::Void set_Item(System::Int32 index, NAMESPACE_OSGEO_RUNTIME::Disposable* value); 00290 }; 00291 00292 END_NAMESPACE_OSGEO_FDO 00293 00294
Comments or suggestions? Send us feedback. |