| 1 | #ifndef _AnyTier_h_ |
| 2 | #define _AnyTier_h_ |
| 3 | /* AnyTier.h |
| 4 | * |
| 5 | * Copyright (C) 1992-2005,2007,2011,2015-2017,2020,2023 Paul Boersma |
| 6 | * |
| 7 | * This code is free software; you can redistribute it and/or modify |
| 8 | * it under the terms of the GNU General Public License as published by |
| 9 | * the Free Software Foundation; either version 2 of the License, or (at |
| 10 | * your option) any later version. |
| 11 | * |
| 12 | * This code is distributed in the hope that it will be useful, but |
| 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| 15 | * See the GNU General Public License for more details. |
| 16 | * |
| 17 | * You should have received a copy of the GNU General Public License |
| 18 | * along with this work. If not, see <http://www.gnu.org/licenses/>. |
| 19 | */ |
| 20 | |
| 21 | #include "Collection.h" |
| 22 | #include "PointProcess.h" |
| 23 | |
| 24 | Thing_define (AnyPoint, SimpleDouble) { |
| 25 | }; |
| 26 | |
| 27 | Thing_define (AnyTier, Function) { |
| 28 | SortedSetOfDoubleOf <structAnyPoint> points; |
| 29 | |
| 30 | void v_shiftX (double xfrom, double xto) |
| 31 | override; |
| 32 | void v_scaleX (double xminfrom, double xmaxfrom, double xminto, double xmaxto) |
| 33 | override; |
| 34 | }; |
| 35 | |
| 36 | integer AnyTier_timeToLowIndex (constAnyTier me, double time); |
| 37 | |
| 38 | integer AnyTier_timeToHighIndex (constAnyTier me, double time); |
| 39 | |
| 40 | integer AnyTier_getWindowPoints (constAnyTier me, double tmin, double tmax, integer *imin, integer *imax); |
| 41 | |
| 42 | integer AnyTier_timeToNearestIndex (constAnyTier me, double time); |
| 43 | integer AnyTier_timeToNearestIndexInIndexWindow (constAnyTier me, double time, integer imin, integer imax); |
| 44 | integer AnyTier_timeToNearestIndexInTimeWindow (constAnyTier me, double time, double tmin, double tmax); |
| 45 | |
| 46 | integer AnyTier_hasPoint (constAnyTier me, double t); |
| 47 | |
| 48 | void AnyTier_addPoint_move (AnyTier me, autoAnyPoint point); |
| 49 | |
| 50 | void AnyTier_removePoint (AnyTier me, integer i); |
| 51 | |
| 52 | void AnyTier_removePointNear (AnyTier me, double time); |
| 53 | |
| 54 | void AnyTier_removePointsBetween (AnyTier me, double tmin, double tmax); |
| 55 | |
| 56 | autoPointProcess AnyTier_downto_PointProcess (constAnyTier me); |
| 57 | |
| 58 | #define AnyTier_METHODS \ |
| 59 | AnyTier asAnyTier () { return reinterpret_cast <AnyTier> (this); } \ |
| 60 | constAnyTier asConstAnyTier () const { return reinterpret_cast <constAnyTier> (this); } \ |
| 61 | void v_shiftX (double xfrom, double xto) \ |
| 62 | override { ((AnyTier) this) -> structAnyTier::v_shiftX (xfrom, xto); } \ |
| 63 | void v_scaleX (double xminfrom, double xmaxfrom, double xminto, double xmaxto) \ |
| 64 | override { ((AnyTier) this) -> structAnyTier::v_scaleX (xminfrom, xmaxfrom, xminto, xmaxto); }; |
| 65 | |
| 66 | #endif |
| 67 | /* End of file AnyTier.h */ |