artdaq_demo
v3_04_00
|
JCF, Mar-17-2016: ToyHardwareInterface is meant to mimic a vendor-provided hardware API, usable within the the ToySimulator fragment generator. For purposes of realism, it's a C++03-style API, as opposed to, say, one based in C++11 capable of taking advantage of smart pointers, etc. An important point to make is that it has ownership of the buffer into which it dumps its data - so rather than use new/delete, use its functions AllocateReadoutBuffer/FreeReadoutBuffer. More...
#include <artdaq-demo/Generators/ToyHardwareInterface/ToyHardwareInterface.hh>
Public Types | |
enum | DistributionType { DistributionType::uniform, DistributionType::gaussian, DistributionType::monotonic, DistributionType::uninitialized, uninit2 } |
Allow for the selection of output distribution. More... | |
typedef uint16_t | data_t |
The type used to represent ADC counts (which are 12 or 14 bits, for TOY1 or TOY2) | |
Public Member Functions | |
ToyHardwareInterface (fhicl::ParameterSet const &ps) | |
Construct and configure ToyHardwareInterface. More... | |
void | StartDatataking () |
"StartDatataking" is meant to mimic actions one would take when telling the hardware to start sending data - the uploading of values to registers, etc. | |
void | StopDatataking () |
Performs shutdown actions. | |
void | FillBuffer (char *buffer, size_t *bytes_read) |
Use configured generator to fill a buffer with data. More... | |
void | AllocateReadoutBuffer (char **buffer) |
Request a buffer from the hardware. More... | |
void | FreeReadoutBuffer (char *buffer) |
Release the given buffer to the hardware. More... | |
int | SerialNumber () const |
Gets the serial number of the simulated hardware. More... | |
int | NumADCBits () const |
Get the number of ADC bits used in generating data. More... | |
int | BoardType () const |
Return the "board type" of the simulated hardware. More... | |
JCF, Mar-17-2016: ToyHardwareInterface is meant to mimic a vendor-provided hardware API, usable within the the ToySimulator fragment generator. For purposes of realism, it's a C++03-style API, as opposed to, say, one based in C++11 capable of taking advantage of smart pointers, etc. An important point to make is that it has ownership of the buffer into which it dumps its data - so rather than use new/delete, use its functions AllocateReadoutBuffer/FreeReadoutBuffer.
Definition at line 21 of file ToyHardwareInterface.hh.
|
strong |
Allow for the selection of output distribution.
Enumerator | |
---|---|
uniform |
A uniform distribution. |
gaussian |
A Gaussian distribution. |
monotonic |
A monotonically-increasing distribution. |
uninitialized |
A use-after-free expliot distribution. |
Definition at line 85 of file ToyHardwareInterface.hh.
|
explicit |
Construct and configure ToyHardwareInterface.
ps | fhicl::ParameterSet with configuration options for ToyHardwareInterface |
Definition at line 22 of file ToyHardwareInterface.cc.
void ToyHardwareInterface::AllocateReadoutBuffer | ( | char ** | buffer | ) |
Request a buffer from the hardware.
buffer | (output) Pointer to buffer |
Definition at line 238 of file ToyHardwareInterface.cc.
int ToyHardwareInterface::BoardType | ( | ) | const |
Return the "board type" of the simulated hardware.
Definition at line 249 of file ToyHardwareInterface.cc.
void ToyHardwareInterface::FillBuffer | ( | char * | buffer, |
size_t * | bytes_read | ||
) |
Use configured generator to fill a buffer with data.
buffer | Buffer to fill |
bytes_read | Number of bytes to fill |
Definition at line 97 of file ToyHardwareInterface.cc.
void ToyHardwareInterface::FreeReadoutBuffer | ( | char * | buffer | ) |
Release the given buffer to the hardware.
buffer | Buffer to release |
Definition at line 243 of file ToyHardwareInterface.cc.
int ToyHardwareInterface::NumADCBits | ( | ) | const |
Get the number of ADC bits used in generating data.
Definition at line 257 of file ToyHardwareInterface.cc.
int ToyHardwareInterface::SerialNumber | ( | ) | const |
Gets the serial number of the simulated hardware.
Definition at line 277 of file ToyHardwareInterface.cc.