comparison main/fixed/src/ov-fixed-complex.cc @ 11278:2deb6b24d293 octave-forge

Use HAVE_HDF5_18 macro to account for HDF5 API changes
author jordigh
date Fri, 30 Nov 2012 20:13:45 +0000
parents 58d36e8880db
children
comparison
equal deleted inserted replaced
11277:7b7cd174847c 11278:2deb6b24d293
347 bool 347 bool
348 octave_fixed_complex::save_hdf5 (hid_t loc_id, const char *name, 348 octave_fixed_complex::save_hdf5 (hid_t loc_id, const char *name,
349 bool save_as_floats) 349 bool save_as_floats)
350 { 350 {
351 hid_t group_hid = -1; 351 hid_t group_hid = -1;
352
353 #if HAVE_HDF5_18
352 group_hid = H5Gcreate (loc_id, name, 0, H5P_DEFAULT, H5P_DEFAULT); 354 group_hid = H5Gcreate (loc_id, name, 0, H5P_DEFAULT, H5P_DEFAULT);
355 #else
356 group_hid = H5Gcreate (loc_id, name, 0);
357 #endif
358
353 if (group_hid < 0 ) return false; 359 if (group_hid < 0 ) return false;
354 360
355 hsize_t dims[3]; 361 hsize_t dims[3];
356 hid_t space_hid = -1, data_hid = -1, type_hid = -1; 362 hid_t space_hid = -1, data_hid = -1, type_hid = -1;
357 bool retval = true; 363 bool retval = true;
369 H5Sclose (space_hid); 375 H5Sclose (space_hid);
370 H5Gclose (group_hid); 376 H5Gclose (group_hid);
371 return false; 377 return false;
372 } 378 }
373 379
380 #if HAVE_HDF5_18
374 data_hid = H5Dcreate (group_hid, "int", type_hid, space_hid, H5P_DEFAULT, 381 data_hid = H5Dcreate (group_hid, "int", type_hid, space_hid, H5P_DEFAULT,
375 H5P_DEFAULT, H5P_DEFAULT); 382 H5P_DEFAULT, H5P_DEFAULT);
383 #else
384 data_hid = H5Dcreate (group_hid, "int", type_hid, space_hid, H5P_DEFAULT);
385 #endif
386
376 if (data_hid < 0) 387 if (data_hid < 0)
377 { 388 {
378 H5Sclose (space_hid); 389 H5Sclose (space_hid);
379 H5Tclose (type_hid); 390 H5Tclose (type_hid);
380 H5Gclose (group_hid); 391 H5Gclose (group_hid);
394 H5Tclose (type_hid); 405 H5Tclose (type_hid);
395 H5Gclose (group_hid); 406 H5Gclose (group_hid);
396 return false; 407 return false;
397 } 408 }
398 409
410 #if HAVE_HDF5_18
399 data_hid = H5Dcreate (group_hid, "dec", type_hid, space_hid, H5P_DEFAULT, 411 data_hid = H5Dcreate (group_hid, "dec", type_hid, space_hid, H5P_DEFAULT,
400 H5P_DEFAULT, H5P_DEFAULT); 412 H5P_DEFAULT, H5P_DEFAULT);
413 #else
414 data_hid = H5Dcreate (group_hid, "dec", type_hid, space_hid, H5P_DEFAULT);
415 #endif
416
401 if (data_hid < 0) 417 if (data_hid < 0)
402 { 418 {
403 H5Sclose (space_hid); 419 H5Sclose (space_hid);
404 H5Tclose (type_hid); 420 H5Tclose (type_hid);
405 H5Gclose (group_hid); 421 H5Gclose (group_hid);
427 H5Sclose (space_hid); 443 H5Sclose (space_hid);
428 H5Gclose (group_hid); 444 H5Gclose (group_hid);
429 return false; 445 return false;
430 } 446 }
431 447
448 #if HAVE_HDF5_18
432 data_hid = H5Dcreate (group_hid, "num", type_hid, space_hid, H5P_DEFAULT, 449 data_hid = H5Dcreate (group_hid, "num", type_hid, space_hid, H5P_DEFAULT,
433 H5P_DEFAULT, H5P_DEFAULT); 450 H5P_DEFAULT, H5P_DEFAULT);
451 #else
452 data_hid = H5Dcreate (group_hid, "num", type_hid, space_hid, H5P_DEFAULT);
453 #endif
454
434 if (data_hid < 0) 455 if (data_hid < 0)
435 { 456 {
436 H5Sclose (space_hid); 457 H5Sclose (space_hid);
437 H5Tclose (type_hid); 458 H5Tclose (type_hid);
438 H5Gclose (group_hid); 459 H5Gclose (group_hid);
459 char intsize[2], decsize[2]; 480 char intsize[2], decsize[2];
460 unsigned int number[2]; 481 unsigned int number[2];
461 hid_t group_hid, data_hid, type_hid, space_id; 482 hid_t group_hid, data_hid, type_hid, space_id;
462 hsize_t rank; 483 hsize_t rank;
463 484
485 #if HAVE_HDF5_18
464 group_hid = H5Gopen (loc_id, name, H5P_DEFAULT); 486 group_hid = H5Gopen (loc_id, name, H5P_DEFAULT);
487 #else
488 group_hid = H5Gopen (loc_id, name);
489 #endif
490
465 if (group_hid < 0 ) return false; 491 if (group_hid < 0 ) return false;
466 492
467 hid_t complex_type = hdf5_make_fixed_complex_type (H5T_NATIVE_UCHAR, 1); 493 hid_t complex_type = hdf5_make_fixed_complex_type (H5T_NATIVE_UCHAR, 1);
468 494
495 #if HAVE_HDF5_18
469 data_hid = H5Dopen (group_hid, "int", H5P_DEFAULT); 496 data_hid = H5Dopen (group_hid, "int", H5P_DEFAULT);
497 #else
498 data_hid = H5Dopen (group_hid, "int");
499 #endif
500
470 type_hid = H5Dget_type (data_hid); 501 type_hid = H5Dget_type (data_hid);
471 502
472 if (! hdf5_types_compatible (type_hid, complex_type)) 503 if (! hdf5_types_compatible (type_hid, complex_type))
473 { 504 {
474 H5Tclose(complex_type); 505 H5Tclose(complex_type);
500 return false; 531 return false;
501 } 532 }
502 533
503 H5Tclose(type_hid); 534 H5Tclose(type_hid);
504 H5Dclose (data_hid); 535 H5Dclose (data_hid);
536
537 #if HAVE_HDF5_18
505 data_hid = H5Dopen (group_hid, "dec", H5P_DEFAULT); 538 data_hid = H5Dopen (group_hid, "dec", H5P_DEFAULT);
539 #else
540 data_hid = H5Dopen (group_hid, "dec");
541 #endif
542
506 type_hid = H5Dget_type (data_hid); 543 type_hid = H5Dget_type (data_hid);
507 544
508 if (! hdf5_types_compatible (type_hid, complex_type)) 545 if (! hdf5_types_compatible (type_hid, complex_type))
509 { 546 {
510 H5Tclose(complex_type); 547 H5Tclose(complex_type);
540 H5Tclose(type_hid); 577 H5Tclose(type_hid);
541 H5Dclose (data_hid); 578 H5Dclose (data_hid);
542 579
543 complex_type = hdf5_make_fixed_complex_type (H5T_NATIVE_UINT, 580 complex_type = hdf5_make_fixed_complex_type (H5T_NATIVE_UINT,
544 sizeof(unsigned int)); 581 sizeof(unsigned int));
582
583 #if HAVE_HDF5_18
545 data_hid = H5Dopen (group_hid, "num", H5P_DEFAULT); 584 data_hid = H5Dopen (group_hid, "num", H5P_DEFAULT);
585 #else
586 data_hid = H5Dopen (group_hid, "num");
587 #endif
588
546 type_hid = H5Dget_type (data_hid); 589 type_hid = H5Dget_type (data_hid);
547 590
548 if (! hdf5_types_compatible (type_hid, complex_type)) 591 if (! hdf5_types_compatible (type_hid, complex_type))
549 { 592 {
550 H5Tclose(complex_type); 593 H5Tclose(complex_type);