|
Fast Research Interface Library
Manual and Documentation
|
00001 // ---------------------- Doxygen info ---------------------- 00050 // ---------------------------------------------------------- 00051 // For a convenient reading of this file's source code, 00052 // please use a tab width of four characters. 00053 // ---------------------------------------------------------- 00054 00055 00056 #ifndef __Console__ 00057 #define __Console__ 00058 00059 #include <stdio.h> 00060 #include <pthread.h> 00061 #include <sched.h> 00062 00063 00064 // ---------------------- Doxygen info ---------------------- 00070 // ---------------------------------------------------------- 00071 #define CONSOLE_NUMBER_OF_BUFFER_ENTRIES 128 00072 00073 00074 // ---------------------- Doxygen info ---------------------- 00079 // ---------------------------------------------------------- 00080 #define CONSOLE_BUFFER_ENTRY_SIZE 4096 00081 00082 00083 00084 00085 // ---------------------- Doxygen info ---------------------- 00099 // ---------------------------------------------------------- 00100 class Console 00101 { 00102 public: 00103 00104 // ---------------------- Doxygen info ---------------------- 00125 // ---------------------------------------------------------- 00126 Console( const unsigned int &Priority 00127 , const FILE *FileHandler = stdout); 00128 00129 00130 // ---------------------- Doxygen info ---------------------- 00144 // ---------------------------------------------------------- 00145 ~Console(void); 00146 00147 00148 // ---------------------- Doxygen info ---------------------- 00178 // ---------------------------------------------------------- 00179 int printf(const char* Format, ...); 00180 00181 00182 // ---------------------- Doxygen info ---------------------- 00190 // ---------------------------------------------------------- 00191 void flush(void) const; 00192 00193 00194 // ---------------------- Doxygen info ---------------------- 00202 // ---------------------------------------------------------- 00203 FILE* GetFileHandler(void) const; 00204 00205 00206 protected: 00207 00208 00209 // ---------------------- Doxygen info ---------------------- 00214 // ---------------------------------------------------------- 00215 FILE *Handler; 00216 00217 00218 // ---------------------- Doxygen info ---------------------- 00240 // ---------------------------------------------------------- 00241 static void* ConsoleThreadMain(void* ObjectPointer); 00242 00243 00244 // ---------------------- Doxygen info ---------------------- 00250 // ---------------------------------------------------------- 00251 unsigned int NumberOfMessages[2]; 00252 00253 00254 // ---------------------- Doxygen info ---------------------- 00260 // ---------------------------------------------------------- 00261 bool ThreadCreated; 00262 00263 00264 // ---------------------- Doxygen info ---------------------- 00270 // ---------------------------------------------------------- 00271 bool ConsoleThreadReadyToRun; 00272 00273 00274 // ---------------------- Doxygen info ---------------------- 00280 // ---------------------------------------------------------- 00281 bool TermintateThread; 00282 00283 00284 // ---------------------- Doxygen info ---------------------- 00295 // ---------------------------------------------------------- 00296 bool BufferNumber; 00297 00298 00299 // ---------------------- Doxygen info ---------------------- 00307 // ---------------------------------------------------------- 00308 pthread_t ConsoleThread; 00309 00310 00311 // ---------------------- Doxygen info ---------------------- 00323 // ---------------------------------------------------------- 00324 pthread_mutex_t Mutex; 00325 00326 00327 // ---------------------- Doxygen info ---------------------- 00345 // ---------------------------------------------------------- 00346 pthread_cond_t CondVar; 00347 00348 00349 // ---------------------- Doxygen info ---------------------- 00358 // ---------------------------------------------------------- 00359 char Buffer[2][CONSOLE_NUMBER_OF_BUFFER_ENTRIES][CONSOLE_BUFFER_ENTRY_SIZE]; 00360 00361 00362 }; // class Console 00363 00364 #endif