/*
 * This file is a part of LuminanceHDR package.
 * ----------------------------------------------------------------------
 * Copyright (C) 2013 Davide Anastasia
 *
 *  This program 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 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program 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 this program; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 * ----------------------------------------------------------------------
 *
 */

//! @author Davide Anastasia <davideanastasia@users.sourceforge.net>

#ifndef LIBPFS_PROGRESS_H
#define LIBPFS_PROGRESS_H

namespace pfs
{

//! \brief This class is a virtual interface for a status callback. It allows
//! to decouple the interface from the actual implementation (which can be, for
//! instance, based on Qt)
//! \note All the functions have an empty implementation, so it not necessary
//! to pass a concrete instance to routine that require the presence of this
//! class
class Progress
{
public:
    Progress();

    //! \brief virtual dtor, enable derivation
    virtual ~Progress() {}

    virtual void setMaximum(int maximum);
    virtual void setMinimum(int minimum);
    virtual void setRange(int minimum, int maximum);

    virtual int maximum() const;
    virtual int minimum() const;

    virtual void setValue(int value);

    ///! \brief increment the counter of 1 and return the new value
    // this kind of function could be particularly useful in a multithreading
    // environment, controlling the call with a monitor
    // virtual int next();

    virtual int value() const;

    virtual void cancel(bool b = true);
    virtual bool canceled() const;

private:
    int m_maximum;
    int m_minimum;

    int m_value;

    bool m_canceled;
};

}

#endif // LIBPFS_PROGRESS_H
