- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

# D:/Programmation/Sources/Tensor2/Utils/src/frost_utils_bool_impl.cpp

Go to the documentation of this file.

    00001 #include "frost_utils_types.h"
    00002
    00003 namespace Frost
    00004 {
    00005
    00006 template<class T>
    00007 s_bool_t<T>::s_bool_t()
    00008 {
    00009     bValue_ = false;
    00010 }
    00011
    00012 template<class T>
    00013 s_bool_t<T>::s_bool_t(const T& bValue)
    00014 {
    00015     bValue_ = bValue;
    00016 }
    00017
    00018 template<class T>
    00019 bool s_bool_t<T>::operator ! () const
    00020 {
    00021     return !bValue_;
    00022 }
    00023
    00024 template<class T>
    00025 s_bool_t<T>::operator MemberFn() const
    00026 {
    00027     if (bValue_)
    00028         return &s_bool_t::Get;
    00029     else
    00030         return NULL;
    00031 }
    00032
    00033 template<class T>
    00034 s_bool_t<T> s_bool_t<T>::operator == (const s_bool_t& bValue) const
    00035 {
    00036     return (bValue_ == bValue.bValue_);
    00037 }
    00038
    00039 template<class T>
    00040 s_bool_t<T> s_bool_t<T>::operator != (const s_bool_t& bValue) const
    00041 {
    00042     return (bValue_ != bValue.bValue_);
    00043 }
    00044
    00045 template<class T>
    00046 s_bool_t<T>& s_bool_t<T>::operator =  (const s_bool_t& bValue)
    00047 {
    00048     bValue_ = bValue.bValue_;
    00049     return *this;
    00050 }
    00051
    00052 /// Returns a random boolean.
    00053 /** \return Either 'true' or 'false' (50% each).
    00054 */
    00055 template<class T>
    00056 s_bool_t<T> s_bool_t<T>::Random()
    00057 {
    00058     return (rand()/(RAND_MAX+1.0) < 0.5f);
    00059 }
    00060
    00061 template<class T>
    00062 const string_element* s_bool_t<T>::BOOL_TRUE = "true";
    00063 template<class T>
    00064 const string_element* s_bool_t<T>::BOOL_ONE  = "1";
    00065 template<class T>
    00066 const string_element* s_bool_t<T>::BOOL_YES  = "yes";
    00067
    00068 template class s_bool_t<bool>;
    00069
    00070 }