Skip to content

Commit

Permalink
Add accessor class for wrapper to allow private method access
Browse files Browse the repository at this point in the history
  • Loading branch information
tmadlener committed Nov 23, 2022
1 parent 6ab7b50 commit 64f82fc
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions source/include/marlin/Processor.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,24 @@
//#define m_endl std::endl
//----------------------------------------

class MarlinProcessorWrapper;

using namespace lcio ;


namespace marlin{
/** Helper class that gives an external processor manager access to private
* methods where necessary. Essentially only provides a constructor from a
* MarlinProcessorWrapper, to at least avoid the most obvious misuses of this.
*/
struct ExternalProcessorMgrAccessor {
explicit ExternalProcessorMgrAccessor(MarlinProcessorWrapper*){};
ExternalProcessorMgrAccessor() = delete;
ExternalProcessorMgrAccessor(const ExternalProcessorMgrAccessor&) = delete;
ExternalProcessorMgrAccessor& operator=(const ExternalProcessorMgrAccessor&) = delete;
ExternalProcessorMgrAccessor(ExternalProcessorMgrAccessor&&) = delete;
ExternalProcessorMgrAccessor& operator=(ExternalProcessorMgrAccessor&&) = delete;
};

class ProcessorMgr ;
// class ProcessorParameter ;
Expand Down Expand Up @@ -115,6 +129,12 @@ namespace marlin{
*/
virtual void check( LCEvent* ) { }

/**
* Public overload of setFirstEvent for use in external processor managers
*/
virtual void setFirstEvent(bool firstEvent, ExternalProcessorMgrAccessor) {
setFirstEvent(firstEvent);
}

/** Called after data processing for clean up in the inverse order of the init()
* method so that resources allocated in the first processor also will be available
Expand Down

0 comments on commit 64f82fc

Please sign in to comment.