Public Member Functions | Private Attributes | List of all members
arttest::NestedFunctionInClassTool Class Reference

#include <NestedFunctionInClassTool.h>

Public Member Functions

 NestedFunctionInClassTool (fhicl::ParameterSet const &ps)
 
int callThroughToAddOne (int const i)
 

Private Attributes

fhicl::ParameterSet pset_
 

Detailed Description

Definition at line 8 of file NestedFunctionInClassTool.h.

Constructor & Destructor Documentation

arttest::NestedFunctionInClassTool::NestedFunctionInClassTool ( fhicl::ParameterSet const &  ps)
inlineexplicit

Definition at line 10 of file NestedFunctionInClassTool.h.

11  : pset_{ps}
12  {}
static constexpr double ps
Definition: Units.h:99

Member Function Documentation

int arttest::NestedFunctionInClassTool::callThroughToAddOne ( int const  i)
inline

Definition at line 15 of file NestedFunctionInClassTool.h.

16  {
17  // It is a bad idea to call make_tool for each function call, as
18  // is the case here. It would be much better to create a data
19  // member of type "std::function<int(int)>" that is initialized
20  // in the c'tor. However, to demonstrate that a tool CAN be
21  // constructed within a function call, we leave it as is. See
22  // the c'tor of AddIntsProducer for an example of better code
23  // practice.
24  auto addOne = art::make_tool<int(int)>(
25  pset_.get<fhicl::ParameterSet>("addOneTool"), "addOne");
26  return addOne(i);
27  }
int addOne(int const i)
Definition: FunctionTool.cc:5
T get(std::string const &key) const
Definition: ParameterSet.h:271

Member Data Documentation

fhicl::ParameterSet arttest::NestedFunctionInClassTool::pset_
private

Definition at line 30 of file NestedFunctionInClassTool.h.


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