27 return const_cast<std::remove_const_t<T>*
>( p );
118 GaudiHandleBase( std::string myTypeAndName, std::string myComponentType, std::string myParentName )
131 std::string type()
const;
134 std::string name()
const;
140 void setTypeAndName( std::string myTypeAndName );
143 void setName( std::string_view myName );
148 std::string pythonPropertyClassName()
const override;
151 std::string messageName()
const;
156 std::string pythonRepr()
const override;
181 GaudiHandle( std::string myTypeAndName, std::string myComponentType, std::string myParentName )
186 template <
typename CT = T,
typename NCT = std::remove_const_t<T>>
188 requires( std::is_const_v<CT> && !std::is_same_v<CT, NCT> )
199 template <
typename CT = T,
typename NCT = std::remove_const_t<T>>
200 requires( std::is_const_v<CT> && !std::is_same_v<CT, NCT> )
202 GaudiHandleBase::operator=( other );
213 GaudiHandleBase::operator=( other );
255 operator bool()
const {
346 bool setTypesAndNames(
const std::vector<std::string>& myTypesAndNamesList );
353 const std::vector<std::string>
types()
const;
356 const std::vector<std::string>
names()
const;
375 virtual bool push_back(
const std::string& myHandleTypeAndName ) = 0;
426 GaudiHandleArray(
const std::vector<std::string>& myTypesAndNamesList, std::string myComponentType,
427 std::string myParentName )
486 return it !=
end() ? &*it :
nullptr;
492 return it !=
end() ? &*it :
nullptr;
506 for (
auto& i : *
this ) {
508 if ( i.retrieve().isFailure() ) {
520 for (
auto& i : *
this ) {
std::ostream & operator<<(std::ostream &s, AlgsExecutionStates::State x)
Streaming of State values.
Define general base for Gaudi exception.
virtual bool push_back(const std::string &myHandleTypeAndName)=0
Add a handle to the array with "type/name" given in <myHandleTypeAndName>.
GaudiHandleArrayBase(std::string myComponentType, std::string myParentName)
std::vector< const GaudiHandleBase * > ConstBaseHandleArray
virtual void clear()=0
Clear the list of handles.
bool setTypesAndNames(const std::vector< std::string > &myTypesAndNamesList)
Set the array of handles from list of "type/name" strings in <myTypesAndNamesList>.
std::vector< GaudiHandleBase * > BaseHandleArray
std::string pythonRepr() const override
Python representation of array of handles, i.e.
const std::vector< std::string > typesAndNames() const
Return a vector with "type/name" strings of all handles in the array.
const std::vector< std::string > types() const
Return a vector with "type" strings of all handles in the array.
const std::vector< std::string > getBaseInfos(auto(GaudiHandleBase::*pMemFunc)() const) const
Helper function to get a vector of strings filled with the return value of each tool of a member func...
virtual ConstBaseHandleArray getBaseArray() const =0
Get a read-only vector of const GaudiHandleBase* pointing to the real handles.
virtual BaseHandleArray getBaseArray()=0
Get a read-write vector of GaudiHandleBase* pointing to the real handles.
virtual StatusCode retrieve()=0
Retrieve all tools.
virtual bool empty() const =0
Return whether the list of tools is empty.
const std::vector< std::string > names() const
Return a vector with "type/name" strings of all handles in the array.
virtual StatusCode release()=0
Release all tools.
GaudiHandleArrayProperty PropertyType
virtual bool retrieved() const =0
To be able to tell if Array was ever retreived.
std::string pythonPropertyClassName() const override
Name of the componentType with "HandleArray" appended.
virtual bool push_back(const T &myHandle)
HandleVector::iterator iterator
T & operator[](int index)
const_iterator end() const
const T * operator[](std::string_view name) const
Get const pointer (!) to ToolHandle by instance name.
void clear() override
Clear the list of handles.
std::vector< T > HandleVector
HandleVector::reverse_iterator reverse_iterator
HandleVector::size_type size_type
const T & operator[](int index) const
HandleVector m_handleArray
StatusCode release() override
Release all tools.
StatusCode retrieve() override
Retrieve all tools.
const_iterator rend() const
HandleVector::value_type value_type
T * operator[](std::string_view name)
Get pointer (!) to ToolHandle by instance name.
GaudiHandleArrayBase::BaseHandleArray getBaseArray() override
Get a read-write vector of GaudiHandleBase* pointing to the real handles.
bool empty() const override
Return whether the list of tools is empty.
HandleVector::const_reference const_reference
GaudiHandleArray(const std::string &myComponentType, const std::string &myParentName)
Constructor creating an empty array.
HandleVector::const_reverse_iterator const_reverse_iterator
virtual bool retrieved() const override
has Array been retreived?
const_iterator begin() const
GaudiHandleArrayBase::ConstBaseHandleArray getBaseArray() const override
Get a read-only vector of const GaudiHandleBase* pointing to the real handles.
const_iterator rbegin() const
HandleVector::const_iterator const_iterator
GaudiHandleArray(const std::vector< std::string > &myTypesAndNamesList, std::string myComponentType, std::string myParentName)
Generic constructor.
HandleVector::reference reference
GaudiHandleArray & operator=(const std::vector< std::string > &myTypesAndNamesList)
Set the array of GaudiHandles from typeAndNames given in vector of strings.
Base class to handles to be used in lieu of naked pointers to various Gaudi components.
GaudiHandleBase(std::string myTypeAndName, std::string myComponentType, std::string myParentName)
Create a handle ('smart pointer') to a gaudi component.
GaudiHandleProperty PropertyType
const std::string & typeAndName() const
The full type and name: "type/name".
bool empty() const
Check if the handle has been set to empty string (i.e.
std::string m_typeAndName
void setTypeAndName(std::string myTypeAndName)
The component "type/name" string.
std::string type() const
The concrete component class name: the part before the '/'.
StatusCode release() const
Release the component.
T * get()
Return the wrapped pointer, not calling retrieve() if null.
std::add_const_t< T > & operator*() const
bool isValid() const
Check if the handle is valid (try to retrive the object is not done yet).
GaudiHandle & operator=(const GaudiHandle< NCT > &other)
Assignment operator for correct ref-counting.
GaudiHandle(const GaudiHandle &other)
Copy constructor needed for correct ref-counting.
StatusCode retrieve() const
Retrieve the component.
GaudiHandle & operator=(const GaudiHandle &other)
Assignment operator for correct ref-counting.
std::add_const_t< T > * get() const
Return the wrapped pointer, not calling retrieve() if null.
void assertObject() const
Load the pointer to the component.
virtual StatusCode release(T *comp) const
Release the component.
GaudiHandle(std::string myTypeAndName, std::string myComponentType, std::string myParentName)
std::string getDefaultName()
virtual StatusCode retrieve(T *&) const =0
Retrieve the component.
std::string getDefaultType()
Helper function to get default type string from the class type.
bool isSet() const
True if the wrapped pointer is not null.
std::add_const_t< T > * operator->() const
GaudiHandle(const GaudiHandle< NCT > &other)
Copy constructor needed for correct ref-counting.
std::atomic< T * > m_pObject
std::string m_componentType
const std::string & componentType() const
std::string m_propertyName
GaudiHandleInfo(std::string myComponentType, std::string myParentName)
Some basic information and helper functions shared between various handles/arrays.
const std::string & propertyName() const
name as used in declareProperty(name,gaudiHandle)
void setParentName(std::string parent)
The name of the parent.
virtual std::string pythonPropertyClassName() const =0
The python class name for the property in the genconf-generated configurables.
void setPropertyName(std::string propName)
set name as used in declareProperty(name,gaudiHandle).
const std::string & parentName() const
The name of the parent.
virtual ~GaudiHandleInfo()
virtual destructor so that derived class destructor is called.
void setComponentType(std::string componentType)
The component type.
virtual std::string pythonRepr() const =0
Python representation of handle, i.e.
This class is used for returning status codes from appropriate routines.
constexpr static const auto SUCCESS
constexpr static const auto FAILURE
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
std::remove_const_t< T > * nonConst(T *p)
Cast a pointer to a non const type.