Array.hpp 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. /*****************************************************************************
  2. Array.hpp
  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_Array_CURRENT_CODEHEADER)
  12. #error Recursive inclusion of Array code header.
  13. #endif
  14. #define ffft_Array_CURRENT_CODEHEADER
  15. #if ! defined (ffft_Array_CODEHEADER_INCLUDED)
  16. #define ffft_Array_CODEHEADER_INCLUDED
  17. /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
  18. #include <cassert>
  19. namespace ffft
  20. {
  21. /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
  22. template <class T, long LEN>
  23. Array <T, LEN>::Array ()
  24. {
  25. // Nothing
  26. }
  27. template <class T, long LEN>
  28. const typename Array <T, LEN>::DataType & Array <T, LEN>::operator [] (long pos) const
  29. {
  30. assert (pos >= 0);
  31. assert (pos < LEN);
  32. return (_data_arr [pos]);
  33. }
  34. template <class T, long LEN>
  35. typename Array <T, LEN>::DataType & Array <T, LEN>::operator [] (long pos)
  36. {
  37. assert (pos >= 0);
  38. assert (pos < LEN);
  39. return (_data_arr [pos]);
  40. }
  41. template <class T, long LEN>
  42. long Array <T, LEN>::size ()
  43. {
  44. return (LEN);
  45. }
  46. /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
  47. /*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
  48. } // namespace ffft
  49. #endif // ffft_Array_CODEHEADER_INCLUDED
  50. #undef ffft_Array_CURRENT_CODEHEADER
  51. /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/