35#ifndef FunctionGeneratorState_h
36#define FunctionGeneratorState_h
47 size_t n = generator->GetChannelCount();
48 m_channelActive = std::make_unique<std::atomic<bool>[] >(n);
49 m_channelAmplitude = std::make_unique<std::atomic<float>[] >(n);
50 m_channelOffset= std::make_unique<std::atomic<float>[] >(n);
51 m_channelFrequency = std::make_unique<std::atomic<float>[] >(n);
52 m_channelShape = std::make_unique<std::atomic<FunctionGenerator::WaveShape>[] >(n);
53 m_channelOutputImpedance = std::make_unique<std::atomic<FunctionGenerator::OutputImpedance>[] >(n);
54 m_channelShapes = std::make_unique<std::vector<FunctionGenerator::WaveShape>[] >(n);
55 m_channelShapeIndexes = std::make_unique<std::map<FunctionGenerator::WaveShape,int>[] >(n);
56 m_channelShapeNames = std::make_unique<std::vector<std::string>[] >(n);
58 m_needsUpdate = std::make_unique<std::atomic<bool>[] >(n);
60 m_strOffset = std::make_unique<std::string[]>(n);
61 m_committedOffset = std::make_unique<float[]>(n);
62 m_strAmplitude = std::make_unique<std::string[]>(n);
63 m_committedAmplitude = std::make_unique<float[]>(n);
64 m_strFrequency = std::make_unique<std::string[]>(n);
65 m_committedFrequency = std::make_unique<float[]>(n);
67 Unit volts(Unit::UNIT_VOLTS);
69 for(
size_t i=0; i<n; i++)
71 m_channelActive[i] =
false;
72 m_channelAmplitude[i] = 0;
73 m_channelOffset[i] = 0;
74 m_channelFrequency[i] = 0;
75 m_channelShape[i] = FunctionGenerator::WaveShape::SHAPE_SINE;
76 m_channelOutputImpedance[i] = FunctionGenerator::OutputImpedance::IMPEDANCE_HIGH_Z;
78 m_channelShapes[i] = generator->GetAvailableWaveformShapes(i);
79 for(
size_t j=0; j<m_channelShapes[i].size(); j++)
81 m_channelShapeNames[i].push_back(generator->GetNameOfShape(m_channelShapes[i][j]));
82 m_channelShapeIndexes[i][m_channelShapes[i][j]] = j;
84 m_needsUpdate[i] =
true;
86 m_committedAmplitude[i] = FLT_MIN;
87 m_committedOffset[i] = FLT_MIN;
88 m_committedFrequency[i] = FLT_MIN;
92 std::unique_ptr<std::atomic<bool>[]> m_channelActive;
93 std::unique_ptr<std::atomic<float>[]> m_channelAmplitude;
94 std::unique_ptr<std::atomic<float>[]> m_channelOffset;
95 std::unique_ptr<std::atomic<float>[]> m_channelFrequency;
96 std::unique_ptr<std::atomic<FunctionGenerator::WaveShape>[]> m_channelShape;
97 std::unique_ptr<std::atomic<FunctionGenerator::OutputImpedance>[]> m_channelOutputImpedance;
98 std::unique_ptr<std::vector<FunctionGenerator::WaveShape>[]> m_channelShapes;
99 std::unique_ptr<std::map<FunctionGenerator::WaveShape,int>[]> m_channelShapeIndexes;
100 std::unique_ptr<std::vector<std::string>[]> m_channelShapeNames;
102 std::unique_ptr<std::atomic<bool>[]> m_needsUpdate;
105 std::unique_ptr<float[]> m_committedOffset;
106 std::unique_ptr<std::string[]> m_strOffset;
108 std::unique_ptr<float[]> m_committedAmplitude;
109 std::unique_ptr<std::string[]> m_strAmplitude;
111 std::unique_ptr<float[]> m_committedFrequency;
112 std::unique_ptr<std::string[]> m_strFrequency;
Current status of a Function Generator.
Definition: FunctionGeneratorState.h:42
A unit of measurement, plus conversion to pretty-printed output.
Definition: Unit.h:57