IT++ Logo Newcom Logo

itpp::bin Class Reference

Binary arithmetic (boolean) class. More...

#include <itpp/base/binary.h>

List of all members.

Public Member Functions

 bin ()
 Default constructor.
 bin (const short value)
 Set the binary object equal to value. Either "0" or "1".
 bin (const bin &inbin)
 Copy constructor.
void operator= (const short &value)
 Assign a value.
void operator= (const bin &inbin)
 Assign a value.
void operator/= (const bin &inbin)
 OR.
void operator|= (const bin &inbin)
 OR.
bin operator/ (const bin &inbin) const
 OR.
bin operator| (const bin &inbin) const
 OR.
void operator+= (const bin &inbin)
 XOR.
void operator^= (const bin &inbin)
 XOR.
bin operator+ (const bin &inbin) const
 XOR.
bin operator^ (const bin &inbin) const
 XOR.
void operator-= (const bin &inbin)
 XOR.
bin operator- (const bin &inbin) const
 XOR.
bin operator- () const
 Dummy definition to be able to use vec<bin>.
void operator *= (const bin &inbin)
 AND.
void operator &= (const bin &inbin)
 AND.
bin operator * (const bin &inbin) const
 AND.
bin operator & (const bin &inbin) const
 AND.
bin operator! (void) const
 NOT.
bin operator~ (void) const
 NOT.
bool operator== (const bin &inbin) const
 Check if equal.
bool operator== (const int &inbin) const
 Check if equal.
bool operator!= (const bin &inbin) const
 Check if not equal.
bool operator!= (const int &inbin) const
 Check if not equal.
bool operator< (const bin &inbin) const
 Less than (interpret the binary values {0,1} as integers).
bool operator<= (const bin &inbin) const
 Less than equal (interpret the binary values {0,1} as integers).
bool operator> (const bin &inbin) const
 Greater than (interpret the binary values {0,1} as integers).
bool operator>= (const bin &inbin) const
 Greater than equal (interpret the binary values {0,1} as integers).
 operator short () const
 Convert bin to short.
 operator int () const
 Convert bin to int.
 operator bool () const
 Convert bin to bool.
 operator float () const
 Convert bin to float.
 operator double () const
 Convert bin to double.
char value () const
 Output the binary value of the object.

Related Functions

(Note that these are not member functions.)

std::ostream & operator<< (std::ostream &output, const bin &inbin)
 Output stream of bin.
std::istream & operator>> (std::istream &input, bin &outbin)
 Input stream of bin.
bin abs (const bin &inbin)
 absolute value of bin


Detailed Description

Binary arithmetic (boolean) class.

Author:
Tony Ottosson
This class creates a binary aritmetic class, following the ordinary rules for binary (GF(2)) fields.

Examples:

    bin a;         // Creation of variable
    bin a = 0;     // Creating a variable and assigning it value 0
    bin b = 1;     // Creating a variable and assigning it value 1
    bin c = a + b; // XOR operation
    c = !a;        // NOT
    c = a * b;     // AND
    c = a / b;     // OR

Definition at line 59 of file binary.h.


Constructor & Destructor Documentation

itpp::bin::bin (  )  [inline]

Default constructor.

Definition at line 62 of file binary.h.

Referenced by operator &(), operator *(), operator!(), operator+(), operator-(), operator/(), operator^(), operator|(), and operator~().

itpp::bin::bin ( const short  value  )  [inline]

Set the binary object equal to value. Either "0" or "1".

Definition at line 65 of file binary.h.

References it_assert0.

itpp::bin::bin ( const bin inbin  )  [inline]

Copy constructor.

Definition at line 71 of file binary.h.

References b.


Member Function Documentation

void itpp::bin::operator= ( const short &  value  )  [inline]

Assign a value.

Definition at line 74 of file binary.h.

References it_assert0.

void itpp::bin::operator= ( const bin inbin  )  [inline]

Assign a value.

Definition at line 80 of file binary.h.

References b.

void itpp::bin::operator/= ( const bin inbin  )  [inline]

OR.

Definition at line 83 of file binary.h.

References b.

void itpp::bin::operator|= ( const bin inbin  )  [inline]

OR.

Definition at line 86 of file binary.h.

References b.

bin itpp::bin::operator/ ( const bin inbin  )  const [inline]

OR.

Definition at line 88 of file binary.h.

References b, and bin().

bin itpp::bin::operator| ( const bin inbin  )  const [inline]

