Overture
Version 25
|
usefull utility classes and functions More...
Classes | |
class | Err |
standard exception class More... | |
class | RangeErr |
exception class for range errors More... | |
class | sptr_Err |
error class for sptr More... | |
class | sptr |
MY smart pointer class (not yours!) More... | |
Typedefs | |
typedef double | real |
change the value of this typedef to get single/double precision | |
Functions | |
template<class E , class B > | |
void | Assert (B assertion, std::string s="") |
template<class E , class B > | |
void | Assert (B assertion, E exception) |
simple assertion throwing a user defined exception instance | |
template<class E , class B > | |
void | AssertAlways (B assertion, std::string s="") |
template<class E , class B > | |
void | AssertAlways (B assertion, E exception) |
simple assertion throwing a user defined exception instance | |
real | getcpu () |
get the current cpu time in seconds | |
real | getrandom () |
get a random number in [0,1] | |
int | round (const real r) |
round a real to the nearest integer | |
long int | acquire_gid () |
acquire a "global" id, this will be used interally by KK::sptr | |
void | release_gid (long int gid) |
release a "global" id allowing it to be used again | |
template<typename TO , typename FROM > | |
sptr< TO > | sptr_cast (sptr< FROM > &p) |
cast from one pointer type to another; return a null ptr if the dynamic cast is invalid | |
template<typename TO , typename FROM > | |
sptr< TO > | sptr_static_cast (sptr< FROM > &p) |
template<typename TO , typename FROM > | |
sptr< TO > | sptr_dynamic_cast (sptr< FROM > &p) |
Variables | |
const real | REAL_MAX = DBL_MAX |
maximum real value | |
const real | REAL_MIN = DBL_MIN |
minimum positive, nonzero real value | |
const real | REAL_EPSILON = DBL_EPSILON |
1+REAL_EPSILON = 1 on a computer | |
usefull utility classes and functions
The KK namespace contains usefull stuff used frequently by K.K. Chand.
typedef double KK::real |
change the value of this typedef to get single/double precision
long int KK::acquire_gid | ( | ) |
acquire a "global" id, this will be used interally by KK::sptr
Referenced by KK::sptr< T >::sptr().
|
inline |
an assertion that can be used with derivations of the Err class. similar to Stroustroup "The C++ Programming Language, 3rd Ed., SS 24.3.7.2
assertion | the boolean assertion |
s | a string that holds information in case of failure (added to the exception) note that the assertions only do something when KK_DEBUG is defined |
Referenced by KK::sptr< T >::sptr().
simple assertion throwing a user defined exception instance
an assertion that can be used with derivations of the Err class. similar to Stroustroup "The C++ Programming Language, 3rd Ed., SS 24.3.7.2
assertion | the boolean assertion |
exception | the exception to be thrown in the case of failure. note that the assertions only do something when KK_DEBUG is defined |
|
inline |
an assertion that can be used with derivations of the Err class. similar to Stroustroup "The C++ Programming Language, 3rd Ed., SS 24.3.7.2
assertion | the boolean assertion |
s | a string that holds information in case of failure (added to the exception) note that the assertions always do something, even when KK_DEBUG is not defined |
simple assertion throwing a user defined exception instance
an assertion that can be used with derivations of the Err class. similar to Stroustroup "The C++ Programming Language, 3rd Ed., SS 24.3.7.2
assertion | the boolean assertion |
exception | the exception to be thrown in the case of failure. note that this assertion is ALWAYS on, even if KK_DEBUG is defined! |
|
inline |
get the current cpu time in seconds
|
inline |
get a random number in [0,1]
void KK::release_gid | ( | long int | gid | ) |
release a "global" id allowing it to be used again
Referenced by KK::sptr< T >::destroy().
|
inline |
round a real to the nearest integer
|
inline |
cast from one pointer type to another; return a null ptr if the dynamic cast is invalid
References KK::sptr< T >::raw().
Referenced by sptr_static_cast().
|
inline |
References KK::sptr< T >::raw().
Referenced by DBase::can_cast_entry(), DBase::cast_entry(), DBase::DataBase::get(), and DBase::DataBase::put().
|
inline |
References sptr_cast().
const real KK::REAL_EPSILON = DBL_EPSILON |
1+REAL_EPSILON = 1 on a computer
const real KK::REAL_MAX = DBL_MAX |
maximum real value
const real KK::REAL_MIN = DBL_MIN |
minimum positive, nonzero real value