LRAUV  revA
KmlLogWriter.h
Go to the documentation of this file.
1 
10 #ifndef KMLLOGWRITER_H_
11 #define KMLLOGWRITER_H_
12 
13 #include "LogWriter.h"
14 #include "data/Location.h"
15 #include "logger/Syslog.h"
16 #include "utils/FlexArray.h"
17 
18 class OutStream;
19 
28 class KmlLogWriter : public LogWriter
29 {
30 public:
32  KmlLogWriter( Str vehicleName, bool emitTimestamps = true, bool doDepth = true );
33 
35  virtual ~KmlLogWriter();
36 
38  virtual unsigned int write( const LogEntry *entry, const Unit* unit = NULL );
39 
40  virtual unsigned int writeHeader();
41 
42  virtual unsigned int writeFooter();
43 
44  void setColor( const char* color )
45  {
46  color_ = color;
47  }
48 
49  static char** GetKmlArgs( bool doKmlSimple = false )
50  {
51  return ( char** )KmlArgs_ + ( doKmlSimple ? 1 : 0 );
52  }
53 
54  static char** GetKmlUnits( bool doKmlSimple = false )
55  {
56  return ( char** )KmlUnits_ + ( doKmlSimple ? 1 : 0 );
57  }
58 
59  static float* GetKmlErrors( bool doKmlSimple = false )
60  {
61  return ( float* )KmlErrors_ + ( doKmlSimple ? 1 : 0 );
62  }
63 protected:
64 
66 
67  class SyslogItem
68  {
69  public:
74  SyslogItem( const Timestamp& timestamp, const char* coordinates,
75  const Syslog::Severity severity, const Str& message )
76  : timestamp_( timestamp ),
77  coordinates_( coordinates ),
78  severity_( severity ),
79  message_( message )
80  {}
81  };
82 
84 
85  unsigned int writeSyslogItems( const char* latestCoordinates );
86 
87 private:
88 
90  bool doDepth_;
96  bool started_;
97 
99 
101 
102  unsigned int lineCount_;
103 
107 
108  double depth_;
109 
110  const char* color_;
111 
112  static const char* KmlArgs_[3];
113 
114  static const char* KmlUnits_[3];
115 
116  static float KmlErrors_[3];
117 
118  static const Location ZERO_LOCATION;
119 
120 };
121 
122 #endif /*KMLLOGWRITER_H_*/
FlexArray< SyslogItem * > syslogItems_
Definition: KmlLogWriter.h:83
double lastLongitude_
Definition: KmlLogWriter.h:106
unsigned int lineCount_
Definition: KmlLogWriter.h:102
Str coordinates_
Definition: KmlLogWriter.h:71
Syslog::Severity severity_
Definition: KmlLogWriter.h:72
Base class for a generalized set of "log data destinations," including to files (text or binary)...
Definition: LogWriter.h:25
Contains the LogWriter class definition.
bool haveFirstLocation_
Definition: KmlLogWriter.h:91
static const char * KmlArgs_[3]
Definition: KmlLogWriter.h:112
bool haveNewLatitude_
Definition: KmlLogWriter.h:93
Timestamp lastTimestamp_
Definition: KmlLogWriter.h:98
void setColor(const char *color)
Definition: KmlLogWriter.h:44
static const char * KmlUnits_[3]
Definition: KmlLogWriter.h:114
static const Location ZERO_LOCATION
Definition: KmlLogWriter.h:118
bool doDepth_
Definition: KmlLogWriter.h:90
virtual unsigned int write(const LogEntry *entry, const Unit *unit=NULL)
Write an entry to the text log.
Definition: KmlLogWriter.cpp:221
Contains the Syslog class definition.
Location location_
Definition: KmlLogWriter.h:104
One "entry" in a LogQueue.
Definition: LogEntry.h:33
bool haveFirstDepth_
Definition: KmlLogWriter.h:92
Contains the FlexArrayBase and FlexArray class declarations.
Str vehicleName_
Definition: KmlLogWriter.h:65
virtual unsigned int writeFooter()
Write the log footer, if any.
Definition: KmlLogWriter.cpp:155
SyslogItem(const Timestamp &timestamp, const char *coordinates, const Syslog::Severity severity, const Str &message)
Definition: KmlLogWriter.h:74
static char ** GetKmlUnits(bool doKmlSimple=false)
Definition: KmlLogWriter.h:54
double depth_
Definition: KmlLogWriter.h:108
static float * GetKmlErrors(bool doKmlSimple=false)
Definition: KmlLogWriter.h:59
Replacement for standard template class string.
Definition: Str.h:12
Str message_
Definition: KmlLogWriter.h:73
bool haveNewLongitude_
Definition: KmlLogWriter.h:94
Defines a LogWriter that can convert Location and depth triples into write kml format text (see http:...
Definition: KmlLogWriter.h:28
Timestamp timestamp_
Definition: KmlLogWriter.h:70
KmlLogWriter(Str vehicleName, bool emitTimestamps=true, bool doDepth=true)
Constructor.
Definition: KmlLogWriter.cpp:28
virtual unsigned int writeHeader()
Write the log header, if any.
Definition: KmlLogWriter.cpp:50
static char ** GetKmlArgs(bool doKmlSimple=false)
Definition: KmlLogWriter.h:49
bool emitTimestamps_
Definition: KmlLogWriter.h:89
Simple class providing a flexible size array of pointers.
Definition: DataReader.h:19
virtual ~KmlLogWriter()
Destructor.
Definition: KmlLogWriter.cpp:152
Severity
An attempt to define different levels of syslog severity.
Definition: Syslog.h:28
This is a very abstract class that can be implemented by classes that want to send stream output...
Definition: OutStream.h:41
bool haveNewDepth_
Definition: KmlLogWriter.h:95
const char * color_
Definition: KmlLogWriter.h:110
bool started_
Definition: KmlLogWriter.h:96
double lastLatitude_
Definition: KmlLogWriter.h:105
Wraps a pair of double precision (8-byte) floating point numbers and units for storage in a DataEleme...
Definition: Location.h:38
Contains the Location class definition.
Code that represents an engineering unit.
Definition: Unit.h:24
Timestamp currentTimestamp_
Definition: KmlLogWriter.h:100
static float KmlErrors_[3]
Definition: KmlLogWriter.h:116
unsigned int writeSyslogItems(const char *latestCoordinates)
Definition: KmlLogWriter.cpp:388
Represents absolute times.
Definition: Timestamp.h:31
Definition: KmlLogWriter.h:67