1 #ifndef artdaq_DAQrate_TokenSender_hh
2 #define artdaq_DAQrate_TokenSender_hh
7 #include "fhiclcpp/types/Atom.h"
8 #include "fhiclcpp/types/Comment.h"
9 #include "fhiclcpp/types/ConfigurationTable.h"
10 #include "fhiclcpp/types/Name.h"
12 #include <arpa/inet.h>
13 #include <netinet/in.h>
14 #include <sys/socket.h>
15 #include <sys/types.h>
39 fhicl::Atom<bool>
use_routing_manager{fhicl::Name{
"use_routing_manager"}, fhicl::Comment{
"True if using the Routing Manager"},
false};
41 fhicl::Atom<int>
routing_token_port{fhicl::Name{
"routing_token_port"}, fhicl::Comment{
"Port to send tokens on"}, 35555};
43 fhicl::Atom<std::string>
routing_token_host{fhicl::Name{
"routing_manager_hostname"}, fhicl::Comment{
"Hostname or IP of RoutingManager"},
"localhost"};
71 explicit TokenSender(
const fhicl::ParameterSet& pset);
104 std::atomic<bool> initialized_;
106 bool send_routing_tokens_;
109 std::string token_address_;
110 std::atomic<size_t> tokens_sent_;
111 uint32_t run_number_;
114 void setup_tokens_();
116 void send_routing_token_(
int nSlots,
int run_number,
int rank);
fhicl::Atom< bool > use_routing_manager
"use_routing_manager" (Default: false) : Whether to send tokens to a RoutingManager ...
fhicl::Atom< int > routing_token_port
"routing_token_port" (Default: 35555) : Port to send tokens on
fhicl::Atom< std::string > routing_token_host
"routing_manager_hostname" (Default: "localhost") : Hostname or IP of RoutingManager ...
TokenSender & operator=(TokenSender const &)=delete
Copy Assignment operator is deleted.
fhicl::WrappedTable< Config > Parameters
Used for ParameterSet validation (if desired)
void SendRoutingToken(int nSlots, int run_number, int rank=my_rank)
Send a RoutingToken message indicating that slots are available.
The TokenSender contains methods used to send data requests and Routing tokens.
Configuration for Routing token sending
size_t GetSentTokenCount() const
Get the count of number of tokens sent.
bool RoutingTokenSendsEnabled()
Determine if routing token sends are enabled.
virtual ~TokenSender()
TokenSender Destructor.
TokenSender()=delete
Default Constructor is deleted.
void SetRunNumber(uint32_t run)
Set the run number to be used in request messages.