# HG changeset patch # User Rik # Date 1631282524 25200 # Node ID 14b098a6ba46113fc206850c9ca403ae36641fb0 # Parent 868156b5027bfacea355a66d0b6f27c1eba78517 maint: Use public: qualifier in structs that are really classes. * __eigs__.cc, graphics.in.h, load-path.h, ls-hdf5.h, ov-base-int.cc, bp-table.h, profiler.h, token.h, Array-util.cc, MArray.cc, Sparse-diag-op-defs.h, lo-ieee.h, oct-sort.cc, oct-sort.h: Use public: qualifier in structs that are really classes. diff -r 868156b5027b -r 14b098a6ba46 libinterp/corefcn/__eigs__.cc --- a/libinterp/corefcn/__eigs__.cc Thu Sep 09 21:08:44 2021 -0700 +++ b/libinterp/corefcn/__eigs__.cc Fri Sep 10 07:02:04 2021 -0700 @@ -49,18 +49,23 @@ #if defined (HAVE_ARPACK) -struct eigs_callback { - // Pointer for user defined function. - octave_value m_eigs_fcn; - - // Have we warned about imaginary values returned from user function? - bool m_warned_imaginary = false; +struct eigs_callback +{ +public: ColumnVector eigs_func (const ColumnVector& x, int& eigs_error); ComplexColumnVector eigs_complex_func (const ComplexColumnVector& x, int& eigs_error); + + //-------- + + // Pointer for user defined function. + octave_value m_eigs_fcn; + + // Have we warned about imaginary values returned from user function? + bool m_warned_imaginary = false; }; // Is this a recursive call? diff -r 868156b5027b -r 14b098a6ba46 libinterp/corefcn/graphics.in.h --- a/libinterp/corefcn/graphics.in.h Thu Sep 09 21:08:44 2021 -0700 +++ b/libinterp/corefcn/graphics.in.h Fri Sep 10 07:02:04 2021 -0700 @@ -2433,6 +2433,7 @@ protected: struct cmp_caseless_str { + public: bool operator () (const caseless_str& a, const caseless_str& b) const { std::string a1 = a; diff -r 868156b5027b -r 14b098a6ba46 libinterp/corefcn/load-path.h --- a/libinterp/corefcn/load-path.h Thu Sep 09 21:08:44 2021 -0700 +++ b/libinterp/corefcn/load-path.h Fri Sep 10 07:02:04 2021 -0700 @@ -229,6 +229,7 @@ struct class_info { + public: class_info (void) : method_file_map (), private_file_map () { } class_info (const class_info& ci) diff -r 868156b5027b -r 14b098a6ba46 libinterp/corefcn/ls-hdf5.h --- a/libinterp/corefcn/ls-hdf5.h Thu Sep 09 21:08:44 2021 -0700 +++ b/libinterp/corefcn/ls-hdf5.h Fri Sep 10 07:02:04 2021 -0700 @@ -99,6 +99,7 @@ struct hdf5_callback_data { +public: hdf5_callback_data (void) : name (), global (false), tc (), doc () { } diff -r 868156b5027b -r 14b098a6ba46 libinterp/octave-value/ov-base-int.cc --- a/libinterp/octave-value/ov-base-int.cc Thu Sep 09 21:08:44 2021 -0700 +++ b/libinterp/octave-value/ov-base-int.cc Fri Sep 10 07:02:04 2021 -0700 @@ -80,6 +80,7 @@ template struct octave_base_int_helper { +public: static bool char_value_out_of_range (T val) { @@ -90,12 +91,14 @@ template struct octave_base_int_helper { +public: static bool char_value_out_of_range (T) { return false; } }; template struct octave_base_int_helper { +public: static bool char_value_out_of_range (T val) { return val > std::numeric_limits::max (); @@ -105,6 +108,7 @@ template struct octave_base_int_helper { +public: static bool char_value_out_of_range (T val) { return val < 0; } }; diff -r 868156b5027b -r 14b098a6ba46 libinterp/parse-tree/bp-table.h --- a/libinterp/parse-tree/bp-table.h Thu Sep 09 21:08:44 2021 -0700 +++ b/libinterp/parse-tree/bp-table.h Fri Sep 10 07:02:04 2021 -0700 @@ -43,10 +43,13 @@ struct bp_type { + public: + bp_type (int l, const std::string& c) : line (l), cond (c) { } + + //-------- + int line; std::string cond; - - bp_type (int l, const std::string& c) : line (l), cond (c) { } }; // Interface to breakpoints. diff -r 868156b5027b -r 14b098a6ba46 libinterp/parse-tree/profiler.h --- a/libinterp/parse-tree/profiler.h Thu Sep 09 21:08:44 2021 -0700 +++ b/libinterp/parse-tree/profiler.h Fri Sep 10 07:02:04 2021 -0700 @@ -114,19 +114,23 @@ // hierarchical call tree. struct stats { + public: stats (void); + typedef std::set function_set; + + // Convert a function_set list to an Octave array of indices. + static octave_value function_set_value (const function_set&); + + //-------- + double m_time; std::size_t m_calls; bool m_recursive; - typedef std::set function_set; function_set m_parents; function_set m_children; - - // Convert a function_set list to an Octave array of indices. - static octave_value function_set_value (const function_set&); }; typedef std::vector flat_profile; diff -r 868156b5027b -r 14b098a6ba46 libinterp/parse-tree/token.h --- a/libinterp/parse-tree/token.h Thu Sep 09 21:08:44 2021 -0700 +++ b/libinterp/parse-tree/token.h Fri Sep 10 07:02:04 2021 -0700 @@ -176,19 +176,21 @@ struct superclass_info { - superclass_info (void) = delete; - - superclass_info (const std::string& meth, - const std::string& cls) + public: + superclass_info (const std::string& meth, const std::string& cls) : m_method_name (meth), m_class_name (cls) { } + superclass_info (void) = delete; + superclass_info (const superclass_info&) = delete; superclass_info& operator = (const superclass_info&) = delete; ~superclass_info (void) = default; + //-------- + // The name of the method to call. This is the text before the // "@" and may be of the form "object.method". std::string m_method_name; diff -r 868156b5027b -r 14b098a6ba46 liboctave/array/Array-util.cc --- a/liboctave/array/Array-util.cc Thu Sep 09 21:08:44 2021 -0700 +++ b/liboctave/array/Array-util.cc Fri Sep 10 07:02:04 2021 -0700 @@ -523,12 +523,14 @@ // A helper class. struct sub2ind_helper { - octave_idx_type *ind, n; - +public: sub2ind_helper (octave_idx_type *_ind, octave_idx_type _n) - : ind(_ind), n(_n) { } + : ind (_ind), n (_n) { } - void operator ()(octave_idx_type k) { (*ind++ *= n) += k; } + void operator () (octave_idx_type k) { (*ind++ *= n) += k; } + + //-------- + octave_idx_type *ind, n; }; octave::idx_vector diff -r 868156b5027b -r 14b098a6ba46 liboctave/array/MArray.cc --- a/liboctave/array/MArray.cc Thu Sep 09 21:08:44 2021 -0700 +++ b/liboctave/array/MArray.cc Fri Sep 10 07:02:04 2021 -0700 @@ -34,21 +34,31 @@ template struct _idxadds_helper { +public: + _idxadds_helper (T *a, T v) : array (a), val (v) { } + + void operator () (octave_idx_type i) + { array[i] += val; } + + //-------- + T *array; T val; - _idxadds_helper (T *a, T v) : array (a), val (v) { } - void operator () (octave_idx_type i) - { array[i] += val; } }; template struct _idxadda_helper { +public: + _idxadda_helper (T *a, const T *v) : array (a), vals (v) { } + + void operator () (octave_idx_type i) + { array[i] += *vals++; } + + //-------- + T *array; const T *vals; - _idxadda_helper (T *a, const T *v) : array (a), vals (v) { } - void operator () (octave_idx_type i) - { array[i] += *vals++; } }; template @@ -91,11 +101,16 @@ typename ref_param::type)> struct _idxbinop_helper { +public: + _idxbinop_helper (T *a, const T *v) : array (a), vals (v) { } + + void operator () (octave_idx_type i) + { array[i] = op (array[i], *vals++); } + + //-------- + T *array; const T *vals; - _idxbinop_helper (T *a, const T *v) : array (a), vals (v) { } - void operator () (octave_idx_type i) - { array[i] = op (array[i], *vals++); } }; template diff -r 868156b5027b -r 14b098a6ba46 liboctave/operators/Sparse-diag-op-defs.h --- a/liboctave/operators/Sparse-diag-op-defs.h Thu Sep 09 21:08:44 2021 -0700 +++ b/liboctave/operators/Sparse-diag-op-defs.h Fri Sep 10 07:02:04 2021 -0700 @@ -106,6 +106,7 @@ struct identity_val : public std::unary_function { +public: T operator () (const T x) { return x; } }; diff -r 868156b5027b -r 14b098a6ba46 liboctave/util/lo-ieee.h --- a/liboctave/util/lo-ieee.h Thu Sep 09 21:08:44 2021 -0700 +++ b/liboctave/util/lo-ieee.h Fri Sep 10 07:02:04 2021 -0700 @@ -128,6 +128,7 @@ template struct numeric_limits { + public: static T NA (void) { return static_cast (0); } static T NaN (void) { return static_cast (0); } static T Inf (void) { return static_cast (0); } @@ -136,6 +137,7 @@ template <> struct numeric_limits { + public: static double NA (void) { return octave_NA; } static double NaN (void) { return octave_NaN; } static double Inf (void) { return octave_Inf; } @@ -144,6 +146,7 @@ template <> struct numeric_limits { + public: static float NA (void) { return octave_Float_NA; } static float NaN (void) { return octave_Float_NaN; } static float Inf (void) { return octave_Float_Inf; } diff -r 868156b5027b -r 14b098a6ba46 liboctave/util/oct-sort.cc --- a/liboctave/util/oct-sort.cc Thu Sep 09 21:08:44 2021 -0700 +++ b/liboctave/util/oct-sort.cc Fri Sep 10 07:02:04 2021 -0700 @@ -1596,8 +1596,10 @@ // FIXME: is there really no way to make this local to the following function? struct sortrows_run_t { +public: sortrows_run_t (octave_idx_type c, octave_idx_type o, octave_idx_type n) : col (c), ofs (o), nel (n) { } + //-------- octave_idx_type col, ofs, nel; }; diff -r 868156b5027b -r 14b098a6ba46 liboctave/util/oct-sort.h --- a/liboctave/util/oct-sort.h Thu Sep 09 21:08:44 2021 -0700 +++ b/liboctave/util/oct-sort.h Fri Sep 10 07:02:04 2021 -0700 @@ -196,6 +196,8 @@ struct MergeState { + public: + MergeState (void) : m_min_gallop (), m_a (nullptr), m_ia (nullptr), m_alloced (0), m_n (0) { reset (); } @@ -216,10 +218,11 @@ void getmemi (octave_idx_type need); - // This controls when we get *into* galloping mode. It's - // initialized to MIN_GALLOP. merge_lo and merge_hi tend to nudge - // it higher for random data, and lower for highly structured - // data. + //-------- + + // This controls when we get *into* galloping mode. It's initialized to + // MIN_GALLOP. merge_lo and merge_hi tend to nudge it higher for random + // data, and lower for highly structured data. octave_idx_type m_min_gallop; // 'a' is temp storage to help with merges. It contains room for @@ -228,9 +231,9 @@ octave_idx_type *m_ia; octave_idx_type m_alloced; - // A stack of n pending runs yet to be merged. Run #i starts at - // address base[i] and extends for len[i] elements. It's always - // true (so long as the indices are in bounds) that + // A stack of n pending runs yet to be merged. Run #i starts at address + // base[i] and extends for len[i] elements. It's always true (so long as + // the indices are in bounds) that // // pending[i].base + pending[i].len == pending[i+1].base //