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 16, 2022
1 parent 6ab7b50 commit cc3e755
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 the MarlinProcessorWrapper 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 MarlinWrapperPrivateAccessor {
MarlinWrapperPrivateAccessor(MarlinProcessorWrapper*){};
MarlinWrapperPrivateAccessor() = delete;
MarlinWrapperPrivateAccessor(const MarlinWrapperPrivateAccessor&) = delete;
MarlinWrapperPrivateAccessor& operator=(const MarlinWrapperPrivateAccessor&) = delete;
MarlinWrapperPrivateAccessor(MarlinWrapperPrivateAccessor&&) = delete;
MarlinWrapperPrivateAccessor& operator=(MarlinWrapperPrivateAccessor&&) = 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 the MarlinProcessorWrapper
*/
virtual void setFirstEvent(bool firstEvent, MarlinWrapperPrivateAccessor) {
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 cc3e755

Please sign in to comment.