StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Board.hh
1 //
2 // Pibero Djawotho <pibero@tamu.edu>
3 // Texas A&M
4 // 16 July 2012
5 //
6 
7 #ifndef BOARD_HH
8 #define BOARD_HH
9 
10 #include <cstring>
11 
12 enum { NCHANNELS = 32, NREGISTERS = 32, MAXPP=5, MAXT=MAXPP*2+1, PRINT=0};
13 
14 struct Board {
15  char name[10];
16  unsigned int bitmask;
17  unsigned short channels[MAXT][NCHANNELS];
18  unsigned short dsmdata[MAXT][NCHANNELS];
19  unsigned int registers[NREGISTERS];
20  unsigned int output[MAXT];
21  int userdata[MAXT][100];
22 
23  Board();
24  unsigned int& registerAt(int i) { return registers[i>>24]; }
25  const unsigned int& registerAt(int i) const { return registers[i>>24]; }
26  void setName(const char* s);
27  void clear();
28  void reset();
29 };
30 
31 inline Board::Board()
32 {
33  reset();
34 }
35 
36 inline void Board::setName(const char* s)
37 {
38  strcpy(name,s);
39 }
40 
41 inline void Board::clear()
42 {
43  memset(channels,0,sizeof(channels));
44  memset(dsmdata,0,sizeof(dsmdata));
45  memset(output,0,sizeof(output));
46 }
47 
48 inline void Board::reset()
49 {
50  setName("");
51  bitmask = 0xffffffff;
52  memset(channels,0,sizeof(channels));
53  memset(dsmdata,0,sizeof(dsmdata));
54  memset(registers,0,sizeof(registers));
55  memset(output,0,sizeof(output));
56 }
57 
58 #endif // BOARD_HH
Definition: Board.hh:14