| 1 | #cxx . . $ `<file>/fon/Label.h`/ifndef _Label_h_ |
| 2 | #define _Label_h_cxx . . $ `fon/Label.h:2:9`! |
| 3 | /* Label.h |
| 4 | * |
| 5 | * Copyright (C) 1992-2005,2007,2011,2012,2015-2018,2022 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"cxx . . $ `<file>/sys/Collection.h`/ |
| 22 | #include "Function.h"cxx . . $ `<file>/fon/Function.h`/ |
| 23 | |
| 24 | |
| 25 | #pragma mark - class Autosegment |
| 26 | |
| 27 | Thing_definecxx . . $ SomeThingHandle# (Autosegment, Function) { |
| 28 | void v1_copycxx . . $ structAutosegment#v1_copy(42659c2335f2eda7). (Daatacxx . . $ Daata# data_to) const |
| 29 | override; |
| 30 | bool v1_equalcxx . . $ structAutosegment#v1_equal(de90b88e0a4bb7f7). (Daatacxx . . $ Daata# otherData) |
| 31 | override; |
| 32 | static Data_Descriptioncxx . . $ Data_Description# s_descriptioncxx . . $ structAutosegment#s_description.; |
| 33 | Data_Descriptioncxx . . $ Data_Description# v_descriptioncxx . . $ structAutosegment#v_description(669317afad7f96e1). () |
| 34 | override { return s_descriptioncxx . . $ structAutosegment#s_description.; } |
| 35 | }; |
| 36 | |
| 37 | autoAutosegmentcxx . . $ autoAutosegment# Autosegment_createcxx . . $ Autosegment_create(2559363179d15401). (double tmin, double tmax, conststring32cxx . . $ conststring32# label); |
| 38 | /* |
| 39 | Function: |
| 40 | create a new instance of Autosegment. |
| 41 | Return value: |
| 42 | the new Autosegment. |
| 43 | Preconditions: |
| 44 | tmax > tmin; |
| 45 | label may be null; |
| 46 | Postconditions: |
| 47 | result -> tmin == tmin; |
| 48 | result -> tmax == tmax; |
| 49 | if (label) |
| 50 | result -> name == nullptr; |
| 51 | else |
| 52 | result -> name [] == label []; // 'label' copied into 'name' |
| 53 | */ |
| 54 | |
| 55 | |
| 56 | #pragma mark - class Tier |
| 57 | |
| 58 | Collection_definecxx . . $ SortedOf# (Tier, SortedOf, Autosegment) { |
| 59 | |
| 60 | /** |
| 61 | Initialize a new Tier containing one Autosegment from -1e30 to 1e30. |
| 62 | @post |
| 63 | this->size == 1; |
| 64 | this->at [1] -> classInfo == classAutosegment; |
| 65 | this->at [1] -> xmin == -1e30; |
| 66 | this->at [1] -> xmax == 1e30; |
| 67 | this->at [1] -> name == nullptr; |
| 68 | */ |
| 69 | structTiercxx . . $ structTier#structTier(49f6e7a06ebc5aa8). () { |
| 70 | ourcxx . . $ `melder/melder.h:42:9`! classInfocxx . . $ structThing#classInfo. = classTiercxx . . $ classTier.; |
| 71 | ourcxx . . $ `melder/melder.h:42:9`! addItem_movecxx . . $ CollectionOf#addItem_move(bcc0cff787be24fe). (Autosegment_createcxx . . $ Autosegment_create(2559363179d15401). (-1e30, 1e30, nullptr)); |
| 72 | } |
| 73 | |
| 74 | static int compareHookcxx . . $ structTier#compareHook(d23c64dc9034fc36). (Autosegmentcxx . . $ Autosegment# me, Autosegmentcxx . . $ Autosegment# thee) { |
| 75 | if (mycxx . . $ `melder/melder.h:44:9`! xmincxx . . $ structFunction#xmin. < thycxx . . $ `melder/melder.h:45:9`! xmincxx . . $ structFunction#xmin.) return -1; |
| 76 | if (mycxx . . $ `melder/melder.h:44:9`! xmincxx . . $ structFunction#xmin. > thycxx . . $ `melder/melder.h:45:9`! xmincxx . . $ structFunction#xmin.) return 1; |
| 77 | if (mycxx . . $ `melder/melder.h:44:9`! xmaxcxx . . $ structFunction#xmax. < thycxx . . $ `melder/melder.h:45:9`! xmaxcxx . . $ structFunction#xmax.) return -1; |
| 78 | if (mycxx . . $ `melder/melder.h:44:9`! xmaxcxx . . $ structFunction#xmax. > thycxx . . $ `melder/melder.h:45:9`! xmaxcxx . . $ structFunction#xmax.) return 1; |
| 79 | return 0; |
| 80 | } |
| 81 | SortedOfcxx . . $ SortedOf#<structAutosegment>::CompareHookcxx . . $ SortedOf#CompareHook# v_getCompareHookcxx . . $ structTier#v_getCompareHook(e8333e9d9d1cac21). () override { return compareHookcxx . . $ structTier#compareHook(d23c64dc9034fc36).; } |
| 82 | }; |
| 83 | |
| 84 | /** |
| 85 | @return |
| 86 | index, or 0 if the tier is empty or t is very large. |
| 87 | @post |
| 88 | result == 0 || my item [i] -> xmin <= result < my item [i] -> xmax; |
| 89 | */ |
| 90 | integercxx . . $ integer# Tier_timeToIndexcxx . . $ Tier_timeToIndex(526b277bcb3b0da8). (Tiercxx . . $ Tier# me, double t); |
| 91 | |
| 92 | |
| 93 | #pragma mark - class Label |
| 94 | |
| 95 | Collection_definecxx . . $ Label# (Label, OrderedOf, Tier) { |
| 96 | }; |
| 97 | |
| 98 | void Label_addTiercxx . . $ Label_addTier(ef1825dee7b20bc0). (Labelcxx . . $ Label# me); |
| 99 | |
| 100 | void Label_suggestDomaincxx . . $ Label_suggestDomain(15016e53206a5452). (Labelcxx . . $ Label# me, double *tmin, double *tmax); |
| 101 | |
| 102 | |
| 103 | /* End of file Label.h */ |
| 104 | #endif |