The Gaudi Framework  master (37c0b60a)
AnyDataWrapperBase::Ptr Class Reference

#include </builds/gaudi/Gaudi/GaudiKernel/include/GaudiKernel/AnyDataWrapper.h>

Collaboration diagram for AnyDataWrapperBase::Ptr:

Public Member Functions

template<typename T >
 Ptr (T const *t)
 
 operator void const * () const
 
std::type_index type () const
 
template<typename T >
T const * get () const
 

Private Attributes

void const * m_ptr = nullptr
 
std::type_index m_type = typeid( void )
 

Detailed Description

Definition at line 33 of file AnyDataWrapper.h.

Constructor & Destructor Documentation

◆ Ptr()

template<typename T >
AnyDataWrapperBase::Ptr::Ptr ( T const *  t)
inline

Definition at line 39 of file AnyDataWrapper.h.

39 : m_ptr{ t }, m_type{ typeid( T ) } {}

Member Function Documentation

◆ get()

template<typename T >
T const* AnyDataWrapperBase::Ptr::get ( ) const
inline

Definition at line 45 of file AnyDataWrapper.h.

45  {
46  if ( std::is_void_v<T> || m_type == std::type_index( typeid( T ) ) ) return static_cast<T const*>( m_ptr );
47  struct bad_AnyDataWrapper_Ptr_cast : std::bad_cast {};
48  throw bad_AnyDataWrapper_Ptr_cast{};
49  }

◆ operator void const *()

AnyDataWrapperBase::Ptr::operator void const * ( ) const
inline

Definition at line 41 of file AnyDataWrapper.h.

41 { return m_ptr; }

◆ type()

std::type_index AnyDataWrapperBase::Ptr::type ( ) const
inline

Definition at line 42 of file AnyDataWrapper.h.

42 { return m_type; }

Member Data Documentation

◆ m_ptr

void const* AnyDataWrapperBase::Ptr::m_ptr = nullptr
private

Definition at line 34 of file AnyDataWrapper.h.

◆ m_type

std::type_index AnyDataWrapperBase::Ptr::m_type = typeid( void )
private

Definition at line 35 of file AnyDataWrapper.h.


The documentation for this class was generated from the following file:
AnyDataWrapperBase::Ptr::m_ptr
void const * m_ptr
Definition: AnyDataWrapper.h:34
std::type_index
std::bad_cast
STL class.
bug_34121.t
t
Definition: bug_34121.py:31
AnyDataWrapperBase::Ptr::m_type
std::type_index m_type
Definition: AnyDataWrapper.h:35