| 1 | /* WorkvectorPool.cpp |
| 2 | * |
| 3 | * Copyright (C) 2024 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 | #include "WorkvectorPool.h"cxx . . $ `<file>/dwsys/WorkvectorPool.h`/ |
| 20 | |
| 21 | #include "oo_DESTROY.h"cxx . . $ `<file>/sys/oo_DESTROY.h`/ |
| 22 | #include "WorkvectorPool_def.h"cxx . . $ `<file>/dwsys/WorkvectorPool_def.h`/ |
| 23 | #include "oo_COPY.h"cxx . . $ `<file>/sys/oo_COPY.h`/ |
| 24 | #include "WorkvectorPool_def.h"cxx . . $ `<file>/dwsys/WorkvectorPool_def.h`/ |
| 25 | #include "oo_EQUAL.h"cxx . . $ `<file>/sys/oo_EQUAL.h`/ |
| 26 | #include "WorkvectorPool_def.h"cxx . . $ `<file>/dwsys/WorkvectorPool_def.h`/ |
| 27 | #include "oo_CAN_WRITE_AS_ENCODING.h"cxx . . $ `<file>/sys/oo_CAN_WRITE_AS_ENCODING.h`/ |
| 28 | #include "WorkvectorPool_def.h"cxx . . $ `<file>/dwsys/WorkvectorPool_def.h`/ |
| 29 | #include "oo_READ_TEXT.h"cxx . . $ `<file>/sys/oo_READ_TEXT.h`/ |
| 30 | #include "WorkvectorPool_def.h"cxx . . $ `<file>/dwsys/WorkvectorPool_def.h`/ |
| 31 | #include "oo_WRITE_TEXT.h"cxx . . $ `<file>/sys/oo_WRITE_TEXT.h`/ |
| 32 | #include "WorkvectorPool_def.h"cxx . . $ `<file>/dwsys/WorkvectorPool_def.h`/ |
| 33 | #include "oo_READ_BINARY.h"cxx . . $ `<file>/sys/oo_READ_BINARY.h`/ |
| 34 | #include "WorkvectorPool_def.h"cxx . . $ `<file>/dwsys/WorkvectorPool_def.h`/ |
| 35 | #include "oo_WRITE_BINARY.h"cxx . . $ `<file>/sys/oo_WRITE_BINARY.h`/ |
| 36 | #include "WorkvectorPool_def.h"cxx . . $ `<file>/dwsys/WorkvectorPool_def.h`/ |
| 37 | #include "oo_DESCRIPTION.h"cxx . . $ `<file>/sys/oo_DESCRIPTION.h`/ |
| 38 | #include "WorkvectorPool_def.h"cxx . . $ `<file>/dwsys/WorkvectorPool_def.h`/ |
| 39 | |
| 40 | Thing_implementcxx . . $ `sys/Thing.h:65:9`! (WorkvectorPool, Daata, 0); |
| 41 | |
| 42 | autoWorkvectorPool WorkvectorPool_createcxx . . $ WorkvectorPool_create(e62654a5b603d687). (constINTVECcxx . . $ constINTVEC# const& vectorSizes, bool reusable) { |
| 43 | try { |
| 44 | autoWorkvectorPool me = Thing_newcxx . . $ `sys/Thing.h:514:9`! (WorkvectorPool); |
| 45 | mycxx . . $ `melder/melder.h:44:9`! numberOfVectors = vectorSizes.sizecxx . . $ constvector#size.; |
| 46 | Melder_assertcxx . . $ `melder/melder_assert.h:39:10`! (mycxx . . $ `melder/melder.h:44:9`! numberOfVectors > 0); |
| 47 | mycxx . . $ `melder/melder.h:44:9`! reusable = reusable; |
| 48 | |
| 49 | mycxx . . $ `melder/melder.h:44:9`! vectorStart =cxx . . $ autovector#`operator=`(f4f0443dbfdd1e40). raw_INTVECcxx . . $ raw_INTVEC(dab5d3ef28d6a25). (mycxx . . $ `melder/melder.h:44:9`! numberOfVectors); |
| 50 | integercxx . . $ integer# vecstart = 1; |
| 51 | for (integercxx . . $ integer# ivec = 1; ivec <= mycxx . . $ `melder/melder.h:44:9`! numberOfVectors; ivec ++) { |
| 52 | Melder_assertcxx . . $ `melder/melder_assert.h:39:10`! (vectorSizes [ivec] > 0); |
| 53 | mycxx . . $ `melder/melder.h:44:9`! vectorStart [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).ivec] = vecstart; |
| 54 | vecstart += vectorSizes [cxx . . $ constvector#`operator[]`(e616e229aa94bfcf).ivec]; |
| 55 | } |
| 56 | mycxx . . $ `melder/melder.h:44:9`! poolMemorySize = vecstart - 1; |
| 57 | mycxx . . $ `melder/melder.h:44:9`! vectorSizes =cxx . . $ autovector#`operator=`(f4f0443dbfdd1e40). copy_INTVECcxx . . $ copy_INTVEC(bcad8fc6381272ce). (vectorSizescxx . . $ constvectorview#constvectorview(fc39adb4395e9baf).); |
| 58 | mycxx . . $ `melder/melder.h:44:9`! inuse =cxx . . $ autovector#`operator=`(f4f0443dbfdd1e40). zero_BOOLVECcxx . . $ zero_BOOLVEC(ba622805578e0bb3). (mycxx . . $ `melder/melder.h:44:9`! numberOfVectors); |
| 59 | mycxx . . $ `melder/melder.h:44:9`! memoryPool =cxx . . $ autovector#`operator=`(f4f0443dbfdd1e40). raw_VECcxx . . $ raw_VEC(e4395f764b859b1e). (mycxx . . $ `melder/melder.h:44:9`! poolMemorySize); |
| 60 | return mecxx . . $ autoSomeThing#autoSomeThing(b79141a71f7bc86f).; |
| 61 | } catch (MelderErrorcxx . . $ MelderError#) { |
| 62 | Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (U"WorkvectorPool not created."); |
| 63 | } |
| 64 | } |
| 65 | |
| 66 | /* End of file WorkvectorPool.cpp */ |