RealTier_def.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /* RealTier_def.h
  2. *
  3. * Copyright (C) 1992-2012,2014,2015,2016,2017 Paul Boersma
  4. *
  5. * This code is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; either version 2 of the License, or (at
  8. * your option) any later version.
  9. *
  10. * This code is distributed in the hope that it will be useful, but
  11. * WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  13. * See the GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this work. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. #define ooSTRUCT RealPoint
  19. oo_DEFINE_CLASS (RealPoint, AnyPoint)
  20. oo_DOUBLE (value)
  21. oo_END_CLASS (RealPoint)
  22. #undef ooSTRUCT
  23. /*
  24. RealTier inherits from Function,
  25. but most of the time a RealTier should also be able to pose as an AnyTier,
  26. because the SortedSetDoubleOf contains RealPoints, which inherit from AnyPoints.
  27. */
  28. #define ooSTRUCT RealTier
  29. oo_DEFINE_CLASS (RealTier, Function) // syntactic inheritance
  30. oo_COLLECTION_OF (SortedSetOfDoubleOf, points, RealPoint, 0) // semantically a kind of AnyTier though
  31. #if oo_DECLARING
  32. AnyTier_METHODS // the semantic superclass has to be copied in by hand (for shift() and scale())
  33. void v_info ()
  34. override;
  35. bool v_hasGetNx ()
  36. override { return true; }
  37. double v_getNx ()
  38. override { return points.size; }
  39. bool v_hasGetX ()
  40. override { return true; }
  41. double v_getX (integer ix)
  42. override { return points.at [ix] -> number; }
  43. bool v_hasGetNcol ()
  44. override { return true; }
  45. double v_getNcol ()
  46. override { return points.size; }
  47. bool v_hasGetVector ()
  48. override { return true; }
  49. double v_getVector (integer irow, integer icol)
  50. override;
  51. bool v_hasGetFunction1 ()
  52. override { return true; }
  53. double v_getFunction1 (integer irow, double x)
  54. override;
  55. conststring32 v_getUnitText (integer /* level */, int /* unit */, uint32 /* flags */)
  56. override { return U"Time (s)"; }
  57. #endif
  58. oo_END_CLASS (RealTier)
  59. #undef ooSTRUCT
  60. /* End of file RealTier_def.h */