Skip to content

Commit

Permalink
excise CVD::Internal::is_POD
Browse files Browse the repository at this point in the history
  • Loading branch information
Edward Rosten committed Jul 9, 2015
1 parent 1bd4a19 commit abefb48
Show file tree
Hide file tree
Showing 11 changed files with 8 additions and 170 deletions.
11 changes: 0 additions & 11 deletions cvd/argb.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
#define CVD_QT_ARGB_H

#include <iostream>
#include <cvd/internal/is_pod.h>

namespace CVD {

Expand Down Expand Up @@ -80,16 +79,6 @@ inline std::ostream& operator <<(std::ostream& os, const Argb<unsigned char>& x)
<< static_cast<unsigned int>(x.blue) << ")";
}

#ifndef DOXYGEN_IGNORE_INTERNAL
namespace Internal
{
template<class C> struct is_POD<Argb<C> >
{
enum { is_pod = is_POD<C>::is_pod };
};
}
#endif



} // end namespace
Expand Down
12 changes: 0 additions & 12 deletions cvd/bgrx.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
#define CVD_INCLUDE_BGRX_H

#include <iostream>
#include <cvd/internal/is_pod.h>

namespace CVD {

Expand Down Expand Up @@ -77,17 +76,6 @@ inline std::ostream& operator <<(std::ostream& os, const Bgrx<unsigned char>& x)
<< static_cast<unsigned int>(x.red) << ",";
}

#ifndef DOXYGEN_IGNORE_INTERNAL
namespace Internal
{
template<class C> struct is_POD<Bgrx<C> >
{
enum { is_pod = is_POD<C>::is_pod };
};
}
#endif



} // end namespace
#endif
Expand Down
59 changes: 0 additions & 59 deletions cvd/colourspaces.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#ifndef CVD_COLOURSPACES_H
#define CVD_COLOURSPACES_H

#include <cvd/internal/is_pod.h>
#include <cvd/internal/builtin_components.h>
#include <cvd/internal/pixel_traits.h>
#include <cvd/internal/name_builtin_types.h>
Expand Down Expand Up @@ -329,64 +328,6 @@ namespace CVD
};
}


#ifndef DOXYGEN_IGNORE_INTERNAL
namespace Internal
{
template<> struct is_POD<bayer_bggr>
{
enum { is_pod = 1 };
};
template<> struct is_POD<bayer_gbrg>
{
enum { is_pod = 1 };
};
template<> struct is_POD<bayer_grbg>
{
enum { is_pod = 1 };
};
template<> struct is_POD<bayer_rggb>
{
enum { is_pod = 1 };
};
template<> struct is_POD<bayer_bggr16>
{
enum { is_pod = 1 };
};
template<> struct is_POD<bayer_gbrg16>
{
enum { is_pod = 1 };
};
template<> struct is_POD<bayer_grbg16>
{
enum { is_pod = 1 };
};
template<> struct is_POD<bayer_rggb16>
{
enum { is_pod = 1 };
};
template<> struct is_POD<bayer_bggr16be>
{
enum { is_pod = 1 };
};
template<> struct is_POD<bayer_gbrg16be>
{
enum { is_pod = 1 };
};
template<> struct is_POD<bayer_grbg16be>
{
enum { is_pod = 1 };
};
template<> struct is_POD<bayer_rggb16be>
{
enum { is_pod = 1 };
};
template<> struct is_POD<yuv411>
{
enum { is_pod = 1 };
};
}
#endif
}

#endif
3 changes: 2 additions & 1 deletion cvd/image_convert.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@
#include <cvd/internal/convert_pixel_types.h>
#include <cvd/internal/rgb_components.h>
#include <cvd/image.h>
#include <type_traits>

