OpenStructure
data_algorithm.hh
Go to the documentation of this file.
1 //------------------------------------------------------------------------------
2 // This file is part of the OpenStructure project <www.openstructure.org>
3 //
4 // Copyright (C) 2008-2020 by the OpenStructure authors
5 // Copyright (C) 2003-2010 by the IPLT authors
6 //
7 // This library is free software; you can redistribute it and/or modify it under
8 // the terms of the GNU Lesser General Public License as published by the Free
9 // Software Foundation; either version 3.0 of the License, or (at your option)
10 // any later version.
11 // This library is distributed in the hope that it will be useful, but WITHOUT
12 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13 // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
14 // details.
15 //
16 // You should have received a copy of the GNU Lesser General Public License
17 // along with this library; if not, write to the Free Software Foundation, Inc.,
18 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 //------------------------------------------------------------------------------
20 
21 /*
22  Data algorithm abstract base classes
23 
24  Author: Ansgar Philippsen
25 */
26 
27 #ifndef IMG_DATA_ALG_H
28 #define IMG_DATA_ALG_H
29 
30 #include <ost/img/module_config.hh>
31 #include "image_fw.hh"
32 
33 /*
34  TODO:
35 
36  add info object as parameter in base class, this guarantees that every
37  algorithm has access to an info object for logging
38 */
39 
40 namespace ost { namespace img {
41 
43 
48  public:
50  const String& GetName() const;
51 
52  virtual ~AlgorithmBase();
53 
54  protected:
56  AlgorithmBase(const String& n);
57 
60 
61  private:
62  String name_;
63 };
64 
67 {
68 public:
70  virtual void Visit(const ConstImageHandle& i) = 0;
71 
72 protected:
74  NonModAlgorithm(const String& name);
79 };
80 
81 
83 
90 {
91 public:
92  virtual void Visit(ImageHandle& ih) = 0;
93 protected:
94  ModIPAlgorithm(const String& name);
97 };
98 
99 
101 
108 {
109 public:
110  virtual void Visit(ImageHandle& ih) const = 0;
111 protected:
115 };
116 
117 
119 
126 {
127 public:
128  virtual ImageHandle Visit(const ConstImageHandle& ih) = 0;
129 
130 protected:
131  ModOPAlgorithm(const String& name);
134 };
135 
137 
144 {
145 public:
146  virtual ImageHandle Visit(const ConstImageHandle& ih) const= 0;
147 
148 protected:
152 };
153 
154 }} // namespace
155 
156 #endif
Algorithm base class.
AlgorithmBase & operator=(const AlgorithmBase &b)
AlgorithmBase(const AlgorithmBase &a)
AlgorithmBase(const String &n)
Constructor must be initialized with algorithm name.
const String & GetName() const
Return name of algorithm.
read-only ImageHandle implementation
In-place modification const algorithm.
ConstModIPAlgorithm & operator=(const ConstModIPAlgorithm &a)
ConstModIPAlgorithm(const String &name)
ConstModIPAlgorithm(const ConstModIPAlgorithm &a)
virtual void Visit(ImageHandle &ih) const =0
out-of-place modification const algorithm
ConstModOPAlgorithm & operator=(const ConstModOPAlgorithm &a)
ConstModOPAlgorithm(const String &name)
ConstModOPAlgorithm(const ConstModOPAlgorithm &a)
virtual ImageHandle Visit(const ConstImageHandle &ih) const =0
Manage shared instances of images.
In-place modification algorithm.
ModIPAlgorithm & operator=(const ModIPAlgorithm &a)
ModIPAlgorithm(const ModIPAlgorithm &a)
ModIPAlgorithm(const String &name)
virtual void Visit(ImageHandle &ih)=0
out-of-place modification algorithm
virtual ImageHandle Visit(const ConstImageHandle &ih)=0
ModOPAlgorithm(const String &name)
ModOPAlgorithm(const ModOPAlgorithm &a)
ModOPAlgorithm & operator=(const ModOPAlgorithm &a)
Non-modifying Algorithm, abstract base class.
NonModAlgorithm(const String &name)
ctor, must be initialized with name
NonModAlgorithm & operator=(const NonModAlgorithm &a)
assignement op
virtual void Visit(const ConstImageHandle &i)=0
visitor implementation for images
NonModAlgorithm(const NonModAlgorithm &a)
copy ctor
#define DLLEXPORT_OST_IMG_BASE
std::string String
Definition: base.hh:54
Definition: base.dox:1