Skip to content
Snippets Groups Projects

Modernize HltDAQ

Merged Gerhard Raven requested to merge modernize-hltdaq into master
1 unresolved thread
  • prefer Gaudi::Property and direct member initialization
  • prefer delegating to base class constructor

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • I think this is fine to be merged. (another MR will then come on top with the fix to the HltRoutingBitsFilter.RequireMask default.

  • Rosen Matev
  • 77 77 //=============================================================================
    78 78 HltRoutingBitsWriter::HltRoutingBitsWriter( const std::string& name,
    79 79 ISvcLocator* pSvcLocator)
    80 : HltEvaluator( name , pSvcLocator )
    80 : HltEvaluator( name , pSvcLocator )
    81 81 {
    82 declareProperty("RoutingBits", m_bits) ->declareUpdateHandler( &HltRoutingBitsWriter::updateBits, this );
    83 declareProperty("UpdateExistingRawBank",m_updateBank = false);
    84 declareProperty("RawEventLocation", m_raw_location = LHCb::RawEventLocation::Default);
    82 m_bits.declareUpdateHandler( &HltRoutingBitsWriter::updateBits, this );
    • @graven, @clemenci, is it worth adding a suitable constructor to Gaudi::Property and putting this in the declaration?

    • Author Developer

      yes, and I've suggested it to @clemenci already -- but in quite a few cases where we now have update handlers, it is actually even better to define a dedicated type, and then add toStream and parse functions to deal with them, and do the work of the updateHandler in parse instead. I've done exactly that in one of the merge requests I submitted yesterday or monday, but I cannot find back which one...

    • Author Developer

      Ah, found it: !457 (diffs). I introduced a Gaudi::Property<TCK> and Gaudi::Property<std::map<TCK,std::string>> where TCK is defined in TCK.h

      Aside: it would have perhaps been better if TCK had been defined in a namespace, and if instead of needing toStream in Gaudi::Utils and parse in Gaudi::Parsers it would be found by ADL, i.e. toStream and parse would live in the same namespace as the class they work on....

      Edited by Gerhard Raven
    • Author Developer

      I think we can allow ADL trivially, just by replacing

      --- a/GaudiKernel/GaudiKernel/Property.h
      +++ b/GaudiKernel/GaudiKernel/Property.h
      @@ -156,7 +156,8 @@ namespace Gaudi
               inline TYPE fromString( const std::string& s )
               {
                 TYPE tmp;
      -          if ( !Gaudi::Parsers::parse( tmp, s ).isSuccess() ) {
      +          using Gaudi::Parsers::parse;
      +          if ( !parse( tmp, s ).isSuccess() ) {
                   throw std::invalid_argument( "cannot parse '" + s + "' to " + System::typeinfoName( typeid( TYPE ) ) );
                 }
                 return tmp;
      @@ -615,7 +616,8 @@ namespace Gaudi
           void toStream( std::ostream& out ) const override
           {
             m_handlers.useReadHandler( *this );
      -      Utils::toStream( m_value, out );
      +      using Utils::toStream;
      +      toStream( m_value, out );
           }
         };
       
      

      @clemenci: what do you think? Should be fully backwards compatible...

    • Thanks, I also found the TCK specialization. It's quite nice indeed.

    • I think it make sense. Create a MR if you can, otherwise a JIRA ticket so that I remember to do it.

    • Author Developer

      Done, see gaudi/Gaudi!242 (merged).

      I've checked explicitly that if I add a namespace around TCK (and put a using LHCb::Hlt::TCK at the end of TCK.h for backwards compatibility) , and put parse and toStream in that namespace, that gaudi/Gaudi!242 (merged) indeed allows ADL and that this is sufficient to then define Gaudi::Property<TCK> in any bit of code with only a plain include TCK.h -- i.e. things indeed work as expected.

      Edited by Gerhard Raven
    • Author Developer

      Even better, you do not need an explicit name space, you can just define toStream and parse as friend functions in the class which you want to make into a property!

      Edited by Gerhard Raven
    • Please register or sign in to reply
  • Gerhard Raven Mentioned in merge request !463 (merged)

    Mentioned in merge request !463 (merged)

  • Rosen Matev
  • Gerhard Raven Added 1 commit:

    Added 1 commit:

    Compare with previous version

  • Gerhard Raven Added 1 commit:

    Added 1 commit:

    Compare with previous version

  • Gerhard Raven Mentioned in commit 125b0e81

    Mentioned in commit 125b0e81

  • Gerhard Raven Resolved all discussions

    Resolved all discussions

  • Marco Cattaneo Status changed to merged

    Status changed to merged

  • Marco Cattaneo Mentioned in commit 34d46b8b

    Mentioned in commit 34d46b8b

  • Marco Cattaneo Mentioned in commit 05d0260b

    Mentioned in commit 05d0260b

  • Please register or sign in to reply
    Loading