ATLAS Offline Software
Public Member Functions | List of all members
D3PD::ICollectionGetterTool Class Referenceabstract

Abstract interface to get a collection of objects and iterate over it. More...

#include <ICollectionGetterTool.h>

Inheritance diagram for D3PD::ICollectionGetterTool:
Collaboration diagram for D3PD::ICollectionGetterTool:

Public Member Functions

 DeclareInterfaceID (ICollectionGetterTool, 1, 0)
 Gaudi interface definition. More...
 
virtual StatusCode reset (bool allowMissing=false)=0
 Reset the iteration to the start of the collection. More...
 
virtual size_t sizeHint (bool allowMissing=false)=0
 Return an estimate of the number of elements in the iteration. More...
 
template<class T >
const T * next ()
 Type-safe wrapper for next. More...
 
template<class T >
StatusCode configureD3PD ()
 Test type compatibility. More...
 
virtual const void * nextTypeinfo (const std::type_info &ti)=0
 Return the next object cast to a different pointer type. More...
 
virtual StatusCode configureElementTypeinfo (const std::type_info &ti)=0
 Test type compatibility. More...
 
template<class T >
void releaseElement (const T *p)
 Type-safe wrapper for releaseElementUntyped. More...
 
void releaseElementTypeinfo (const void *p, const std::type_info &ti)
 Release an element retrieved from the getter. More...
 
 DeclareInterfaceID (IObjGetterTool, 1, 0)
 Gaudi interface definition. More...
 
virtual const std::type_info & typeinfo () const =0
 Return the type of object retrieved by this tool. More...
 
virtual const void * getUntyped (bool allowMissing=false)=0
 Return the target object. More...
 
template<class T >
const T * get (bool allowMissing=false)
 Type-safe wrapper for get. More...
 
virtual void releaseObjectUntyped (const void *p)
 Release an object retrieved from the getter. More...
 
template<class T >
void releaseObject (const T *p)
 Type-safe wrapper for releaseObjectUntyped. More...
 
virtual const void * getTypeinfo (const std::type_info &ti, bool allowMissing=false)=0
 Return the target object cast to a different pointer type. More...
 
void releaseObjectTypeinfo (const void *p, const std::type_info &ti)
 Release an object retrieved from the getter. More...
 
virtual StatusCode configureTypeinfo (const std::type_info &ti)=0
 Test type compatibility. More...
 
virtual const std::type_info & elementTypeinfo () const =0
 Return the element type of the collection. More...
 
virtual const void * nextUntyped ()=0
 Return a pointer to the next element in the iteration. More...
 
virtual void releaseElementUntyped (const void *p)
 Release an object retrieved from the getter. More...
 

Detailed Description

Abstract interface to get a collection of objects and iterate over it.

This extends the IObjGetterTool interface to allow iterating over the objects within a container.

The iteration is started by calling reset(). After that, call #nextUntyped() repeatedly until it returns 0.

Definition at line 36 of file ICollectionGetterTool.h.

Member Function Documentation

◆ configureD3PD()

template<class T >
StatusCode D3PD::ICollectionGetterTool::configureD3PD ( )

Test type compatibility.

Test to see if the object being returned by the tool can be converted to a pointer to T. This can be used to perform type checks during job initialization.

This is implemented in terms of configureElementTypeinfo.

◆ configureElementTypeinfo()

virtual StatusCode D3PD::ICollectionGetterTool::configureElementTypeinfo ( const std::type_info &  ti)
pure virtual

Test type compatibility.

Parameters
tiThe desired type.

Test to see if the object being returned by the tool can be converted to a pointer to T. This can be used to perform type checks during job initialization.

◆ configureTypeinfo()

virtual StatusCode D3PD::IObjGetterTool::configureTypeinfo ( const std::type_info &  ti)
pure virtualinherited

Test type compatibility.

Parameters
tiThe desired type.

Test to see if the object being returned by the tool can be converted to a pointer to T. This can be used to perform type checks during job initialization.

◆ DeclareInterfaceID() [1/2]

D3PD::ICollectionGetterTool::DeclareInterfaceID ( ICollectionGetterTool  ,
,
 
)

Gaudi interface definition.

◆ DeclareInterfaceID() [2/2]

D3PD::IObjGetterTool::DeclareInterfaceID ( IObjGetterTool  ,
,
 
)
inherited

Gaudi interface definition.

◆ elementTypeinfo()

virtual const std::type_info& D3PD::IIteration::elementTypeinfo ( ) const
pure virtualinherited

Return the element type of the collection.

I.e., nextUntyped returns a pointer to this type.

◆ get()

template<class T >
const T* D3PD::IObjGetterTool::get ( bool  allowMissing = false)
inherited

Type-safe wrapper for get.

Parameters
allowMissingIf true, then we should not generate errors if the requested object is missing.

