ruby-hdf5 0.0.3 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/hdf5/attribute.rb +25 -10
- data/lib/hdf5/data_helpers.rb +153 -17
- data/lib/hdf5/dataset.rb +125 -64
- data/lib/hdf5/dtype.rb +22 -8
- data/lib/hdf5/ffi.rb +3 -3
- data/lib/hdf5/ffi_10.rb +0 -485
- data/lib/hdf5/ffi_14.rb +0 -479
- data/lib/hdf5/ffi_20.rb +0 -516
- data/lib/hdf5/file.rb +23 -5
- data/lib/hdf5/group.rb +23 -5
- data/lib/hdf5/hierarchy.rb +1 -1
- data/lib/hdf5/selection.rb +17 -1
- data/lib/hdf5/string_codec.rb +31 -18
- data/lib/hdf5/version.rb +1 -1
- metadata +1 -1
data/lib/hdf5/ffi_20.rb
CHANGED
|
@@ -198,39 +198,6 @@ module HDF5
|
|
|
198
198
|
|
|
199
199
|
ImaxdivT = Anon_Type_2
|
|
200
200
|
|
|
201
|
-
attach_function 'imaxabs', [
|
|
202
|
-
:intmax_t
|
|
203
|
-
], :intmax_t
|
|
204
|
-
|
|
205
|
-
attach_function 'imaxdiv', %i[
|
|
206
|
-
intmax_t
|
|
207
|
-
intmax_t
|
|
208
|
-
], ImaxdivT
|
|
209
|
-
|
|
210
|
-
attach_function 'strtoimax', %i[
|
|
211
|
-
string
|
|
212
|
-
pointer
|
|
213
|
-
int
|
|
214
|
-
], :intmax_t
|
|
215
|
-
|
|
216
|
-
attach_function 'strtoumax', %i[
|
|
217
|
-
string
|
|
218
|
-
pointer
|
|
219
|
-
int
|
|
220
|
-
], :uintmax_t
|
|
221
|
-
|
|
222
|
-
attach_function 'wcstoimax', %i[
|
|
223
|
-
pointer
|
|
224
|
-
pointer
|
|
225
|
-
int
|
|
226
|
-
], :intmax_t
|
|
227
|
-
|
|
228
|
-
attach_function 'wcstoumax', %i[
|
|
229
|
-
pointer
|
|
230
|
-
pointer
|
|
231
|
-
int
|
|
232
|
-
], :uintmax_t
|
|
233
|
-
|
|
234
201
|
typedef :pointer, :__gnuc_va_list
|
|
235
202
|
|
|
236
203
|
typedef :pointer, :va_list
|
|
@@ -373,23 +340,6 @@ module HDF5
|
|
|
373
340
|
|
|
374
341
|
typedef :__fd_mask, :fd_mask
|
|
375
342
|
|
|
376
|
-
attach_function 'select', [
|
|
377
|
-
:int,
|
|
378
|
-
FdSet.ptr,
|
|
379
|
-
FdSet.ptr,
|
|
380
|
-
FdSet.ptr,
|
|
381
|
-
Timeval.ptr
|
|
382
|
-
], :int
|
|
383
|
-
|
|
384
|
-
attach_function 'pselect', [
|
|
385
|
-
:int,
|
|
386
|
-
FdSet.ptr,
|
|
387
|
-
FdSet.ptr,
|
|
388
|
-
FdSet.ptr,
|
|
389
|
-
Timespec.ptr,
|
|
390
|
-
C_SigsetT.ptr
|
|
391
|
-
], :int
|
|
392
|
-
|
|
393
343
|
typedef :__blksize_t, :blksize_t
|
|
394
344
|
|
|
395
345
|
typedef :__blkcnt_t, :blkcnt_t
|
|
@@ -2950,195 +2900,6 @@ module HDF5
|
|
|
2950
2900
|
|
|
2951
2901
|
FposT = C_FposT
|
|
2952
2902
|
|
|
2953
|
-
attach_variable :stdin, :stdin, FILE.ptr
|
|
2954
|
-
|
|
2955
|
-
attach_variable :stdout, :stdout, FILE.ptr
|
|
2956
|
-
|
|
2957
|
-
attach_variable :stderr, :stderr, FILE.ptr
|
|
2958
|
-
|
|
2959
|
-
attach_function 'remove', [
|
|
2960
|
-
:string
|
|
2961
|
-
], :int
|
|
2962
|
-
|
|
2963
|
-
attach_function 'rename', %i[
|
|
2964
|
-
string
|
|
2965
|
-
string
|
|
2966
|
-
], :int
|
|
2967
|
-
|
|
2968
|
-
attach_function 'renameat', %i[
|
|
2969
|
-
int
|
|
2970
|
-
string
|
|
2971
|
-
int
|
|
2972
|
-
string
|
|
2973
|
-
], :int
|
|
2974
|
-
|
|
2975
|
-
attach_function 'fclose', [
|
|
2976
|
-
FILE.ptr
|
|
2977
|
-
], :int
|
|
2978
|
-
|
|
2979
|
-
attach_function 'tmpfile', [], FILE.ptr
|
|
2980
|
-
|
|
2981
|
-
attach_function 'tmpnam', [
|
|
2982
|
-
:pointer # [:char, 20]
|
|
2983
|
-
], :string
|
|
2984
|
-
|
|
2985
|
-
attach_function 'tmpnam_r', [
|
|
2986
|
-
:pointer # [:char, 20]
|
|
2987
|
-
], :string
|
|
2988
|
-
|
|
2989
|
-
attach_function 'tempnam', %i[
|
|
2990
|
-
string
|
|
2991
|
-
string
|
|
2992
|
-
], :string
|
|
2993
|
-
|
|
2994
|
-
attach_function 'fflush', [
|
|
2995
|
-
FILE.ptr
|
|
2996
|
-
], :int
|
|
2997
|
-
|
|
2998
|
-
attach_function 'fflush_unlocked', [
|
|
2999
|
-
FILE.ptr
|
|
3000
|
-
], :int
|
|
3001
|
-
|
|
3002
|
-
attach_function 'fopen', %i[
|
|
3003
|
-
string
|
|
3004
|
-
string
|
|
3005
|
-
], FILE.ptr
|
|
3006
|
-
|
|
3007
|
-
attach_function 'freopen', [
|
|
3008
|
-
:string,
|
|
3009
|
-
:string,
|
|
3010
|
-
FILE.ptr
|
|
3011
|
-
], FILE.ptr
|
|
3012
|
-
|
|
3013
|
-
attach_function 'fdopen', %i[
|
|
3014
|
-
int
|
|
3015
|
-
string
|
|
3016
|
-
], FILE.ptr
|
|
3017
|
-
|
|
3018
|
-
attach_function 'fopencookie', [
|
|
3019
|
-
:pointer,
|
|
3020
|
-
:string,
|
|
3021
|
-
CookieIoFunctionsT
|
|
3022
|
-
], FILE.ptr
|
|
3023
|
-
|
|
3024
|
-
attach_function 'fmemopen', %i[
|
|
3025
|
-
pointer
|
|
3026
|
-
size_t
|
|
3027
|
-
string
|
|
3028
|
-
], FILE.ptr
|
|
3029
|
-
|
|
3030
|
-
attach_function 'open_memstream', %i[
|
|
3031
|
-
pointer
|
|
3032
|
-
pointer
|
|
3033
|
-
], FILE.ptr
|
|
3034
|
-
|
|
3035
|
-
attach_function 'setbuf', [
|
|
3036
|
-
FILE.ptr,
|
|
3037
|
-
:string
|
|
3038
|
-
], :void
|
|
3039
|
-
|
|
3040
|
-
attach_function 'setvbuf', [
|
|
3041
|
-
FILE.ptr,
|
|
3042
|
-
:string,
|
|
3043
|
-
:int,
|
|
3044
|
-
:size_t
|
|
3045
|
-
], :int
|
|
3046
|
-
|
|
3047
|
-
attach_function 'setbuffer', [
|
|
3048
|
-
FILE.ptr,
|
|
3049
|
-
:string,
|
|
3050
|
-
:size_t
|
|
3051
|
-
], :void
|
|
3052
|
-
|
|
3053
|
-
attach_function 'setlinebuf', [
|
|
3054
|
-
FILE.ptr
|
|
3055
|
-
], :void
|
|
3056
|
-
|
|
3057
|
-
attach_function 'fprintf', [
|
|
3058
|
-
FILE.ptr,
|
|
3059
|
-
:string
|
|
3060
|
-
], :int
|
|
3061
|
-
|
|
3062
|
-
attach_function 'printf', [
|
|
3063
|
-
:string
|
|
3064
|
-
], :int
|
|
3065
|
-
|
|
3066
|
-
attach_function 'sprintf', %i[
|
|
3067
|
-
string
|
|
3068
|
-
string
|
|
3069
|
-
], :int
|
|
3070
|
-
|
|
3071
|
-
attach_function 'vfprintf', [
|
|
3072
|
-
FILE.ptr,
|
|
3073
|
-
:string,
|
|
3074
|
-
:__gnuc_va_list
|
|
3075
|
-
], :int
|
|
3076
|
-
|
|
3077
|
-
attach_function 'vprintf', %i[
|
|
3078
|
-
string
|
|
3079
|
-
__gnuc_va_list
|
|
3080
|
-
], :int
|
|
3081
|
-
|
|
3082
|
-
attach_function 'vsprintf', %i[
|
|
3083
|
-
string
|
|
3084
|
-
string
|
|
3085
|
-
__gnuc_va_list
|
|
3086
|
-
], :int
|
|
3087
|
-
|
|
3088
|
-
attach_function 'snprintf', %i[
|
|
3089
|
-
string
|
|
3090
|
-
size_t
|
|
3091
|
-
string
|
|
3092
|
-
], :int
|
|
3093
|
-
|
|
3094
|
-
attach_function 'vsnprintf', %i[
|
|
3095
|
-
string
|
|
3096
|
-
size_t
|
|
3097
|
-
string
|
|
3098
|
-
__gnuc_va_list
|
|
3099
|
-
], :int
|
|
3100
|
-
|
|
3101
|
-
attach_function 'vasprintf', %i[
|
|
3102
|
-
pointer
|
|
3103
|
-
string
|
|
3104
|
-
__gnuc_va_list
|
|
3105
|
-
], :int
|
|
3106
|
-
|
|
3107
|
-
attach_function '__asprintf', %i[
|
|
3108
|
-
pointer
|
|
3109
|
-
string
|
|
3110
|
-
], :int
|
|
3111
|
-
|
|
3112
|
-
attach_function 'asprintf', %i[
|
|
3113
|
-
pointer
|
|
3114
|
-
string
|
|
3115
|
-
], :int
|
|
3116
|
-
|
|
3117
|
-
attach_function 'vdprintf', %i[
|
|
3118
|
-
int
|
|
3119
|
-
string
|
|
3120
|
-
__gnuc_va_list
|
|
3121
|
-
], :int
|
|
3122
|
-
|
|
3123
|
-
attach_function 'dprintf', %i[
|
|
3124
|
-
int
|
|
3125
|
-
string
|
|
3126
|
-
], :int
|
|
3127
|
-
|
|
3128
|
-
attach_function 'fscanf', [
|
|
3129
|
-
FILE.ptr,
|
|
3130
|
-
:string
|
|
3131
|
-
], :int
|
|
3132
|
-
|
|
3133
|
-
attach_function 'scanf', [
|
|
3134
|
-
:string
|
|
3135
|
-
], :int
|
|
3136
|
-
|
|
3137
|
-
attach_function 'sscanf', %i[
|
|
3138
|
-
string
|
|
3139
|
-
string
|
|
3140
|
-
], :int
|
|
3141
|
-
|
|
3142
2903
|
typedef :float, :_Float32
|
|
3143
2904
|
|
|
3144
2905
|
typedef :double, :_Float64
|
|
@@ -3147,283 +2908,6 @@ module HDF5
|
|
|
3147
2908
|
|
|
3148
2909
|
typedef :long_double, :_Float64x
|
|
3149
2910
|
|
|
3150
|
-
attach_function 'fscanf', [
|
|
3151
|
-
FILE.ptr,
|
|
3152
|
-
:string
|
|
3153
|
-
], :int
|
|
3154
|
-
|
|
3155
|
-
attach_function 'scanf', [
|
|
3156
|
-
:string
|
|
3157
|
-
], :int
|
|
3158
|
-
|
|
3159
|
-
attach_function 'sscanf', %i[
|
|
3160
|
-
string
|
|
3161
|
-
string
|
|
3162
|
-
], :int
|
|
3163
|
-
|
|
3164
|
-
attach_function 'vfscanf', [
|
|
3165
|
-
FILE.ptr,
|
|
3166
|
-
:string,
|
|
3167
|
-
:__gnuc_va_list
|
|
3168
|
-
], :int
|
|
3169
|
-
|
|
3170
|
-
attach_function 'vscanf', %i[
|
|
3171
|
-
string
|
|
3172
|
-
__gnuc_va_list
|
|
3173
|
-
], :int
|
|
3174
|
-
|
|
3175
|
-
attach_function 'vsscanf', %i[
|
|
3176
|
-
string
|
|
3177
|
-
string
|
|
3178
|
-
__gnuc_va_list
|
|
3179
|
-
], :int
|
|
3180
|
-
|
|
3181
|
-
attach_function 'vfscanf', [
|
|
3182
|
-
FILE.ptr,
|
|
3183
|
-
:string,
|
|
3184
|
-
:__gnuc_va_list
|
|
3185
|
-
], :int
|
|
3186
|
-
|
|
3187
|
-
attach_function 'vscanf', %i[
|
|
3188
|
-
string
|
|
3189
|
-
__gnuc_va_list
|
|
3190
|
-
], :int
|
|
3191
|
-
|
|
3192
|
-
attach_function 'vsscanf', %i[
|
|
3193
|
-
string
|
|
3194
|
-
string
|
|
3195
|
-
__gnuc_va_list
|
|
3196
|
-
], :int
|
|
3197
|
-
|
|
3198
|
-
attach_function 'fgetc', [
|
|
3199
|
-
FILE.ptr
|
|
3200
|
-
], :int
|
|
3201
|
-
|
|
3202
|
-
attach_function 'getc', [
|
|
3203
|
-
FILE.ptr
|
|
3204
|
-
], :int
|
|
3205
|
-
|
|
3206
|
-
attach_function 'getchar', [], :int
|
|
3207
|
-
|
|
3208
|
-
attach_function 'getc_unlocked', [
|
|
3209
|
-
FILE.ptr
|
|
3210
|
-
], :int
|
|
3211
|
-
|
|
3212
|
-
attach_function 'getchar_unlocked', [], :int
|
|
3213
|
-
|
|
3214
|
-
attach_function 'fgetc_unlocked', [
|
|
3215
|
-
FILE.ptr
|
|
3216
|
-
], :int
|
|
3217
|
-
|
|
3218
|
-
attach_function 'fputc', [
|
|
3219
|
-
:int,
|
|
3220
|
-
FILE.ptr
|
|
3221
|
-
], :int
|
|
3222
|
-
|
|
3223
|
-
attach_function 'putc', [
|
|
3224
|
-
:int,
|
|
3225
|
-
FILE.ptr
|
|
3226
|
-
], :int
|
|
3227
|
-
|
|
3228
|
-
attach_function 'putchar', [
|
|
3229
|
-
:int
|
|
3230
|
-
], :int
|
|
3231
|
-
|
|
3232
|
-
attach_function 'fputc_unlocked', [
|
|
3233
|
-
:int,
|
|
3234
|
-
FILE.ptr
|
|
3235
|
-
], :int
|
|
3236
|
-
|
|
3237
|
-
attach_function 'putc_unlocked', [
|
|
3238
|
-
:int,
|
|
3239
|
-
FILE.ptr
|
|
3240
|
-
], :int
|
|
3241
|
-
|
|
3242
|
-
attach_function 'putchar_unlocked', [
|
|
3243
|
-
:int
|
|
3244
|
-
], :int
|
|
3245
|
-
|
|
3246
|
-
attach_function 'getw', [
|
|
3247
|
-
FILE.ptr
|
|
3248
|
-
], :int
|
|
3249
|
-
|
|
3250
|
-
attach_function 'putw', [
|
|
3251
|
-
:int,
|
|
3252
|
-
FILE.ptr
|
|
3253
|
-
], :int
|
|
3254
|
-
|
|
3255
|
-
attach_function 'fgets', [
|
|
3256
|
-
:string,
|
|
3257
|
-
:int,
|
|
3258
|
-
FILE.ptr
|
|
3259
|
-
], :string
|
|
3260
|
-
|
|
3261
|
-
attach_function '__getdelim', [
|
|
3262
|
-
:pointer,
|
|
3263
|
-
:pointer,
|
|
3264
|
-
:int,
|
|
3265
|
-
FILE.ptr
|
|
3266
|
-
], :__ssize_t
|
|
3267
|
-
|
|
3268
|
-
attach_function 'getdelim', [
|
|
3269
|
-
:pointer,
|
|
3270
|
-
:pointer,
|
|
3271
|
-
:int,
|
|
3272
|
-
FILE.ptr
|
|
3273
|
-
], :__ssize_t
|
|
3274
|
-
|
|
3275
|
-
attach_function 'getline', [
|
|
3276
|
-
:pointer,
|
|
3277
|
-
:pointer,
|
|
3278
|
-
FILE.ptr
|
|
3279
|
-
], :__ssize_t
|
|
3280
|
-
|
|
3281
|
-
attach_function 'fputs', [
|
|
3282
|
-
:string,
|
|
3283
|
-
FILE.ptr
|
|
3284
|
-
], :int
|
|
3285
|
-
|
|
3286
|
-
attach_function 'puts', [
|
|
3287
|
-
:string
|
|
3288
|
-
], :int
|
|
3289
|
-
|
|
3290
|
-
attach_function 'ungetc', [
|
|
3291
|
-
:int,
|
|
3292
|
-
FILE.ptr
|
|
3293
|
-
], :int
|
|
3294
|
-
|
|
3295
|
-
attach_function 'fread', [
|
|
3296
|
-
:pointer,
|
|
3297
|
-
:size_t,
|
|
3298
|
-
:size_t,
|
|
3299
|
-
FILE.ptr
|
|
3300
|
-
], :ulong
|
|
3301
|
-
|
|
3302
|
-
attach_function 'fwrite', [
|
|
3303
|
-
:pointer,
|
|
3304
|
-
:size_t,
|
|
3305
|
-
:size_t,
|
|
3306
|
-
FILE.ptr
|
|
3307
|
-
], :ulong
|
|
3308
|
-
|
|
3309
|
-
attach_function 'fread_unlocked', [
|
|
3310
|
-
:pointer,
|
|
3311
|
-
:size_t,
|
|
3312
|
-
:size_t,
|
|
3313
|
-
FILE.ptr
|
|
3314
|
-
], :size_t
|
|
3315
|
-
|
|
3316
|
-
attach_function 'fwrite_unlocked', [
|
|
3317
|
-
:pointer,
|
|
3318
|
-
:size_t,
|
|
3319
|
-
:size_t,
|
|
3320
|
-
FILE.ptr
|
|
3321
|
-
], :size_t
|
|
3322
|
-
|
|
3323
|
-
attach_function 'fseek', [
|
|
3324
|
-
FILE.ptr,
|
|
3325
|
-
:long,
|
|
3326
|
-
:int
|
|
3327
|
-
], :int
|
|
3328
|
-
|
|
3329
|
-
attach_function 'ftell', [
|
|
3330
|
-
FILE.ptr
|
|
3331
|
-
], :long
|
|
3332
|
-
|
|
3333
|
-
attach_function 'rewind', [
|
|
3334
|
-
FILE.ptr
|
|
3335
|
-
], :void
|
|
3336
|
-
|
|
3337
|
-
attach_function 'fseeko', [
|
|
3338
|
-
FILE.ptr,
|
|
3339
|
-
:__off_t,
|
|
3340
|
-
:int
|
|
3341
|
-
], :int
|
|
3342
|
-
|
|
3343
|
-
attach_function 'ftello', [
|
|
3344
|
-
FILE.ptr
|
|
3345
|
-
], :__off_t
|
|
3346
|
-
|
|
3347
|
-
attach_function 'fgetpos', [
|
|
3348
|
-
FILE.ptr,
|
|
3349
|
-
FposT.ptr
|
|
3350
|
-
], :int
|
|
3351
|
-
|
|
3352
|
-
attach_function 'fsetpos', [
|
|
3353
|
-
FILE.ptr,
|
|
3354
|
-
FposT.ptr
|
|
3355
|
-
], :int
|
|
3356
|
-
|
|
3357
|
-
attach_function 'clearerr', [
|
|
3358
|
-
FILE.ptr
|
|
3359
|
-
], :void
|
|
3360
|
-
|
|
3361
|
-
attach_function 'feof', [
|
|
3362
|
-
FILE.ptr
|
|
3363
|
-
], :int
|
|
3364
|
-
|
|
3365
|
-
attach_function 'ferror', [
|
|
3366
|
-
FILE.ptr
|
|
3367
|
-
], :int
|
|
3368
|
-
|
|
3369
|
-
attach_function 'clearerr_unlocked', [
|
|
3370
|
-
FILE.ptr
|
|
3371
|
-
], :void
|
|
3372
|
-
|
|
3373
|
-
attach_function 'feof_unlocked', [
|
|
3374
|
-
FILE.ptr
|
|
3375
|
-
], :int
|
|
3376
|
-
|
|
3377
|
-
attach_function 'ferror_unlocked', [
|
|
3378
|
-
FILE.ptr
|
|
3379
|
-
], :int
|
|
3380
|
-
|
|
3381
|
-
attach_function 'perror', [
|
|
3382
|
-
:string
|
|
3383
|
-
], :void
|
|
3384
|
-
|
|
3385
|
-
attach_function 'fileno', [
|
|
3386
|
-
FILE.ptr
|
|
3387
|
-
], :int
|
|
3388
|
-
|
|
3389
|
-
attach_function 'fileno_unlocked', [
|
|
3390
|
-
FILE.ptr
|
|
3391
|
-
], :int
|
|
3392
|
-
|
|
3393
|
-
attach_function 'pclose', [
|
|
3394
|
-
FILE.ptr
|
|
3395
|
-
], :int
|
|
3396
|
-
|
|
3397
|
-
attach_function 'popen', %i[
|
|
3398
|
-
string
|
|
3399
|
-
string
|
|
3400
|
-
], FILE.ptr
|
|
3401
|
-
|
|
3402
|
-
attach_function 'ctermid', [
|
|
3403
|
-
:string
|
|
3404
|
-
], :string
|
|
3405
|
-
|
|
3406
|
-
attach_function 'flockfile', [
|
|
3407
|
-
FILE.ptr
|
|
3408
|
-
], :void
|
|
3409
|
-
|
|
3410
|
-
attach_function 'ftrylockfile', [
|
|
3411
|
-
FILE.ptr
|
|
3412
|
-
], :int
|
|
3413
|
-
|
|
3414
|
-
attach_function 'funlockfile', [
|
|
3415
|
-
FILE.ptr
|
|
3416
|
-
], :void
|
|
3417
|
-
|
|
3418
|
-
attach_function '__uflow', [
|
|
3419
|
-
FILE.ptr
|
|
3420
|
-
], :int
|
|
3421
|
-
|
|
3422
|
-
attach_function '__overflow', [
|
|
3423
|
-
FILE.ptr,
|
|
3424
|
-
:int
|
|
3425
|
-
], :int
|
|
3426
|
-
|
|
3427
2911
|
enum :H5E_type_t, [
|
|
3428
2912
|
:H5E_MAJOR, 0,
|
|
3429
2913
|
:H5E_MINOR, 1
|
data/lib/hdf5/file.rb
CHANGED
|
@@ -88,13 +88,31 @@ module HDF5
|
|
|
88
88
|
end
|
|
89
89
|
|
|
90
90
|
def create_group(name, &block)
|
|
91
|
-
|
|
92
|
-
|
|
91
|
+
group = @context.synchronize do
|
|
92
|
+
ensure_open!
|
|
93
|
+
Group.create(@file_id, name, @context)
|
|
94
|
+
end
|
|
95
|
+
return group unless block
|
|
96
|
+
|
|
97
|
+
begin
|
|
98
|
+
block.call(group)
|
|
99
|
+
ensure
|
|
100
|
+
group.close
|
|
101
|
+
end
|
|
93
102
|
end
|
|
94
103
|
|
|
95
104
|
def create_dataset(name, data = nil, **options, &block)
|
|
96
|
-
|
|
97
|
-
|
|
105
|
+
dataset = @context.synchronize do
|
|
106
|
+
ensure_open!
|
|
107
|
+
Dataset.create(@file_id, name, data, context: @context, **options)
|
|
108
|
+
end
|
|
109
|
+
return dataset unless block
|
|
110
|
+
|
|
111
|
+
begin
|
|
112
|
+
block.call(dataset)
|
|
113
|
+
ensure
|
|
114
|
+
dataset.close
|
|
115
|
+
end
|
|
98
116
|
end
|
|
99
117
|
|
|
100
118
|
def list_entries
|
|
@@ -179,6 +197,6 @@ module HDF5
|
|
|
179
197
|
info[:type] == :H5O_TYPE_DATASET
|
|
180
198
|
end
|
|
181
199
|
|
|
182
|
-
prepend FileContext.guard(:flush, :
|
|
200
|
+
prepend FileContext.guard(:flush, :list_entries, :[], :attrs, :close, :closed?)
|
|
183
201
|
end
|
|
184
202
|
end
|
data/lib/hdf5/group.rb
CHANGED
|
@@ -53,13 +53,31 @@ module HDF5
|
|
|
53
53
|
end
|
|
54
54
|
|
|
55
55
|
def create_group(name, &block)
|
|
56
|
-
|
|
57
|
-
|
|
56
|
+
group = HDF5::FFI::CALL_LOCK.synchronize do
|
|
57
|
+
ensure_open!
|
|
58
|
+
self.class.create(@group_id, name, @context)
|
|
59
|
+
end
|
|
60
|
+
return group unless block
|
|
61
|
+
|
|
62
|
+
begin
|
|
63
|
+
block.call(group)
|
|
64
|
+
ensure
|
|
65
|
+
group.close
|
|
66
|
+
end
|
|
58
67
|
end
|
|
59
68
|
|
|
60
69
|
def create_dataset(name, data = nil, **options, &block)
|
|
61
|
-
|
|
62
|
-
|
|
70
|
+
dataset = HDF5::FFI::CALL_LOCK.synchronize do
|
|
71
|
+
ensure_open!
|
|
72
|
+
Dataset.create(@group_id, name, data, context: @context, **options)
|
|
73
|
+
end
|
|
74
|
+
return dataset unless block
|
|
75
|
+
|
|
76
|
+
begin
|
|
77
|
+
block.call(dataset)
|
|
78
|
+
ensure
|
|
79
|
+
dataset.close
|
|
80
|
+
end
|
|
63
81
|
end
|
|
64
82
|
|
|
65
83
|
def list_entries
|
|
@@ -148,6 +166,6 @@ module HDF5
|
|
|
148
166
|
info[:type] == :H5O_TYPE_DATASET
|
|
149
167
|
end
|
|
150
168
|
|
|
151
|
-
prepend FileContext.guard(:
|
|
169
|
+
prepend FileContext.guard(:list_entries, :list_datasets, :[], :attrs, :close, :closed?)
|
|
152
170
|
end
|
|
153
171
|
end
|
data/lib/hdf5/hierarchy.rb
CHANGED
data/lib/hdf5/selection.rb
CHANGED
|
@@ -17,8 +17,10 @@ module HDF5
|
|
|
17
17
|
@stride = []
|
|
18
18
|
@count = []
|
|
19
19
|
@result_shape = []
|
|
20
|
+
@result_axes = []
|
|
20
21
|
|
|
21
|
-
selectors.zip(shape).
|
|
22
|
+
selectors.zip(shape).each_with_index do |(selector, dimension), axis|
|
|
23
|
+
@result_axes << axis unless selector.is_a?(Integer)
|
|
22
24
|
normalize_axis(selector, dimension)
|
|
23
25
|
end
|
|
24
26
|
end
|
|
@@ -31,6 +33,20 @@ module HDF5
|
|
|
31
33
|
count.inject(1, :*)
|
|
32
34
|
end
|
|
33
35
|
|
|
36
|
+
def block(ranges)
|
|
37
|
+
result = dup
|
|
38
|
+
starts = start.dup
|
|
39
|
+
counts = count.dup
|
|
40
|
+
@result_axes.zip(ranges).each do |axis, range|
|
|
41
|
+
starts[axis] += range.begin * stride[axis]
|
|
42
|
+
counts[axis] = range.end - range.begin
|
|
43
|
+
end
|
|
44
|
+
result.instance_variable_set(:@start, starts)
|
|
45
|
+
result.instance_variable_set(:@count, counts)
|
|
46
|
+
result.instance_variable_set(:@result_shape, ranges.map { |range| range.end - range.begin })
|
|
47
|
+
result
|
|
48
|
+
end
|
|
49
|
+
|
|
34
50
|
private
|
|
35
51
|
|
|
36
52
|
def normalize_axis(selector, dimension)
|