Introduce rtengine/noncopyable.hpp

This commit is contained in:
Flössie
2016-10-08 15:36:44 +02:00
parent 8a2b2e6700
commit d132149a26
20 changed files with 142 additions and 105 deletions

View File

@@ -50,17 +50,19 @@ My email address is my screen name followed by @yahoo.com. I'm also known as ben
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include "opthelper.h"
#include "noncopyable.h"
//This is for solving big symmetric positive definite linear problems.
float *SparseConjugateGradient(void Ax(float *Product, float *x, void *Pass), float *b, int n, bool OkToModify_b = true, float *x = NULL, float RMSResidual = 0.0f, void *Pass = NULL, int MaximumIterates = 0, void Preconditioner(float *Product, float *x, void *Pass) = NULL);
//Storage and use class for symmetric matrices, the nonzero contents of which are confined to diagonals.
class MultiDiagonalSymmetricMatrix
class MultiDiagonalSymmetricMatrix :
public rtengine::NonCopyable
{
public:
MultiDiagonalSymmetricMatrix(int Dimension, int NumberOfDiagonalsInLowerTriangle);
MultiDiagonalSymmetricMatrix(const MultiDiagonalSymmetricMatrix&) = delete;
~MultiDiagonalSymmetricMatrix();
/* Storage of matrix data, and a function to create memory for Diagonals[index].
@@ -115,11 +117,11 @@ public:
};
class EdgePreservingDecomposition
class EdgePreservingDecomposition :
public rtengine::NonCopyable
{
public:
EdgePreservingDecomposition(int width, int height);
EdgePreservingDecomposition(const EdgePreservingDecomposition&) = delete;
~EdgePreservingDecomposition();
//Create an edge preserving blur of Source. Will create and return, or fill into Blur if not NULL. In place not ok.

View File

@@ -61,13 +61,16 @@
#include <cstring>
#include <cstdint>
#include <cassert>
#ifndef NDEBUG
#include <glibmm.h>
#include <fstream>
#endif
#include "opthelper.h"
#include <assert.h>
#include "rt_math.h"
#include "noncopyable.h"
// Bit representations of flags
enum {
@@ -85,7 +88,8 @@ using LUTd = LUT<double>;
using LUTuc = LUT<uint8_t>;
template<typename T>
class LUT
class LUT :
public rtengine::NonCopyable
{
protected:
// list of variables ordered to improve cache speed
@@ -167,8 +171,6 @@ public:
reset();
}
LUT(const LUT&) = delete;
~LUT()
{
if (owner) {

View File

@@ -66,8 +66,11 @@
#include <cstring>
#include <cstdio>
#include "noncopyable.h"
template<typename T>
class array2D
class array2D :
public rtengine::NonCopyable
{
private:
@@ -167,8 +170,6 @@ public:
}
}
array2D(const array2D&) = delete;
// destructor
~array2D()
{

View File

@@ -20,11 +20,13 @@
#define _CIEIMAGE_H_
#include "image16.h"
#include "noncopyable.h"
namespace rtengine
{
class CieImage
class CieImage :
public NonCopyable
{
private:
bool fromImage;
@@ -41,8 +43,6 @@ public:
float** h_p;
CieImage (int w, int h);
CieImage (const CieImage&) = delete;
~CieImage ();
//Copies image data in Img into this instance.

View File

@@ -7,16 +7,16 @@
#include "cache.h"
#include "alignedbuffer.h"
#include "noncopyable.h"
namespace rtengine
{
class HaldCLUT
class HaldCLUT final :
public NonCopyable
{
public:
HaldCLUT();
HaldCLUT(const HaldCLUT& other) = delete;
HaldCLUT& operator =(const HaldCLUT& other) = delete;
~HaldCLUT();
bool load(const Glib::ustring& filename);
@@ -51,14 +51,12 @@ private:
Glib::ustring clut_profile;
};
class CLUTStore
class CLUTStore final :
public NonCopyable
{
public:
static CLUTStore& getInstance();
CLUTStore(const CLUTStore& other) = delete;
CLUTStore& operator =(const CLUTStore& other) = delete;
std::shared_ptr<HaldCLUT> getClut(const Glib::ustring& filename);
void clearCache();

View File

@@ -22,15 +22,17 @@
#define CPLX_WAVELET_DEC_H_INCLUDED
#include <cstddef>
#include <math.h>
#include <cmath>
#include "cplx_wavelet_level.h"
#include "cplx_wavelet_filter_coeffs.h"
#include "noncopyable.h"
namespace rtengine
{
class wavelet_decomposition
class wavelet_decomposition :
public NonCopyable
{
public:
@@ -58,8 +60,6 @@ public:
template<typename E>
wavelet_decomposition(E * src, int width, int height, int maxlvl, int subsampling, int skipcrop = 1, int numThreads = 1, int Daub4Len = 6);
wavelet_decomposition(const wavelet_decomposition&) = delete;
~wavelet_decomposition();
internal_type ** level_coeffs(int level) const

View File

@@ -26,11 +26,12 @@
#include <glibmm.h>
#include "../rtgui/threadutils.h"
#include "imagefloat.h"
#include "curves.h"
#include "colortemp.h"
#include "../rtgui/threadutils.h"
#include "noncopyable.h"
namespace rtengine
{
@@ -145,14 +146,12 @@ private:
AdobeToneCurve tone_curve;
};
class DCPStore final
class DCPStore final :
public NonCopyable
{
public:
static DCPStore* getInstance();
DCPStore(const DCPStore& other) = delete;
DCPStore& operator =(const DCPStore& other) = delete;
void init(const Glib::ustring& rt_profile_dir);
bool isValidDCPFileName(const Glib::ustring& filename) const;

View File

@@ -17,8 +17,9 @@
* You should have received a copy of the GNU General Public License
* along with RawTherapee. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef JAGGEDARRAY_H
#define JAGGEDARRAY_H
#pragma once
#include "noncopyable.h"
namespace rtengine
{
@@ -50,7 +51,8 @@ inline void freeJaggedArray (T** const a)
}
template<class T>
class JaggedArray
class JaggedArray :
public NonCopyable
{
public:
JaggedArray (const int W, const int H, const bool initZero = false)
@@ -65,10 +67,6 @@ public:
}
}
JaggedArray (const JaggedArray&) = delete;
JaggedArray& operator= (const JaggedArray&) = delete;
public:
operator T** const () const
{
return a;
@@ -85,5 +83,3 @@ template<class T>
void freeJaggedArray (JaggedArray<T>&);
} // rtengine
#endif // JAGGEDARRAY_H

34
rtengine/noncopyable.h Normal file
View File

@@ -0,0 +1,34 @@
/*
* This file is part of RawTherapee.
*
* Copyright (c) 2016 Flössie <floessie.mail@gmail.com>
*
* RawTherapee is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* RawTherapee is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with RawTherapee. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
namespace rtengine
{
class NonCopyable
{
public:
NonCopyable() = default;
explicit NonCopyable(const NonCopyable&) = delete;
NonCopyable& operator =(const NonCopyable&) = delete;
};
}

View File

@@ -19,11 +19,13 @@
#ifndef _PROCPARAMS_H_
#define _PROCPARAMS_H_
#include <glibmm.h>
#include <vector>
#include <cstdio>
#include <cmath>
#include <glibmm.h>
#include <lcms2.h>
#include "LUT.h"
#include "coord.h"
@@ -1363,7 +1365,7 @@ class PartialProfile
public:
rtengine::procparams::ProcParams* pparams;
ParamsEdited* pedited;
PartialProfile& operator=(PartialProfile& rhs)
PartialProfile& operator =(const PartialProfile& rhs)
{
pparams = rhs.pparams;
pedited = rhs.pedited;

View File

@@ -20,8 +20,10 @@
#define __RAWIMAGE_H
#include <ctime>
#include "dcraw.h"
#include "imageio.h"
#include "noncopyable.h"
namespace rtengine
{
@@ -32,7 +34,8 @@ struct badPix {
badPix( uint16_t xc, uint16_t yc ): x(xc), y(yc) {}
};
class PixelsMap
class PixelsMap :
public NonCopyable
{
int w; // line width in base_t units
int h; // height
@@ -49,8 +52,6 @@ public:
memset(pm, 0, h * w * base_t_size );
}
PixelsMap(const PixelsMap&) = delete;
~PixelsMap()
{
delete [] pm;

View File

@@ -21,11 +21,13 @@
#include "imagefloat.h"
#include "image16.h"
#include "noncopyable.h"
namespace rtengine
{
class SHMap
class SHMap :
public NonCopyable
{
public:
@@ -33,8 +35,6 @@ public:
float max_f, min_f, avg;
SHMap (int w, int h, bool multiThread);
SHMap(const SHMap&) = delete;
~SHMap ();
void update (Imagefloat* img, double radius, double lumi[3], bool hq, int skip);