Transient Recorder Framework
TRChannelsDriver.h
Go to the documentation of this file.
1 /* This file is part of the Transient Recorder Framework.
2  * It is subject to the license terms in the LICENSE.txt file found in the
3  * top-level directory of this distribution and at
4  * https://confluence.slac.stanford.edu/display/ppareg/LICENSE.html. No part
5  * of the Transient Recorder Framework, including this file, may be copied,
6  * modified, propagated, or distributed except according to the terms
7  * contained in the LICENSE.txt file.
8  */
9 
16 #ifndef TRANSREC_BASE_CHANNELS_DRIVER_H
17 #define TRANSREC_BASE_CHANNELS_DRIVER_H
18 
19 #include <stddef.h>
20 
21 #include <string>
22 
23 #include <asynNDArrayDriver.h>
24 
25 #include "TRNonCopyable.h"
26 
27 class TRBaseDriver;
28 class TRChannelsDriver;
31 
36  friend class TRChannelsDriver;
37 
38 public:
49  inline TRChannelsDriverConfig (TRBaseDriver &base_driver)
50  : num_extra_addrs(0),
51  num_asyn_params(0),
52  base_driver(base_driver)
53  {
54  }
55 
64 
69 
84  template <typename ParamType>
85  inline TRChannelsDriverConfig & set (ParamType TRChannelsDriverConfig::*param, ParamType const &value)
86  {
87  this->*param = value;
88  return *this;
89  }
90 
91 private:
92  TRBaseDriver &base_driver;
93 };
94 
114 class TRChannelsDriver : public asynNDArrayDriver,
115  private TRNonCopyable
116 {
117  friend class TRBaseDriver;
118  friend class TRChannelDataSubmit;
119 
120 private:
121  // Enumeration of asyn parameters.
122  enum Params {
123  UPDATE_ARRAYS,
124  NUM_CHANNEL_ASYN_PARAMS
125  };
126 
127 public:
134 
135  virtual ~TRChannelsDriver ();
136 
137 private:
138  // The follwing functions are for internal use by Transient Recorder framework.
139 
140  // Clear all arrays from pArrays (called during arming).
141  void resetArrays ();
142 
143  // Allocate an NDArray for later submission.
144  NDArray * allocateArray (NDDataType_t data_type, int num_samples);
145 
146  // Submit an NDArray to the port.
147  void submitArray (NDArray *array, int channel, double sample_rate,
148  TRArrayCompletionCallback *compl_cb);
149 
150 private:
151  // Array of asyn parameter indices.
152  int m_asyn_params[NUM_CHANNEL_ASYN_PARAMS];
153 };
154 
155 #endif
Callback class for final adjustment of the NDArray.
Definition: TRChannelDataSubmit.h:164
Class for submitting burst data.
Definition: TRChannelDataSubmit.h:38
Central class of the Transient Recorder framework for transient recorders (digitizers).
Definition: TRBaseDriver.h:55
An asynNDArrayDriver-based class though which burst data is submitted into the AreaDetector framework...
Definition: TRChannelsDriver.h:114
Construction parameters for TRChannelsDriver.
Definition: TRChannelsDriver.h:35
int num_extra_addrs
Number of additional asyn addresses to support.
Definition: TRChannelsDriver.h:63
int num_asyn_params
Number of asyn parameters defined by the derived class.
Definition: TRChannelsDriver.h:68
TRChannelsDriverConfig(TRBaseDriver &base_driver)
Constructor for channel driver parameters.
Definition: TRChannelsDriver.h:49
bool allocateArray(TRBaseDriver &driver, int channel_num, NDDataType_t data_type, int num_samples)
Set parameters for the array and allocate the NDArray.