Pdaq device objects at work...
In each of the code snippets, we loop through all Device objects and call the appropriate member function. The while loop will stop when we reach the final entry (which is “0”).
If we add a new device, we do not need to modify or recompile the code that deals with the Devices. This part of the code has essentially been unchanged since 1997.
while ( (device = devicelist[idev++] ) )
size += device->max_length(i);
Finding out what the maximum
while ( (device = devicelist[idev++] ) )
Initializing all devices...
while ( (device = devicelist[idev++] ) )
len += fillBuffer->addSubevent(device);
Reading out all devices...
For most purposes we don’t need to know anymore what the hardware is in detail, the knowledge that it is a “Device” will suffice: