• Main Page
  • Modules
  • Classes
  • Files
  • File List

tbt.h

Go to the documentation of this file.
00001 /*  Time Based Text - Recorder
00002  *
00003  *  (C) Copyright 2006 - 2012 Denis Roio <jaromil@dyne.org>
00004  *
00005  * This source code is free software; you can redistribute it and/or
00006  * modify it under the terms of the GNU Public License as published 
00007  * by the Free Software Foundation; either version 2 of the License,
00008  * or (at your option) any later version.
00009  *
00010  * This source code is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
00013  * Please refer to the GNU Public License for more details.
00014  *
00015  * You should have received a copy of the GNU Public License along with
00016  * this source code; if not, write to:
00017  * Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00018  *
00019  */
00020 
00026 #ifndef __TIMEBASEDTEXT_H__
00027 #define __TIMEBASEDTEXT_H__
00028 
00029 
00030 #include <time.h>
00031 #include <inttypes.h>
00032 #include <sys/time.h>
00033 
00034 #include <linklist.h>
00035 
00036 class RTClock; // ghost pointer for rtclock.h
00037 
00038 class TBTEntry; // defined later
00039 
00040 
00059 class TBT {
00060   
00061  public:
00062   TBT();
00063   ~TBT();
00064 
00080   int init(); 
00081 
00082 
00083   // input functions: time based append of keys into a tbt recording
00084 
00085   void append(uint64_t key); 
00086   uint64_t getkey(); 
00087   int position; 
00088 
00089 
00090   // loading functions: load a tbt recording for playback
00091 
00092   int load(char *filename); 
00093   int save_bin(char *filename); 
00094 
00095 
00096   int load_ascii(char *filename); 
00097   int save_ascii(char *filename); 
00098 
00099   //TODO: int load_html(char *filename);
00100   int save_html(char *filename); 
00101 
00102   int save_doku(char *filename); 
00103 
00104 
00105   void clear(); 
00106 
00108 
00109   Linklist *buffer; 
00110 
00111   bool quit; 
00112 
00113   bool rtc;
00114   RTClock *clock;
00115 
00116 
00117  private:
00118 
00119   void compute_delta(TBTEntry *tbt);
00121 
00122   uint64_t now;  
00123   uint64_t past; 
00124 
00125   struct timespec psleep; 
00126   struct timeval gettime; 
00127 
00128 };
00129 
00130 
00152 class TBTEntry : public Entry {
00153  public:
00154   TBTEntry();
00155   ~TBTEntry();
00156 
00166   uint64_t key; 
00167   uint64_t msec; 
00168 
00170 
00181   bool parse_uint64(void *buf); 
00182   bool parse_ascii(char *buf); 
00183   
00184   int render_uint64(void *buf); 
00185   int render_ascii(void *buf); 
00186   int render_html(void *buf); 
00187 
00189 };
00190 
00191 
00192 #endif

Generated on Mon Apr 9 2012 15:29:22 for TimeBasedText_code_doc by  doxygen 1.7.1