summaryrefslogtreecommitdiff
path: root/utils/BitField.h
blob: 26908ef5a675b98b07f14f4e8fad1d7f7de44e9f (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, 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 IvlBitRef {
friend	class	IvlBitField;

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

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

class IvlBitField {
friend	class	IvlBitRef;

protected:
	long	Chunks [8];
public:
		IvlBitField ();
	IvlBitRef	operator [] (int);
};

#endif	/* BitField_H_ */