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   std::ostream &operator<<(std::ostream &output, const bin &inbin)
00037   {
00038     output << static_cast<int>(inbin);
00039     return output;
00040   }
00041 
00042   std::istream &operator>>(std::istream &input, bin &outbin)
00043   {
00044     int tmp;
00045     input >> tmp;
00046     it_assert((tmp == 0) || (tmp == 1),
00047               "bin::operator>>(): input value must be 0 or 1");
00048     outbin = tmp;
00049     return input;
00050   }
00051 
00052 } // namespace itpp
SourceForge Logo

Generated on Mon Jan 7 22:28:55 2008 for IT++ by Doxygen 1.5.4