<commit_before>#pragma once

#include <array>
#include <vector>

#include <reflectionzeug/base/Color.h>

#include <gloperate/gloperate_api.h>

namespace globjects
{


class Texture;


} // namespace globjects

namespace gloperate
{


class ColorGradientList;

class GLOPERATE_API AbstractColorGradient
{
public:
    explicit AbstractColorGradient(const std::string & name);

    virtual ~AbstractColorGradient();

    const std::string & name() const;
    void setName(const std::string & name);

    std::vector<unsigned char> pixelData(size_t numPixels) const;

    template <size_t numPixels>
    std::array<unsigned char, numPixels * sizeof(std::uint32_t)> pixelData() const;

    virtual void fillPixelData(unsigned char * data, size_t numPixels) const;
    virtual reflectionzeug::Color colorAt(float position) const = 0;

    globjects::Texture * generateTexture(size_t numPixels) const;

protected:
    std::string m_name;
};


} // namespace reflectionzeug

#include <gloperate/base/AbstractColorGradient.hpp>
<commit_msg>Add class documentation for AbstractColorGradient class<commit_after>#pragma once

#include <array>
#include <vector>

#include <reflectionzeug/base/Color.h>

#include <gloperate/gloperate_api.h>

namespace globjects
{


class Texture;


} // namespace globjects

namespace gloperate
{


class ColorGradientList;

/**
 * @brief
 *    The base class for color gradients (i.e., a mapping of float values in the range of [0..1] to a reflectionzeug::Color).
 *
 *    This class provides convenience methods for accessing the binary image data of the gradient with specific widths (pixelData)
 *    and for using this color gradient in an OpenGL texture (generateTexture).
 *
 *    A color gradient is identified through its name and this name is mainly used by the ColorGradientList class.
 *
 *    \see ColorGradientList
 *    \see ExplicitEquidistantColorGradient
 */
class GLOPERATE_API AbstractColorGradient
{
public:
    explicit AbstractColorGradient(const std::string & name);

    /**
     * @brief Virtual destructor for subclasses.
     */
    virtual ~AbstractColorGradient();

    const std::string & name() const;
    void setName(const std::string & name);

    std::vector<unsigned char> pixelData(size_t numPixels) const;

    template <size_t numPixels>
    std::array<unsigned char, numPixels * sizeof(std::uint32_t)> pixelData() const;

    virtual void fillPixelData(unsigned char * data, size_t numPixels) const;
    virtual reflectionzeug::Color colorAt(float position) const = 0;

    globjects::Texture * generateTexture(size_t numPixels) const;

protected:
    std::string m_name;
};


} // namespace reflectionzeug


#include <gloperate/base/AbstractColorGradient.hpp>

{'fraction_non_alphanumeric': 0.0940484937545922, 'fraction_numerical': 0.0029390154298310064, 'mean_word_length': 4.48991935483871, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 19, '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': '2652272', 'n_tokens_mistral': 825, 'n_tokens_neox': 789, 'n_words': 236}