lcls2
C++ API: public headers of xtcdata, psalg, psdaq and psana
Loading...
Searching...
No Matches
CollectionApp Class Referenceabstract

Base of processes that join a DAQ collection: checks resource limits, connects a PUSH socket to tcp://manager:(zmq_base_port + platform) and a SUB socket (topic all) to port zmq_base_port + 10 + platform, binds inproc://drp, and dispatches incoming messages by key to the handle* methods. More...

#include <Collection.hh>

Inherited by Drp::BldApp, Drp::EpicsArchApp, Drp::Gpu::PGPDetectorApp, Drp::PGPDetectorApp, Drp::PvApp, Drp::TprApp, and Drp::UdpApp.

Public Types

enum  { zmq_base_port = 29980 }
 Base TCP port of the collection sockets. More...
 

Public Member Functions

 CollectionApp (const std::string &managerHostname, int platform, const std::string &level, const std::string &alias, const std::string &device=std::string())
 Check the resource limits (throwing a C string if they are inadequate), connect the PUSH and SUB sockets to managerHostname for platform, bind inproc://drp, and register handlers for rollcall, alloc, dealloc, connect, disconnect, reset and the phase-1 transitions (configure, unconfigure, beginrun, endrun, beginstep, endstep, enable, disable).
 
virtual ~CollectionApp ()
 Does nothing; empty body.
 
void run ()
 Message loop: dispatch collection messages from the SUB socket to their handlers by header key, and forward pulseId, fileReport, error and chunkRequest messages from inproc://drp to the manager.
 

Protected Member Functions

void handleRollcall (const nlohmann::json &msg)
 
void handleAlloc (const nlohmann::json &msg)
 
virtual void handleDealloc (const nlohmann::json &msg)
 
virtual nlohmann::json connectionInfo (const nlohmann::json &msg)=0
 
virtual void connectionShutdown ()
 
virtual void handleConnect (const nlohmann::json &msg)=0
 
virtual void handleDisconnect (const nlohmann::json &msg)
 
virtual void handlePhase1 (const nlohmann::json &msg)
 
virtual void handleReset (const nlohmann::json &msg)=0
 
void reply (const nlohmann::json &msg)
 
size_t getId () const
 
const std::string & getLevel () const
 
const std::string & getAlias () const
 
ZmqContext & context ()
 
void subscribePartition ()
 
void unsubscribePartition ()
 

Detailed Description

Base of processes that join a DAQ collection: checks resource limits, connects a PUSH socket to tcp://manager:(zmq_base_port + platform) and a SUB socket (topic all) to port zmq_base_port + 10 + platform, binds inproc://drp, and dispatches incoming messages by key to the handle* methods.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum

Base TCP port of the collection sockets.

Enumerator
zmq_base_port 

29980; the PUSH port is this plus the platform, the SUB port this plus 10 plus the platform.

Constructor & Destructor Documentation

◆ CollectionApp()

CollectionApp::CollectionApp ( const std::string &  managerHostname,
int  platform,
const std::string &  level,
const std::string &  alias,
const std::string &  device = std::string() 
)

Check the resource limits (throwing a C string if they are inadequate), connect the PUSH and SUB sockets to managerHostname for platform, bind inproc://drp, and register handlers for rollcall, alloc, dealloc, connect, disconnect, reset and the phase-1 transitions (configure, unconfigure, beginrun, endrun, beginstep, endstep, enable, disable).

◆ ~CollectionApp()

virtual CollectionApp::~CollectionApp ( )
inlinevirtual

Does nothing; empty body.

Member Function Documentation

◆ connectionInfo()

virtual nlohmann::json CollectionApp::connectionInfo ( const nlohmann::json &  msg)
protectedpure virtual

Implemented in Drp::PGPDetectorApp.

◆ connectionShutdown()

virtual void CollectionApp::connectionShutdown ( )
inlineprotectedvirtual

Reimplemented in Drp::PGPDetectorApp.

◆ context()

ZmqContext & CollectionApp::context ( )
inlineprotected

◆ getAlias()

const std::string & CollectionApp::getAlias ( ) const
inlineprotected

◆ getId()

size_t CollectionApp::getId ( ) const
inlineprotected

◆ getLevel()

const std::string & CollectionApp::getLevel ( ) const
inlineprotected

◆ handleAlloc()

void CollectionApp::handleAlloc ( const nlohmann::json &  msg)
protected

◆ handleConnect()

virtual void CollectionApp::handleConnect ( const nlohmann::json &  msg)
protectedpure virtual

◆ handleDealloc()

virtual void CollectionApp::handleDealloc ( const nlohmann::json &  msg)
protectedvirtual

◆ handleDisconnect()

virtual void CollectionApp::handleDisconnect ( const nlohmann::json &  msg)
inlineprotectedvirtual

◆ handlePhase1()

virtual void CollectionApp::handlePhase1 ( const nlohmann::json &  msg)
inlineprotectedvirtual

◆ handleReset()

virtual void CollectionApp::handleReset ( const nlohmann::json &  msg)
protectedpure virtual

◆ handleRollcall()

void CollectionApp::handleRollcall ( const nlohmann::json &  msg)
protected

◆ reply()

void CollectionApp::reply ( const nlohmann::json &  msg)
protected

◆ run()

void CollectionApp::run ( )

Message loop: dispatch collection messages from the SUB socket to their handlers by header key, and forward pulseId, fileReport, error and chunkRequest messages from inproc://drp to the manager.

Returns when zmq_poll() is interrupted or a malformed (fewer than 2 frames) message arrives.

◆ subscribePartition()

void CollectionApp::subscribePartition ( )
protected

◆ unsubscribePartition()

void CollectionApp::unsubscribePartition ( )
protected

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