8 #ifdef max // If this was defined, e.g. in windef.h without NOMINMAX undefine it!
16 template<
class T> T
Signum(
const T& _v) {
return (std::abs(_v) == _v)?1:0; }
19 #define LODWORD32(l) ((DWORD32)(((ULONG64)(l)) & 0xffffffff))
21 #define HIDWORD32(l) ((DWORD32)((((ULONG64)(l)) >> 32) & 0xffffffff))
24 template<
class Interface>
26 if (*ppInterfaceToRelease !=
nullptr) {
27 (*ppInterfaceToRelease)->Release();
28 (*ppInterfaceToRelease) =
nullptr;
35 inline double round(
const double& v) {
return floor(v+0.5); }
36 inline uint64_t round2ui64(
const double& v) {
return static_cast<uint64_t
>(floor(v+0.5)); }
37 inline uint32_t round2ui32(
const double& v) {
return static_cast<uint32_t
>(floor(v+0.5)); }
38 inline uint16_t round2ui16(
const double& v) {
return static_cast<uint16_t
>(floor(v+0.5)); }
39 inline uint8_t round2ui8(
const double& v) {
return static_cast<uint8_t
>(floor(v+0.5)); }
40 inline int64_t round2i64(
const double& v) {
return static_cast<int64_t
>(floor(v+0.5)); }
41 inline int32_t round2i32(
const double& v) {
return static_cast<int32_t
>(floor(v+0.5)); }
42 inline int16_t round2i16(
const double& v) {
return static_cast<int16_t
>(floor(v+0.5)); }
43 inline int8_t round2i8(
const double& v) {
return static_cast<int8_t
>(floor(v+0.5)); }
46 T round2(
const double& v) {
return static_cast<T
>(floor(v+0.5)); }
91 mutable std::atomic_bool
stop;
108 void Set(
const bool& _a =
true) { stop.store(_a); }
115 Scaler(
const double& _minin,
const double& _maxin)
118 ,
maxout(static_cast<double>(
std::numeric_limits<T>::max()))
119 ,
minout(static_cast<double>(
std::numeric_limits<T>::min()))
120 ,
rangerelation( static_cast<double>(
std::numeric_limits<T>::max()-
std::numeric_limits<T>::min()) / (_maxin-_minin) ) {
121 assert(std::numeric_limits<T>::is_specialized);
122 assert(std::numeric_limits<T>::is_integer);
148 std::wostringstream os_; \
149 os_ << s << std::endl; \
150 ATLTRACE2( os_.str().c_str() ); \
StopCondition(const bool &_init=false)
Initialize as false.
const double minout
minimum value of type T
Thread-safe lock-free bool to signal a requested stop to the worker function currently executed in th...
const double minin
minimum of range
const double maxin
maximum of range
const double maxout
maximum value of type T
StopCondition(StopCondition &ac)
disable copy
ScopeMessageTag
Tag for ScopeMessage.
Class for scaling to the full range of a datatype.
ScopeMessageTag tag
the tag of the message, at the moment only nothing or abort
Message with tag and cargo for SyncQueues between controllers.
void SafeRelease(Interface **ppInterfaceToRelease)
A safe release for COM objects.
T operator()(const double &v) const
std::atomic_bool stop
the stop signal
Scaler(const double &_minin, const double &_maxin)
std::wstring GetCurrentDateString()
ScopeMessage(const ScopeMessageTag &_tag, const T &_cargo)
Construct.
const double rangerelation
scaler between (maxin-minin) and (maxout - minout)
StopCondition & operator=(StopCondition &ac)
disable assignment
void Set(const bool &_a=true)
std::wstring GetCurrentTimeString(const bool &_filenamecompatible=true)