History

TimeSeriesPlatformLibrary: Added static assestions that will fail at compile time if float is not 32-bits and double is not 64-bits since compression depends on this.

J. Ritchie Carroll committed 7 years ago

Commit 0fb09bd1 parent 385845d2 files · +21 −17Browse files

Unified · Split

2 files
  1. Source/Libraries/TimeSeriesPlatformLibrary/Common/CommonTypes.h +6 −2
  2. Source/Libraries/TimeSeriesPlatformLibrary/Samples/PublisherHandler.cpp +15 −15
Source/Libraries/TimeSeriesPlatformLibrary/Common/CommonTypes.h+6−2
@@ -24,6 +24,7 @@ · 23 unmodified lines
24#ifndef __COMMON_TYPES_H24#ifndef __COMMON_TYPES_H
25#define __COMMON_TYPES_H25#define __COMMON_TYPES_H
26 26
27#include <climits>
27#include <cstddef>28#include <cstddef>
28#include <cstring>29#include <cstring>
29#include <map>30#include <map>
@@ -44,9 +45,12 @@ · 14 unmodified lines
44 45
45namespace GSF46namespace GSF
46{47{
48 static_assert(sizeof(float) * CHAR_BIT == 32, "float not defined as 32-bits");
49 static_assert(sizeof(double) * CHAR_BIT == 64, "double not defined as 64-bits");
50
47 // Floating-point types51 // Floating-point types
48 typedef float_t float32_t;52 typedef float float32_t;
49 typedef double_t float64_t;53 typedef double float64_t;
50 typedef boost::multiprecision::cpp_dec_float_100 decimal_t;54 typedef boost::multiprecision::cpp_dec_float_100 decimal_t;
51 55
52 // DateTime type56 // DateTime type
Source/Libraries/TimeSeriesPlatformLibrary/Samples/PublisherHandler.cpp+15−15
@@ -208,21 +208,21 @@ void PublisherHandler::Start() · 207 unmodified lines
208 208
209 switch (metadata->Reference.Kind)209 switch (metadata->Reference.Kind)
210 {210 {
211 case Frequency:211 case Frequency:
212 value = 60.0 + sign * randFraction * 0.1;212 value = 60.0 + sign * randFraction * 0.1;
213 break;213 break;
214 case DfDt:214 case DfDt:
215 value = sign * randFraction * 2;215 value = sign * randFraction * 2;
216 break;216 break;
217 case Magnitude:217 case Magnitude:
218 value = 500 + sign * randFraction * 50;218 value = 500 + sign * randFraction * 50;
219 break;219 break;
220 case Angle:220 case Angle:
221 value = sign * randFraction * 180;221 value = sign * randFraction * 180;
222 break;222 break;
223 default:223 default:
224 value = sign * randFraction * UInt32::MaxValue;224 value = sign * randFraction * UInt32::MaxValue;
225 break;225 break;
226 }226 }
227 227
228 measurement->Value = value;228 measurement->Value = value;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t