DLS  1.6
globals.h
Go to the documentation of this file.
1 /******************************************************************************
2  *
3  * This file is part of the Data Logging Service (DLS).
4  *
5  * DLS is free software: you can redistribute it and/or modify it under the
6  * terms of the GNU General Public License as published by the Free Software
7  * Foundation, either version 3 of the License, or (at your option) any later
8  * version.
9  *
10  * DLS is distributed in the hope that it will be useful, but WITHOUT ANY
11  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
13  * details.
14  *
15  * You should have received a copy of the GNU General Public License along
16  * with DLS. If not, see <http://www.gnu.org/licenses/>.
17  *
18  *****************************************************************************/
19 
26 #ifndef LibDLSGlobalsH
27 #define LibDLSGlobalsH
28 
29 /*****************************************************************************/
30 
31 #include <string>
32 #include <stdint.h>
33 
34 /*****************************************************************************/
35 
38 #define DLS_PID_FILE "dlsd.pid"
39 
42 #define ENV_DLS_DIR "DLS_DIR"
43 
46 #define ENV_DLS_USER "DLS_USER"
47 
48 /*****************************************************************************/
49 
50 #ifdef _WIN32
51 
53 #define DLS_PUBLIC __declspec(dllexport)
54 #else
55 
57 #define DLS_PUBLIC
58 #endif
59 
60 /*****************************************************************************/
61 
62 namespace LibDLS {
63 
64 /*****************************************************************************/
65 
74 {
75  TUNKNOWN,
76  TCHAR,
77  TUCHAR,
78  TSHORT,
79  TUSHORT,
80  TINT,
81  TUINT,
82  TLINT,
83  TULINT,
84  TFLT,
85  TDBL
86 };
87 
90 DLS_PUBLIC ChannelType str_to_channel_type(const std::string &);
91 
94 DLS_PUBLIC const char *channel_type_to_str(ChannelType);
95 
96 /*****************************************************************************/
97 
104 {
105  MetaGen = 0,
106  MetaMean = 1,
107  MetaMin = 2,
108  MetaMax = 4
109 };
110 
113 DLS_PUBLIC std::string meta_type_str(MetaType);
114 
115 /*****************************************************************************/
116 
120 {
121  std::string name;
122  std::string unit;
123  int index;
125  unsigned int bufsize;
126  unsigned int frequency;
127 };
128 
131 DLS_PUBLIC bool operator<(const RealChannel &a, const RealChannel &b);
132 
133 /*****************************************************************************/
134 
141 enum {
142  FORMAT_INVALID = -1,
143  FORMAT_ZLIB,
144  FORMAT_MDCT,
145  FORMAT_QUANT,
146  FORMAT_COUNT
147 };
148 
151 extern const char *format_strings[FORMAT_COUNT];
152 
153 /*****************************************************************************/
154 
155 #pragma pack(push, 1)
156 
160 {
161  uint64_t start_time;
162  uint64_t end_time;
163  uint32_t position;
164 };
165 
166 /*****************************************************************************/
167 
171 {
172  uint64_t start_time;
173  uint64_t end_time;
174 };
175 
176 /*****************************************************************************/
177 
181 {
182  uint64_t time;
183  uint32_t position;
184 };
185 
186 /*****************************************************************************/
187 
191 {
192  uint64_t start_time;
193  uint64_t end_time;
194 };
195 
196 #pragma pack(pop)
197 
198 /*****************************************************************************/
199 
201 enum {
202  MSR_PORT = 2345
203 };
204 
205 /*****************************************************************************/
206 
213 typedef void (*LoggingCallback)(const char *, void *);
214 
219 DLS_PUBLIC void set_logging_callback(LoggingCallback, void *);
220 
223 DLS_PUBLIC void log(const std::string &);
224 
227 DLS_PUBLIC std::string convert_to_bin(const void *, unsigned int, int);
228 
229 /*****************************************************************************/
230 
231 } // namespace
232 
233 /*****************************************************************************/
234 
235 #endif
Channel index record, containing all chunk times.
Definition: globals.h:190
DLS_PUBLIC void log(const std::string &)
Global log method, that is used by the library.
unsigned int frequency
Maximum sample frequency of the signal.
Definition: globals.h:126
ChannelType type
Signal data type (TUINT, TDBL, etc.)
Definition: globals.h:124
DLS_PUBLIC void set_logging_callback(LoggingCallback, void *)
Set global logging callback.
Maximum values.
Definition: globals.h:108
MetaType
Meta type for recorded data.
Definition: globals.h:103
std::string name
Signal name.
Definition: globals.h:121
Minimum values.
Definition: globals.h:107
Message index.
Definition: globals.h:180
Index record for a data file index as part of a chunk.
Definition: globals.h:159
int index
Index.
Definition: globals.h:123
Arithmetic mean values (deprecated).
Definition: globals.h:106
DLS_PUBLIC std::string convert_to_bin(const void *, unsigned int, int)
Convert data to binary.
Describes a signal of the data source.
Definition: globals.h:119
Definition: Channel.h:44
Generic data as received from data source.
Definition: globals.h:105
Index record for all data file of a chunk.
Definition: globals.h:170
DLS_PUBLIC bool operator<(const RealChannel &a, const RealChannel &b)
Less operator for sorting RealChannel lists.
#define DLS_PUBLIC
Macro for public method definitions (empty on non-win32).
Definition: globals.h:57
ChannelType
Basic DLS channel datatype.
Definition: globals.h:73
unsigned int bufsize
Size of the signal buffer.
Definition: globals.h:125
std::string unit
Unit.
Definition: globals.h:122