logger
Logging.hh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2008 DFKI
3  * Copyright (c) 2005-2006 LAAS/CNRS <openrobots@laas.fr>
4  * Sylvain Joyeux <sylvain.joyeux@m4x.org>
5  *
6  * All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions are
10  * met:
11  *
12  * 1. Redistributions of source code must retain the above copyright
13  * notice, this list of conditions and the following disclaimer.
14  * 2. Redistributions in binary form must reproduce the above copyright
15  * notice, this list of conditions and the following disclaimer in
16  * the documentation and/or other materials provided with the
17  * distribution.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23  * HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
24  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
25  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
26  * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
27  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
28  * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
29  * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
30  * DAMAGE.
31  */
32 
33 #ifndef OROCOS_LOGGER_H
34 #define OROCOS_LOGGER_H
35 
36 #include <base/Time.hpp>
37 #include <stdint.h>
38 
98 namespace Logging
99 {
100  // Version 1 is the same format without a prologue, and without the compression
101  // flag in data blocks
102  static const int FORMAT_VERSION = 2;
103  extern const char FORMAT_MAGIC[];
104 
105  struct Prologue
106  {
107  char magic[7];
108  uint8_t padding;
109 
110  uint32_t version;
111  uint32_t flags;
113  : padding(0), version(0), flags(0)
114  {
115  for (int i = 0; i < 7; ++i)
116  magic[i] = FORMAT_MAGIC[i];
117  }
118  };
119 
120  struct BlockHeader
121  {
122  uint8_t type;
123  uint8_t padding;
124  uint16_t stream_idx;
125  uint32_t data_size;
126  };
127  static const int BLOCK_HEADER_SIZE = 8;
128 
130  {
131  base::Time realtime;
132  base::Time timestamp;
133  uint32_t data_size;
134  uint8_t compressed;
135  };
136  static const int SAMPLE_HEADER_SIZE = 21;
137 
138  enum BlockType
139  {
144  };
146  {
150  };
152  {
155  };
156 
157 };
158 
159 #endif
160 
uint8_t type
Definition: Logging.hh:122
Definition: Logging.hh:140
char magic[7]
Definition: Logging.hh:107
Definition: Logging.hh:147
base::Time realtime
Definition: Logging.hh:131
Definition: Logfile.cpp:63
BlockType
Definition: Logging.hh:138
uint16_t stream_idx
Definition: Logging.hh:124
Definition: Logging.hh:141
Definition: Logging.hh:148
Definition: Logging.hh:129
Definition: Logging.hh:120
const char FORMAT_MAGIC[]
Definition: Logfile.cpp:47
uint8_t padding
Definition: Logging.hh:108
base::Time timestamp
Definition: Logging.hh:132
Prologue()
Definition: Logging.hh:112
uint32_t version
Definition: Logging.hh:110
Definition: Logging.hh:149
uint8_t padding
Definition: Logging.hh:123
CommandType
Definition: Logging.hh:151
uint32_t flags
Definition: Logging.hh:111
a data block in an already declared stream
Definition: Logging.hh:143
uint8_t compressed
Definition: Logging.hh:134
Definition: Logging.hh:153
uint32_t data_size
Definition: Logging.hh:133
uint32_t data_size
Definition: Logging.hh:125
StreamType
Definition: Logging.hh:145
stream declaration block
Definition: Logging.hh:142
Definition: Logging.hh:154
Definition: Logging.hh:105