casacore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | List of all members
casacore::ArrayIO_global_functions_Array_IO Struct Reference

Input/output operators for Arrays. 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;

Motivation

Effortless input/output is clearly a big win.

Definition at line 99 of file ArrayIO.h.

Member Function Documentation

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.

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).

template<typename T , typename Alloc >
AipsIO& casacore::ArrayIO_global_functions_Array_IO::operator>> ( AipsIO ,
Array< T, Alloc > &   
)
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: