| 1 |
/* RealTier_def.h |
| 2 |
* |
| 3 |
* Copyright (C) 1992-2012,2014-2018,2022,2023 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 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. |
| 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 ooSTRUCT RealPoint |
| 21 |
oo_DEFINE_CLASS (RealPoint, AnyPoint) |
| 22 |
|
| 23 |
oo_DOUBLE (value) |
| 24 |
|
| 25 |
oo_END_CLASS (RealPoint) |
| 26 |
#undef ooSTRUCT |
| 27 |
|
| 28 |
|
| 29 |
/* |
| 30 |
RealTier inherits from Function, |
| 31 |
but most of the time a RealTier should also be able to pose as an AnyTier, |
| 32 |
because the SortedSetDoubleOf contains RealPoints, which inherit from AnyPoints. |
| 33 |
*/ |
| 34 |
#define ooSTRUCT RealTier |
| 35 |
oo_DEFINE_CLASS (RealTier, Function) // syntactic inheritance |
| 36 |
|
| 37 |
oo_COLLECTION_OF (SortedSetOfDoubleOf, points, RealPoint, 0) // semantically a kind of AnyTier though |
| 38 |
|
| 39 |
#if oo_DECLARING |
| 40 |
AnyTier_METHODS // the semantic superclass has to be copied in by hand (for shift() and scale()) |
| 41 |
|
| 42 |
void v1_info () |
| 43 |
override; |
| 44 |
bool v_hasGetNx () const |
| 45 |
override { return true; } |
| 46 |
double v_getNx () const |
| 47 |
override { return points.size; } |
| 48 |
bool v_hasGetX () const |
| 49 |
override { return true; } |
| 50 |
double v_getX (const integer ix) const |
| 51 |
override { return points.at [ix] -> number; } |
| 52 |
bool v_hasGetNcol () const |
| 53 |
override { return true; } |
| 54 |
double v_getNcol () const |
| 55 |
override { return points.size; } |
| 56 |
bool v_hasGetVector () const |
| 57 |
override { return true; } |
| 58 |
double v_getVector (integer irow, integer icol) const |
| 59 |
override; |
| 60 |
bool v_hasGetFunction1 () const |
| 61 |
override { return true; } |
| 62 |
double v_getFunction1 (integer irow, double x) const |
| 63 |
override; |
| 64 |
conststring32 v_getUnitText (integer /* level */, int /* unit */, uint32 /* flags */) const |
| 65 |
override { return U"Time (s)"; } |
| 66 |
#endif |
| 67 |
|
| 68 |
oo_END_CLASS (RealTier) |
| 69 |
#undef ooSTRUCT |
| 70 |
|
| 71 |
|
| 72 |
/* End of file RealTier_def.h */ |