casacore
Loading...
Searching...
No Matches
casacore::ArrayIO_global_functions_Array_IO Struct Reference

More...

#include <ArrayIO.h>

Public Member Functions

template<typename T, typename Alloc>
LogIOoperator<< (LogIO &os, const Array< T > &a)
 Write a formatted copy of the array to the LogIO output object.
template<typename T, typename Alloc>
AipsIOoperator<< (AipsIO &, const Array< T > &)
 Read or write a binary representation of an Array to a file.
template<typename T, typename Alloc>
void putArray (AipsIO &, const Array< T > &, const char *name)
template<typename T, typename Alloc>
AipsIOoperator>> (AipsIO &, Array< T > &)

Detailed Description

Input/output operators for Arrays.

Intended use:

Public interface

Review Status

Reviewed By:
Paul Shannon
Date Reviewed:
1995/02/21

This header was reviewed and revised with the goal of making it an example for those writing global function header files.

Prerequisite

Etymology

ArrayIO is simply the conventional shorthand for "array input/output".

Synopsis

These global functions provide easy input and output of (possibly) large and (possibly) multi-dimensional arrays. Iteration through entire arrays is done behind the scenes, with no effort required of the client programmer.
These functions are global, rather than member functions of the Array class, because of the well-known C++ requirement that the first argument to an operator function (as it is declared) is the left operand when the function is called.

Example

IPosition shape (3,10,10,3);
Array <float> array (shape);
//...initialize and manipulate the array..\.
cout << "result: " << array;
TYPE * array
the allocated array
Definition hdu.h:491
IPosition shape(const RecordFieldId &) const
Get the actual shape of this field.

Motivation

Effortless input/output is clearly a big win.

Definition at line 97 of file ArrayIO.h.

Member Function Documentation

◆ operator<<() [1/2]

template<typename T, typename Alloc>
AipsIO & casacore::ArrayIO_global_functions_Array_IO::operator<< ( AipsIO & ,
const Array< T > &  )

Read or write a binary representation of an Array to a file.

Very useful for saving arrays and restoring them later.
The putArray function is put in for forwards compatibility of images (so new images can be read with old release).

◆ operator<<() [2/2]

template<typename T, typename Alloc>
LogIO & casacore::ArrayIO_global_functions_Array_IO::operator<< ( LogIO & os,
const Array< T > & a )

Write a formatted copy of the array to the LogIO output object.

Merely calls the ostream operator<< in turn.

◆ operator>>()

template<typename T, typename Alloc>
AipsIO & casacore::ArrayIO_global_functions_Array_IO::operator>> ( AipsIO & ,
Array< T > &  )

◆ putArray()

template<typename T, typename Alloc>
void casacore::ArrayIO_global_functions_Array_IO::putArray ( AipsIO & ,
const Array< T > & ,
const char * name )

References casacore::name().


The documentation for this struct was generated from the following file: