ifw-odp 5.0.0
Loading...
Searching...
No Matches
imageWrapper.hpp
Go to the documentation of this file.
1
9#ifndef ODP_IMAGE_WRAPPER_HPP
10#define ODP_IMAGE_WRAPPER_HPP
11
12#ifndef __cplusplus
13#error This is a C++ include file and cannot be used from plain C
14#endif
15
16// System header files
17#include <type_traits>
18
19// Local header files
21
22
23namespace ifw::odp {
35 template <typename T>
36 class ImageWrapper: virtual public odp::Image
37 {
38
39 // Restrict the usage to the supported built-in types
40 static_assert(std::is_same<T, int>::value ||
41 std::is_same<T, float>::value ||
42 std::is_same<T, double>::value,
43 "class ImageWrapper can only be instantiated with int|float|double types");
44
45 public:
52
67 ImageWrapper(const cpl_size xsize, const cpl_size ysize);
68
81 const cpl_size llx,
82 const cpl_size lly,
83 const cpl_size urx,
84 const cpl_size ury);
85
93 virtual ~ImageWrapper();
94
99 virtual void Unload();
100
107 virtual bool IsWrapped() const;
108
113 virtual void SetWrap(bool status);
114
120 virtual void Save(const char *filename);
121
128 virtual void Save(const char *filename, cpl_type_bpp type_bpp);
129
144 virtual void Read(T *data_ptr,
145 cpl_size width,
146 cpl_size height);
147
148 private:
154 void Allocate(size_t size);
155
156 protected:
158
159
160 private:
161 bool m_wrapped;
162 };
163
164
165
166
167}
168
169#include "imageWrapper.ipp"
170#endif
This is the base class that provides the interface to wrap images from shared memory areas....
Definition imageWrapper.hpp:37
virtual void Read(T *data_ptr, cpl_size width, cpl_size height)
Wrap data from a data buffer.
T * m_data
Object buffer to store copied or casted shared memory areas.
Definition imageWrapper.hpp:157
ImageWrapper()
Class constructor.
ImageWrapper(const ImageWrapper &image)
Copy constructor.
ImageWrapper(const cpl_size xsize, const cpl_size ysize)
Class constructor.
virtual ~ImageWrapper()
Class destructor.
virtual void Save(const char *filename, cpl_type_bpp type_bpp)
Saves image into a FITS file of a specific data type.
virtual void Unload()
Unwrap CPL image.
virtual void Save(const char *filename)
Saves image into a FITS file.
ImageWrapper(const ImageWrapper &image, const cpl_size llx, const cpl_size lly, const cpl_size urx, const cpl_size ury)
Copy constructor.
virtual void SetWrap(bool status)
Set wrapped flag.
virtual bool IsWrapped() const
Check if image was created around a pixel buffer.
This class is C++ wrapper for a CPL image object. It provides a simplified interface that allows to c...
Definition image.hpp:44
Image class header file.
Definition array.cpp:16