-
Notifications
You must be signed in to change notification settings - Fork 0
/
FlagList.h
executable file
·35 lines (31 loc) · 1.02 KB
/
FlagList.h
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
// File: FlagList.h
// David E. Taylor
// Applied Research Laboratory
// Department of Computer Science and Engineering
// Washington University in Saint Louis
//
// Class definition for FlagList
// - Maintains distribution of flag values for each protocol
// - Reads in distribution from seed file
// - Selects flag fields based on selected protocol
#ifndef __FLAGLIST_H_
#define __FLAGLIST_H_
struct FlagListItem{
unsigned flags;
unsigned flags_mask;
float prob;
struct FlagListItem *prev;
struct FlagListItem *next;
};
class FlagList {
struct FlagListItem **first; // array of pointers to first item in list
struct FlagListItem **last; // array of pointers to last item in list
public:
FlagList(); // constructor
~FlagList(); // destructor
void choose(float p, int prot, unsigned *flags, unsigned *flags_mask); // choose flags based on probability
void read(FILE *fp); // read distributions from input file
void print(FILE *fp); // print distribution to output file
};
#endif