iutil/array.h
Go to the documentation of this file.00001 /* 00002 Copyright (C) 2006 by Frank Richter 00003 00004 This library is free software; you can redistribute it and/or 00005 modify it under the terms of the GNU Library General Public 00006 License as published by the Free Software Foundation; either 00007 version 2 of the License, or (at your option) any later version. 00008 00009 This library is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 Library General Public License for more details. 00013 00014 You should have received a copy of the GNU Library General Public 00015 License along with this library; if not, write to the Free 00016 Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00017 */ 00018 00019 #ifndef __CS_IUTIL_ARRAY_H__ 00020 #define __CS_IUTIL_ARRAY_H__ 00021 00026 #include "csutil/scf.h" 00027 00049 template<typename T> 00050 struct iArrayReadOnly : public virtual iBase 00051 { 00052 typedef T ContainedType; 00053 00055 virtual size_t GetSize () const = 0; 00057 virtual T const& Get (size_t n) const = 0; 00059 virtual T const& Top () const = 0; 00065 virtual size_t Find (T const& which) const = 0; 00072 virtual size_t GetIndex (const T* which) const = 0; 00078 virtual bool IsEmpty() const = 0; 00084 virtual void GetAll (T* dest) const = 0; 00085 }; 00086 00093 #define SCF_IARRAYREADONLY_INTERFACE(Name) \ 00094 SCF_INTERFACE(Name, 0, 0, 1) 00095 00114 template<typename T> 00115 struct iArrayChangeElements : public virtual iArrayReadOnly<T> 00116 { 00118 using iArrayReadOnly<T>::Get; 00119 virtual T& Get (size_t n) = 0; 00121 using iArrayReadOnly<T>::Top; 00122 virtual T& Top () = 0; 00123 }; 00124 00132 #define SCF_IARRAYCHANGEELEMENTS_INTERFACE(Name) \ 00133 SCF_INTERFACE(Name, 0, 0, 1) 00134 00152 template<typename T> 00153 struct iArrayChangeAll : public virtual iArrayChangeElements<T> 00154 { 00164 virtual void SetSize (size_t n, T const& what) = 0; 00172 virtual void SetSize (size_t n) = 0; 00178 virtual T& GetExtend (size_t n) = 0; 00180 virtual void Put (size_t n, T const& what) = 0; 00185 virtual size_t Push (T const& what) = 0; 00190 virtual size_t PushSmart (T const& what) = 0; 00192 virtual T Pop () = 0; 00194 virtual bool Insert (size_t n, T const& item) = 0; 00196 virtual void DeleteAll () = 0; 00208 virtual void Truncate (size_t n) = 0; 00214 virtual void Empty () = 0; 00223 virtual bool DeleteIndex (size_t n) = 0; 00233 virtual bool DeleteIndexFast (size_t n) = 0; 00239 virtual bool Delete (T const& item) = 0; 00240 }; 00241 00249 #define SCF_IARRAYCHANGEALL_INTERFACE(Name) \ 00250 SCF_INTERFACE(Name, 0, 1, 0) 00251 00254 #endif // __CS_IUTIL_ARRAY_H__
Generated for Crystal Space 2.0 by doxygen 1.6.1