#ifndef bitvectorH
#define bitvectorH

#define DATATYPE unsigned long
#define WORDLENGTH (sizeof(DATATYPE)*8)

	struct position {
		unsigned int index;
		unsigned int bit;
	};

class bitvector
{
private:
	vector<DATATYPE> data;
	unsigned int bitsize;		// size in bits

	position GetPosition( const unsigned int pos ) const;

public:
	bool operator[] ( const unsigned int pos ) const;
//	bool operator= ( bitvector &_vector );
	bool operator== ( const bitvector &_vector ) const;
	bitvector operator& ( const bitvector &_vector ) const;
	bitvector operator| ( const bitvector &_vector ) const;
	bitvector operator^ ( const bitvector &_vector ) const;
	bitvector operator~ () const;
	
	bitvector(void);
	bitvector( const unsigned int _size );
	~bitvector(void);

	unsigned int size(void) const { return bitsize; };
	unsigned int items(void) const { return bitsize/WORDLENGTH+1; };
	void resize( const unsigned int _size );
	void resize( const unsigned int _size, const bool val );
	void push_back( const bool bit );
	void setbit( const unsigned int pos, const bool val );
	void clear(void);
	bool empty(void) { return bitsize == 0; };
	bool contains( const bitvector &_vector ) const;		// returns true, if this contains _vector
};

#endif