Scope
ScopeDatatypes.cpp
1 #include "stdafx.h"
2 #include "ScopeDatatypes.h"
3 #include "ScopeDefines.h"
4 
5 namespace scope {
6 
7 uint16_t Uint16LowerBoundary(const Uint16Range& r) {
8  switch ( r.t ) {
9  case Uint16RangeHelper::full:
10  case Uint16RangeHelper::firsthalf:
11  case Uint16RangeHelper::first4096:
12  return 0;
13  case Uint16RangeHelper::secondhalf:
14  return 32768;
15  default:
16  return 0;
17  }
18 }
19 
20 uint16_t Uint16UpperBoundary(const Uint16Range& r) {
21  switch ( r.t ) {
22  case Uint16RangeHelper::full:
23  case Uint16RangeHelper::secondhalf:
24  return UINT16_MAX;
25  case Uint16RangeHelper::firsthalf:
26  return 32767;
27  case Uint16RangeHelper::first4096:
28  return 4095;
29  default:
30  return UINT16_MAX;
31  }
32 }
33 
34 std::vector<ScannerVectorTypeHelper::Mode> ScannerSupportedVectors::List(const ScannerTypeHelper::Mode& _scannertype) {
35  switch (_scannertype) {
36  default:
37  case ScannerTypeHelper::Mode::Regular:
38  { ScannerVectorTypeHelper::Mode ret[] = {ScannerVectorTypeHelper::Mode::Sawtooth, ScannerVectorTypeHelper::Mode::Bidirectional };
39  return std::vector<ScannerVectorTypeHelper::Mode>(ret, ret + sizeof(ret) / sizeof(ret[0]) ); }
40  case ScannerTypeHelper::Mode::Resonance:
41  { ScannerVectorTypeHelper::Mode ret[] = {ScannerVectorTypeHelper::Mode::ResonanceBiDi, ScannerVectorTypeHelper::Mode::ResonanceHopper };
42  return std::vector<ScannerVectorTypeHelper::Mode>(ret, ret + sizeof(ret) / sizeof(ret[0]) ); }
43  case ScannerTypeHelper::Mode::AOD:
44  { ScannerVectorTypeHelper::Mode ret[] = {ScannerVectorTypeHelper::Mode::Basic};
45  return std::vector<ScannerVectorTypeHelper::Mode>(ret, ret + sizeof(ret) / sizeof(ret[0]) ); }
46  case ScannerTypeHelper::Mode::Fiber:
47  { ScannerVectorTypeHelper::Mode ret[] = {ScannerVectorTypeHelper::Mode::Basic};
48  return std::vector<ScannerVectorTypeHelper::Mode>(ret, ret + sizeof(ret) / sizeof(ret[0]) ); }
49  }
50 }
51 
52 
54  auto veclist = ScannerSupportedVectors::List(_scannertype);
55  return (std::end(veclist) != std::find(std::begin(veclist), std::end(veclist), _scanmode));
56 }
57 
59  return IsSupported(_scanmode, SCOPE_SCANNERTYPE);
60 }
61 
62 }
static bool IsSupported(const ScannerVectorTypeHelper::Mode &_scanmode, const ScannerTypeHelper::Mode &_scannertype=SCOPE_SCANNERTYPE)
Returns true if a given scannervector/scanmode is supported by a given scannertypeDefault scannertype...
Mode
The different types of scans.
static bool IsBuiltinSupported(const ScannerVectorTypeHelper::Mode &_scanmode)
Returns true if a given scannervector/scanmode is supported by the builtin/hardcoded (see ScopeDefine...
This is the include file for standard system include files, or project specific include files that ar...
In here all declarations for all kinds of datatypes Scope needs.
Mode
The different types of scanners.
static std::vector< ScannerVectorTypeHelper::Mode > List(const ScannerTypeHelper::Mode &_scannertype=SCOPE_SCANNERTYPE)
Returns a vector with all supported scannervectors for a given scannertype.