Overture  Version 25
Classes | Typedefs | Functions | Variables
KK Namespace Reference

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
 

Detailed Description

usefull utility classes and functions

The KK namespace contains usefull stuff used frequently by K.K. Chand.

Typedef Documentation

typedef double KK::real

change the value of this typedef to get single/double precision

Function Documentation

long int KK::acquire_gid ( )

acquire a "global" id, this will be used interally by KK::sptr

Referenced by KK::sptr< T >::sptr().

template<class E , class B >
void KK::Assert ( B  assertion,
std::string  s = "" 
)
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

Parameters
assertionthe boolean assertion
sa string that holds information in case of failure (added to the exception) note that the assertions only do something when KK_DEBUG is defined

References E, and s.

Referenced by KK::sptr< T >::sptr().

template<class E , class B >
void KK::Assert ( B  assertion,
E  exception 
)
inline

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

Parameters
assertionthe boolean assertion
exceptionthe exception to be thrown in the case of failure. note that the assertions only do something when KK_DEBUG is defined
template<class E , class B >
void KK::AssertAlways ( B  assertion,
std::string  s = "" 
)
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

Parameters
assertionthe boolean assertion
sa 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

References E, and s.

template<class E , class B >
void KK::AssertAlways ( B  assertion,
E  exception 
)
inline

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

Parameters
assertionthe boolean assertion
exceptionthe exception to be thrown in the case of failure. note that this assertion is ALWAYS on, even if KK_DEBUG is defined!
real KK::getcpu ( )
inline

get the current cpu time in seconds

real KK::getrandom ( )
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().

int KK::round ( const real  r)
inline

round a real to the nearest integer

template<typename TO , typename FROM >
sptr<TO> KK::sptr_cast ( sptr< FROM > &  p)
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().

template<typename TO , typename FROM >
sptr<TO> KK::sptr_dynamic_cast ( sptr< FROM > &  p)
inline
template<typename TO , typename FROM >
sptr<TO> KK::sptr_static_cast ( sptr< FROM > &  p)
inline

References sptr_cast().

Variable Documentation

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