artdaq_demo  v3_04_00
ToyHardwareInterface Class Reference

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...
 

Detailed Description

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.

Member Enumeration Documentation

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.

Constructor & Destructor Documentation

ToyHardwareInterface::ToyHardwareInterface ( fhicl::ParameterSet const &  ps)
explicit

Construct and configure ToyHardwareInterface.

Parameters
psfhicl::ParameterSet with configuration options for ToyHardwareInterface

Definition at line 22 of file ToyHardwareInterface.cc.

Member Function Documentation

void ToyHardwareInterface::AllocateReadoutBuffer ( char **  buffer)

Request a buffer from the hardware.

Parameters
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.

Returns
A vendor-provided integer identifying the board type

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.

Parameters
bufferBuffer to fill
bytes_readNumber of bytes to fill

Definition at line 97 of file ToyHardwareInterface.cc.

void ToyHardwareInterface::FreeReadoutBuffer ( char *  buffer)

Release the given buffer to the hardware.

Parameters
bufferBuffer to release

Definition at line 243 of file ToyHardwareInterface.cc.

int ToyHardwareInterface::NumADCBits ( ) const

Get the number of ADC bits used in generating data.

Returns
The number of ADC bits used

Definition at line 257 of file ToyHardwareInterface.cc.

int ToyHardwareInterface::SerialNumber ( ) const

Gets the serial number of the simulated hardware.

Returns
Serial number of the simulated hardware

Definition at line 277 of file ToyHardwareInterface.cc.


The documentation for this class was generated from the following files: