OpenStructure
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
null_data.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-2011 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  convenience null data class
23 
24  Author: Ansgar Philippsen
25 */
26 
27 #ifndef IMG_NULL_DATA_H
28 #define IMG_NULL_DATA_H
29 
30 #include "data.hh"
31 #include "pixel_sampling.hh"
32 #include "image_factory.hh"
33 #include "image_handle.hh"
34 
35 namespace ost { namespace img {
36 
38 
45 {
46 public:
47  virtual DataType GetType() const {return REAL;}
48 
49  virtual DataDomain GetDomain() const {return SPATIAL;}
50 
51  virtual Extent GetExtent() const {return Extent();}
52 
53  virtual Real GetReal(const Point &p) const {return 0.0;}
54 
55  virtual Complex GetComplex(const Point &p) const {return 0.0;}
56 
57  virtual Real GetIntpolReal(const Vec3 &v) const {return 0.0;}
58  virtual Real GetIntpolReal(const Vec2 &v) const {return 0.0;}
59  virtual Real GetIntpolReal(const Real &d) const {return 0.0;}
60 
61  virtual Complex GetIntpolComplex(const Vec3 &v) const {return 0.0;}
62  virtual Complex GetIntpolComplex(const Vec2 &v) const {return 0.0;}
63  virtual Complex GetIntpolComplex(const Real &d) const {return 0.0;}
64 
65  virtual void Apply(NonModAlgorithm& a) const {}
66  virtual void ApplyIP(NonModAlgorithm& a) const {}
67 
68  virtual void SetSpatialOrigin(const Point& o) {}
69 
70  virtual Point GetSpatialOrigin() const {return Point();}
71 
72  virtual void Attach(DataObserver *o) const {}
73 
74  virtual void Detach(DataObserver *o) const {}
75 
76  virtual void Notify() const {}
77 
78  virtual ImageHandle Crop(const Extent& e) const {
79  return CreateImage();
80  }
81 
82  static Data& Instance() {
83  static NullData instance;
84  return instance;
85  }
86 
87 protected:
88  virtual PixelSampling& Sampling() {
89  return sampling_;
90  }
91  virtual const PixelSampling& Sampling() const {
92  return sampling_;
93  }
94 
95 private:
96  PixelSampling sampling_;
97 };
98 
99 }} // namespace
100 
101 #endif