Scope
ScopeDefines.cpp
1 #include "stdafx.h"
2 #include "ScopeDefines.h"
3 #include "ScopeDatatypes.h"
4 #include "devices/Inputs.h"
5 #include "devices/InputsDAQmx.h"
6 #include "devices/InputsFPGA.h"
7 #include "devices/Outputs.h"
8 #include "devices/OutputsDAQmx.h"
9 #include "devices/OutputsDAQmxLineClock.h"
10 #include "devices/OutputsDAQmxResonance.h"
11 #include "devices/OutputsDAQmxSlave.h"
12 #include "gui/DAQmxPage.h"
13 #include "gui/FPGANoiseOutputPage.h"
14 #include "gui/FPGAAnalogDemultiplexerPage.h"
15 #include "gui/FPGAAnalogIntegratorPage.h"
16 #include "gui/FPGAResonanceScannerPage.h"
17 #include "gui/FPGAResonanceScanner_NI5771Page.h"
18 #include "gui/FPGADigitalDemultiplexerPage.h"
19 #include "gui/FPGAPhotonCounterPage.h"
20 #include "parameters/IO.h"
21 
22 namespace scope {
23 
24 bool ThisIsSlaveArea(const uint32_t& _a) {
25 #ifdef SCOPE_NBEAM_SETUP
26  return _a != 0;
27 #else
28  return false;
29 #endif
30 }
31 
32 uint32_t ThisAreaOrMasterArea(const uint32_t& _a) {
33  return ThisIsSlaveArea(_a)?0:_a;
34 }
35 
36 void CheckScopeDefines() {
37  static_assert( (SCOPE_SCANNERTYPE == ScannerTypeHelper::Mode::Regular) || (SCOPE_SCANNERTYPE == ScannerTypeHelper::Mode::Resonance), "Only regular and resonance scanner type supported right now");
38 
39  static_assert( (SCOPE_USE_FPGA) ? std::is_same<SCOPE_INPUTS_T, InputsFPGA>::value : true, "You have to use InputsFPGA if you use an FPGA");
40 
41  static_assert( (!SCOPE_USE_FPGA)? !std::is_same<SCOPE_INPUTS_T, InputsFPGA>::value : true, "You cannot use InputsFPGA if you do not use an FPGA");
42 
43  static_assert( (SCOPE_NAREAS>1) ? !std::is_same<SCOPE_FPGA_T, FPGAPhotonCounter>::value : true, "You cannot use FPGAPhotonCounter for multiple areas");
44 
45  static_assert( (SCOPE_NAREAS>1) ? !std::is_same<SCOPE_FPGA_T, FPGAAnalogIntegrator>::value : true, "You cannot use FPGAAnalogIntegrator for multiple areas");
46 
47  static_assert( (SCOPE_NAREAS>1) ? !std::is_same<SCOPE_FPGA_T, FPGAResonanceScanner>::value : true, "You cannot use FPGAAnalogIntegrator for multiple areas");
48 
49  static_assert( (SCOPE_NAREAS>1) ? !std::is_same<SCOPE_FPGA_T, FPGAResonanceScannerNI5771>::value : true, "You cannot use FPGAAnalogIntegrator for multiple areas");
50 
51  static_assert( (SCOPE_NAREAS>1) ? SCOPE_USE_FPGA : true, "You have to use an FPGA for a multi-area configuration");
52 
53  static_assert( (std::is_same<SCOPE_FPGA_T, FPGAPhotonCounter>::value&&SCOPE_USE_FPGA) ? std::is_same<parameters::SCOPE_INPUTS_PARAMETERS_T, parameters::InputsFPGAPhotonCounter>::value : true, "The inputs parameters type must match the FPGA type");
54 
55  static_assert( (std::is_same<SCOPE_FPGA_T, FPGADigitalDemultiplexer>::value&&SCOPE_USE_FPGA) ? std::is_same<parameters::SCOPE_INPUTS_PARAMETERS_T, parameters::InputsFPGADigitalDemultiplexer>::value : true, "The inputs parameters type must match the FPGA type");
56 
57  static_assert( (std::is_same<SCOPE_FPGA_T, FPGAAnalogIntegrator>::value&&SCOPE_USE_FPGA) ? std::is_same<parameters::SCOPE_INPUTS_PARAMETERS_T, parameters::InputsFPGAAnalogIntegrator>::value : true, "The inputs parameters type must match the FPGA type");
58 
59  static_assert( (std::is_same<SCOPE_FPGA_T, FPGAResonanceScanner>::value&&SCOPE_USE_FPGA) ? std::is_same<parameters::SCOPE_INPUTS_PARAMETERS_T, parameters::InputsFPGAResonanceScanner>::value : true, "The inputs parameters type must match the FPGA type");
60 
61  static_assert( (std::is_same<SCOPE_FPGA_T, FPGAResonanceScannerNI5771>::value&&SCOPE_USE_FPGA) ? std::is_same<parameters::SCOPE_INPUTS_PARAMETERS_T, parameters::InputsFPGAAnalogIntegrator>::value : true, "The inputs parameters type must match the FPGA type");
62 
63  static_assert( (std::is_same<SCOPE_FPGA_T, FPGAAnalogDemultiplexer>::value&&SCOPE_USE_FPGA) ? std::is_same<parameters::SCOPE_INPUTS_PARAMETERS_T, parameters::InputsFPGAAnalogDemultiplexer>::value : true, "The inputs parameters type must match the FPGA type");
64 
65  static_assert( (std::is_same<SCOPE_FPGA_T, FPGANoiseOutput>::value&&SCOPE_USE_FPGA) ? std::is_same<parameters::SCOPE_INPUTS_PARAMETERS_T, parameters::InputsFPGANoiseOutput>::value : true, "The inputs parameters type must match the FPGA type");
66 
67  static_assert( !SCOPE_USE_FPGA ? std::is_same<parameters::SCOPE_INPUTS_PARAMETERS_T, parameters::InputsDAQmx>::value : true, "The inputs parameters type must be InputsDAQmx for DAQmx inputs");
68 
69  static_assert( (std::is_same<parameters::SCOPE_INPUTS_PARAMETERS_T, parameters::InputsDAQmx>::value && std::is_same<gui::SCOPE_INPUTSINFOPAGE_T, gui::CDAQmxPage>::value)
70  || (std::is_same<parameters::SCOPE_INPUTS_PARAMETERS_T, parameters::InputsFPGAAnalogDemultiplexer>::value && std::is_same<gui::SCOPE_INPUTSINFOPAGE_T, gui::CFPGAAnalogDemultiplexerPage>::value)
71  || (std::is_same<parameters::SCOPE_INPUTS_PARAMETERS_T, parameters::InputsFPGAAnalogIntegrator>::value && std::is_same<gui::SCOPE_INPUTSINFOPAGE_T, gui::CFPGAAnalogIntegratorPage>::value)
72  || (std::is_same<parameters::SCOPE_INPUTS_PARAMETERS_T, parameters::InputsFPGAResonanceScanner>::value && std::is_same<gui::SCOPE_INPUTSINFOPAGE_T, gui::CFPGAResonanceScannerPage>::value)
73  || (std::is_same<parameters::SCOPE_INPUTS_PARAMETERS_T, parameters::InputsFPGAAnalogIntegrator>::value && std::is_same<gui::SCOPE_INPUTSINFOPAGE_T, gui::CFPGAResonanceScannerNI5771Page>::value)
74  || (std::is_same<parameters::SCOPE_INPUTS_PARAMETERS_T, parameters::InputsFPGADigitalDemultiplexer>::value && std::is_same<gui::SCOPE_INPUTSINFOPAGE_T, gui::CFPGADigitalDemultiplexerPage>::value)
75  || (std::is_same<parameters::SCOPE_INPUTS_PARAMETERS_T, parameters::InputsFPGAPhotonCounter>::value && std::is_same<gui::SCOPE_INPUTSINFOPAGE_T, gui::CFPGAPhotonCounterPage>::value)
76  || (std::is_same<parameters::SCOPE_INPUTS_PARAMETERS_T, parameters::InputsFPGANoiseOutput>::value && std::is_same<gui::SCOPE_INPUTSINFOPAGE_T, gui::CFPGANoiseOutputPage>::value), "The inputs information page must match the inputs type");
77 
78  static_assert(SCOPE_NAREAS > 0, "Come on!");
79 
80  static_assert( (std::is_same<SCOPE_OUTPUTS_T, OutputsDAQmx>::value && (SCOPE_MASTERFRAMEVECTORFILL == ScannerVectorFillTypeHelper::Mode::FullframeXYZP))
81  || (std::is_same<SCOPE_OUTPUTS_T, OutputsDAQmxLineClock>::value && (SCOPE_MASTERFRAMEVECTORFILL == ScannerVectorFillTypeHelper::Mode::LineXPColumnYZ))
82  || (std::is_same<SCOPE_OUTPUTS_T, OutputsDAQmxResonance>::value && (SCOPE_MASTERFRAMEVECTORFILL == ScannerVectorFillTypeHelper::Mode::FullframeXYZP)), "You have to use the correct scanner vector fill type for your choosen Outputs type");
83 
84  static_assert( (std::is_same<SCOPE_OUTPUTS_T, OutputsDAQmx>::value && std::is_same<SCOPE_ZEROOUTPUTS_T, ZeroOutputsDAQmx>::value)
85  || (std::is_same<SCOPE_OUTPUTS_T, OutputsDAQmxLineClock>::value && std::is_same<SCOPE_ZEROOUTPUTS_T, ZeroOutputsDAQmxLineClock>::value)
86  || (std::is_same<SCOPE_OUTPUTS_T, OutputsDAQmxResonance>::value && std::is_same<SCOPE_ZEROOUTPUTS_T, ZeroOutputsDAQmxResonance>::value), "You have to use the ZeroOutputs type corresponding to your choosen Outputs type");
87 
88  static_assert( std::is_same<SCOPE_SLAVEOUTPUTS_T, OutputsDAQmxSlave>::value && (SCOPE_SLAVEFRAMEVECTORFILL == ScannerVectorFillTypeHelper::Mode::LineZP), "You have to use the correct scanner vector fill type for your choosen slave Outputs type");
89 
90  static_assert( (SCOPE_MAXCHANNELS <=4 ) && (SCOPE_MAXCHANNELS > 0), "Buttons etc are only included for up to 4 channels. If you need more, add the appropriate resource to the CChannelFrame menu etc.!");
91 
92 
93 }
94 
95 }
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.