Tolto close() a TDistrib
git-svn-id: svn://10.65.10.50/trunk@61 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
8b6051e689
commit
3eb401c338
@ -778,7 +778,7 @@ void TDistrib ::add (real slice)
|
||||
_slices.add (slice);
|
||||
}
|
||||
|
||||
real TDistrib ::get ()
|
||||
real TDistrib::get ()
|
||||
{
|
||||
_ready = TRUE;
|
||||
CHECK (_current < _slices.items (), "TDistrib: too many gets");
|
||||
@ -793,7 +793,7 @@ real TDistrib ::get ()
|
||||
return r;
|
||||
}
|
||||
|
||||
void TDistrib ::init (const real & r)
|
||||
void TDistrib::init (const real & r)
|
||||
{
|
||||
_current = 0; _prog = 0;
|
||||
_tot = r; _ready = FALSE;
|
||||
|
111
include/real.h
111
include/real.h
@ -24,50 +24,50 @@
|
||||
// @C
|
||||
class real : public TObject
|
||||
{
|
||||
// @DPRIV
|
||||
DEC _dec;
|
||||
// @END
|
||||
// @DPRIV
|
||||
DEC _dec;
|
||||
// @END
|
||||
|
||||
protected:
|
||||
virtual TObject* dup() const;
|
||||
char* literals() const;
|
||||
char* points(int decimals = 0) const;
|
||||
virtual TObject* dup() const;
|
||||
char* literals() const;
|
||||
char* points(int decimals = 0) const;
|
||||
|
||||
public:
|
||||
|
||||
static char* eng2ita(char* s);
|
||||
static char* ita2eng(const char* s);
|
||||
static bool is_real(const char* n);
|
||||
static char* eng2ita(char* s);
|
||||
static char* ita2eng(const char* s);
|
||||
static bool is_real(const char* n);
|
||||
|
||||
// @FPUB
|
||||
DEC* ptr() const { return (DEC*)&_dec; }
|
||||
char* string(int len = 0, int dec = UNDEFINED, char pad = ' ') const;
|
||||
char* stringa(int len = 0, int dec = UNDEFINED, char pad = ' ') const;
|
||||
char* string(const char* picture) const;
|
||||
// @FPUB
|
||||
DEC* ptr() const { return (DEC*)&_dec; }
|
||||
char* string(int len = 0, int dec = UNDEFINED, char pad = ' ') const;
|
||||
char* stringa(int len = 0, int dec = UNDEFINED, char pad = ' ') const;
|
||||
char* string(const char* picture) const;
|
||||
|
||||
int precision() ;
|
||||
bool is_zero() const;
|
||||
int sign() const;
|
||||
int integer() const; // operator int is too dangerous
|
||||
int precision() ;
|
||||
bool is_zero() const;
|
||||
int sign() const;
|
||||
int integer() const; // operator int is too dangerous
|
||||
|
||||
real& round(int prec = 0) ;
|
||||
real& trunc(int prec = 0) ;
|
||||
real& ceil(int prec = 0);
|
||||
real& operator =(double a);
|
||||
real& operator =(const real& b);
|
||||
real& operator +=(const real& b);
|
||||
real& operator +=(double a);
|
||||
real& operator -=(const real& b);
|
||||
real& operator *=(const real& b);
|
||||
real& operator /=(const real& b);
|
||||
bool operator !() const { return is_zero(); }
|
||||
real operator -() const;
|
||||
real& round(int prec = 0) ;
|
||||
real& trunc(int prec = 0) ;
|
||||
real& ceil(int prec = 0);
|
||||
real& operator =(double a);
|
||||
real& operator =(const real& b);
|
||||
real& operator +=(const real& b);
|
||||
real& operator +=(double a);
|
||||
real& operator -=(const real& b);
|
||||
real& operator *=(const real& b);
|
||||
real& operator /=(const real& b);
|
||||
bool operator !() const { return is_zero(); }
|
||||
real operator -() const;
|
||||
|
||||
real();
|
||||
real(const real& b);
|
||||
real(double a);
|
||||
real(const char* s);
|
||||
virtual ~real() {}
|
||||
real();
|
||||
real(const real& b);
|
||||
real(double a);
|
||||
real(const char* s);
|
||||
virtual ~real() {}
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
@ -129,31 +129,30 @@ extern const real ZERO;
|
||||
|
||||
class TDistrib : public TObject
|
||||
{
|
||||
real _tot;
|
||||
real _prog;
|
||||
bool _ready;
|
||||
TArray _slices;
|
||||
int _current;
|
||||
int _decs;
|
||||
real _tot;
|
||||
real _prog;
|
||||
bool _ready;
|
||||
TArray _slices;
|
||||
int _current;
|
||||
int _decs;
|
||||
|
||||
public:
|
||||
public:
|
||||
|
||||
void add(real slice);
|
||||
real get();
|
||||
void close();
|
||||
void add(real slice);
|
||||
real get();
|
||||
|
||||
void init(const real& r);
|
||||
void operator =(const real& r) { init(r); }
|
||||
const real& last_slice() const
|
||||
{
|
||||
CHECK(_current,"TDistrib: slices not set");
|
||||
return (const real&)_slices[_current-1];
|
||||
}
|
||||
void init(const real& r);
|
||||
void operator =(const real& r) { init(r); }
|
||||
const real& last_slice() const
|
||||
{
|
||||
CHECK(_current,"TDistrib: slices not set");
|
||||
return (const real&)_slices[_current-1];
|
||||
}
|
||||
|
||||
TDistrib(const real& r, int round = UNDEFINED) :
|
||||
_prog(0.0), _tot(r), _ready(FALSE),
|
||||
_current(0), _decs(round), _slices(4)
|
||||
{}
|
||||
TDistrib(const real& r, int round = UNDEFINED) :
|
||||
_prog(0.0), _tot(r), _ready(FALSE),
|
||||
_current(0), _decs(round), _slices(4)
|
||||
{}
|
||||
virtual ~TDistrib() {}
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user