DynArray.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. /*****************************************************************************
  2. DynArray.h
  3. By Laurent de Soras
  4. --- Legal stuff ---
  5. This program is free software. It comes without any warranty, to
  6. the extent permitted by applicable law. You can redistribute it
  7. and/or modify it under the terms of the Do What The Fuck You Want
  8. To Public License, Version 2, as published by Sam Hocevar. See
  9. http://sam.zoy.org/wtfpl/COPYING for more details.
  10. *Tab=3***********************************************************************/
  11. #if ! defined (ffft_DynArray_HEADER_INCLUDED)
  12. #define ffft_DynArray_HEADER_INCLUDED
  13. #if defined (_MSC_VER)
  14. #pragma once
  15. #pragma warning (4 : 4250) // "Inherits via dominance."
  16. #endif
  17. /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
  18. namespace ffft
  19. {
  20. template <class T>
  21. class DynArray
  22. {
  23. /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
  24. public:
  25. typedef T DataType;
  26. DynArray ();
  27. explicit DynArray (long size);
  28. ~DynArray ();
  29. inline long size () const;
  30. inline void resize (long size);
  31. inline const DataType &
  32. operator [] (long pos) const;
  33. inline DataType &
  34. operator [] (long pos);
  35. /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
  36. protected:
  37. /*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
  38. private:
  39. DataType * _data_ptr;
  40. long _len;
  41. /*\\\ FORBIDDEN MEMBER FUNCTIONS \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
  42. private:
  43. DynArray (const DynArray &other);
  44. DynArray & operator = (const DynArray &other);
  45. bool operator == (const DynArray &other);
  46. bool operator != (const DynArray &other);
  47. }; // class DynArray
  48. } // namespace ffft
  49. #include "DynArray.hpp"
  50. #endif // ffft_DynArray_HEADER_INCLUDED
  51. /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/