versadac  1
versadac - Scalable Recorder Firmware
am_historytext.h
1 /*****************************************************************************
2 FILE : am_historytext.h
3 VERSION : $Id: am_historytext.h 4938 2006-10-10 14:20:18Z martinto $
4 AUTHOR : Sandra Herring
5 SYSTEM : GNU C++ for Power PC
6 DESCRIPTION : Header file for recorded text.
7 *****************************************************************************/
8 
9 #if !defined(__AM_HISTORYTEXT_H)
10 #define __AM_HISTORYTEXT_H
11 
12 #if !defined(__AM_HISTORYRECORD_H)
13 #include "am_historyrecord.h"
14 #endif
15 
16 extern "C"
17 {
18 #include <time.h>
19 }
20 
21 
22 // ***************************************************************************
23 //
24 // History Text Sample class
25 //
26 // ***************************************************************************
27 
28 class AM_HistoryHeader;
29 class AM_TimeFormatter;
30 class AM_Archiver;
31 
33 {
34  public :
35 
36  // services inherited from class AM_HistoryRecord
37 
38  virtual sint32 read( AM_HistoryStream & stream );
39  virtual uint16 recordID();
40 
41 /*---------------------------------------------------------------------------
42 FUNCTION : constructor
43 ARGUMENTS : None.
44 ---------------------------------------------------------------------------*/
46 
47 /*---------------------------------------------------------------------------
48 FUNCTION : destructor
49 ---------------------------------------------------------------------------*/
50  virtual ~AM_HistoryText();
51 
52 /*---------------------------------------------------------------------------
53 FUNCTION : format
54 DESCRIPTION : Converts message contents to text.
55 ARGUMENTS : timeFormatter formatter for embedded date/time
56  archiver object to check for archive deactivation
57 RETURN : Message in ASCII.
58 NOTES :
59 ---------------------------------------------------------------------------*/
60  char * format( AM_TimeFormatter & timeFormatter,
61  AM_Archiver & archiver );
62 
63 /*---------------------------------------------------------------------------
64 FUNCTION : getTicksSinceStart
65 DESCRIPTION : Provides access to the message time in ticks rel to start time
66 ARGUMENTS : None.
67 RETURN : None
68 NOTES :
69 ---------------------------------------------------------------------------*/
70  double getTicksSinceStart();
71 
72 /*---------------------------------------------------------------------------
73 FUNCTION : getTimestamp
74 DESCRIPTION : Returns the time of this message in UTC.
75  If the message contains a time, returns that in preference to
76  the time the message was recorded.
77 ARGUMENTS : Object for converting ticks to seconds.
78  Optional return argument for number of milliseconds
79 RETURN : UTC time + milliseconds over
80 NOTES :
81 ------------------------------------------------------------------------------*/
82  time_t getTimestamp( AM_HistoryHeader & ticksConverter,
83  uint16 * pRetMillisecs );
84 
85 /*---------------------------------------------------------------------------
86 FUNCTION : getEmbeddedTimestamp
87 DESCRIPTION : Provides access to the timestamp given in the first field of the
88  message, if present, as a time_date_t in UTC.
89 ARGUMENTS : None.
90 RETURN : timestamp or 0 if not available
91 NOTES :
92 ---------------------------------------------------------------------------*/
93  time_t getEmbeddedTimestamp();
94 
95  private :
96  uint8 * m_pData; // unformatted data
97  char * m_pText; // reformatted text
98  time_t m_EmbeddedTimestamp; // timestamp from first field of message or 0
99  sint16 m_ByteCount; // number of bytes to convert, signed so that
100  // it is not necessary to worry about checking
101  // for exactly zero
102  double m_TicksSinceStart; // timestamp of message in ticks rel to start record
103  uint32 m_Category; // message category as defined in uhh file spec, or 0 if not categorised
104 
105 }; // class AM_HistoryText
106 
107 
108 /*---------------------------------------------------------------------------
109 FUNCTION : getTicksSinceStart
110 DESCRIPTION : Provides access to the message time in ticks rel to start time
111 ARGUMENTS :
112 RETURN : None
113 NOTES :
114 ---------------------------------------------------------------------------*/
115 inline double AM_HistoryText::getTicksSinceStart()
116 {
117  return m_TicksSinceStart;
118 }
119 
120 /*---------------------------------------------------------------------------
121 FUNCTION : getEmbeddedTimestamp
122 DESCRIPTION : Provides access to the timestamp given in the first field of the
123  message, if present, as a time_date_t in UTC.
124 ARGUMENTS : None.
125 RETURN : timestamp or 0 if not available
126 NOTES :
127 ---------------------------------------------------------------------------*/
128 inline time_t AM_HistoryText::getEmbeddedTimestamp()
129 {
130  return m_EmbeddedTimestamp;
131 }
132 
133 #endif // end of __AM_HISTORYTEXT_H conditional include
134 
Definition: am_historystream.h:23
Definition: am_historytext.h:32
Definition: am_archiver.h:90
Definition: am_historyrecord.h:29
Definition: am_historyhdr.h:28
Definition: am_timeformatter.h:21