ATLAS Offline Software
asg_tools_test_init.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 
7 
8 
9 //
10 // includes
11 //
12 
14 #include <AsgTools/IAsgTool.h>
15 
16 //
17 // main program
18 //
19 
20 int main (int argc, char *argv [])
21 {
22  using namespace asg::msgUserCode;
23  ANA_CHECK_SET_TYPE (int);
24 
25  if (argc < 2)
26  {
27  ANA_MSG_ERROR ("missing argument: [type]");
28  return -1;
29  }
30 
31  asg::StandaloneToolHandle<asg::IAsgTool> tool (std::string (argv[1]) + "/tool");
32  for (int iter = 2; iter != argc; ++ iter)
33  {
34  const std::string arg = argv[iter];
35  const auto split = arg.find ("=");
36  if (split == std::string::npos)
37  {
38  ANA_MSG_ERROR ("argument doesn't match name=value syntax: \"" << arg << "\"");
39  return -1;
40  }
41  ANA_CHECK (tool.setProperty (arg.substr (0, split), arg.substr (split + 1)));
42  }
43  ANA_CHECK (tool.initialize());
44  ANA_MSG_INFO ("successfully initialized tool");
45  return 0;
46 }
main
int main(int argc, char *argv[])
Definition: asg_tools_test_init.cxx:20
ANA_MSG_ERROR
#define ANA_MSG_ERROR(xmsg)
Macro printing error messages.
Definition: Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:294
ANA_CHECK
#define ANA_CHECK(EXP)
check whether the given expression was successful
Definition: Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:324
asg::StandaloneToolHandle
an "initializing" ToolHandle for stand-alone applications
Definition: StandaloneToolHandle.h:44
LArCellNtuple.argv
argv
Definition: LArCellNtuple.py:152
ANA_MSG_INFO
#define ANA_MSG_INFO(xmsg)
Macro printing info messages.
Definition: Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:290
DQHistogramMergeRegExp.argc
argc
Definition: DQHistogramMergeRegExp.py:20
IAsgTool.h
create_dcsc_inputs_sqlite.arg
list arg
Definition: create_dcsc_inputs_sqlite.py:48
AtlCoolConsole.tool
tool
Definition: AtlCoolConsole.py:453
ANA_CHECK_SET_TYPE
#define ANA_CHECK_SET_TYPE(TYPE)
set the type for ANA_CHECK to report failures
Definition: Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:314
StandaloneToolHandle.h
Trk::split
@ split
Definition: LayerMaterialProperties.h:38