comparison libinterp/octave-value/ov-base-int.cc @ 31143:b3ca7f891750

maint: use "m_" prefix for member variables in class octave_base_matrix. * ov-base-int.cc, ov-base-mat.cc, ov-base-mat.h, ov-base.h, ov-bool-mat.cc, ov-bool-mat.h, ov-cell.cc, ov-cell.h, ov-ch-mat.cc, ov-ch-mat.h, ov-cx-mat.cc, ov-cx-mat.h, ov-flt-cx-mat.cc, ov-flt-cx-mat.h, ov-flt-re-mat.cc, ov-flt-re-mat.h, ov-intx.h, ov-re-mat.cc, ov-re-mat.h, ov-str-mat.cc, ov-str-mat.h: use "m_" prefix for member variables in class octave_base_matrix.
author Rik <rik@octave.org>
date Sun, 10 Jul 2022 18:26:24 -0700
parents 83f9f8bda883
children
comparison
equal deleted inserted replaced
31142:6308ce73bdca 31143:b3ca7f891750
146 octave_base_value * 146 octave_base_value *
147 octave_base_int_matrix<T>::try_narrowing_conversion (void) 147 octave_base_int_matrix<T>::try_narrowing_conversion (void)
148 { 148 {
149 octave_base_value *retval = nullptr; 149 octave_base_value *retval = nullptr;
150 150
151 if (this->matrix.numel () == 1) 151 if (this->m_matrix.numel () == 1)
152 retval = new typename octave_value_int_traits<T>::scalar_type 152 retval = new typename octave_value_int_traits<T>::scalar_type
153 (this->matrix (0)); 153 (this->m_matrix (0));
154 154
155 return retval; 155 return retval;
156 } 156 }
157 157
158 template <typename T> 158 template <typename T>
169 169
170 for (octave_idx_type i = 0; i < nel; i++) 170 for (octave_idx_type i = 0; i < nel; i++)
171 { 171 {
172 octave_quit (); 172 octave_quit ();
173 173
174 typename T::element_type tmp = this->matrix(i); 174 typename T::element_type tmp = this->m_matrix(i);
175 175
176 typedef typename T::element_type::val_type val_type; 176 typedef typename T::element_type::val_type val_type;
177 177
178 val_type ival = tmp.value (); 178 val_type ival = tmp.value ();
179 179
205 205
206 template <typename MT> 206 template <typename MT>
207 octave_value 207 octave_value
208 octave_base_int_matrix<MT>::as_double (void) const 208 octave_base_int_matrix<MT>::as_double (void) const
209 { 209 {
210 return NDArray (this->matrix); 210 return NDArray (this->m_matrix);
211 } 211 }
212 212
213 template <typename MT> 213 template <typename MT>
214 octave_value 214 octave_value
215 octave_base_int_matrix<MT>::as_single (void) const 215 octave_base_int_matrix<MT>::as_single (void) const
216 { 216 {
217 return FloatNDArray (this->matrix); 217 return FloatNDArray (this->m_matrix);
218 } 218 }
219 219
220 template <typename MT> 220 template <typename MT>
221 octave_value 221 octave_value
222 octave_base_int_matrix<MT>::as_int8 (void) const 222 octave_base_int_matrix<MT>::as_int8 (void) const
223 { 223 {
224 return int8NDArray (this->matrix); 224 return int8NDArray (this->m_matrix);
225 } 225 }
226 226
227 template <typename MT> 227 template <typename MT>
228 octave_value 228 octave_value
229 octave_base_int_matrix<MT>::as_int16 (void) const 229 octave_base_int_matrix<MT>::as_int16 (void) const
230 { 230 {
231 return int16NDArray (this->matrix); 231 return int16NDArray (this->m_matrix);
232 } 232 }
233 233
234 template <typename MT> 234 template <typename MT>
235 octave_value 235 octave_value
236 octave_base_int_matrix<MT>::as_int32 (void) const 236 octave_base_int_matrix<MT>::as_int32 (void) const
237 { 237 {
238 return int32NDArray (this->matrix); 238 return int32NDArray (this->m_matrix);
239 } 239 }
240 240
241 template <typename MT> 241 template <typename MT>
242 octave_value 242 octave_value
243 octave_base_int_matrix<MT>::as_int64 (void) const 243 octave_base_int_matrix<MT>::as_int64 (void) const
244 { 244 {
245 return int64NDArray (this->matrix); 245 return int64NDArray (this->m_matrix);
246 } 246 }
247 247
248 template <typename MT> 248 template <typename MT>
249 octave_value 249 octave_value
250 octave_base_int_matrix<MT>::as_uint8 (void) const 250 octave_base_int_matrix<MT>::as_uint8 (void) const
251 { 251 {
252 return uint8NDArray (this->matrix); 252 return uint8NDArray (this->m_matrix);
253 } 253 }
254 254
255 template <typename MT> 255 template <typename MT>
256 octave_value 256 octave_value
257 octave_base_int_matrix<MT>::as_uint16 (void) const 257 octave_base_int_matrix<MT>::as_uint16 (void) const
258 { 258 {
259 return uint16NDArray (this->matrix); 259 return uint16NDArray (this->m_matrix);
260 } 260 }
261 261
262 template <typename MT> 262 template <typename MT>
263 octave_value 263 octave_value
264 octave_base_int_matrix<MT>::as_uint32 (void) const 264 octave_base_int_matrix<MT>::as_uint32 (void) const
265 { 265 {
266 return uint32NDArray (this->matrix); 266 return uint32NDArray (this->m_matrix);
267 } 267 }
268 268
269 template <typename MT> 269 template <typename MT>
270 octave_value 270 octave_value
271 octave_base_int_matrix<MT>::as_uint64 (void) const 271 octave_base_int_matrix<MT>::as_uint64 (void) const
272 { 272 {
273 return uint64NDArray (this->matrix); 273 return uint64NDArray (this->m_matrix);
274 } 274 }
275 275
276 template <typename T> 276 template <typename T>
277 std::string 277 std::string
278 octave_base_int_matrix<T>::edit_display (const float_display_format& fmt, 278 octave_base_int_matrix<T>::edit_display (const float_display_format& fmt,
279 octave_idx_type i, 279 octave_idx_type i,
280 octave_idx_type j) const 280 octave_idx_type j) const
281 { 281 {
282 std::ostringstream buf; 282 std::ostringstream buf;
283 octave_print_internal (buf, fmt, this->matrix(i, j)); 283 octave_print_internal (buf, fmt, this->m_matrix(i, j));
284 return buf.str (); 284 return buf.str ();
285 } 285 }
286 286
287 template <typename T> 287 template <typename T>
288 bool 288 bool
293 os << "# ndims: " << dv.ndims () << "\n"; 293 os << "# ndims: " << dv.ndims () << "\n";
294 294
295 for (int i = 0; i < dv.ndims (); i++) 295 for (int i = 0; i < dv.ndims (); i++)
296 os << ' ' << dv(i); 296 os << ' ' << dv(i);
297 297
298 os << "\n" << this->matrix; 298 os << "\n" << this->m_matrix;
299 299
300 return true; 300 return true;
301 } 301 }
302 302
303 template <typename T> 303 template <typename T>
323 is >> tmp; 323 is >> tmp;
324 324
325 if (! is) 325 if (! is)
326 error ("load: failed to load matrix constant"); 326 error ("load: failed to load matrix constant");
327 327
328 this->matrix = tmp; 328 this->m_matrix = tmp;
329 329
330 return true; 330 return true;
331 } 331 }
332 332
333 template <typename T> 333 template <typename T>
345 { 345 {
346 tmp = dv(i); 346 tmp = dv(i);
347 os.write (reinterpret_cast<char *> (&tmp), 4); 347 os.write (reinterpret_cast<char *> (&tmp), 4);
348 } 348 }
349 349
350 os.write (reinterpret_cast<const char *> (this->matrix.data ()), 350 os.write (reinterpret_cast<const char *> (this->m_matrix.data ()),
351 this->byte_size ()); 351 this->byte_size ());
352 352
353 return true; 353 return true;
354 } 354 }
355 355
417 default: 417 default:
418 break; 418 break;
419 } 419 }
420 } 420 }
421 421
422 this->matrix = m; 422 this->m_matrix = m;
423 return true; 423 return true;
424 } 424 }
425 425
426 template <typename T> 426 template <typename T>
427 bool 427 bool
464 H5Sclose (space_hid); 464 H5Sclose (space_hid);
465 return false; 465 return false;
466 } 466 }
467 467
468 retval = H5Dwrite (data_hid, save_type_hid, octave_H5S_ALL, octave_H5S_ALL, 468 retval = H5Dwrite (data_hid, save_type_hid, octave_H5S_ALL, octave_H5S_ALL,
469 octave_H5P_DEFAULT, this->matrix.data ()) >= 0; 469 octave_H5P_DEFAULT, this->m_matrix.data ()) >= 0;
470 470
471 H5Dclose (data_hid); 471 H5Dclose (data_hid);
472 H5Sclose (space_hid); 472 H5Sclose (space_hid);
473 473
474 #else 474 #else
494 494
495 hid_t save_type_hid = save_type; 495 hid_t save_type_hid = save_type;
496 dim_vector dv; 496 dim_vector dv;
497 int empty = load_hdf5_empty (loc_id, name, dv); 497 int empty = load_hdf5_empty (loc_id, name, dv);
498 if (empty > 0) 498 if (empty > 0)
499 this->matrix.resize (dv); 499 this->m_matrix.resize (dv);
500 if (empty) 500 if (empty)
501 return (empty > 0); 501 return (empty > 0);
502 502
503 #if defined (HAVE_HDF5_18) 503 #if defined (HAVE_HDF5_18)
504 hid_t data_hid = H5Dopen (loc_id, name, octave_H5P_DEFAULT); 504 hid_t data_hid = H5Dopen (loc_id, name, octave_H5P_DEFAULT);
538 T m (dv); 538 T m (dv);
539 if (H5Dread (data_hid, save_type_hid, octave_H5S_ALL, octave_H5S_ALL, 539 if (H5Dread (data_hid, save_type_hid, octave_H5S_ALL, octave_H5S_ALL,
540 octave_H5P_DEFAULT, m.fortran_vec ()) >= 0) 540 octave_H5P_DEFAULT, m.fortran_vec ()) >= 0)
541 { 541 {
542 retval = true; 542 retval = true;
543 this->matrix = m; 543 this->m_matrix = m;
544 } 544 }
545 545
546 H5Sclose (space_id); 546 H5Sclose (space_id);
547 H5Dclose (data_hid); 547 H5Dclose (data_hid);
548 548
560 template <typename T> 560 template <typename T>
561 void 561 void
562 octave_base_int_matrix<T>::print_raw (std::ostream& os, 562 octave_base_int_matrix<T>::print_raw (std::ostream& os,
563 bool pr_as_read_syntax) const 563 bool pr_as_read_syntax) const
564 { 564 {
565 octave_print_internal (os, this->matrix, pr_as_read_syntax, 565 octave_print_internal (os, this->m_matrix, pr_as_read_syntax,
566 this->current_print_indent_level ()); 566 this->current_print_indent_level ());
567 } 567 }
568 568
569 template <typename T> 569 template <typename T>
570 octave_value 570 octave_value