| 1 |
/* SampledXY_def.h |
| 2 |
* |
| 3 |
* Copyright (C) 1992-2005,2008,2011-2018,2023 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 |
|
| 19 |
|
| 20 |
#define ooSTRUCT SampledXY |
| 21 |
oo_DEFINE_CLASS (SampledXY, Sampled) |
| 22 |
|
| 23 |
oo_DOUBLE (ymin) |
| 24 |
oo_DOUBLE (ymax) |
| 25 |
oo_INTEGER (ny) |
| 26 |
oo_DOUBLE (dy) |
| 27 |
oo_DOUBLE (y1) |
| 28 |
|
| 29 |
#if oo_READING |
| 30 |
if (ymin > ymax) { |
| 31 |
Melder_throw (U"ymax should be at least as great as ymin."); |
| 32 |
} |
| 33 |
if (ny < 1) { |
| 34 |
Melder_throw (U"ny should be at least 1."); |
| 35 |
} |
| 36 |
if (dy <= 0.0) { |
| 37 |
Melder_throw (U"dy should be positive."); |
| 38 |
} |
| 39 |
#endif |
| 40 |
|
| 41 |
#if oo_DECLARING |
| 42 |
bool v_hasGetYmin () const |
| 43 |
override { return true; } |
| 44 |
double v_getYmin () const |
| 45 |
override { return ymin; } |
| 46 |
bool v_hasGetYmax () const |
| 47 |
override { return true; } |
| 48 |
double v_getYmax () const |
| 49 |
override { return ymax; } |
| 50 |
bool v_hasGetNy () const |
| 51 |
override { return true; } |
| 52 |
double v_getNy () const |
| 53 |
override { return ny; } |
| 54 |
bool v_hasGetDy () const |
| 55 |
override { return true; } |
| 56 |
double v_getDy () const |
| 57 |
override { return dy; } |
| 58 |
bool v_hasGetY () const |
| 59 |
override { return true; } |
| 60 |
double v_getY (const integer iy) const |
| 61 |
override { return y1 + (iy - 1) * dy; } |
| 62 |
#endif |
| 63 |
|
| 64 |
oo_END_CLASS (SampledXY) |
| 65 |
#undef ooSTRUCT |
| 66 |
|
| 67 |
|
| 68 |
/* End of file SampledXY_def.h */ |