namespace CVD
{

// The most general case: one row at a time

template <class From, class To, class Conv=typename Pixel::DefaultConversion<From,To>::type, int both_pod=Internal::is_POD<From>::is_pod && Internal::is_POD<To>::is_pod> struct ConvertImage {
template <class From, class To, class Conv=typename Pixel::DefaultConversion<From,To>::type, int both_pod=std::is_trivially_copyable<From>::value && std::is_trivially_copyable<To>::value> struct ConvertImage {
static void convert(const BasicImage<From>& from, BasicImage<To>& to) {
for (int r=0; r<from.size().y; r++)
Pixel::ConvertPixels<From,To,Conv>::convert(from[r], to[r], from.size().x);
Expand Down
5 changes: 2 additions & 3 deletions cvd/internal/convert_pixel_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@
#define CVD_CONVERT_PIXEL_TYPES_H

#include <math.h>

#include <type_traits>
#include <cvd/abs.h>
#include <cvd/internal/scalar_convert.h>
#include <cvd/internal/builtin_components.h>
#include <cvd/internal/rgb_components.h>
#include <cvd/internal/is_pod.h>
#include <limits>

namespace CVD{namespace Pixel
Expand Down Expand Up @@ -265,7 +264,7 @@ namespace CVD{namespace Pixel


template <class From, class To, class Conv=typename DefaultConversion<From,To>::type,
bool both_pod=CVD::Internal::is_POD<From>::is_pod && CVD::Internal::is_POD<To>::is_pod> struct ConvertPixels {
bool both_pod=std::is_trivially_copyable<From>::value && std::is_trivially_copyable<To>::value> struct ConvertPixels {
static inline void convert(const From* from, To* to, size_t count) {
for (size_t i=0; i<count; i++)
Conv::convert(from[i], to[i]);
Expand Down
28 changes: 0 additions & 28 deletions cvd/internal/is_pod.h

This file was deleted.

12 changes: 0 additions & 12 deletions cvd/la.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
#define CVD_LA_H

#include <iostream>
#include <cvd/internal/is_pod.h>

namespace CVD {

Expand Down Expand Up @@ -74,17 +73,6 @@ namespace CVD {
<< static_cast<unsigned int>(x.alpha) << ")";
}

#ifndef DOXYGEN_IGNORE_INTERNAL
namespace Internal
{
template<class C> struct is_POD<La<C> >
{
enum { is_pod = is_POD<C>::is_pod };
};
}
#endif



} // end namespace
#endif
Expand Down
13 changes: 0 additions & 13 deletions cvd/rgb.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@

#include <cvd/byte.h>

#include <cvd/internal/is_pod.h>

namespace CVD {

/// A colour consisting of red, green and blue components.
Expand Down Expand Up @@ -99,16 +97,5 @@ inline std::ostream& operator <<(std::ostream& os, const Rgb<byte>& x)
<< static_cast<int>(x.blue) << ")";
}

#ifndef DOXYGEN_IGNORE_INTERNAL
namespace Internal
{
template<class C> struct is_POD<Rgb<C> >
{
enum { is_pod = is_POD<C>::is_pod };
};
}
#endif


} // end namespace
#endif
13 changes: 0 additions & 13 deletions cvd/rgb8.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
#ifndef __RGB8_H
#define __RGB8_H

#include <cvd/internal/is_pod.h>


namespace CVD {

/// @ingroup gImage
Expand All @@ -29,15 +26,5 @@ struct Rgb8
: red(r), green(g), blue(b), dummy(a) {}
};

#ifndef DOXYGEN_IGNORE_INTERNAL
namespace Internal
{
template <> struct is_POD<Rgb8>
{
enum { is_pod = 1 };
};
}
#endif

} // end namespace
#endif
12 changes: 0 additions & 12 deletions cvd/rgba.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
#define CVD_RGBA_H

#include <iostream>
#include <cvd/internal/is_pod.h>

namespace CVD {

Expand Down Expand Up @@ -81,17 +80,6 @@ inline std::ostream& operator <<(std::ostream& os, const Rgba<unsigned char>& x)
<< static_cast<unsigned int>(x.alpha) << ")";
}

#ifndef DOXYGEN_IGNORE_INTERNAL
namespace Internal
{
template<class C> struct is_POD<Rgba<C> >
{
enum { is_pod = is_POD<C>::is_pod };
};
}
#endif



} // end namespace
#endif
Expand Down
10 changes: 4 additions & 6 deletions cvd/utility.h
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
#ifndef CVD_UTILITY_H
#define CVD_UTILITY_H

#ifndef _WIN32
#include <stdint.h>
#endif
#include <cstdint>

#include <cvd/image.h>
#include <cvd/internal/is_pod.h>
#include <cvd/internal/pixel_traits.h>
#include <cvd/internal/convert_pixel_types.h>
#include <type_traits>

namespace CVD { //begin namespace

Expand Down Expand Up @@ -53,7 +51,7 @@ in the output image
}
}

template <class T, bool pod = Internal::is_POD<T>::is_pod> struct ZeroPixel {
template <class T, bool pod = std::is_pod<T>::value> struct ZeroPixel {
static void zero(T& t) {
for (unsigned int c=0; c<Pixel::Component<T>::count; c++)
Pixel::Component<T>::get(t,c) = 0;
Expand All @@ -64,7 +62,7 @@ in the output image
static void zero(T& t) { memset(&t,0,sizeof(T)); }
};

template <class T, bool pod = Internal::is_POD<T>::is_pod> struct ZeroPixels {
template <class T, bool pod = std::is_pod<T>::value> struct ZeroPixels {
static void zero(T* pixels, int count) {
if (count) {
ZeroPixel<T>::zero(*pixels);
Expand Down

0 comments on commit abefb48

Please sign in to comment.