Util Namespace Reference


Classes

class  Color
class  VoxelGrid

Functions

template<typename T>
std::auto_ptr< T > autoPtr (T *t)
template<typename Target, typename Source>
bool lexical_cast (const Source &source, Target &target)
template<typename Source>
bool lexical_cast (const Source &source, std::string &target)
bool lexical_cast (const std::string &source, bool &target)
template<typename Source>
std::string toString (const Source &source)
template<typename T>
std::set< T > readSet (std::istream &in)
float randf ()
template<typename T>
void destroy (T *t)


Detailed Description

The Util namespace.


Function Documentation

template<typename T>
std::auto_ptr<T> Util::autoPtr T *  t  ) 
 

Shortcut for creating an std::auto_ptr without having to specify template parameters.

Parameters:
t the pointer to embed in an auto_ptr.
Returns:
an auto_ptr containing the supplied pointer.

template<typename T>
void Util::destroy T *  t  ) 
 

Deletes the supplied pointer.

Parameters:
t the pointer to the object to delete.

bool Util::lexical_cast const std::string &  source,
bool &  target
[inline]
 

Overload of lexical cast for bools. Allows bools to be represented as 0/1 or true/false.

Parameters:
source the source string.
target the bool target.
Returns:
if conversion was successful (source was 0/1 or true/false).

template<typename Source>
bool Util::lexical_cast const Source &  source,
std::string &  target
 

Overload of lexical cast for string targets. Uses toString to make sure that the source is not split by whitespace.

Parameters:
source the source variable.
target the target string.
Returns:
true, as this conversion is always successful.

template<typename Target, typename Source>
bool Util::lexical_cast const Source &  source,
Target &  target
 

Lexical cast between types. Uses std::stringstream to perform the conversion.

Parameters:
source the source variable.
target the target variable.
Returns:
if the conversion was successful.

float Util::randf  )  [inline]
 

Returns random float values in the range [0.0f, 1.0f>.

Returns:
the random float value.

template<typename T>
std::set<T> Util::readSet std::istream &  in  ) 
 

Reads a std::set of values from an std::istream.

Parameters:
in the input stream.
Returns:
the set containing the values read from the istream.

template<typename Source>
std::string Util::toString const Source &  source  ) 
 

Conversion to std::string.

Parameters:
source the variable to convert.
Returns:
a string representing the variable.


Generated on Fri Jun 16 08:42:54 2006 for GPU Thesis by  doxygen 1.4.6-NO