-
Notifications
You must be signed in to change notification settings - Fork 2
/
model.h
60 lines (48 loc) · 1.37 KB
/
model.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
//The header file template for a ROSS model
//This file includes:
// - the state and message structs
// - extern'ed command line arguments
// - custom mapping function prototypes (if needed)
// - any other needed structs, enums, unions, or #defines
#ifndef _model_h
#define _model_h
#include "ross.h"
//Example enumeration of message type... could also use #defines
typedef enum {
HELLO,
GOODBYE,
} message_type;
//Message struct
// this contains all data sent in an event
typedef struct {
message_type type;
double contents;
tw_lpid sender;
} message;
//State struct
// this defines the state of each LP
typedef struct {
int rcvd_count_H;
int rcvd_count_G;
double value;
} state;
//Command Line Argument declarations
extern unsigned int setting_1;
//Global variables used by both main and driver
// - this defines the LP types
extern tw_lptype model_lps[];
//Function Declarations
// defined in model_driver.c:
extern void model_init(state *s, tw_lp *lp);
extern void model_event(state *s, tw_bf *bf, message *in_msg, tw_lp *lp);
extern void model_event_reverse(state *s, tw_bf *bf, message *in_msg, tw_lp *lp);
extern void model_final(state *s, tw_lp *lp);
// defined in model_map.c:
extern tw_peid model_map(tw_lpid gid);
/*
//Custom mapping prototypes
void model_cutom_mapping(void);
tw_lp * model_mapping_to_lp(tw_lpid lpid);
tw_peid model_map(tw_lpid gid);
*/
#endif