FRIBParallelanalysis  1.0
FrameworkforMPIParalleldataanalysisatFRIB
Public Member Functions | List of all members
frib::analysis::CTriggerSorter Class Referenceabstract

#include <TriggerSorter.h>

Inheritance diagram for frib::analysis::CTriggerSorter:
Inheritance graph
[legend]

Public Member Functions

 CTriggerSorter ()
 
virtual ~CTriggerSorter ()
 
void addItem (pParameterItem item)
 
void flush ()
 
virtual void emitItem (pParameterItem item)=0
 

Detailed Description

CTriggerSorter has methods to add parameter ring items which may be out of order and then to emit ring items later in order.

This is implemented in a manner that does not depend on MPI so that ordinary unit tests can be used to verify the operation of the class. The idea is that addItem is called to add items to the sorting system. When one or more items can be emitted (because they have triggers sequential to the last emitted item), emitItem is called with those items.

emitItem is pure virtual so that derived classes can decide what to actually do with items that are sorted.

Constructor & Destructor Documentation

◆ CTriggerSorter()

frib::analysis::CTriggerSorter::CTriggerSorter ( )

constructor The hardest part of the constructor is initializing the last emitted trigger... we emit it to 0-1 unsigned so that it + 1 (0) is the next trigger.

◆ ~CTriggerSorter()

frib::analysis::CTriggerSorter::~CTriggerSorter ( )
virtual

destructor

Delete any remaining items.

Member Function Documentation

◆ addItem()

void frib::analysis::CTriggerSorter::addItem ( pParameterItem  item)

addItem

  • If the item is the next trigger just emit it. otherwise shove it into m_items indexed by trigger#
  • while the map is not empty and the 'first' item's trigger is sequential, emit it and remove it from the map. A bit on ownereship Ownership of the item is ours and passes to emitItem or whatever it does. Note that in most of the frameworks we put his class into, delete should should be called by emitItem to get rid of the item.
    Parameters
    itempointer to the item to add/sort/emit.
    Note
    the 'sorting' via the map is amortized O(nLog(m)) where m is the number of in-flight items and n is the total number of items.

◆ flush()

void frib::analysis::CTriggerSorter::flush ( )

flush flush all elements of m_items -> emitItem

Note
that at the end of this m_items will be empty.
if the application operates properly, this should not really do anything as the application is supposed to hand us empty parameter item placeholders for events that were software filtered out.

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