check transfer  0.1
Check data transfer for SDAccell OpenCL application
Public Member Functions | Private Attributes | List of all members
TableEngineConsole Class Reference

#include <table_engine_console.h>

Inheritance diagram for TableEngineConsole:
TableEngine

Public Member Functions

int AddRowTable ()
 
void ClearTable ()
 
int CreateTable (const char *pColumnName[], unsigned nCount, unsigned isTStudio)
 
void GetConsolePos (int &X, int &Y)
 
void SaveTable ()
 
void SetConsolePos (int X, int Y)
 
int SetValueTable (unsigned nRow, unsigned nColumn, const char *fmt,...)
 
int SetValueTable (unsigned nRow, unsigned nColumn, signed nVal, const char *format="%d")
 
int SetValueTable (unsigned nRow, unsigned nColumn, unsigned nVal, const char *format="%u")
 
int SetValueTable (unsigned nRow, unsigned nColumn, float dVal, const char *format="%f")
 
 TableEngineConsole ()
 
void UpdateTable ()
 
 ~TableEngineConsole ()
 
- Public Member Functions inherited from TableEngine
 TableEngine ()
 
virtual ~TableEngine ()
 

Private Attributes

int flagTableCreate
 

Detailed Description

Definition at line 9 of file table_engine_console.h.

Constructor & Destructor Documentation

◆ TableEngineConsole()

TableEngineConsole::TableEngineConsole ( )

Definition at line 25 of file table_engine_console.cpp.

References CELL_HEIGHT, CELL_WIDTH, and flagTableCreate.

25  : TableEngine()
26 {
28 #if defined(__linux__)
29  rows.clear();
30  m_C = m_R = 0;
31  WC = CELL_WIDTH;
32  HC = CELL_HEIGHT;
33  WCL = 25;
34 #else
35 #endif
36 }
#define CELL_HEIGHT
Definition: term_table.h:37
#define CELL_WIDTH
Definition: term_table.h:36

◆ ~TableEngineConsole()

TableEngineConsole::~TableEngineConsole ( )

Definition at line 40 of file table_engine_console.cpp.

41 {
42 #if defined(__linux__)
43 #else
44 #endif
45 }

Member Function Documentation

◆ AddRowTable()

int TableEngineConsole::AddRowTable ( )
virtual

Implements TableEngine.

Definition at line 99 of file table_engine_console.cpp.

References row_t::c, _cell_t::col, flagTableCreate, row_t::num, _cell_t::row, _cell_t::x, and _cell_t::y.

100 {
101  if( 0==flagTableCreate )
102  return 0;
103 
104 #if defined(__linux__)
105  row_t new_row;
106  row_t& last_row = rows.at(rows.size()-1);
107 
108  new_row.num = last_row.num+1;
109  for(int j=0; j<m_C; j++) {
110 
111  cell_t c;
112 
113  c.row = new_row.num;
114  c.col = j;
115  c.x = XC + c.col*WC;
116  c.y = YC + c.row*HC;
117 
118  cell_draw(c.x, c.y, WC, HC);
119 
120  new_row.c.push_back(c);
121  }
122 
123  m_R++;
124 
125  rows.push_back(new_row);
126 
127  cell_draw_fix();
128 #else
129 #endif
130  return rows.size()-1;
131 }
int col
Definition: term_table.h:56
int num
Definition: term_table.h:67
std::vector< cell_t > c
Definition: term_table.h:68
int row
Definition: term_table.h:55
int y
Definition: term_table.h:54
int x
Definition: term_table.h:53

◆ ClearTable()

void TableEngineConsole::ClearTable ( )
virtual

Implements TableEngine.

Definition at line 195 of file table_engine_console.cpp.

196 {
197 #if defined(__linux__)
198 #else
199 #endif
200 }

◆ CreateTable()

int TableEngineConsole::CreateTable ( const char *  pColumnName[],
unsigned  nCount,
unsigned  isTStudio 
)
virtual

Implements TableEngine.

Definition at line 49 of file table_engine_console.cpp.

References row_t::c, _cell_t::col, flagTableCreate, row_t::num, _cell_t::row, SetValueTable(), _cell_t::x, and _cell_t::y.

50 {
51 #if defined(__linux__)
52  get_screen(&WS, &HS);
53  get_pos(&XC, &YC);
54 
55  if(HS-YC < 20) {
56  system("clear");
57  YC = 1;
58  }
59 
60  m_C = nCount;
61  m_R = 1;
62 
63  for(int i=0; i<m_R; i++) {
64 
65  row_t row;
66 
67  for(unsigned j=0; j<nCount; j++) {
68 
69  cell_t c;
70 
71  c.row = i;
72  c.col = j;
73  c.x = XC + j*WC;
74  c.y = YC + i*HC;
75 
76  cell_draw(c.x, c.y, WC, HC);
77 
78  row.c.push_back(c);
79  }
80 
81  row.num = i;
82  rows.push_back(row);
83  }
84 
85  cell_draw_fix();
86 
87  for(unsigned i=0; i<nCount; i++) {
88  SetValueTable(0, i, "%s", pColumnName[i]);
89  }
90 
92  return 0;
93 #else
94 #endif
95 }
int col
Definition: term_table.h:56
int num
Definition: term_table.h:67
std::vector< cell_t > c
Definition: term_table.h:68
int row
Definition: term_table.h:55
int SetValueTable(unsigned nRow, unsigned nColumn, const char *fmt,...)
int y
Definition: term_table.h:54
int x
Definition: term_table.h:53

◆ GetConsolePos()

void TableEngineConsole::GetConsolePos ( int &  X,
int &  Y 
)
virtual

Implements TableEngine.

Definition at line 222 of file table_engine_console.cpp.

223 {
224 #if defined(__linux__)
225  get_pos(&X, &Y);
226 #else
227 #endif
228 }

◆ SaveTable()

void TableEngineConsole::SaveTable ( )
virtual

Implements TableEngine.

Definition at line 204 of file table_engine_console.cpp.

205 {
206 #if defined(__linux__)
207 #else
208 #endif
209 }

◆ SetConsolePos()

void TableEngineConsole::SetConsolePos ( int  X,
int  Y 
)
virtual

Implements TableEngine.

Definition at line 232 of file table_engine_console.cpp.

References gotoxy.

233 {
234 #if defined(__linux__)
235  gotoxy(X, Y);
236 #endif
237 }
#define gotoxy(x, y)
Definition: term_table.h:43

◆ SetValueTable() [1/4]

int TableEngineConsole::SetValueTable ( unsigned  nRow,
unsigned  nColumn,
const char *  fmt,
  ... 
)
virtual

Implements TableEngine.

Definition at line 135 of file table_engine_console.cpp.

References gotoxy, _cell_t::x, and _cell_t::y.

Referenced by CreateTable(), and SetValueTable().

136 {
137 #if defined(__linux__)
138  cell_t& c = get_cell(nRow, nColumn);
139  gotoxy(c.x+2, c.y+1);
140  va_list argptr;
141  va_start(argptr, fmt);
142  char msg[32];
143  vsprintf(msg, fmt, argptr);
144  printf("%s\n", msg);
145 #endif
146  return 0;
147 }
int y
Definition: term_table.h:54
#define gotoxy(x, y)
Definition: term_table.h:43
int x
Definition: term_table.h:53

◆ SetValueTable() [2/4]

int TableEngineConsole::SetValueTable ( unsigned  nRow,
unsigned  nColumn,
signed  nVal,
const char *  format = "%d" 
)
virtual

Implements TableEngine.

Definition at line 162 of file table_engine_console.cpp.

References SetValueTable().

163 {
164 #if defined(__linux__)
165  SetValueTable(nRow, nColumn, format, nVal);
166 #else
167 #endif
168  return 0;
169 }
int SetValueTable(unsigned nRow, unsigned nColumn, const char *fmt,...)

◆ SetValueTable() [3/4]

int TableEngineConsole::SetValueTable ( unsigned  nRow,
unsigned  nColumn,
unsigned  nVal,
const char *  format = "%u" 
)
virtual

Implements TableEngine.

Definition at line 173 of file table_engine_console.cpp.

References SetValueTable().

174 {
175 #if defined(__linux__)
176  SetValueTable(nRow, nColumn, format, nVal);
177 #else
178 #endif
179  return 0;
180 }
int SetValueTable(unsigned nRow, unsigned nColumn, const char *fmt,...)

◆ SetValueTable() [4/4]

int TableEngineConsole::SetValueTable ( unsigned  nRow,
unsigned  nColumn,
float  dVal,
const char *  format = "%f" 
)
virtual

Implements TableEngine.

Definition at line 184 of file table_engine_console.cpp.

References SetValueTable().

185 {
186 #if defined(__linux__)
187  SetValueTable(nRow, nColumn, format, dVal);
188 #else
189 #endif
190  return 0;
191 }
int SetValueTable(unsigned nRow, unsigned nColumn, const char *fmt,...)

◆ UpdateTable()

void TableEngineConsole::UpdateTable ( )
virtual

Implements TableEngine.

Definition at line 213 of file table_engine_console.cpp.

214 {
215 #if defined(__linux__)
216 #else
217 #endif
218 }

Member Data Documentation

◆ flagTableCreate

int TableEngineConsole::flagTableCreate
private

Definition at line 30 of file table_engine_console.h.

Referenced by AddRowTable(), CreateTable(), and TableEngineConsole().


The documentation for this class was generated from the following files: