Debian Codegraph @

dwtools/TextGridTierNavigator_def.h

raw
1 /* TextGridTierNavigator_def.h
2 *
3 * Copyright (C) 2021 David Weenink
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. See the GNU
13 * 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 #define ooSTRUCT IntegerRange
20 oo_DEFINE_STRUCT (IntegerRange)
21 oo_INTEGER (first)
22 oo_INTEGER (last)
23 #if oo_DECLARING
24 integer size () const {
25 integer result = last - first + 1;
26 return std::max (result, 0_integer);
27 }
28 #endif
29 oo_END_STRUCT (IntegerRange)
30 #undef ooSTRUCT
31
32 #define ooSTRUCT TextGridTierNavigator
33 oo_DEFINE_CLASS (TextGridTierNavigator, Function)
34
35 oo_INTEGER (tierNumber) // we need to know where it came from
36 oo_OBJECT (Function, 0, tier)
37 oo_OBJECT (NavigationContext, 0, navigationContext)
38 oo_STRUCT (IntegerRange, beforeRange)
39 oo_STRUCT (IntegerRange, afterRange)
40
41 oo_INTEGER (currentTopicIndex) // maintain state: index of current match, (offLeft) 0 <= currentTopicIndex <= size + 1 : (offRight)
42
43 oo_ENUM (kMatchDomain, matchDomain) // what is to be considered as the domain (startTime, endTime) of the match?
44 oo_ENUM (kMatchDomainAlignment, matchDomainAlignment) // relation to match in possible other navigators
45
46 #if oo_DECLARING
47 void v1_info () override;
48 virtual integer v_getSize ();
49 virtual integer v_timeToLowIndex (double time);
50 virtual integer v_timeToIndex (double time);
51 virtual integer v_timeToHighIndex (double time);
52 virtual double v_getStartTime (integer index);
53 virtual double v_getEndTime (integer index);
54 virtual conststring32 v_getLabel (integer index);
55 #endif
56
57 oo_END_CLASS (TextGridTierNavigator)
58 #undef ooSTRUCT
59
60
61 /* End of file TextGridTierNavigator_def.h */