1 #ifndef _AnyTier_h_
2 #define _AnyTier_h_
3 /* AnyTier.h
4  *
5  * Copyright (C) 1992-2005,2007,2011,2015-2017,2020 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 
Thing_define(AnyPoint,SimpleDouble)24 Thing_define (AnyPoint, SimpleDouble) {
25 };
26 
Thing_define(AnyTier,Function)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 (AnyTier me, double time);
37 
38 integer AnyTier_timeToHighIndex (AnyTier me, double time);
39 
40 integer AnyTier_getWindowPoints (AnyTier me, double tmin, double tmax, integer *imin, integer *imax);
41 
42 integer AnyTier_timeToNearestIndex (AnyTier me, double time);
43 integer AnyTier_timeToNearestIndexInIndexWindow (AnyTier me, double time, integer imin, integer imax);
44 integer AnyTier_timeToNearestIndexInTimeWindow (AnyTier me, double time, double tmin, double tmax);
45 
46 integer AnyTier_hasPoint (AnyTier 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 (AnyTier me);
57 
58 #define AnyTier_METHODS \
59 	AnyTier asAnyTier () { return reinterpret_cast <AnyTier> (this); } \
60 	void v_shiftX (double xfrom, double xto) \
61 		override { ((AnyTier) this) -> structAnyTier::v_shiftX (xfrom, xto); } \
62 	void v_scaleX (double xminfrom, double xmaxfrom, double xminto, double xmaxto) \
63 		override { ((AnyTier) this) -> structAnyTier::v_scaleX (xminfrom, xmaxfrom, xminto, xmaxto); };
64 
65 #endif
66 /* End of file AnyTier.h */
67