Commit ce649abf authored by michael's avatar michael
Browse files

class optic

parent 086ec068
Loading
Loading
Loading
Loading

LrOptic.cpp

0 → 100644
+130 −0
Original line number Diff line number Diff line
#if defined HAVE_CONFIG_H
#include "config.h"
#endif

/*****************************************************************************
 * class LrOptic (body)                                                      *
 *                                                                           *
 * author : etudiant                                                         *
 * creation : Thursday, March 6 2008 (3/6/2008)                              *
 * note :                                                                    *
 *****************************************************************************/

#include "LrOptic.h"

/*---------------------------------------------------------------------------*
 * constructors and destructor                                               *
 *---------------------------------------------------------------------------*/
LrOptic::LrOptic()
:
    m_luminance(),
    m_transparency(),
    m_color()
{
}

LrOptic::LrOptic(const LrOptic &source)
:
    m_luminance(source.m_luminance),
    m_transparency(source.m_transparency),
    m_color(source.m_color)
{
}

LrOptic *
LrOptic::clone() const
{
    return new LrOptic(*this);
}

LrOptic::LrOptic(REAL luminance, REAL transparency, LrColor color)
:
    m_luminance(luminance),
    m_transparency(transparency),
    m_color(color)
{
}

LrOptic::~LrOptic()
{
}


/*---------------------------------------------------------------------------*
 * assignement operator(s)                                                   *
 *---------------------------------------------------------------------------*/
LrOptic &
LrOptic::operator = (const LrOptic &source)
{
    if (this == &source)
        return *this;

    m_luminance = source.m_luminance;
    m_transparency = source.m_transparency;
    m_color = source.m_color;

    return *this;
}


/*---------------------------------------------------------------------------*
 * comparison operator(s)                                                    *
 *---------------------------------------------------------------------------*/
bool
operator == (const LrOptic &lhs, const LrOptic &rhs)
{
    return    (lhs.m_luminance == rhs.m_luminance)
           && (lhs.m_transparency == rhs.m_transparency)
           && (lhs.m_color == rhs.m_color);
}

bool
operator != (const LrOptic &lhs, const LrOptic &rhs)
{
    return (! (lhs == rhs));
}


/*---------------------------------------------------------------------------*
 * accessors                                                                 *
 *---------------------------------------------------------------------------*/
REAL
LrOptic::getLuminance() const
{
    return m_luminance;
}

void
LrOptic::setLuminance(REAL luminance)
{
    m_luminance = luminance;
}

REAL
LrOptic::getTransparency() const
{
    return m_transparency;
}

void
LrOptic::setTransparency(REAL transparency)
{
    m_transparency = transparency;
}

LrColor
LrOptic::getColor() const
{
    return m_color;
}

void
LrOptic::setColor(LrColor color)
{
    m_color = color;
}


/*****************************************************************************
 * $Log$
 *****************************************************************************/

LrOptic.h

0 → 100644
+61 −0
Original line number Diff line number Diff line
/*****************************************************************************
 * class LrOptic (specification)                                             *
 *                                                                           *
 * author : etudiant                                                         *
 * creation : Thursday, March 6 2008 (3/6/2008)                              *
 * note :                                                                    *
 *****************************************************************************/

#ifndef LROPTIC_H
#define LROPTIC_H


class LrOptic
{
public:

    // constructors and destructor
    // ***************************

    LrOptic();
    LrOptic(const LrOptic &source);
    LrOptic * clone() const;
    LrOptic(REAL luminance, REAL transparency, LrColor color);

    virtual ~LrOptic();

    // assignement operator(s)
    // ***********************

    LrOptic & operator = (const LrOptic &source);

    // comparison operator(s)
    // **********************

    friend bool operator == (const LrOptic &lhs, const LrOptic &rhs);
    friend bool operator != (const LrOptic &lhs, const LrOptic &rhs);

    // accessors
    // *********

    REAL getLuminance() const;
    void setLuminance(REAL luminance);

    REAL getTransparency() const;
    void setTransparency(REAL transparency);

    LrColor getColor() const;
    void setColor(LrColor color);


private:

    // data
    // ****

    REAL m_luminance;
    REAL m_transparency;
    LrColor m_color;
};

#endif