IT++ Logo

binary.cpp

Go to the documentation of this file.
00001 
00030 #include <itpp/base/binary.h>
00031 #include <iostream>
00032 
00033 
00034 namespace itpp
00035 {
00036 
00037 std::ostream &operator<<(std::ostream &output, const bin &inbin)
00038 {
00039   output << static_cast<int>(inbin);
00040   return output;
00041 }
00042 
00043 std::istream &operator>>(std::istream &input, bin &outbin)
00044 {
00045   int tmp;
00046   input >> tmp;
00047   it_assert((tmp == 0) || (tmp == 1),
00048             "bin::operator>>(): input value must be 0 or 1");
00049   outbin = tmp;
00050   return input;
00051 }
00052 
00053 } // namespace itpp
SourceForge Logo

Generated on Sun Jul 26 08:54:24 2009 for IT++ by Doxygen 1.5.9