annotate libinterp/octave-value/ov-uint8.cc @ 24224:ff81c6772664

avoid issue with link-time optimization With link-time optimization, the value used for the HDF5 save type was not working correctly for Octave int types. It seems that the templated load and save functions were recognized as duplicates and only one version was used, even though they needed to be different. This patch attempts to avoid that. * ov-base-int.h, ov-base-int.cc (octave_base_int<T>::load_hdf5_internal): Rename from octave_base_int<T>::load_hdf5. Pass HDF5 save type as arg. (octave_base_int<T>::save_hdf5_internal): Rename from octave_base_int<T>::save_hdf5. Pass HDF5 save type as arg. * ov-intx.h (OCTAVE_VALUE_INT_MATRIX_T::load_hdf5, OCTAVE_VALUE_INT_MATRIX_T::save_hdf5, OCTAVE_VALUE_INT_SCALAR_T:load_hdf5, OCTAVE_VALUE_INT_SCALAR_T:save_hdf5): New declarations. * ov-int16.cc, ov-int32.cc, ov-int64.cc, ov-int8.cc, ov-uint16.cc, ov-uint32.cc, ov-uint64.cc, ov-uint8.cc: Define load_hdf5 and save_hdf5 functions.
author John W. Eaton <jwe@octave.org>
date Thu, 09 Nov 2017 18:20:19 -0500
parents 092078913d54
children b8cb5a05955e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4901
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents:
diff changeset
1 /*
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents:
diff changeset
2
23219
3ac9f9ecfae5 maint: Update copyright dates.
John W. Eaton <jwe@octave.org>
parents: 23083
diff changeset
3 Copyright (C) 2004-2017 John W. Eaton
4901
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents:
diff changeset
4
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents:
diff changeset
5 This file is part of Octave.
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents:
diff changeset
6
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents:
diff changeset
7 Octave is free software; you can redistribute it and/or modify it
22755
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22407
diff changeset
8 under the terms of the GNU General Public License as published by
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22407
diff changeset
9 the Free Software Foundation; either version 3 of the License, or
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22407
diff changeset
10 (at your option) any later version.
4901
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents:
diff changeset
11
22755
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22407
diff changeset
12 Octave is distributed in the hope that it will be useful, but
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22407
diff changeset
13 WITHOUT ANY WARRANTY; without even the implied warranty of
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22407
diff changeset
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22407
diff changeset
15 GNU General Public License for more details.
4901
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents:
diff changeset
16
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents:
diff changeset
17 You should have received a copy of the GNU General Public License
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 5307
diff changeset
18 along with Octave; see the file COPYING. If not, see
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 5307
diff changeset
19 <http://www.gnu.org/licenses/>.
4901
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents:
diff changeset
20
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents:
diff changeset
21 */
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents:
diff changeset
22
21724
aba2e6293dd8 use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents: 21574
diff changeset
23 #if defined (HAVE_CONFIG_H)
21301
40de9f8f23a6 Use '#include "config.h"' rather than <config.h>.
Rik <rik@octave.org>
parents: 21200
diff changeset
24 # include "config.h"
4901
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents:
diff changeset
25 #endif
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents:
diff changeset
26
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents:
diff changeset
27 #include <iostream>
15215
9020dddc925a use std::numeric_limits for integer max and min values
John W. Eaton <jwe@octave.org>
parents: 15195
diff changeset
28 #include <limits>
4901
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents:
diff changeset
29
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents:
diff changeset
30 #include "lo-ieee.h"
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents:
diff changeset
31 #include "lo-utils.h"
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents:
diff changeset
32 #include "mx-base.h"
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents:
diff changeset
33 #include "quit.h"
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents:
diff changeset
34
21100
e39e05d90788 Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents: 20940
diff changeset
35 #include "errwarn.h"
4901
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents:
diff changeset
36 #include "oct-lvalue.h"
19863
09ed6f7538dd avoid needing to include hdf5 in public header files (bug #44370, #43180)
John W. Eaton <jwe@octave.org> and Mike Miller <mtmiller@ieee.org>
parents: 19697
diff changeset
37 #include "oct-hdf5.h"
4901
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents:
diff changeset
38 #include "ops.h"
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents:
diff changeset
39 #include "ov-base.h"
4917
f69e95587ba3 [project @ 2004-07-27 14:03:03 by jwe]
jwe
parents: 4901
diff changeset
40
20257
d54aa96abadf Fix load/save of integers with -hdf5 (bug #45225)
Mike Miller <mtmiller@octave.org>
parents: 19863
diff changeset
41 #if defined (HAVE_HDF5)
21200
fcac5dbbf9ed maint: Indent #ifdef blocks in libinterp.
Rik <rik@octave.org>
parents: 21100
diff changeset
42 # define HDF5_SAVE_TYPE H5T_NATIVE_UINT8
24224
ff81c6772664 avoid issue with link-time optimization
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
43 #else
ff81c6772664 avoid issue with link-time optimization
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
44 // This value will not be used.
ff81c6772664 avoid issue with link-time optimization
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
45 # define HDF5_SAVE_TYPE 0
20257
d54aa96abadf Fix load/save of integers with -hdf5 (bug #45225)
Mike Miller <mtmiller@octave.org>
parents: 19863
diff changeset
46 #endif
d54aa96abadf Fix load/save of integers with -hdf5 (bug #45225)
Mike Miller <mtmiller@octave.org>
parents: 19863
diff changeset
47
4901
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents:
diff changeset
48 #include "ov-base-int.h"
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents:
diff changeset
49 #include "ov-base-int.cc"
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents:
diff changeset
50 #include "ov-uint8.h"
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents:
diff changeset
51 #include "pr-output.h"
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents:
diff changeset
52 #include "variables.h"
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents:
diff changeset
53
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents:
diff changeset
54 #include "byte-swap.h"
20447
c6224b4e7774 maint: Rename instances of LS_ASCII to LS_TEXT for clarity.
Rik <rik@octave.org>
parents: 20257
diff changeset
55 #include "ls-oct-text.h"
4901
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents:
diff changeset
56 #include "ls-utils.h"
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents:
diff changeset
57 #include "ls-hdf5.h"
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents:
diff changeset
58
21573
f3f8e1d3e399 avoid mulitple definitions of static function-scope vars (bug #47372)
John W. Eaton <jwe@octave.org>
parents: 20257
diff changeset
59 // Prevent implicit instantiations on some systems (Windows, others?)
f3f8e1d3e399 avoid mulitple definitions of static function-scope vars (bug #47372)
John W. Eaton <jwe@octave.org>
parents: 20257
diff changeset
60 // that can lead to duplicate definitions of static data members.
f3f8e1d3e399 avoid mulitple definitions of static function-scope vars (bug #47372)
John W. Eaton <jwe@octave.org>
parents: 20257
diff changeset
61
f3f8e1d3e399 avoid mulitple definitions of static function-scope vars (bug #47372)
John W. Eaton <jwe@octave.org>
parents: 20257
diff changeset
62 extern template class OCTINTERP_API octave_base_scalar<double>;
f3f8e1d3e399 avoid mulitple definitions of static function-scope vars (bug #47372)
John W. Eaton <jwe@octave.org>
parents: 20257
diff changeset
63
4901
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents:
diff changeset
64 template class octave_base_matrix<uint8NDArray>;
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents:
diff changeset
65
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents:
diff changeset
66 template class octave_base_int_matrix<uint8NDArray>;
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents:
diff changeset
67
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents:
diff changeset
68 DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_uint8_matrix,
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
69 "uint8 matrix", "uint8");
4901
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents:
diff changeset
70
24224
ff81c6772664 avoid issue with link-time optimization
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
71 bool
ff81c6772664 avoid issue with link-time optimization
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
72 octave_uint8_matrix::save_hdf5 (octave_hdf5_id loc_id, const char *name,
ff81c6772664 avoid issue with link-time optimization
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
73 bool flag)
ff81c6772664 avoid issue with link-time optimization
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
74 {
ff81c6772664 avoid issue with link-time optimization
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
75 return save_hdf5_internal (loc_id, HDF5_SAVE_TYPE, name, flag);
ff81c6772664 avoid issue with link-time optimization
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
76 }
ff81c6772664 avoid issue with link-time optimization
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
77
ff81c6772664 avoid issue with link-time optimization
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
78 bool
ff81c6772664 avoid issue with link-time optimization
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
79 octave_uint8_matrix::load_hdf5 (octave_hdf5_id loc_id, const char *name)
ff81c6772664 avoid issue with link-time optimization
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
80 {
ff81c6772664 avoid issue with link-time optimization
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
81 return load_hdf5_internal (loc_id, HDF5_SAVE_TYPE, name);
ff81c6772664 avoid issue with link-time optimization
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
82 }
ff81c6772664 avoid issue with link-time optimization
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
83
4901
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents:
diff changeset
84 template class octave_base_scalar<octave_uint8>;
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents:
diff changeset
85
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents:
diff changeset
86 template class octave_base_int_scalar<octave_uint8>;
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents:
diff changeset
87
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents:
diff changeset
88 DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_uint8_scalar,
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
89 "uint8 scalar", "uint8");
24224
ff81c6772664 avoid issue with link-time optimization
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
90
ff81c6772664 avoid issue with link-time optimization
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
91 bool
ff81c6772664 avoid issue with link-time optimization
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
92 octave_uint8_scalar::save_hdf5 (octave_hdf5_id loc_id, const char *name,
ff81c6772664 avoid issue with link-time optimization
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
93 bool flag)
ff81c6772664 avoid issue with link-time optimization
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
94 {
ff81c6772664 avoid issue with link-time optimization
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
95 return save_hdf5_internal (loc_id, HDF5_SAVE_TYPE, name, flag);
ff81c6772664 avoid issue with link-time optimization
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
96 }
ff81c6772664 avoid issue with link-time optimization
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
97
ff81c6772664 avoid issue with link-time optimization
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
98 bool
ff81c6772664 avoid issue with link-time optimization
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
99 octave_uint8_scalar::load_hdf5 (octave_hdf5_id loc_id, const char *name)
ff81c6772664 avoid issue with link-time optimization
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
100 {
ff81c6772664 avoid issue with link-time optimization
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
101 return load_hdf5_internal (loc_id, HDF5_SAVE_TYPE, name);
ff81c6772664 avoid issue with link-time optimization
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
102 }