STIR  6.2.0
ArrayFunctionObject_1ArgumentImplementation.h
Go to the documentation of this file.
1 //
2 //
12 /*
13  Copyright (C) 2000- 2009, Hammersmith Imanet Ltd
14  This file is part of STIR.
15 
16  SPDX-License-Identifier: Apache-2.0
17 
18  See STIR/LICENSE.txt for details
19 */
20 
21 #ifndef __stir_ArrayFunctionObject_1ArgumentImplementation_H__
22 #define __stir_ArrayFunctionObject_1ArgumentImplementation_H__
23 
25 #include "stir/Array.h"
26 
27 START_NAMESPACE_STIR
28 
42 template <int num_dimensions, typename elemT>
44 {
45 public:
46  void operator()(Array<num_dimensions, elemT>& array) const override { do_it(array); }
47 
49  void inline operator()(Array<num_dimensions, elemT>& out_array, const Array<num_dimensions, elemT>& in_array) const override
50  {
51  assert(out_array.get_index_range() == in_array.get_index_range());
52  out_array = in_array;
53  do_it(out_array);
54  }
55 
56 protected:
57  virtual void do_it(Array<num_dimensions, elemT>& array) const = 0;
58 };
59 
60 END_NAMESPACE_STIR
61 
62 #endif
A class for operations on n-dimensional Arrays.
Definition: ArrayFunctionObject.h:38
defines the Array class for multi-dimensional (numeric) arrays
void operator()(Array< num_dimensions, elemT > &out_array, const Array< num_dimensions, elemT > &in_array) const override
result stored in another array, implemented inline
Definition: ArrayFunctionObject_1ArgumentImplementation.h:49
void operator()(Array< num_dimensions, elemT > &array) const override
in-place modification
Definition: ArrayFunctionObject_1ArgumentImplementation.h:46
A convenience class for children of ArrayFunctionObject. It implements the 2 argument operator() in t...
Definition: ArrayFunctionObject_1ArgumentImplementation.h:43
This class defines multi-dimensional (numeric) arrays.
Definition: Array.h:73
Declaration of class stir::ArrayFunctionObject.