|
ATLAS Offline Software
|
an object that can create a AsgService
More...
#include <AsgServiceConfig.h>
an object that can create a AsgService
Definition at line 24 of file AsgServiceConfig.h.
◆ AsgServiceConfig() [1/3]
asg::AsgServiceConfig::AsgServiceConfig |
( |
| ) |
|
|
default |
standard constructor
- Guarantee
- strong
- Failures
- out of memory I
◆ AsgServiceConfig() [2/3]
asg::AsgServiceConfig::AsgServiceConfig |
( |
const std::string & |
val_typeAndName | ) |
|
|
explicit |
initializing constructor
- Guarantee
- strong
- Failures
- out of memory II
Definition at line 24 of file AsgServiceConfig.cxx.
◆ AsgServiceConfig() [3/3]
initializing constructor
- Guarantee
- strong
- Failures
- out of memory II
Definition at line 31 of file AsgServiceConfig.cxx.
◆ ~AsgServiceConfig()
virtual asg::AsgServiceConfig::~AsgServiceConfig |
( |
| ) |
|
|
virtualdefault |
Virtual destructor, to make PyROOT happy.
Without it ROOT 6.22+ does not allow Python classes to inherit from this type.
◆ accessSubtool()
Definition at line 239 of file AsgComponentConfig.cxx.
245 throw std::runtime_error (
"trying to access unknown private tool: " +
name.substr (0,
split));
246 result.config = &(subtool->second.m_config);
◆ addPrivateTool()
add a private tool from the given configuration
This will ignore the name set in toolConfig
and use whatever name
is given instead.
- Guarantee
- basic
- Failures
- out of memory II
Definition at line 167 of file AsgComponentConfig.cxx.
171 using namespace msgComponentConfig;
174 if (
split == std::string::npos)
176 toolConfig.setName (
name);
178 return StatusCode::SUCCESS;
182 return subtool.config->addPrivateTool (subtool.name, std::move (toolConfig));
◆ addPrivateToolInArray()
std::string asg::AsgComponentConfig::addPrivateToolInArray |
( |
const std::string & |
name, |
|
|
AsgComponentConfig |
toolConfig |
|
) |
| |
|
inherited |
the array version of addPrivateTool
This will ignore the name set in toolConfig
and use whatever name
is given instead.
- Guarantee
- basic
- Failures
- out of memory II
Definition at line 188 of file AsgComponentConfig.cxx.
192 using namespace msgComponentConfig;
195 if (
split == std::string::npos)
198 auto myname = makeArrayName (
name, arrayData.size());
199 toolConfig.setName (myname);
201 arrayData.push_back (myname);
206 return subtool.prefix + subtool.config
207 ->addPrivateToolInArray (subtool.name, std::move (toolConfig));
◆ checkTypeName()
StatusCode asg::AsgComponentConfig::checkTypeName |
( |
bool |
nestedNames | ) |
const |
|
privateinherited |
check that the type and name members have the correct format
- Guarantee
- strong
- Failures
- type or name doesn't have proper format
Definition at line 213 of file AsgComponentConfig.cxx.
216 using namespace msgComponentConfig;
218 std::regex typeExpr (
"[A-Za-z_][A-Za-z0-9_]*(::[A-Za-z_][A-Za-z0-9_]*)*");
219 if (!std::regex_match (
m_type, typeExpr))
222 return StatusCode::FAILURE;
226 nameExpr =
std::regex (
"[A-Za-z_][A-Za-z0-9_]*(\\.[A-Za-z_][A-Za-z0-9_]*)*(@[0-9]+)?");
228 nameExpr =
std::regex (
"[A-Za-z_][A-Za-z0-9_]*(@[0-9]+)?");
229 if (!std::regex_match (
m_name, nameExpr))
232 return StatusCode::FAILURE;
234 return StatusCode::SUCCESS;
◆ configureComponentExpert()
StatusCode asg::AsgComponentConfig::configureComponentExpert |
( |
const std::string & |
prefix, |
|
|
bool |
nestedNames |
|
) |
| const |
|
inherited |
add component configuration to configuration service (expert only)
In Athena we are not creating components (we leave that to the proper Athena services), but instead we load the configuration values up first, then ask for the component to be created the normal way. This makes sure that if we dump the configuration it will include this component, and as a bonus it avoids the whole issue of having to deal with Athena factory functions.
- Guarantee
- basic
- Failures
- configuration errors
Definition at line 364 of file AsgComponentConfig.cxx.
368 using namespace msgComponentConfig;
378 if (
tool.second.m_propName.empty())
381 joSvc->set (toolPath,
tool.second.m_config.typeAndName());
387 std::vector<std::string> valueArray;
388 for (
const auto&
tool : toolArray.second)
395 return StatusCode::FAILURE;
397 valueArray.push_back (toolConfig->second.m_config.typeAndName());
400 std::string propertyPath =
prefix +
m_name +
"." + toolArray.first;
401 joSvc->set (propertyPath, valueString);
406 std::string propertyPath =
prefix +
m_name +
"." +
property.first;
407 joSvc->set (propertyPath, property.second);
410 return StatusCode::SUCCESS;
◆ createPrivateTool()
StatusCode asg::AsgComponentConfig::createPrivateTool |
( |
const std::string & |
name, |
|
|
const std::string & |
toolType |
|
) |
| |
|
inherited |
create a private tool of the given name and type
This is the only way you can configure tool properties through AsgComponentConfig: You need to add it the tool to the component configuration and then you can set individual properties on the tool, using the property name "tool.property".
If you want to add a subtool for a tool, you can do this by calling it "tool.subtool". Note that you will have to create both the tool and the subtool this way, i.e. you can't configure a subtool without also configuring the tool that owns it.
You can apply this to tools held by either ToolHandle or asg::AnaToolHandle, but if you configure a tool held by an AnaToolHandle this way it will completely replace teh tool configuration done in the component itself.
The calling convention is somewhat inverted compared to setTypeAndName() calls, but otherwise they would be inverted compared to the setProperty() calls. :(
- Guarantee
- strong
- Failures
- out of memory II
Definition at line 149 of file AsgComponentConfig.cxx.
◆ createPrivateToolInArray()
std::string asg::AsgComponentConfig::createPrivateToolInArray |
( |
const std::string & |
name, |
|
|
const std::string & |
toolType |
|
) |
| |
|
inherited |
◆ empty()
bool asg::AsgComponentConfig::empty |
( |
| ) |
const |
|
noexceptinherited |
◆ makeService() [1/4]
template<typename T >
::StatusCode asg::AsgServiceConfig::makeService |
( |
ServiceHandle< T > & |
service | ) |
const |
◆ makeService() [2/4]
template<typename T >
::StatusCode asg::AsgServiceConfig::makeService |
( |
ServiceHandle< T > & |
service | ) |
const |
Definition at line 166 of file AsgServiceConfig.h.
169 using namespace msgComponentConfig;
177 return StatusCode::SUCCESS;
◆ makeService() [3/4]
template<typename T >
::StatusCode asg::AsgServiceConfig::makeService |
( |
std::shared_ptr< T > & |
service | ) |
const |
make a service with the given configuration
\warn This is mostly meant as a low level interface to be used in unit tests and internally by framework functions that manage services. As a user you should mostly rely on the python configuration or on passing the AsgServiceConfig object to your framework, which will then create and manage the service for you.
\warn Regardless of which function you use, the memory management and cleanup of services differs between stand-alone use and Athena. In EventLoop you receive an owning pointer/handle that can be shared with other users and will release the service when the last reference is deleted. In Athena the framework itself will hold on to the service (or at least its configuration) and release it at the end of the job, even if no user code references it. As a user you should not rely on the service still being around after you destroy the last reference, or on the service being around after framework teardown has started.
- Guarantee
- strong
- Failures
- configuration errors
service creation/initialization errors
◆ makeService() [4/4]
template<typename T >
::StatusCode asg::AsgServiceConfig::makeService |
( |
std::shared_ptr< T > & |
service | ) |
const |
Definition at line 145 of file AsgServiceConfig.h.
148 using namespace msgComponentConfig;
160 service = std::shared_ptr<T> (std::shared_ptr<void>(), &*serviceHandle);
163 return StatusCode::SUCCESS;
◆ name()
const std::string & asg::AsgComponentConfig::name |
( |
| ) |
const |
|
noexceptinherited |
◆ setName()
void asg::AsgComponentConfig::setName |
( |
const std::string & |
val_name | ) |
|
|
inherited |
◆ setProperty()
template<typename T >
StatusCode asg::AsgComponentConfig::setProperty |
( |
const std::string & |
name, |
|
|
const T & |
value |
|
) |
| |
|
inherited |
set the given property
- Guarantee
- strong
- Failures
- could not convert to string
out of memory II
◆ setPropertyFromString()
void asg::AsgComponentConfig::setPropertyFromString |
( |
const std::string & |
name, |
|
|
const std::string & |
value |
|
) |
| |
|
inherited |
set a given property from a string value
- Guarantee
- strong
- Failures
- out of memory II
Definition at line 132 of file AsgComponentConfig.cxx.
137 if (
split == std::string::npos)
143 subtool.config->setPropertyFromString (subtool.name,
value);
◆ setType()
void asg::AsgComponentConfig::setType |
( |
const std::string & |
val_type | ) |
|
|
inherited |
◆ setTypeAndName()
void asg::AsgComponentConfig::setTypeAndName |
( |
const std::string & |
val_typeAndName | ) |
|
|
inherited |
set type and name at the same time
- Guarantee
- basic
- Failures
- out of memory II
Definition at line 115 of file AsgComponentConfig.cxx.
118 const auto split = val_typeAndName.find (
'/');
119 if (
split == std::string::npos)
◆ type()
const std::string & asg::AsgComponentConfig::type |
( |
| ) |
const |
|
noexceptinherited |
◆ typeAndName()
std::string asg::AsgComponentConfig::typeAndName |
( |
| ) |
const |
|
inherited |
◆ m_name
std::string asg::AsgComponentConfig::m_name |
|
privateinherited |
◆ m_privateTools
◆ m_propertyValues
std::map<std::string,std::string> asg::AsgComponentConfig::m_propertyValues |
|
privateinherited |
◆ m_toolArrays
std::map<std::string,std::vector<std::string> > asg::AsgComponentConfig::m_toolArrays |
|
privateinherited |
the map of (private) tool handle arrays to manage, and the tools they contain
Definition at line 285 of file AsgComponentConfig.h.
◆ m_type
std::string asg::AsgComponentConfig::m_type |
|
privateinherited |
The documentation for this class was generated from the following files:
void setType(const std::string &val_type)
set the value of type
std::map< std::string, std::string > m_propertyValues
the map of property values
std::string m_name
the value of name
std::map< std::string, std::vector< std::string > > m_toolArrays
the map of (private) tool handle arrays to manage, and the tools they contain
AsgComponentConfig()=default
standard constructor
std::string m_type
the value of type
std::string toString(const Translation3D &translation, int precision=4)
GeoPrimitvesToStringConverter.
StatusCode checkTypeName(bool nestedNames) const
check that the type and name members have the correct format
std::string addPrivateToolInArray(const std::string &name, AsgComponentConfig toolConfig)
the array version of addPrivateTool
const std::string & type() const noexcept
the type of the component
StatusCode configureComponentExpert(const std::string &prefix, bool nestedNames) const
add component configuration to configuration service (expert only)
void setName(const std::string &val_name)
set the value of name
std::string typeAndName() const
get type and name at the same time
const std::string & name() const noexcept
the name of the component
::StatusCode makeService(std::shared_ptr< T > &service) const
make a service with the given configuration
StatusCode addPrivateTool(const std::string &name, AsgComponentConfig toolConfig)
add a private tool from the given configuration
AccessSubtoolData accessSubtool(const std::string &name, std::size_t split)
std::map< std::string, details::AsgComponentPrivateToolConfig > m_privateTools
the map of (private) tools to create