| 1 | /* Sampled_def.h |
| 2 | * |
| 3 | * Copyright (C) 1992-2005,2011,2014-2018,2020,2023,2025 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 3 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 ooSTRUCTcxx . . $ `fon/Sampled_def.h:20:9`! Sampled |
| 21 | oo_DEFINE_CLASScxx . . $ `sys/oo.h:176:9`! (Sampled, Function) |
| 22 | |
| 23 | oo_INTEGERcxx . . $ `sys/oo.h:45:9`! (nx) |
| 24 | oo_DOUBLEcxx . . $ `sys/oo.h:58:9`! (dx) |
| 25 | oo_DOUBLEcxx . . $ `sys/oo.h:58:9`! (x1) |
| 26 | |
| 27 | #if oo_READINGcxx . . $ `sys/oo.h:235:9`! |
| 28 | Melder_require (xmax >= xmin, |
| 29 | U"xmax should be at least as great as xmin."); |
| 30 | Melder_require (nx >= 1, |
| 31 | U"nx should be at least 1."); |
| 32 | Melder_require (dx > 0.0, |
| 33 | U"dx should be positive."); |
| 34 | #endif |
| 35 | |
| 36 | #if oo_DECLARINGcxx . . $ `sys/oo.h:230:9`! |
| 37 | bool v_hasGetNxcxx . . $ structSampled#v_hasGetNx(50ce9a9e25b4a850). () const |
| 38 | override { return true; } |
| 39 | double v_getNxcxx . . $ structSampled#v_getNx(21b6c25e127938e2). () const |
| 40 | override { return nxcxx . . $ structSampled#nx.; } |
| 41 | bool v_hasGetDxcxx . . $ structSampled#v_hasGetDx(50ce9a9e25b4a850). () const |
| 42 | override { return true; } |
| 43 | double v_getDxcxx . . $ structSampled#v_getDx(21b6c25e127938e2). () const |
| 44 | override { return dxcxx . . $ structSampled#dx.; } |
| 45 | bool v_hasGetXcxx . . $ structSampled#v_hasGetX(50ce9a9e25b4a850). () const |
| 46 | override { return true; } |
| 47 | double v_getXcxx . . $ structSampled#v_getX(9db9ea2d2e621dac). (const integercxx . . $ integer# ix) const |
| 48 | override { return x1cxx . . $ structSampled#x1. + (ix - 1) * dxcxx . . $ structSampled#dx.; } |
| 49 | void v_shiftXcxx . . $ structSampled#v_shiftX(bc12c9ec15586e6a). (double xfrom, double xto) |
| 50 | override; |
| 51 | void v_scaleXcxx . . $ structSampled#v_scaleX(52a61fa14d44b641). (double xminfrom, double xmaxfrom, double xminto, double xmaxto) |
| 52 | override; |
| 53 | |
| 54 | virtual double v_getValueAtSamplecxx . . $ structSampled#v_getValueAtSample(8bbfc6ce471470c9). (integercxx . . $ integer# /* isamp */, integercxx . . $ integer# /* ilevel */, int /* unit */) const |
| 55 | { return undefinedcxx . . $ undefined.; } |
| 56 | virtual conststring32cxx . . $ conststring32# v_getIndexTextcxx . . $ structSampled#v_getIndexText(d608cbfe2b610d03). () const |
| 57 | { return U"index"; } |
| 58 | virtual conststring32cxx . . $ conststring32# v_getNxTextcxx . . $ structSampled#v_getNxText(d608cbfe2b610d03). () const |
| 59 | { return U"nx"; } |
| 60 | virtual void checkIndexcxx . . $ structSampled#checkIndex(1624ee8275b10bda). (const integercxx . . $ integer# index) { |
| 61 | Melder_requirecxx . . $ `melder/melder_require.h:21:9`! (index >= 1, |
| 62 | U"The ", ourcxx . . $ `melder/melder.h:42:9`! v_getIndexText (), U" should be at least 1, but is ", index, U" instead."); |
| 63 | Melder_requirecxx . . $ `melder/melder_require.h:21:9`! (index <= ourcxx . . $ `melder/melder.h:42:9`! nx, |
| 64 | U"The ", ourcxx . . $ `melder/melder.h:42:9`! v_getIndexText (), U" should be at most ", ourcxx . . $ `melder/melder.h:42:9`! v_getNxText (), |
| 65 | U" (", ourcxx . . $ `melder/melder.h:42:9`! nx, U"), but is ", index, U" instead." |
| 66 | ); |
| 67 | } |
| 68 | #endif // oo_DECLARING |
| 69 | |
| 70 | oo_END_CLASScxx . . $ `sys/oo.h:186:9`! (Sampled) |
| 71 | #undef ooSTRUCTcxx . . $ `fon/Sampled_def.h:20:9`! |
| 72 | |
| 73 | |
| 74 | /* End of file Sampled_def.h */ |