artdaq  v3_09_00
artdaqtest::CommandableFragmentGeneratorTest Class Reference

CommandableFragmentGenerator derived class for testing. More...

Inheritance diagram for artdaqtest::CommandableFragmentGeneratorTest:
artdaq::CommandableFragmentGenerator

Public Member Functions

 CommandableFragmentGeneratorTest (const fhicl::ParameterSet &ps)
 CommandableFragmentGeneratorTest Constructor.
 
void setFireCount (size_t count)
 Have getNext_ generate count fragments. More...
 
void setHwFail ()
 Set the hwFail flag.
 
void setEnabledIds (uint64_t bitmask)
 Set the enabled IDs mask for the Fragment Generator. More...
 
void setTimestamp (artdaq::Fragment::timestamp_t ts)
 Set the timestamp to be used for the next Fragment. More...
 
artdaq::Fragment::timestamp_t getTimestamp ()
 Get the timestamp that will be used for the next Fragment. More...
 
- Public Member Functions inherited from artdaq::CommandableFragmentGenerator
 CommandableFragmentGenerator (const fhicl::ParameterSet &ps)
 CommandableFragmentGenerator Constructor. More...
 
virtual ~CommandableFragmentGenerator ()
 CommandableFragmentGenerator Destructor. More...
 
void joinThreads ()
 Join any data-taking threads. Should be called when destructing CommandableFragmentGenerator. More...
 
bool getNext (FragmentPtrs &output) overridefinal
 getNext calls either applyRequests or getNext_ to get any data that is ready to be sent to the EventBuilders More...
 
void startMonitoringThread ()
 Function that launches the monitoring thread (getMonitoringDataLoop())
 
void getMonitoringDataLoop ()
 This function regularly calls checkHWStatus_(), and sets the isHardwareOK flag accordingly.
 
std::vector
< Fragment::fragment_id_t > 
fragmentIDs () override
 Get the list of Fragment IDs handled by this CommandableFragmentGenerator. More...
 
size_t ev_counter () const
 Get the current value of the event counter. More...
 
void StartCmd (int run, uint64_t timeout, uint64_t timestamp)
 Start the CommandableFragmentGenerator. More...
 
void StopCmd (uint64_t timeout, uint64_t timestamp)
 Stop the CommandableFragmentGenerator. More...
 
void PauseCmd (uint64_t timeout, uint64_t timestamp)
 Pause the CommandableFragmentGenerator. More...
 
void ResumeCmd (uint64_t timeout, uint64_t timestamp)
 Resume the CommandableFragmentGenerator. More...
 
std::string ReportCmd (std::string const &which="")
 Get a report about a user-specified run-time quantity. More...
 
virtual std::string metricsReportingInstanceName () const
 Get the name used when reporting metrics. More...
 
bool exception () const
 Get the current value of the exception flag. More...
 
virtual bool metaCommand (std::string const &command, std::string const &arg)
 The meta-command is used for implementing user-specific commands in a CommandableFragmentGenerator. More...
 
void SetRequestBuffer (std::shared_ptr< RequestBuffer > buffer)
 

Protected Member Functions

bool getNext_ (artdaq::FragmentPtrs &frags) override
 Generate data and return it to CommandableFragmentGenerator. More...
 
bool checkHWStatus_ () override
 Returns whether the hwFail flag has not been set. More...
 
void start () override
 Perform start actions. No-Op.
 
void stopNoMutex () override
 Perform immediate stop actions. No-Op.
 
void stop () override
 Perform stop actions. No-Op.
 
void pause () override
 Perform pause actions. No-Op.
 
void resume () override
 Perform resume actions. No-Op.
 
- Protected Member Functions inherited from artdaq::CommandableFragmentGenerator
int run_number () const
 Get the current Run number. More...
 
int subrun_number () const
 Get the current Subrun number. More...
 
uint64_t timeout () const
 Timeout of last command. More...
 
uint64_t timestamp () const
 Timestamp of last command. More...
 
artdaq::Fragment::fragment_id_t fragment_id () const
 Get the Fragment ID of this Fragment generator. More...
 
bool should_stop () const
 Get the current value of the should_stop flag. More...
 
