1. Which design pattern is used in the following code?

#include <cassert>
#include <iostream>

class Image;

class ImageProcessor
{
public:
    ImageProcessor()
        : m_next_processor(nullptr)
    { }

public:
    void process(Image &a)
    {
        process_implementation(a);
        if (m_next_processor != nullptr) {
            m_next_processor->process(a);
        }
    }

    virtual ~ImageProcessor() { }

protected:
    virtual void process_implementation(Image &a) = 0;

public:
    void set_next_processor(ImageProcessor *p)
    {
        assert(p != nullptr);
        m_next_processor = p;
    }

private:
    ImageProcessor *m_next_processor;
};

class ImageRotator
    : public ImageProcessor
{
public:
    typedef enum { rotate_0, rotate_90, rotate_180, rotate_270 } Rotation;

public:
    ImageRotator(Rotation r)
        : m_rotation(r)
    { }

private:
    void process_implementation(Image &a)
    {
        std::cout << "Rotating the image by the given rotation" << std::endl;
    }

private:
    Rotation m_rotation;
};

class RedEyeRemover
    : public ImageProcessor
{
private:
    void process_implementation(Image &a)
    {
        std::cout << "Detecting and removing red eye effects" << std::endl;
    }
};

class ColorAutoAdjuster
    : public ImageProcessor
{
private:
    void process_implementation(Image &a)
    {
        std::cout << "Automatically adjusting the colors of the image";
        std::cout << std::endl;
    }
};

void image_processor_test(Image &a)
{
    ImageRotator r(ImageRotator::rotate_90);
    RedEyeRemover e;
    ColorAutoAdjuster c;
    r.set_next_processor(&e);
    e.set_next_processor(&c);
    r.process(a);
}