aboutsummaryrefslogtreecommitdiff
path: root/include/common.h
blob: 2db125866c810365df43ea3d7999ad6d46633d39 (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
/**
* @file common.h
* @author Paul Oliver
*
* This module controls the common sender and receiver functors, through which
* communication between different simulations can occur. By calling SEND,
* processes may output local instructions through a network. These instructions
* may then be read by processes running on a different simulation somewhere
* else.
*/

#ifndef SALIS_COMMON_H
#define SALIS_COMMON_H

/**
* Typedef sender functor type for easy python parsing.
*/
typedef void (*Sender)(uint8 inst);

/**
* Typedef receiver functor type for easy python parsing.
*/
typedef uint8 (*Receiver)(void);

/**
* Set sender functor. When unset, SEND instruction does nothing.
* @param sender Sender functor
*/
SALIS_API void sal_comm_set_sender(Sender sender);

/**
* Set receiver functor. When unset, RCVE instruction does nothing.
* @param receiver Receiver functor
*/
SALIS_API void sal_comm_set_receiver(Receiver receiver);


/*******************************
* PRIVATES                     *
*******************************/

void _sal_comm_send(uint8 inst);
uint8 _sal_comm_receive(void);

#endif