ATLAS Offline Software
Loading...
Searching...
No Matches
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
20int main (int argc, char *argv [])
21{
22 using namespace asg::msgUserCode;
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}
#define ANA_MSG_INFO(xmsg)
Macro printing info messages.
#define ANA_MSG_ERROR(xmsg)
Macro printing error messages.
#define ANA_CHECK(EXP)
check whether the given expression was successful
#define ANA_CHECK_SET_TYPE(TYPE)
set the type for ANA_CHECK to report failures
an "initializing" ToolHandle for stand-alone applications
std::vector< std::string > split(const std::string &s, const std::string &t=":")
Definition hcg.cxx:177
int main()
Definition hello.cxx:18