<commit_before>#ifndef IMP_IMAGE_HPP
#define IMP_IMAGE_HPP

#include <cstdint>

#include <imp/core/image_base.hpp>
#include <imp/core/exception.hpp>
#include <imp/core/pixel.hpp>

namespace imp {

template<typename Pixel, imp::PixelType pixel_type>
class Image : public ImageBase
{
  typedef Pixel pixel_t;
  typedef pixel_t* pixel_container_t;

protected:
  Image(imp::PixelOrder pixel_order = imp::PixelOrder::undefined)
    : ImageBase(pixel_type, pixel_order)
  { ; }

  Image(std::uint32_t width, std::uint32_t height,
        PixelOrder pixel_order = imp::PixelOrder::undefined)
    : ImageBase(width, height, pixel_type, pixel_order)
  { ; }

  Image(const imp::Size2u &size,
        imp::PixelOrder pixel_order = imp::PixelOrder::undefined)
    : ImageBase(size, pixel_type, pixel_order)
  { ; }

  Image(const Image& from) = default;

public:
  Image() = delete;
  virtual ~Image() = default;

  /** Returns a pointer to the pixel data.
   * The pointer can be offset to position \a (ox/oy).
   * @param[in] ox Horizontal offset of the pointer array.
   * @param[in] oy Vertical offset of the pointer array.
   * @return Pointer to the pixel array.
   */
  virtual pixel_container_t data(std::uint32_t ox = 0, std::uint32_t oy = 0) = 0;
  virtual const Pixel* data(std::uint32_t ox = 0, std::uint32_t oy = 0) const = 0;

  /** Get Pixel value at position x,y. */
  pixel_t pixel(std::uint32_t x, std::uint32_t y) const
  {
    return *data(x, y);
  }

  /** Get Pixel value at position x,y. */
  pixel_t operator()(std::uint32_t x, std::uint32_t y) const
  {
    return *data(x, y);
  }

  /** Get Pointer to beginning of row \a row (y index).
   * This enables the usage of [y][x] operator.
   */
  pixel_container_t operator[] (std::uint32_t row)
  {
    return data(0,row);
  }
  const Pixel* operator[] (std::uint32_t row) const
  {
    return data(0,row);
  }


  /**<commit_msg>depthmaps look wooonderfull :)<commit_after>#ifndef IMP_IMAGE_HPP
#define IMP_IMAGE_HPP

#include <cstdint>

#include <imp/core/image_base.hpp>
#include <imp/core/exception.hpp>
#include <imp/core/pixel.hpp>

namespace imp {

template<typename Pixel, imp::PixelType pixel_type>
class Image : public ImageBase
{
  typedef Pixel pixel_t;
  typedef pixel_t* pixel_container_t;

protected:
  Image(imp::PixelOrder pixel_order = imp::PixelOrder::undefined)
    : ImageBase(pixel_type, pixel_order)
  { ; }

  Image(std::uint32_t width, std::uint32_t height,
        PixelOrder pixel_order = imp::PixelOrder::undefined)
    : ImageBase(width, height, pixel_type, pixel_order)
  { ; }

  Image(const imp::Size2u &size,
        imp::PixelOrder pixel_order = imp::PixelOrder::undefined)
    : ImageBase(size, pixel_type, pixel_order)
  { ; }

  Image(const Image& from) = default;

public:
  Image() = delete;
  virtual ~Image() = default;

  /** Returns a pointer to the pixel data.
   * The pointer can be offset to position \a (ox/oy).
   * @param[in] ox Horizontal offset of the pointer array.
   * @param[in] oy Vertical offset of the pointer array.
   * @return Pointer to the pixel array.
   */
  virtual pixel_container_t data(std::uint32_t ox = 0, std::uint32_t oy = 0) = 0;
  virtual const Pixel* data(std::uint32_t ox = 0, std::uint32_t oy = 0) const = 0;

  /** Get Pixel value at position x,y. */
  pixel_t pixel(std::uint32_t x, std::uint32_t y) const
  {
    return *data(x, y);
  }

  /** Get Pixel value at position x,y. */
  pixel_t& pixel(std::uint32_t x, std::uint32_t y)
  {
    return *data(x, y);
  }

  /** Get Pixel value at position x,y. */
  pixel_t operator()(std::uint32_t x, std::uint32_t y) const
  {
    return *data(x, y);
  }

  /** Get Pointer to beginning of row \a row (y index).
   * This enables the usage of [y][x] operator.
   */
  pixel_container_t operator[] (std::uint32_t row)
  {
    return data(0,row);
  }
  const Pixel* operator[] (std::uint32_t row) const
  {
    return data(0,row);
  }


  /**
{'fraction_non_alphanumeric': 0.13184016289132094, 'fraction_numerical': 0.017816238228556883, 'mean_word_length': 3.6785714285714284, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7377476', 'n_tokens_mistral': 1452, 'n_tokens_neox': 1371, 'n_words': 383}