Main Page   Modules   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

at::gray_code< T > Class Template Reference

#include <at_gray_code.h>

List of all members.

Public Types

typedef T value_type
enum  ArgType { is_gray, is_binary }

Public Methods

 operator value_type () const throw ()
value_type getbin () const throw ()
value_type getgray () const throw ()
void setgray (value_type value) throw ()
 gray_code (const T &i_value, ArgType i_arg_type)
 gray_code (const T &i_value)
template<typename RHS_T>  gray_code (const gray_code< RHS_T > &i_other_gray)
template<typename RHS_T> gray_code & operator= (const RHS_T &i_other_gray)
bool gtez ()
bool equal_to_zero ()

Protected Attributes

value_type m_value

Friends

class gray_code


Detailed Description

template<typename T>
class at::gray_code< T >

The class gray_code encapsulates the "special" integer type that represents a "gray_code". Because of the potential for confusion between regular data types and gray_code encoded values it is more appropriate to encapsulate gray code encoded values in your code than to expose them as POD integers. This class performs this encapsulation and provides some convenience functions.


Member Typedef Documentation

template<typename T>
typedef T at::gray_code< T >::value_type
 


Member Enumeration Documentation

template<typename T>
enum at::gray_code::ArgType
 

Allow construction of a gray code without any conversion.

Enumeration values:
is_gray  pass is_gray as the second parameter if the value is a gray code.
is_binary  pass is_binary as the second parameter if the value is a binary code. Omitting this parameter will use the default type T constructor that is the same as is_binary.


Constructor & Destructor Documentation

template<typename T>
at::gray_code< T >::gray_code const T &    i_value,
ArgType    i_arg_type
[inline]
 

gray_code constructor from a either a binary value or a binary form of a gray code.

To construct a gray_code object with a gray_code value, then do the following:

      gray_code( 0x234235, gray_code::is_gray )

 To construct a gray_code object with a binary value then:

      gray_code( 555, gray_code::is_binary )
 or
      gray_code( 555 ) // implicit conversions allowed.

     *
Parameters:
i_value  a value of type T that is used to initialize this code
i_arg_type  determine the representation of the value being passed in as either gray_code::is_gray or gray_code::is_binary

template<typename T>
at::gray_code< T >::gray_code const T &    i_value [inline]
 

gray_code constructor from a regular binary value.

Parameters:
i_value  a value of type T that is interpretted as a binary value.

template<typename T>
template<typename RHS_T>
at::gray_code< T >::gray_code const gray_code< RHS_T > &    i_other_gray [inline]
 

Construct a gray_code from another gray code of different type.

Parameters:
i_other_gray  the gray_code being copied.


Member Function Documentation

template<typename T>
bool at::gray_code< T >::equal_to_zero   [inline]
 

Since there is not much meaning in compareing gray codes, other than special things like being equal to zero or sign, this is an efficient method for doing this. This method compares for equal to zero.

template<typename T>
value_type at::gray_code< T >::getbin   const throw () [inline]
 

template<typename T>
value_type at::gray_code< T >::getgray   const throw () [inline]
 

template<typename T>
bool at::gray_code< T >::gtez   [inline]
 

Since there is not much meaning in compareing gray codes, other than special things like being equal to zero or sign, this is an efficient method for doing this. This method compares for "greater than or equal to zero". This is allways true for unsigned values.

template<typename T>
at::gray_code< T >::operator value_type   const throw () [inline]
 

conversion operator for a gray_code to a regular binary number.

template<typename T>
template<typename RHS_T>
gray_code& at::gray_code< T >::operator= const RHS_T &    i_other_gray [inline]
 

Assign a gray_code from a gray code of a different type.

Parameters:
i_other_gray  the gray_code being read.

template<typename T>
void at::gray_code< T >::setgray value_type    value throw () [inline]
 


Friends And Related Function Documentation

template<typename T>
friend class gray_code [friend]
 


Member Data Documentation

template<typename T>
value_type at::gray_code< T >::m_value [protected]
 


The documentation for this class was generated from the following file:

Generated for Austria by doxygen and MakeXS at Sun Oct 24 17:35:34 PDT 2004