summaryrefslogtreecommitdiff
path: root/utils/BitField.h
blob: cc7633cbf42b5a664cfd85e9c825636fb7cadaf3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/*
 *	CENA C++ Utilities
 *
 *	by Stephane Chatty
 *
 *	Copyright 1992
 *	Centre d'Etudes de la Navigation Aerienne (CENA)
 *
 *	bit fields
 *
 *	$Id$
 *	$CurLog$
 */

#ifndef BitField_H_
#define BitField_H_

#include "bool.h"

class CcuBitRef {
friend	class	CcuBitField;

protected:
	short	Chunk;
	short	Offset;
	CcuBitField&	Field;
inline	CcuBitRef (CcuBitField& f, short c, short o) : Field (f), Chunk (c), Offset (o)	{}

public:
		operator bool () const;
	bool	operator = (bool) const;
};

class CcuBitField {
friend	class	CcuBitRef;

protected:
	long	Chunks [8];
public:
		CcuBitField ();
	CcuBitRef	operator [] (int);
};


#endif	/* BitField_H_ */