CARMA C++
PhaseSwitchTable.h
1 
11 #ifndef CARMA_UTIL_PHASESWITCHTABLE_H
12 #define CARMA_UTIL_PHASESWITCHTABLE_H
13 
14 
15 // System Includes
16 #include <vector>
17 
18 //#include <stdio.h>
19 
20 
21 
22 namespace carma
23 {
24  namespace util
25  {
26 
38  public:
39  /*
40  ** Constructor
41  ** Creates an underlying table that is the carma default table
42  ** (16x16) on construction, no matter what size was requested.
43  ** The table can be filled with other data as desired
44  ** by using the setState() method.
45  ** @param rows number of rows (rows represent temporal states)
46  ** default = 16
47  ** @param cols number of columns (columns represent antenna/inputs)
48  ** default = 16
49  */
50  PhaseSwitchTable(int rows=16, int columns=16);
51 
52  virtual ~PhaseSwitchTable() ;
53 
54  /*
55  * Get number of rows in table
56  */
57  int getNumRows();
58 
59  /*
60  * Get number of columns in table
61  */
62  int getNumColumns();
63 
64  /*
65  ** Get temporal states for a specific input
66  ** @param columnId column index, starting at 0
67  ** @return vector of bools representing phase states
68  */
69  std::vector<bool> getColumn(int columnId);
70  /*
71  ** Get states for a specific temporal index and input
72  ** @param columnId column (antenna) index, starting at 0
73  ** @param rowId row index (temporal slot), starting at 0
74  */
75  bool getState(int columnId, int rowId);
76  /*
77  ** Set states for a specific temporal index and input
78  ** @param columnId column (antenna) index, starting at 0
79  ** @param rowId row index (temporal slot), starting at 0
80  ** @param state phase switch state for specified input and time
81  */
82  void setState(int columnId, int rowId, bool state);
83  /*
84  ** Get table state as a string to print out for debugging
85  */
86  std::string toString(bool header = true);
87 
88  private:
89  int nRows_;
90  int nCols_;
91  // Array of pointers to vector<bool>'s (one per column)
92  std::vector<bool>** psData_;
93  void checkRowCol(int row, int col);
94 
95  }; // class PhaseSwitchTable
96  }; // util namespace
97 }; // carma namespace
98 
99 #endif // CARMA_UTIL_PHASESWITCHTABLE_H
100 
The PhaseSwitchTable class provides a generic way of reading, writing and retreiving specific PhaseSw...