Receives a BLD multicast stream on a UDP socket and steps through the events packed in each packet (a header, then entries carrying timestamp and pulse ID offsets); can also simulate packets.
More...
#include <BldDetector.hh>
|
| | Bld (unsigned mcaddr, unsigned port, unsigned interface, unsigned timestampPos, unsigned pulseIdPos, unsigned headerSize, unsigned payloadSize, bool simulate, uint64_t timestampCorr=0, bool varLenArr=false, std::vector< unsigned > entryByteSizes={}, std::map< unsigned, unsigned > arraySizeMap={}) |
| | Open a UDP socket with a 16 MiB receive buffer, bind it to mcaddr:port and join that multicast group on interface; throws a std::string on failure.
|
| |
| | Bld (const Bld &) |
| | Copy only the layout fields and the socket descriptor (other members are left uninitialized) and log an error.
|
| |
| | ~Bld () |
| | Close the socket.
|
| |
| bool | ready () const |
| | Return true if the current packet still holds another event (a 4-byte offset word plus payload) after the current position.
|
| |
| void | clear (uint64_t ts) |
| | Skip events, receiving (or simulating) packets as needed, until one with a timestamp at or after ts is current or no more data is available; dropped timestamps and pulse ID jumps are logged.
|
| |
| uint64_t | next () |
| | Advance to the next event and return its timestamp (header timestamp minus the correction, plus the entry offset for packed events), receiving a new packet when the current one is used up.
|
| |
| uint8_t * | payload () const |
| | Return the payload of the current event.
|
| |
| unsigned | payloadSize () const |
| | Return the payload size of the current event (recomputed per event for variable-length arrays).
|
| |
|
| static constexpr unsigned | MTU = 9000 |
| | Receive buffer size in bytes (9000).
|
| |
| static constexpr unsigned | TimestampPos = 0 |
| | Offset of the timestamp in an LCLS-II style header (0).
|
| |
| static constexpr unsigned | PulseIdPos = 8 |
| | Offset of the pulse ID in an LCLS-II style header (8).
|
| |
| static constexpr unsigned | HeaderSize = 20 |
| | Header size of the LCLS-II style (20 bytes); used for PV-described sources.
|
| |
| static constexpr unsigned | DgramTimestampPos = 0 |
| | Offset of the timestamp in an LCLS-I style header (0).
|
| |
| static constexpr unsigned | DgramPulseIdPos = 8 |
| | Offset of the pulse ID in an LCLS-I style header (8).
|
| |
| static constexpr unsigned | DgramHeaderSize = 60 |
| | Header size of the LCLS-I style (60 bytes); used for the built-in sources.
|
| |
Receives a BLD multicast stream on a UDP socket and steps through the events packed in each packet (a header, then entries carrying timestamp and pulse ID offsets); can also simulate packets.
◆ Bld() [1/2]
| Drp::Bld::Bld |
( |
unsigned |
mcaddr, |
|
|
unsigned |
port, |
|
|
unsigned |
interface, |
|
|
unsigned |
timestampPos, |
|
|
unsigned |
pulseIdPos, |
|
|
unsigned |
headerSize, |
|
|
unsigned |
payloadSize, |
|
|
bool |
simulate, |
|
|
uint64_t |
timestampCorr = 0, |
|
|
bool |
varLenArr = false, |
|
|
std::vector< unsigned > |
entryByteSizes = {}, |
|
|
std::map< unsigned, unsigned > |
arraySizeMap = {} |
|
) |
| |
Open a UDP socket with a 16 MiB receive buffer, bind it to mcaddr:port and join that multicast group on interface; throws a std::string on failure.
The other arguments give the header layout, the fixed payload size, simulation, a timestamp correction and the variable-length-array description.
◆ Bld() [2/2]
| Drp::Bld::Bld |
( |
const Bld & |
| ) |
|
Copy only the layout fields and the socket descriptor (other members are left uninitialized) and log an error.
◆ ~Bld()
◆ clear()
| void Drp::Bld::clear |
( |
uint64_t |
ts | ) |
|
Skip events, receiving (or simulating) packets as needed, until one with a timestamp at or after ts is current or no more data is available; dropped timestamps and pulse ID jumps are logged.
◆ next()
| uint64_t Drp::Bld::next |
( |
| ) |
|
Advance to the next event and return its timestamp (header timestamp minus the correction, plus the entry offset for packed events), receiving a new packet when the current one is used up.
Returns 0 when a new packet is needed but none is available, and always in that case when simulating.
◆ payload()
| uint8_t * Drp::Bld::payload |
( |
| ) |
const |
|
inline |
Return the payload of the current event.
◆ payloadSize()
| unsigned Drp::Bld::payloadSize |
( |
| ) |
const |
|
inline |
Return the payload size of the current event (recomputed per event for variable-length arrays).
◆ ready()
| bool Drp::Bld::ready |
( |
| ) |
const |
|
inline |
Return true if the current packet still holds another event (a 4-byte offset word plus payload) after the current position.
◆ DgramHeaderSize
| constexpr unsigned Drp::Bld::DgramHeaderSize = 60 |
|
inlinestaticconstexpr |
Header size of the LCLS-I style (60 bytes); used for the built-in sources.
◆ DgramPulseIdPos
| constexpr unsigned Drp::Bld::DgramPulseIdPos = 8 |
|
inlinestaticconstexpr |
Offset of the pulse ID in an LCLS-I style header (8).
◆ DgramTimestampPos
| constexpr unsigned Drp::Bld::DgramTimestampPos = 0 |
|
inlinestaticconstexpr |
Offset of the timestamp in an LCLS-I style header (0).
◆ HeaderSize
| constexpr unsigned Drp::Bld::HeaderSize = 20 |
|
inlinestaticconstexpr |
Header size of the LCLS-II style (20 bytes); used for PV-described sources.
◆ MTU
| constexpr unsigned Drp::Bld::MTU = 9000 |
|
inlinestaticconstexpr |
Receive buffer size in bytes (9000).
◆ PulseIdPos
| constexpr unsigned Drp::Bld::PulseIdPos = 8 |
|
inlinestaticconstexpr |
Offset of the pulse ID in an LCLS-II style header (8).
◆ TimestampPos
| constexpr unsigned Drp::Bld::TimestampPos = 0 |
|
inlinestaticconstexpr |
Offset of the timestamp in an LCLS-II style header (0).
The documentation for this class was generated from the following file: