ATLAS Offline Software
Loading...
Searching...
No Matches
SG::BaseInfoBase Class Reference

The non-template portion of the BaseInfo implementation. More...

#include <BaseInfo.h>

Collaboration diagram for SG::BaseInfoBase:

Public Types

typedef void * castfn_t(void *p)
 Type of a pointer conversion function.
typedef void init_func_t(BaseInfoBase *bib)
 Type for an initialization function.

Public Member Functions

CLID clid () const
 Return the CLID for this class.
const std::type_info & typeinfo () const
 Return the std::type_info for this class.
void * cast (void *p, CLID clid) const
 Cast to a base pointer.
void * cast (void *p, const std::type_info &tinfo) const
 Cast to a base pointer.
void * castTo (void *p, CLID clid) const
 Cast to a derived pointer.
void * castTo (void *p, const std::type_info &tinfo) const
 Cast to a derived pointer.
castfn_tcastfn (CLID clid) const
 Return a function for casting to a base pointer.
castfn_tcastfn (const std::type_info &tinfo) const
 Return a function for casting to a base pointer.
castfn_tcastfnTo (CLID clid) const
 Return a function for casting to a derived pointer.
castfn_tcastfnTo (const std::type_info &tinfo) const
 Return a function for casting to a derived pointer.
const std::vector< CLID > & get_bases () const
 Return the class IDs of all known bases of T (that have class IDs).
std::vector< const std::type_info * > get_ti_bases () const
 Return the type_info's of all known bases of T.
bool is_base (CLID clid) const
 Return true if clid is the ID of a class that is known to be a base of T.
bool is_base (const std::type_info &tinfo) const
 Return true if tinfo is the type_info of a class that is known to be a base of T.
bool is_virtual (CLID clid) const
 Return true if clid is the ID of a class that is known to be a virtual base of T.
bool is_virtual (const std::type_info &tinfo) const
 Return true if tinfo is the std::type_info of a class that is known to be a virtual base of T.
const CopyConversionBasecopy_conversion (const std::type_info &tinfo) const
 Search for a copy conversion to tinfo.
const CopyConversionBasecopy_conversion (CLID clid) const
 Search for a copy conversion to clid.
void add_copy_conversion (const std::type_info &tinfo, const CopyConversionBase *cnv)
 Add a new copy conversion.
std::vector< CLIDget_copy_conversions () const
 Return known copy conversions.
void add_info (const std::type_info &tinfo, castfn_t *converter, castfn_t *converterTo, bool is_virtual)
 Add information about one base class.
void maybeInit ()
 Run initializations for this class, if needed.

Static Public Member Functions

static const BaseInfoBasefind (CLID clid)
 Find the BaseInfoBase instance for clid.
static const BaseInfoBasefind (const std::type_info &tinfo)
 Find the BaseInfoBase instance for tinfo.
static void addInit (const std::type_info *tinfo, init_func_t *init_func)
 Register an initialization function.

Protected Member Functions

 BaseInfoBase (const std::type_info &tinfo)
 Constructor.
 ~BaseInfoBase ()
 Destructor.

Private Member Functions

 BaseInfoBase (const BaseInfoBase &)
BaseInfoBaseoperator= (const BaseInfoBase &)

Static Private Member Functions

static BaseInfoBasefind1 (const std::type_info &tinfo)
 Helper for find.

Private Attributes

BaseInfoBaseImplm_impl
 Pointer to internal state.

Friends

template<class D, class B>
struct RegisterAddBaseInit
template<class D, class B>
struct RegisterAddCopyConversionInit

Detailed Description

The non-template portion of the BaseInfo implementation.

Definition at line 450 of file Control/AthenaKernel/AthenaKernel/BaseInfo.h.

Member Typedef Documentation

◆ castfn_t

typedef void * SG::BaseInfoBase::castfn_t(void *p)

Type of a pointer conversion function.

Definition at line 516 of file Control/AthenaKernel/AthenaKernel/BaseInfo.h.

◆ init_func_t

typedef void SG::BaseInfoBase::init_func_t(BaseInfoBase *bib)

Type for an initialization function.

Definition at line 688 of file Control/AthenaKernel/AthenaKernel/BaseInfo.h.

Constructor & Destructor Documentation

◆ BaseInfoBase() [1/2]

SG::BaseInfoBase::BaseInfoBase ( const std::type_info & tinfo)
protected

Constructor.

Parameters
tinfoThe std::type_info for this class.

Definition at line 529 of file BaseInfo.cxx.

530 : m_impl (new BaseInfoBaseImpl)
531{
532 m_impl->m_clid = CLIDRegistry::typeinfoToCLID (tinfo);
533 m_impl->m_typeinfo = &tinfo;
534 m_impl->m_needs_init = true;
535
536 BaseInfoBaseImpl::lock_t lock (BaseInfoBaseImpl::s_mutex);
537 if (!BaseInfoBaseImpl::s_bi_by_ti)
538 BaseInfoBaseImpl::s_bi_by_ti = new BaseInfoBaseImpl::bi_by_ti_map_type;
539 if (!BaseInfoBaseImpl::s_ti_by_name)
540 BaseInfoBaseImpl::s_ti_by_name = new BaseInfoBaseImpl::ti_by_name_map_type;
541
542 // Register this instance in the static maps.
543 (*BaseInfoBaseImpl::s_bi_by_ti)[&tinfo] = this;
544 (*BaseInfoBaseImpl::s_ti_by_name)[tinfo.name()] = &tinfo;
545}
static CLID typeinfoToCLID(const std::type_info &ti)
Return the CLID corresponding to a type_info.
BaseInfoBaseImpl * m_impl
Pointer to internal state.
std::lock_guard< mutex_t > lock_t
Definition BaseInfo.cxx:101
std::unordered_map< std::string, const std::type_info * > ti_by_name_map_type
Used to canonicalize type_info instances.
Definition BaseInfo.cxx:82
std::unordered_map< const std::type_info *, BaseInfoBase * > bi_by_ti_map_type
Map of all type_info pointers to BaseInfoBase instances.
Definition BaseInfo.cxx:77

◆ ~BaseInfoBase()

SG::BaseInfoBase::~BaseInfoBase ( )
protected

Destructor.

Definition at line 551 of file BaseInfo.cxx.

552{
553 for (BaseInfoBaseImpl::ti_copyconversion_type::iterator it =
554 m_impl->m_ti_copyconversion_map.begin();
555 it != m_impl->m_ti_copyconversion_map.end();
556 ++it)
557 {
558 delete it->second;
559 }
560 delete m_impl;
561}

◆ BaseInfoBase() [2/2]

SG::BaseInfoBase::BaseInfoBase ( const BaseInfoBase & )
private

Member Function Documentation

◆ add_copy_conversion()

void SG::BaseInfoBase::add_copy_conversion ( const std::type_info & tinfo,
const CopyConversionBase * cnv )

Add a new copy conversion.

Parameters
tinfoThe std::type_info of the target class.
cnvA CopyConversionBase instance describing the conversion.

The BaseInfoBase takes ownership of the cnv object.

Definition at line 440 of file BaseInfo.cxx.

442{
443 BaseInfoBaseImpl::lock_t lock (m_impl->m_mutex);
444 m_impl->m_ti_copyconversion_map.emplace_back (&tinfo, cnv);
445}

◆ add_info()

void SG::BaseInfoBase::add_info ( const std::type_info & tinfo,
castfn_t * converter,
castfn_t * converterTo,
bool is_virtual )

Add information about one base class.

Parameters
tinfoThe std::type_info of the base.
converterConverter function. This should be able to convert a T* to a pointer to this base.
converterToConverter function. This should be able to convert a pointer to this base to a T*.
is_virtualTrue if the derivation from this base to T is via virtual derivation.

Definition at line 479 of file BaseInfo.cxx.

483{
484 BaseInfoBaseImpl::lock_t slock (BaseInfoBaseImpl::s_mutex);
485 BaseInfoBaseImpl::lock_t lock (m_impl->m_mutex);
486 {
487 const BaseInfoBaseImpl::info* i = m_impl->findInfo (tinfo);
488 if (!i) {
489 m_impl->m_timap.emplace_back (&tinfo,
490 BaseInfoBaseImpl::info (converter, converterTo, is_virtual));
491 }
492 }
493
494 auto i = BaseInfoBaseImpl::s_bi_by_ti->find (&tinfo);
495 if (i != BaseInfoBaseImpl::s_bi_by_ti->end()) {
496 BaseInfoBaseImpl& impl = *i->second->m_impl;
497 if (impl.m_clid == CLID_NULL)
498 impl.m_clid = CLIDRegistry::typeinfoToCLID (tinfo);
499 }
500}
bool is_virtual(CLID clid) const
Return true if clid is the ID of a class that is known to be a virtual base of T.
Definition BaseInfo.cxx:373

◆ addInit()

void SG::BaseInfoBase::addInit ( const std::type_info * tinfo,
init_func_t * init_func )
static

Register an initialization function.

Parameters
tinfoThe std::type_info for the class being registered.
init_funcFunction to initialize BaseInfo for the class.

Definition at line 673 of file BaseInfo.cxx.

675{
676 BaseInfoBaseImpl::lock_t lock (BaseInfoBaseImpl::s_mutex);
677 if (!BaseInfoBaseImpl::s_init_list)
678 BaseInfoBaseImpl::s_init_list =
680 BaseInfoBaseImpl::s_init_list->insert (std::make_pair (tinfo, init_func));
681
682 if (BaseInfoBaseImpl::s_bi_by_ti) {
683 auto i = BaseInfoBaseImpl::s_bi_by_ti->find (tinfo);
684 if (i != BaseInfoBaseImpl::s_bi_by_ti->end()) {
685 BaseInfoBaseImpl::lock_t lock (i->second->m_impl->m_mutex);
686 BaseInfoBaseImpl& impl = *i->second->m_impl;
687 impl.m_needs_init = true;
688 if (impl.m_clid == CLID_NULL)
689 impl.m_clid = CLIDRegistry::typeinfoToCLID (*tinfo);
690 }
691 }
692}
std::unordered_multimap< const std::type_info *, BaseInfoBase::init_func_t * > init_list_t
Holds BaseInfo classes awaiting initialization.
Definition BaseInfo.cxx:89

◆ cast() [1/2]

void * SG::BaseInfoBase::cast ( void * p,
CLID clid ) const

Cast to a base pointer.

Parameters
pThe pointer to cast (a T* cast to a void*).
clidID of the class to which to cast.
Returns
The pointer cast to the requested type, returned as a void*. clid must be known to be a base of T; otherwise, 0 will be returned.

Definition at line 166 of file BaseInfo.cxx.

167{
168 const std::type_info* ti = CLIDRegistry::CLIDToTypeinfo (clid);
169 if (ti)
170 return this->cast (p, *ti);
171 return 0;
172}
static const std::type_info * CLIDToTypeinfo(CLID clid)
Translate between CLID and type_info.
CLID clid() const
Return the CLID for this class.
Definition BaseInfo.cxx:141
void * cast(void *p, CLID clid) const
Cast to a base pointer.
Definition BaseInfo.cxx:166

◆ cast() [2/2]

void * SG::BaseInfoBase::cast ( void * p,
const std::type_info & tinfo ) const

Cast to a base pointer.

Parameters
pThe pointer to cast (a T* cast to a void*).
clidtype_info of the class to which to cast.
Returns
The pointer cast to the requested type, returned as a void*. tinfo must be known to be a base of T; otherwise, 0 will be returned.

Definition at line 183 of file BaseInfo.cxx.

184{
185 if (BaseInfoBase::castfn_t* converter = castfn (tinfo)) {
186 return converter (p);
187 }
188 return nullptr;
189}
castfn_t * castfn(CLID clid) const
Return a function for casting to a base pointer.
Definition BaseInfo.cxx:236
void * castfn_t(void *p)
Type of a pointer conversion function.

◆ castfn() [1/2]

BaseInfoBase::castfn_t * SG::BaseInfoBase::castfn ( CLID clid) const

Return a function for casting to a base pointer.

Parameters
clidID of the class to which to cast.
Returns
A function to convert a pointer to a T to a pointer to the type identified by clid. clid must be known to be a base of T; otherwise, 0 will be returned.

Definition at line 236 of file BaseInfo.cxx.

237{
238 const std::type_info* ti = CLIDRegistry::CLIDToTypeinfo (clid);
239 if (ti)
240 return this->castfn (*ti);
241 return 0;
242}

◆ castfn() [2/2]

BaseInfoBase::castfn_t * SG::BaseInfoBase::castfn ( const std::type_info & tinfo) const

Return a function for casting to a base pointer.

Parameters
clidtype_info of the class to which to cast.
Returns
A function to convert a pointer to a T to a pointer to the type identified by tinfo. tinfo must be known to be a base of T; otherwise, 0 will be returned.

Definition at line 254 of file BaseInfo.cxx.

255{
256 BaseInfoBaseImpl::lock_t lock (m_impl->m_mutex);
257 const BaseInfoBaseImpl::info* i = m_impl->findInfo (tinfo);
258 if (i)
259 return i->m_converter;
260 return nullptr;
261}

◆ castfnTo() [1/2]

BaseInfoBase::castfn_t * SG::BaseInfoBase::castfnTo ( CLID clid) const

Return a function for casting to a derived pointer.

Parameters
clidID of the class B from which to cast.
Returns
A function to convert a pointer to a B to a pointer to a T. B must be known to be a base of T; otherwise, 0 will be returned. 0 will also be returned if the dynamic_cast fails.

Definition at line 272 of file BaseInfo.cxx.

273{
274 const std::type_info* ti = CLIDRegistry::CLIDToTypeinfo (clid);
275 if (ti)
276 return this->castfnTo (*ti);
277 return 0;
278}
castfn_t * castfnTo(CLID clid) const
Return a function for casting to a derived pointer.
Definition BaseInfo.cxx:272

◆ castfnTo() [2/2]

BaseInfoBase::castfn_t * SG::BaseInfoBase::castfnTo ( const std::type_info & tinfo) const

Return a function for casting to a derived pointer.

Parameters
clidtype_info of the class B from which to cast.
Returns
A function to convert a pointer to a B to a pointer to a T. B must be known to be a base of T; otherwise, 0 will be returned. 0 will also be returned if the dynamic_cast fails.

Definition at line 290 of file BaseInfo.cxx.

291{
292 BaseInfoBaseImpl::lock_t lock (m_impl->m_mutex);
293 const BaseInfoBaseImpl::info* i = m_impl->findInfo (tinfo);
294 if (i)
295 return i->m_converterTo;
296 return nullptr;
297}

◆ castTo() [1/2]

void * SG::BaseInfoBase::castTo ( void * p,
CLID clid ) const

Cast to a derived pointer.

Parameters
pThe pointer to cast (a B* cast to a void*).
clidID of the class B from which to cast.
Returns
The pointer cast to the requested type, returned as a void*. clid must be known to be a base of T; otherwise, 0 will be returned. 0 will also be returned if the dynamic_cast fails.

Definition at line 201 of file BaseInfo.cxx.

202{
203 const std::type_info* ti = CLIDRegistry::CLIDToTypeinfo (clid);
204 if (ti)
205 return this->castTo (p, *ti);
206 return 0;
207}
void * castTo(void *p, CLID clid) const
Cast to a derived pointer.
Definition BaseInfo.cxx:201

◆ castTo() [2/2]

void * SG::BaseInfoBase::castTo ( void * p,
const std::type_info & tinfo ) const

Cast to a derived pointer.

Parameters
pThe pointer to cast (a B* cast to a void*).
clidtype_info of the class B from which to cast.
Returns
The pointer cast to the requested type, returned as a void*. tinfo must be known to be a base of T; otherwise, 0 will be returned. 0 will also be returned if the dynamic_cast fails.

Definition at line 219 of file BaseInfo.cxx.

220{
221 if (BaseInfoBase::castfn_t* converterTo = castfnTo (tinfo)) {
222 return converterTo (p);
223 }
224 return nullptr;
225}

◆ clid()

CLID SG::BaseInfoBase::clid ( ) const

Return the CLID for this class.

Definition at line 141 of file BaseInfo.cxx.

142{
143 BaseInfoBaseImpl::lock_t lock (m_impl->m_mutex);
144 return m_impl->m_clid;
145}

◆ copy_conversion() [1/2]

const CopyConversionBase * SG::BaseInfoBase::copy_conversion ( CLID clid) const

Search for a copy conversion to clid.

Parameters
clidThe class to which we want to convert.

Returns the conversion instance or 0.

Definition at line 423 of file BaseInfo.cxx.

424{
425 const std::type_info* ti = CLIDRegistry::CLIDToTypeinfo (clid);
426 if (ti)
427 return this->copy_conversion (*ti);
428 return 0;
429}
const CopyConversionBase * copy_conversion(const std::type_info &tinfo) const
Search for a copy conversion to tinfo.
Definition BaseInfo.cxx:405

◆ copy_conversion() [2/2]

const CopyConversionBase * SG::BaseInfoBase::copy_conversion ( const std::type_info & tinfo) const

Search for a copy conversion to tinfo.

Parameters
tinfoThe class to which we want to convert.

Returns the conversion instance or 0.

Definition at line 405 of file BaseInfo.cxx.

406{
407 BaseInfoBaseImpl::lock_t lock (m_impl->m_mutex);
408 for (const auto& p : m_impl->m_ti_copyconversion_map) {
409 if (p.first == &tinfo)
410 return p.second;
411 }
412 return 0;
413}

◆ find() [1/2]

const BaseInfoBase * SG::BaseInfoBase::find ( CLID clid)
static

Find the BaseInfoBase instance for clid.

Parameters
clidThe class ID of the class for which we want information.

Returns 0 if no BaseInfoBase instance is available.

Definition at line 570 of file BaseInfo.cxx.

571{
572 const std::type_info* ti = CLIDRegistry::CLIDToTypeinfo (clid);
573 if (ti)
574 return BaseInfoBase::find (*ti);
575 return 0;
576}
static const BaseInfoBase * find(CLID clid)
Find the BaseInfoBase instance for clid.
Definition BaseInfo.cxx:570

◆ find() [2/2]

const BaseInfoBase * SG::BaseInfoBase::find ( const std::type_info & tinfo)
static

Find the BaseInfoBase instance for tinfo.

Parameters
tinfoThe std::type_info of the class for which we want information.

Returns 0 if no BaseInfoBase instance is available.

Definition at line 633 of file BaseInfo.cxx.

634{
635 BaseInfoBase* bib = find1 (tinfo);
636
637 // If we didn't find it, try looking up by name.
638 // This to deal with the issue of sometimes getting duplicate
639 // @c std::type_info instances.
640 if (!bib) {
641 const std::type_info* tinfo2 = nullptr;
642 {
643 BaseInfoBaseImpl::lock_t lock (BaseInfoBaseImpl::s_mutex);
644 if (BaseInfoBaseImpl::s_ti_by_name) {
645 BaseInfoBaseImpl::ti_by_name_map_type::iterator i =
646 BaseInfoBaseImpl::s_ti_by_name->find (tinfo.name());
647 if (i != BaseInfoBaseImpl::s_ti_by_name->end() && i->second != &tinfo) {
648 tinfo2 = i->second;
649 }
650 }
651 }
652 if (tinfo2) {
653 bib = find1 (*tinfo2);
654 }
655 }
656
657 if (bib) {
658 BaseInfoBaseImpl& impl = *bib->m_impl;
659 BaseInfoBaseImpl::lock_t lock (impl.m_mutex);
660 if (impl.m_clid == CLID_NULL)
661 impl.m_clid = CLIDRegistry::typeinfoToCLID (*impl.m_typeinfo);
662 }
663
664 return bib;
665}
static BaseInfoBase * find1(const std::type_info &tinfo)
Helper for find.
Definition BaseInfo.cxx:586
BaseInfoBase(const std::type_info &tinfo)
Constructor.
Definition BaseInfo.cxx:529

◆ find1()

BaseInfoBase * SG::BaseInfoBase::find1 ( const std::type_info & tinfo)
staticprivate

Helper for find.

Parameters
tinfoThe std::type_info of the class for which we want information.

Returns 0 if no BaseInfoBase instance is available.

Definition at line 586 of file BaseInfo.cxx.

587{
588 BaseInfoBase* bib = nullptr;
589 {
590 BaseInfoBaseImpl::lock_t lock (BaseInfoBaseImpl::s_mutex);
591 if (!BaseInfoBaseImpl::s_bi_by_ti) return 0;
592 BaseInfoBaseImpl::bi_by_ti_map_type::iterator i =
593 BaseInfoBaseImpl::s_bi_by_ti->find (&tinfo);
594 if (i != BaseInfoBaseImpl::s_bi_by_ti->end()) {
595 bib = i->second;
596 BaseInfoBaseImpl::lock_t lock (bib->m_impl->m_mutex);
597 if (!bib->m_impl->m_needs_init)
598 return bib;
599 bib->m_impl->m_needs_init = false;
600 }
601 }
602
603 // Try the initlist.
604 while (true) {
606 {
607 BaseInfoBaseImpl::lock_t lock (BaseInfoBaseImpl::s_mutex);
608 if (!BaseInfoBaseImpl::s_init_list) break;
609 BaseInfoBaseImpl::bi_by_ti_map_type::iterator i =
610 BaseInfoBaseImpl::s_bi_by_ti->find (&tinfo);
611 if (i != BaseInfoBaseImpl::s_bi_by_ti->end())
612 bib = i->second;
613 BaseInfoBaseImpl::init_list_t::iterator it =
614 BaseInfoBaseImpl::s_init_list->find (&tinfo);
615 if (it == BaseInfoBaseImpl::s_init_list->end()) break;
616 init = it->second;
617 BaseInfoBaseImpl::s_init_list->erase (it);
618 }
619 init (bib);
620 }
621
622 return bib;
623}
void init_func_t(BaseInfoBase *bib)
Type for an initialization function.
init(v_theApp, v_rootStream=None)
Definition PyKernel.py:45

◆ get_bases()

const std::vector< CLID > & SG::BaseInfoBase::get_bases ( ) const

Return the class IDs of all known bases of T (that have class IDs).

The list will include T itself.

Definition at line 304 of file BaseInfo.cxx.

305{
306 if (!m_impl->m_bases.isValid()) {
307 BaseInfoBaseImpl::lock_t lock (m_impl->m_mutex);
308 const BaseInfoBaseImpl::ti_map_type& map = m_impl->m_timap;
309 std::vector<CLID> v;
310 v.reserve (map.size());
311 for (const auto& p : map) {
313 if (clid != CLID_NULL)
314 v.push_back (clid);
315 }
316 m_impl->m_bases.set (std::move (v));
317 }
318 return *m_impl->m_bases.ptr();
319}
uint32_t CLID
The Class ID type.
std::vector< ti_map_pair_type > ti_map_type
Definition BaseInfo.cxx:65

◆ get_copy_conversions()

std::vector< CLID > SG::BaseInfoBase::get_copy_conversions ( ) const

Return known copy conversions.

Returns the CLIDs of all target classes that have been registered with this one for copy conversion.

Definition at line 455 of file BaseInfo.cxx.

456{
457 BaseInfoBaseImpl::lock_t lock (m_impl->m_mutex);
458 std::vector<CLID> out;
459 out.reserve (m_impl->m_ti_copyconversion_map.size());
460 for (const auto& i : m_impl->m_ti_copyconversion_map) {
462 if (clid != CLID_NULL)
463 out.push_back (clid);
464 }
465 return out;
466}

◆ get_ti_bases()

std::vector< const std::type_info * > SG::BaseInfoBase::get_ti_bases ( ) const

Return the type_info's of all known bases of T.

The list will include T itself.

Definition at line 326 of file BaseInfo.cxx.

327{
328 BaseInfoBaseImpl::lock_t lock (m_impl->m_mutex);
329 const BaseInfoBaseImpl::ti_map_type& map = m_impl->m_timap;
330 std::vector<const std::type_info*> v;
331 v.reserve (map.size());
332 for (const auto& i : map)
333 v.push_back (i.first);
334 return v;
335}

◆ is_base() [1/2]

bool SG::BaseInfoBase::is_base ( CLID clid) const

Return true if clid is the ID of a class that is known to be a base of T.

T is considered to be its own base for this purpose.

Parameters
clidThe ID of the class to test.

Definition at line 344 of file BaseInfo.cxx.

345{
346 const std::type_info* ti = CLIDRegistry::CLIDToTypeinfo (clid);
347 if (ti)
348 return this->is_base (*ti);
349 return 0;
350}
bool is_base(CLID clid) const
Return true if clid is the ID of a class that is known to be a base of T.
Definition BaseInfo.cxx:344

◆ is_base() [2/2]

bool SG::BaseInfoBase::is_base ( const std::type_info & tinfo) const

Return true if tinfo is the type_info of a class that is known to be a base of T.

T is considered to be its own base for this purpose.

Parameters
clidThe ID of the class to test.

Definition at line 359 of file BaseInfo.cxx.

360{
361 BaseInfoBaseImpl::lock_t lock (m_impl->m_mutex);
362 const BaseInfoBaseImpl::info* i = m_impl->findInfo (tinfo);
363 return i != 0;
364}

◆ is_virtual() [1/2]

bool SG::BaseInfoBase::is_virtual ( CLID clid) const

Return true if clid is the ID of a class that is known to be a virtual base of T.

(This will always be false for T itself.)

Parameters
clidThe ID of the class to test.

Definition at line 373 of file BaseInfo.cxx.

374{
375 const std::type_info* ti = CLIDRegistry::CLIDToTypeinfo (clid);
376 if (ti)
377 return this->is_virtual (*ti);
378 return false;
379}

◆ is_virtual() [2/2]

bool SG::BaseInfoBase::is_virtual ( const std::type_info & tinfo) const

Return true if tinfo is the std::type_info of a class that is known to be a virtual base of T.

(This will always be false for T itself.)

Parameters
tinfoThe std::type_info of the class to test.

Definition at line 388 of file BaseInfo.cxx.

389{
390 BaseInfoBaseImpl::lock_t lock (m_impl->m_mutex);
391 const BaseInfoBaseImpl::info* i = m_impl->findInfo (tinfo);
392 if (i)
393 return i->m_is_virtual;
394 return false;
395}

◆ maybeInit()

void SG::BaseInfoBase::maybeInit ( )

Run initializations for this class, if needed.

Definition at line 698 of file BaseInfo.cxx.

699{
700 // This may be null during initialization, if we're initializing a
701 // BaseInfo<T>::s_instance instance which references another type
702 // for which the s_instance constructor has not yet been run.
703 if (!m_impl) return;
704
705 bool needs_init = false;
706 const std::type_info* ti = nullptr;
707 {
708 BaseInfoBaseImpl::lock_t lock (m_impl->m_mutex);
709 needs_init = m_impl->m_needs_init;
710 ti = m_impl->m_typeinfo;
711 }
712
713 if (needs_init)
714 find (*ti);
715}

◆ operator=()

BaseInfoBase & SG::BaseInfoBase::operator= ( const BaseInfoBase & )
private

◆ typeinfo()

const std::type_info & SG::BaseInfoBase::typeinfo ( ) const

Return the std::type_info for this class.

Definition at line 151 of file BaseInfo.cxx.

152{
153 BaseInfoBaseImpl::lock_t lock (m_impl->m_mutex);
154 return *m_impl->m_typeinfo;
155}

◆ RegisterAddBaseInit

template<class D, class B>
friend struct RegisterAddBaseInit
friend

◆ RegisterAddCopyConversionInit

template<class D, class B>
friend struct RegisterAddCopyConversionInit
friend

Member Data Documentation

◆ m_impl

BaseInfoBaseImpl* SG::BaseInfoBase::m_impl
private

Pointer to internal state.

Definition at line 734 of file Control/AthenaKernel/AthenaKernel/BaseInfo.h.


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