summaryrefslogtreecommitdiff
path: root/utils/BitField.h
blob: 8377d299bd3f6f55f24b11d0df5847afd762eedd (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
46
/*
 *	CENA C++ Utilities
 *
 *	by Stephane Chatty
 *
 *	Copyright 1992, 1993, 1994
 *	Centre d'Etudes de la Navigation Aerienne (CENA)
 *
 *	bit fields
 *
 *	$Id$
 *	$CurLog$
 */

#ifndef BitField_H_
#define BitField_H_

#include "cplus_bugs.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_ */