/***************************************************************************
rpoints.h - description
-------------------
begin : Thu Mar 2 2000
copyright : (C) 2000 by Daniel Roberge
email : droberge@uvic.ca
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the Artistic License *
* *
***************************************************************************/
#ifndef RPOINTS_H
#define RPOINTS_H
/**A points structure in which there is a current value and a normal value
*@author Daniel Roberge
*/
class RenormalizablePoints {
public:
/**Creates a new RenormalizablePoints with current and normal 0*/
RenormalizablePoints();
/**Creates a new RenormalizablePoints with current and normal values value*/
RenormalizablePoints(int value);
~RenormalizablePoints();
/** Sets the normal value of the RenormalizablePoints to val */
void setNormal(int val) { normal = val; };
/** Returns the current value */
int getCurrent() const { return current; };
/** Sets the current value to val. */
void setCurrent(int val) { current = val; };
/** Returns the current value to the normal value. */
void renormalize() { current = normal; };
/** Increments the current value. */
RenormalizablePoints operator++ ();
/** Decrements the current value. */
RenormalizablePoints operator-- ();
/** Sums the current value and the operand. */
int operator+ (int operand) const { return current + operand; };
/** Takes the difference of the current value and the operand. */
int operator- (int operand) const { return current - operand; };
/** Assigns a new current value to the RPoints */
RenormalizablePoints operator= (int newVal);
/** Changes the normal value to match the current value. */
void makeNormal() { normal = current; };
/** Returns the normal value of the RPoints */
int getNormal() { return normal; };
protected: // Protected attributes
/** The value this variable has currently */
int current;
/** The value this object renormalize()s to. */
int normal;
};
/** Increments the normal value and renormalizes */
inline RenormalizablePoints RenormalizablePoints::operator++ (){
current++;
return *this;
}
#endif
| Generated by: droberge@magebook.localdomain on Mon Jul 3 13:20:08 200. |