ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/FAS/src/bitvector.h
Revision: 88
Committed: Mon Aug 19 20:49:08 2002 UTC (21 years, 10 months ago) by tim
Content type: text/plain
File size: 2235 byte(s)
Log Message:
*** empty log message ***

File Contents

# Content
1 /**********************************************************************
2 * Copyright (C) 2002-2003 by Gezelter's Group
3 *This program is free software; you can redistribute it and/or modify
4 *it under the terms of the GNU General Public License as published by
5 *the Free Software Foundation version 2 of the License.
6 *
7 *This program is distributed in the hope that it will be useful,
8 *but WITHOUT ANY WARRANTY; without even the implied warranty of
9 *MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 *GNU General Public License for more details.
11 *
12 ************************************************************************
13 *Author: Teng Lin Email: tlin@nd.edu
14 *Date: 08/13/2002 Version: 1.0
15 *
16 ************************************************************************
17 *Description:
18 *
19 ***********************************************************************/
20 #ifndef bitvectorH
21 #define bitvectorH
22 #include <iostream>
23 #include <vector>
24
25 using namespace std;
26
27 class TBitVector : public bit_vector
28 {
29 public:
30 void Resize(int newSize);
31 bool IsEmpty();
32 int Count() { return this->size();}
33 void SetBitOn(int index);
34 void SetBitOff(int index);
35 void SetRangeOn(int begin, int end);
36 void SetRangeOff(int begin, int end);
37 void SetAllOn();
38 void SetAllOff();
39
40 bool IsBitOn(int index);
41
42 TBitVector& operator =(const TBitVector &src);
43 TBitVector& operator &=(const TBitVector &src);
44 TBitVector& operator |=(const TBitVector &src);
45 TBitVector& operator ^=(const TBitVector &src);
46 TBitVector& operator -=(const TBitVector &src);
47 TBitVector& operator |=(const int i);
48
49 void FromIntVec(vector<int> &intVec);
50 void ToIntvec(vector<int> &intVec);
51
52 friend TBitVector operator &(const TBitVector& bv1, const TBitVector& bv2);
53 friend TBitVector operator |(const TBitVector& bv1, const TBitVector& bv2);
54 friend TBitVector operator ^(const TBitVector& bv1, const TBitVector& bv2);
55 friend TBitVector operator -(const TBitVector& bv1, const TBitVector& bv2);
56 friend bool operator ==(const TBitVector& bv1, const TBitVector& bv2);
57
58 };
59 //---------------------------------------------------------------------------
60 #endif