OR.

Definition at line 90 of file binary.h.

References b, and bin().

void itpp::bin::operator+= ( const bin inbin  )  [inline]

XOR.

Definition at line 93 of file binary.h.

References b.

void itpp::bin::operator^= ( const bin inbin  )  [inline]

XOR.

Definition at line 95 of file binary.h.

References b.

bin itpp::bin::operator+ ( const bin inbin  )  const [inline]

XOR.

Definition at line 97 of file binary.h.

References b, and bin().

bin itpp::bin::operator^ ( const bin inbin  )  const [inline]

XOR.

Definition at line 99 of file binary.h.

References b, and bin().

void itpp::bin::operator-= ( const bin inbin  )  [inline]

XOR.

Definition at line 101 of file binary.h.

References b.

bin itpp::bin::operator- ( const bin inbin  )  const [inline]

XOR.

Definition at line 103 of file binary.h.

References b, and bin().

bin itpp::bin::operator- (  )  const [inline]

Dummy definition to be able to use vec<bin>.

Definition at line 105 of file binary.h.

References bin().

void itpp::bin::operator *= ( const bin inbin  )  [inline]

AND.

Definition at line 108 of file binary.h.

References b.

void itpp::bin::operator &= ( const bin inbin  )  [inline]

AND.

Definition at line 110 of file binary.h.

References b.

bin itpp::bin::operator * ( const bin inbin  )  const [inline]

AND.

Definition at line 112 of file binary.h.

References b, and bin().

bin itpp::bin::operator & ( const bin inbin  )  const [inline]

AND.

Definition at line 114 of file binary.h.

References b, and bin().

bin itpp::bin::operator! ( void   )  const [inline]

NOT.

Definition at line 117 of file binary.h.

References bin().

bin itpp::bin::operator~ ( void   )  const [inline]

NOT.

Definition at line 119 of file binary.h.

References bin().

bool itpp::bin::operator== ( const bin inbin  )  const [inline]

Check if equal.

Definition at line 122 of file binary.h.

References b.

bool itpp::bin::operator== ( const int &  inbin  )  const [inline]

Check if equal.

Definition at line 124 of file binary.h.

bool itpp::bin::operator!= ( const bin inbin  )  const [inline]

Check if not equal.

Definition at line 127 of file binary.h.

References b.

bool itpp::bin::operator!= ( const int &  inbin  )  const [inline]

Check if not equal.

Definition at line 129 of file binary.h.

bool itpp::bin::operator< ( const bin inbin  )  const [inline]

Less than (interpret the binary values {0,1} as integers).

Definition at line 132 of file binary.h.

References b.

bool itpp::bin::operator<= ( const bin inbin  )  const [inline]

Less than equal (interpret the binary values {0,1} as integers).

Definition at line 134 of file binary.h.

References b.

bool itpp::bin::operator> ( const bin inbin  )  const [inline]

Greater than (interpret the binary values {0,1} as integers).

Definition at line 137 of file binary.h.

References b.

bool itpp::bin::operator>= ( const bin inbin  )  const [inline]

Greater than equal (interpret the binary values {0,1} as integers).

Definition at line 139 of file binary.h.

References b.

itpp::bin::operator short (  )  const [inline]

Convert bin to short.

Definition at line 142 of file binary.h.

itpp::bin::operator int (  )  const [inline]

Convert bin to int.

Definition at line 144 of file binary.h.

itpp::bin::operator bool (  )  const [inline]

Convert bin to bool.

Definition at line 146 of file binary.h.

itpp::bin::operator float (  )  const [inline]

Convert bin to float.

Definition at line 148 of file binary.h.

itpp::bin::operator double (  )  const [inline]

Convert bin to double.

Definition at line 150 of file binary.h.

char itpp::bin::value (  )  const [inline]

Output the binary value of the object.

Definition at line 153 of file binary.h.


Friends And Related Function Documentation

std::ostream & operator<< ( std::ostream &  output,
const bin inbin 
) [related]

Output stream of bin.

Definition at line 39 of file binary.cpp.

std::istream & operator>> ( std::istream &  input,
bin outbin 
) [related]

Input stream of bin.

Definition at line 45 of file binary.cpp.

short abs ( const bin inbin  )  [related]

absolute value of bin

Definition at line 177 of file binary.h.


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

Generated on Sat Aug 25 23:37:29 2007 for IT++ by Doxygen 1.5.2