casacore
Public Member Functions | List of all members
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, Alloc > &a)
 Write a formatted copy of the array to the LogIO output object. More...
 
template<typename T , typename Alloc >
AipsIOoperator<< (AipsIO &, const Array< T, Alloc > &)
 Read or write a binary representation of an Array to a file. More...
 
template<typename T , typename Alloc >
void putArray (AipsIO &, const Array< T, Alloc > &, const char *name)
 
template<typename T , typename Alloc >
AipsIOoperator>> (AipsIO &, Array< T, Alloc > &)
 

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;
TableExprNode shape(const TableExprNode &array)
Function operating on any scalar or array resulting in a Double array containing the shape.
Definition: ExprNode.h:1987
TableExprNode array(const TableExprNode &values, const TableExprNodeSet &shape)
Create an array of the given shape and fill it with the values.
Definition: ExprNode.h:1929

Motivation

Effortless input/output is clearly a big win.


Definition at line 99 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, Alloc > &   
)

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, Alloc > &  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, Alloc > &   
)

◆ putArray()

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

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