Main Page   Packages   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Search  

C:/temp/src/j2k/Test/BitVectorTest.cpp

Go to the documentation of this file.
00001 // Fred P. for J2K Library
00002 // LGPL Licensed.
00003 // http://j2k.sourceforge.net/
00004 
00005 // Test the BitVector class
00006 #include <j2k/Fred/Math/BitVector.hpp>
00007 
00008 // To simplify our life!
00009 #include <j2k/Fred/Math/BitVector.cpp>
00010 
00011 int main()
00012 {
00013   UCHAR b[] = { 0x0f, 0xff, 0xf0, 0xAA, 0x78, 0x11 };
00014 
00015   BitVector bv1(b, sizeof b / sizeof *b);
00016   BitVector bv2("10010100111100101010001010010010101");
00017 
00018   bv1.print("bv1 before modification");
00019 
00020   for(int i = 36; i < bv1.bits(); i++)
00021     bv1.clear(i);
00022 
00023   bv1.print("bv1 after  modification");
00024   bv2.print("bv2 before modification");
00025 
00026   for(int j=bv2.bits()-10; j<bv2.bits(); j++)
00027     bv2.clear(j);
00028 
00029   bv2.set(30);
00030   bv2.print("bv2 after  modification");
00031 
00032   bv2.bits(bv2.bits() / 2);
00033   bv2.print("bv2 cut in half");
00034 
00035   bv2.bits(bv2.bits() + 10);
00036   bv2.print("bv2 grown by 10");
00037 
00038   BitVector bv3( (UCHAR*)0 );
00039 
00040   int nb;
00041   cin >> nb;
00042 
00043   return 0;
00044 }
00045 

Generated on Sun Oct 14 18:46:43 2001 for Standard J2K Library by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001