| 1 | #cxx . . $ `<file>/melder/MelderArg.h`/ifndef _melder_arg_h_ |
| 2 | #define _melder_arg_h_cxx . . $ `melder/MelderArg.h:2:9`! |
| 3 | /* MelderArg.h |
| 4 | * |
| 5 | * Copyright (C) 1992-2020,2022,2024-2026 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 3 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 | typedef class structThingcxx . . $ structThing# *Thingcxx . . $ Thing#; // forward declaration |
| 22 | typedef const class structThingcxx . . $ structThing# *constThingcxx . . $ constThing#; // forward declaration |
| 23 | conststring32cxx . . $ conststring32# Thing_messageNamecxx . . $ Thing_messageName(11f2223ccd84d3cf). (constThingcxx . . $ constThing# me); |
| 24 | |
| 25 | struct MelderArgcxx . . $ MelderArg# { |
| 26 | const conststring32cxx . . $ conststring32# _argcxx . . $ MelderArg#_arg.; |
| 27 | /* |
| 28 | The types of arguments that never involve memory allocation: |
| 29 | */ |
| 30 | MelderArgcxx . . $ MelderArg#MelderArg(ff00d524ab0355ec). (conststring32cxx . . $ conststring32# arg) : _argcxx . . $ MelderArg#_arg. (arg) { } |
| 31 | MelderArgcxx . . $ MelderArg#MelderArg(ba8836b59fb42830). (const double arg) : _argcxx . . $ MelderArg#_arg. (Melder_doublecxx . . $ Melder_double(f05d861d9dbec9b2). (arg)) { } |
| 32 | MelderArgcxx . . $ MelderArg#MelderArg(35cb52607f6af42f). (const long long arg) : _argcxx . . $ MelderArg#_arg. (Melder_integercxx . . $ Melder_integer(7b348ebc2004441d). (arg)) { } |
| 33 | MelderArgcxx . . $ MelderArg#MelderArg(891dc3055356b409). (const unsigned long long arg) : _argcxx . . $ MelderArg#_arg. (Melder_integercxx . . $ Melder_integer(7b348ebc2004441d). ((int64cxx . . $ int64#) arg)) { } |
| 34 | MelderArgcxx . . $ MelderArg#MelderArg(1624ee8275b10bda). (const long arg) : _argcxx . . $ MelderArg#_arg. (Melder_integercxx . . $ Melder_integer(7b348ebc2004441d). (arg)) { } |
| 35 | MelderArgcxx . . $ MelderArg#MelderArg(2c44cd906ae4e829). (const unsigned long arg) : _argcxx . . $ MelderArg#_arg. (Melder_integercxx . . $ Melder_integer(7b348ebc2004441d). ((int64cxx . . $ int64#) arg)) { } // ignore ULL above 2^63 |
| 36 | MelderArgcxx . . $ MelderArg#MelderArg(d4f767463ce0a6b3). (const int arg) : _argcxx . . $ MelderArg#_arg. (Melder_integercxx . . $ Melder_integer(7b348ebc2004441d). (arg)) { } |
| 37 | MelderArgcxx . . $ MelderArg#MelderArg(cb2f890c2fdad230). (const unsigned int arg) : _argcxx . . $ MelderArg#_arg. (Melder_integercxx . . $ Melder_integer(7b348ebc2004441d). (arg)) { } |
| 38 | MelderArgcxx . . $ MelderArg#MelderArg(68e3ae50fe6578a9). (const short arg) : _argcxx . . $ MelderArg#_arg. (Melder_integercxx . . $ Melder_integer(7b348ebc2004441d). (arg)) { } |
| 39 | MelderArgcxx . . $ MelderArg#MelderArg(ed53e3bbd3fa2f69). (const unsigned short arg) : _argcxx . . $ MelderArg#_arg. (Melder_integercxx . . $ Melder_integer(7b348ebc2004441d). (arg)) { } |
| 40 | MelderArgcxx . . $ MelderArg#MelderArg(c360aa6dfec3de66). (const dcomplexcxx . . $ dcomplex# arg) : _argcxx . . $ MelderArg#_arg. (Melder_dcomplexcxx . . $ Melder_dcomplex(4cf419d79128e8b4). (argcxx . . $ std/complex#complex(20ef1611af677bca).)) { } |
| 41 | MelderArgcxx . . $ MelderArg#MelderArg(63b47b4ccdb1f3af). (const char32cxx . . $ char32# arg) : _argcxx . . $ MelderArg#_arg. (Melder_charactercxx . . $ Melder_character(7ee4a1927ac5447f). (arg)) { } |
| 42 | MelderArgcxx . . $ MelderArg#MelderArg(2dd9df8dc1ca3bd9). (const MelderColourcxx . . $ MelderColour# arg) : _argcxx . . $ MelderArg#_arg. (Melder_colourcxx . . $ Melder_colour(7dfff7c3df3cd0ae). (arg)) { } |
| 43 | /* |
| 44 | The types of arguments that sometimes involve memory allocation: |
| 45 | */ |
| 46 | MelderArgcxx . . $ MelderArg#MelderArg(6c19826474b9da28). (constVECVUcxx . . $ constVECVU# const& arg) : _argcxx . . $ MelderArg#_arg. (Melder_VECcxx . . $ Melder_VEC(b17600fbee77d577). (arg)) { } |
| 47 | MelderArgcxx . . $ MelderArg#MelderArg(853efded210346fb). (constMATVUcxx . . $ constMATVU# const& arg) : _argcxx . . $ MelderArg#_arg. (Melder_MATcxx . . $ Melder_MAT(3aa2643813231815). (arg)) { } |
| 48 | MelderArgcxx . . $ MelderArg#MelderArg(94701bb160f8ed51). (constSTRVECcxx . . $ constSTRVEC# const& arg) : _argcxx . . $ MelderArg#_arg. (Melder_STRVECcxx . . $ Melder_STRVEC(7e69ba2a7c76306a). (arg)) { } |
| 49 | MelderArgcxx . . $ MelderArg#MelderArg(4452523f51a9471a). (VECVUcxx . . $ VECVU# const& arg) : _argcxx . . $ MelderArg#_arg. (Melder_VECcxx . . $ Melder_VEC(b17600fbee77d577). (argcxx . . $ constvectorview#constvectorview(5c6f246bf1d99401).)) { } |
| 50 | MelderArgcxx . . $ MelderArg#MelderArg(a810c3355071c044). (MATVUcxx . . $ MATVU# const& arg) : _argcxx . . $ MelderArg#_arg. (Melder_MATcxx . . $ Melder_MAT(3aa2643813231815). (argcxx . . $ constmatrixview#constmatrixview(c98a2930b9469e58).)) { } |
| 51 | MelderArgcxx . . $ MelderArg#MelderArg(bedb44e9ae7c63cf). (STRVECcxx . . $ STRVEC# const& arg) : _argcxx . . $ MelderArg#_arg. (Melder_STRVECcxx . . $ Melder_STRVEC(7e69ba2a7c76306a). (argcxx . . $ _conststringvector#_conststringvector(93d9e701af42cb0d).)) { } |
| 52 | MelderArgcxx . . $ MelderArg#MelderArg(7855d71b5e065b66). (constThingcxx . . $ constThing# arg) : _argcxx . . $ MelderArg#_arg. (Thing_messageNamecxx . . $ Thing_messageName(11f2223ccd84d3cf). (arg)) { } |
| 53 | MelderArgcxx . . $ MelderArg#MelderArg(1145552d769d7b5d). (MelderFilecxx . . $ MelderFile# arg) : _argcxx . . $ MelderArg#_arg. (MelderFile_messageNamecxx . . $ MelderFile_messageName(d9f043369fa9b55b). (arg)) { } |
| 54 | MelderArgcxx . . $ MelderArg#MelderArg(63f38d3b6b86d1dc). (MelderFoldercxx . . $ MelderFolder# arg) : _argcxx . . $ MelderArg#_arg. (MelderFolder_messageNamecxx . . $ MelderFolder_messageName(fbe3b4f4d15c56ee). (arg)) { } |
| 55 | /* |
| 56 | There could be more types of arguments, but those are rare; |
| 57 | you have to use explicit conversion to one of the types above. |
| 58 | For instance, you can write a char* string by using Melder_peek8to32_u() |
| 59 | (which sometimes involves memory allocation), |
| 60 | and you can write a void* by using Melder_pointer() |
| 61 | (which never involves memory allocation). |
| 62 | */ |
| 63 | }; |
| 64 | |
| 65 | template <typename... Arg> |
| 66 | integercxx . . $ integer# MelderArg__lengthcxx . . $ MelderArg__length(17371cc2e0a1329d). (const Arg... arg) { |
| 67 | return |
| 68 | (// fold |
| 69 | Melder_lengthcxx . . $ Melder_length(3fae411214b133ad). (MelderArgcxx . . $ MelderArg# { arg }. _argcxx . . $ MelderArg#_arg.) |
| 70 | + ... + 0 |
| 71 | ); |
| 72 | } |
| 73 | |
| 74 | /* End of file MelderArg.h */ |
| 75 | #endif |