Return the object as a pointer to T. Return 0 if the get fails or if the pointer can't be converted.

This is implemented in terms of getTypeinfo().

◆ getTypeinfo()

virtual const void* D3PD::IObjGetterTool::getTypeinfo ( const std::type_info &  ti,
bool  allowMissing = false 
)
pure virtualinherited

Return the target object cast to a different pointer type.

Parameters
tiThe desired type.
allowMissingIf true, then we should not generate errors if the requested object is missing.

Return the object as a pointer to the ti type. Return 0 if the get fails or if the pointer can't be converted.

◆ getUntyped()

virtual const void* D3PD::IObjGetterTool::getUntyped ( bool  allowMissing = false)
pure virtualinherited

◆ next()

template<class T >
const T* D3PD::ICollectionGetterTool::next ( )

Type-safe wrapper for next.

Return the next element from the collection as a pointer to T. Return 0 if the pointer can't be converted or at the end of the iteration.

This is implemented in terms of nextTypeinfo().

◆ nextTypeinfo()

virtual const void* D3PD::ICollectionGetterTool::nextTypeinfo ( const std::type_info &  ti)
pure virtual

Return the next object cast to a different pointer type.

Return the next element from the collection as a pointer to the ti type. Return 0 if the pointer can't be converted or at the end of the iteration.

◆ nextUntyped()

virtual const void* D3PD::IIteration::nextUntyped ( )
pure virtualinherited

Return a pointer to the next element in the iteration.

Return 0 when the collection has been exhausted.

◆ releaseElement()

template<class T >
void D3PD::ICollectionGetterTool::releaseElement ( const T *  p)

Type-safe wrapper for releaseElementUntyped.

Parameters
pThe element to release.

Call this when you are done with the object returned by next(). The default implementation is a no-op, but if the getter dynamically allocated the object which it returned, this gives it a chance to free it.

This is implemented in terms of releaseElementTypeinfo().

◆ releaseElementTypeinfo()

void D3PD::ICollectionGetterTool::releaseElementTypeinfo ( const void *  p,
const std::type_info &  ti 
)

Release an element retrieved from the getter.

Parameters
pThe element to release.
tiThe type of p.

Call this when you are done with the element returned by nextUntyped(). The default implementation is a no-op, but if the getter dynamically allocated the object which it returned, this gives it a chance to free it.

◆ releaseElementUntyped()

virtual void D3PD::IIteration::releaseElementUntyped ( const void *  p)
virtualinherited

Release an object retrieved from the getter.

Parameters
pThe object to release.

Call this when you are done with the object returned by nextUntyped(). The default implementation is a no-op, but if the getter dynamically allocated the object which it returned, this gives it a chance to free it.

◆ releaseObject()

template<class T >
void D3PD::IObjGetterTool::releaseObject ( const T *  p)
inherited

Type-safe wrapper for releaseObjectUntyped.

Parameters
pThe object to release.

Call this when you are done with the object returned by get(). The default implementation is a no-op, but if the getter dynamically allocated the object which it returned, this gives it a chance to free it.

This is implemented in terms of releaseObjectTypeinfo().

◆ releaseObjectTypeinfo()

void D3PD::IObjGetterTool::releaseObjectTypeinfo ( const void *  p,
const std::type_info &  ti 
)
inherited

Release an object retrieved from the getter.

Parameters
pThe object to release.
tiThe type of p.

Call this when you are done with the object returned by getUntyped(). The default implementation is a no-op, but if the getter dynamically allocated the object which it returned, this gives it a chance to free it.

◆ releaseObjectUntyped()

virtual void D3PD::IObjGetterTool::releaseObjectUntyped ( const void *  p)
virtualinherited

Release an object retrieved from the getter.

Parameters
pThe object to release.

Call this when you are done with the object returned by getUntyped(). The default implementation is a no-op, but if the getter dynamically allocated the object which it returned, this gives it a chance to free it.

◆ reset()

virtual StatusCode D3PD::ICollectionGetterTool::reset ( bool  allowMissing = false)
pure virtual

Reset the iteration to the start of the collection.

Parameters
allowMissingIf true, then we should not generate errors if the requested object is missing.

Return failure if the container cannot be retrieved.

◆ sizeHint()

virtual size_t D3PD::ICollectionGetterTool::sizeHint ( bool  allowMissing = false)
pure virtual

Return an estimate of the number of elements in the iteration.

Parameters
allowMissingIf true, then we should not generate errors if the requested object is missing.

This can be used to pre-allocate memory. (It's possible that this isn't known in advance of iterating over the entire collection, for example if a selection is being applied, so this is only a hint.)

◆ typeinfo()

virtual const std::type_info& D3PD::IObjGetterTool::typeinfo ( ) const
pure virtualinherited

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