forked from sccn/liblsl
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcommon.h
More file actions
76 lines (61 loc) · 2.09 KB
/
common.h
File metadata and controls
76 lines (61 loc) · 2.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#ifndef COMMON_H
#define COMMON_H
#include "../include/lsl/constants.h"
#include <stdexcept>
#include <boost/version.hpp>
#include <string>
#ifdef _WIN32
#define LIBLSL_CPP_API __declspec(dllexport)
#else
#define LIBLSL_CPP_API
#endif
#ifdef _MSC_VER
#pragma warning( disable : 4275 )
#if _MSC_VER <= 1600
#include <boost/cstdint.hpp>
using lslboost::int8_t;
using lslboost::int16_t;
using lslboost::int32_t;
using lslboost::int64_t;
using lslboost::uint8_t;
using lslboost::uint16_t;
using lslboost::uint32_t;
using lslboost::uint64_t;
#define __func__ "An unknown function"
#endif
#endif
#ifndef BOOST_CSTDINT_HPP
#include <cstdint>
#endif
#if BOOST_VERSION < 104500
#error "Please do not compile this with a lslboost version older than 1.45 because the library would otherwise not be protocol-compatible with builds using other versions."
#endif
// the highest supported protocol version
// * 100 is the original version, supported by library versions 1.00+
// * 110 is an alternative protocol that improves throughput, supported by library versions 1.10+
const int LSL_PROTOCOL_VERSION = 110;
// the library version
const int LSL_LIBRARY_VERSION = 113;
namespace lsl {
/// A very large time duration (> 1 year) for timeout values.
const double FOREVER = 32000000.0;
/// Constant to indicate that a sample has the next successive time stamp.
const double DEDUCED_TIMESTAMP = -1.0;
/// Constant to indicate that a stream has variable sampling rate.
const double IRREGULAR_RATE = 0.0;
/// Obtain a local system time stamp in seconds.
double lsl_clock();
/// Ensure that LSL is initialized.
void ensure_lsl_initialized();
/// Exception class that indicates that a stream inlet's source has been irrecoverably lost.
class LIBLSL_CPP_API lost_error: public std::runtime_error {
public:
explicit lost_error(const std::string &msg): std::runtime_error(msg) {}
};
/// Exception class that indicates that an operation failed due to a timeout.
class LIBLSL_CPP_API timeout_error: public std::runtime_error {
public:
explicit timeout_error(const std::string &msg): std::runtime_error(msg) {}
};
}
#endif