bool check_stop ()
 Routine used by applyRequests to make sure that all outstanding requests have been fulfilled before returning. More...
 
int board_id () const
 Gets the current board_id. More...
 
size_t ev_counter_inc (size_t step=1)
 Increment the event counter. More...
 
void set_exception (bool exception)
 Control the exception flag. More...
 
void metricsReportingInstanceName (std::string const &name)
 Sets the name for metrics reporting. More...
 
std::shared_ptr< RequestBufferGetRequestBuffer ()
 
virtual bool getNext_ (FragmentPtrs &output)=0
 Obtain the next group of Fragments, if any are available. Return false if readout cannot continue, if we are 'stopped', or if we are not running in state-machine mode. Note that getNext_() must return n of each fragmentID declared by fragmentIDs_(). More...
 
virtual void pauseNoMutex ()
 On call to PauseCmd, pauseNoMutex() is called prior to PauseCmd acquiring the mutex More...
 
virtual std::string report ()
 Let's say that the contract with the report() functions is that they return a non-empty string if they have something useful to report, but if they don't know how to handle a given request, they simply return an empty string and the ReportCmd() takes care of saying "the xyz command is not currently supported". For backward compatibility, we keep the report function that takes no arguments and add one that takes a "which" argument. In the ReportCmd function, we'll call the more specific one first. More...
 
virtual std::string reportSpecific (std::string const &what)
 Report the status of a specific quantity More...
 

Additional Inherited Members

- Public Types inherited from artdaq::CommandableFragmentGenerator
using Parameters = fhicl::WrappedTable< Config >
 Used for ParameterSet validation (if desired)
 
- Protected Attributes inherited from artdaq::CommandableFragmentGenerator
std::mutex mutex_
 Mutex used to ensure that multiple transition commands do not run at the same time.
 

Detailed Description

CommandableFragmentGenerator derived class for testing.

Definition at line 46 of file CommandableFragmentGenerator_t.cc.

Member Function Documentation

bool artdaqtest::CommandableFragmentGeneratorTest::checkHWStatus_ ( )
inlineoverrideprotectedvirtual

Returns whether the hwFail flag has not been set.

Returns
If hwFail has been set, false, otherwise true

Reimplemented from artdaq::CommandableFragmentGenerator.

Definition at line 76 of file CommandableFragmentGenerator_t.cc.

bool artdaqtest::CommandableFragmentGeneratorTest::getNext_ ( artdaq::FragmentPtrs &  frags)
overrideprotected

Generate data and return it to CommandableFragmentGenerator.

Parameters
fragsFragmentPtrs list that new Fragments should be added to
Returns
True if data was generated

CommandableFragmentGeneratorTest merely default-constructs Fragments, emplacing them on the frags list.

Definition at line 157 of file CommandableFragmentGenerator_t.cc.

artdaq::Fragment::timestamp_t artdaqtest::CommandableFragmentGeneratorTest::getTimestamp ( )
inline

Get the timestamp that will be used for the next Fragment.

Returns
The timestamp that will be used for the next Fragment

Definition at line 134 of file CommandableFragmentGenerator_t.cc.

void artdaqtest::CommandableFragmentGeneratorTest::setEnabledIds ( uint64_t  bitmask)
inline

Set the enabled IDs mask for the Fragment Generator.

Parameters
bitmaskBitmask of enabled IDs for the Fragment Generator

For testing, this bitmask allows a configured Fragment ID to not be generated by a given call to setFireCount. This is used to create asymmetric response from the Fragment generator in the _MultipleIDs test cases

Definition at line 122 of file CommandableFragmentGenerator_t.cc.

void artdaqtest::CommandableFragmentGeneratorTest::setFireCount ( size_t  count)
inline

Have getNext_ generate count fragments.

Parameters
countNumber of fragments to generate

Definition at line 108 of file CommandableFragmentGenerator_t.cc.

void artdaqtest::CommandableFragmentGeneratorTest::setTimestamp ( artdaq::Fragment::timestamp_t  ts)
inline

Set the timestamp to be used for the next Fragment.

Parameters
tsTimestamp to be used for the next Fragment

Definition at line 128 of file CommandableFragmentGenerator_t.cc.


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