Документ взят из кэша поисковой машины. Адрес оригинального документа : http://www.atnf.csiro.au/computing/software/casacore/casacore-1.2.0/doc/html/classcasa_1_1SampledFunctional.html
Дата изменения: Unknown
Дата индексирования: Mon Feb 14 22:58:18 2011
Кодировка:

Поисковые слова: ъбртеэеооще урелфтбмшоще мйойй
casacore: casa::SampledFunctional< Range > Class Template Reference
Public Member Functions

casa::SampledFunctional< Range > Class Template Reference
[Functionals_module]

A base class for indexing into arbitrary data types. More...

#include <SampledFunctional.h>

Inheritance diagram for casa::SampledFunctional< Range >:
casa::Functional< uInt, Range >

List of all members.

Public Member Functions

virtual Range operator() (const uInt &index) const =0
 Access the specified element of the data.
virtual uInt nelements () const =0
 Return the total size of the data set.
virtual ~SampledFunctional ()
 The virtual destructor does nothing.

Detailed Description

template<class Range>
class casa::SampledFunctional< Range >

A base class for indexing into arbitrary data types.

Intended use:

Public interface

Review Status

Reviewed By:
wyoung
Date Reviewed:
1996/10/10
Test programs:
tSampledFunctional

Prerequisite

Etymology

A Functional is simply a mapping from a Domain type to a Range type. Experimental data is usually sampled, and is can be represented as a mapping from the unsigned integers to an arbitrary Domain.

Synopsis

This abstract class defines an interface for functions that map from the unsigned integers to an arbitrary type. It defines two functions: the operator() function which it inherits from the Functional class, and the nelements function which is necessary to know how many data elements.

This class is useful for freeing the writer of other classes from having to know how how a linear data set is stored or represented. For example, four floating point numbers will probably be stored as a Vector<Float>, and kept in memory for fast access. But 400 million floating point numbers cannot usually be kept in memory, and may be stored on disk as a Table. By using a SampledFunctional writers of other classes (Interpolate1D is an example), can ignore these details if all they are interested in is random access to individual elements of the data.

Example

Because this is an abstract class the example will be inside a function

    T sum(SampledFunctional<T> data)
    {
      T result = 0;
      for (uInt i = 0; i < data.nelements(); i++)
        result += data(i);
      return result;
    }

Motivation

If all you need to do is random access indexing into arbitrary data sets this class provides a suitable abstraction of that functionality.

Template Type Argument Requirements (Range)

Thrown Exceptions

To Do

Definition at line 101 of file SampledFunctional.h.


Constructor & Destructor Documentation

template<class Range>
virtual casa::SampledFunctional< Range >::~SampledFunctional (  )  [inline, virtual]

The virtual destructor does nothing.

Definition at line 110 of file SampledFunctional.h.


Member Function Documentation

template<class Range>
virtual uInt casa::SampledFunctional< Range >::nelements (  )  const [pure virtual]

Return the total size of the data set.

Implemented in casa::ArraySampledFunctional< T >, and casa::ScalarSampledFunctional< T >.

template<class Range>
virtual Range casa::SampledFunctional< Range >::operator() ( const uInt index  )  const [pure virtual]

Access the specified element of the data.

Implements casa::Functional< uInt, Range >.

Implemented in casa::ArraySampledFunctional< T >, and casa::ScalarSampledFunctional< T >.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines