This commit is contained in:
Matthias Koefferlein 2021-05-18 01:23:08 +02:00
parent ea3bfabd90
commit cc336017b1
3 changed files with 13 additions and 3 deletions

View File

@ -585,10 +585,12 @@ public:
set_name (name);
}
virtual bool is_of_type (const std::type_info &ti) const
#if 0 // @@@
virtual bool is_of_type (const std::type_info & /*ti*/) const
{
return (ti == typeid (X));
}
#endif
virtual const std::type_info &type () const
{
@ -865,7 +867,8 @@ public:
return m_subclass_tester.get () && m_subclass_tester->can_upcast (p);
}
virtual bool is_of_type (const std::type_info &ti) const
#if 0 // @@@
virtual bool is_of_type (const std::type_info & /*ti*/) const
{
if (adapted_type_info ()) {
// A class matches the typeinfo of the adapted type. We'll sort this out later
@ -875,6 +878,7 @@ public:
return (ti == typeid (X));
}
}
#endif
virtual const std::type_info &type () const
{

View File

@ -736,6 +736,7 @@ ClassBase::classes_in_definition_order (const char *mod_name)
void
ClassBase::initialize ()
{
// @@@ tl::error << "@@@ registration of class " << name () << " (type " << type().name () << ")";
// don't initialize again
if (m_initialized) {
return;
@ -825,6 +826,8 @@ static void add_class_to_map (const gsi::ClassBase *c)
if (! ti) {
ti = &c->type ();
}
// tl::warn << "@@@ -> registering " << c->name() << " (as " << ti->name() << " with p=" << size_t((void*)ti) << ")";
// @@@ tl::warn << "@@@ X2 " << c->is_of_type (*ti) << " " << size_t((void*)ti) << " " << size_t((void*)&c->type()) << " " << (*ti==c->type()) << " adapted_type_info=" << size_t((void*)c->adapted_type_info());
if (! sp_ti_to_class) {
sp_ti_to_class = new ti_to_class_map_t ();
@ -833,7 +836,7 @@ static void add_class_to_map (const gsi::ClassBase *c)
sp_tname_to_class = new tname_to_class_map_t ();
}
if (ti && c->is_of_type (*ti)) {
if (ti /*@@@&& c->is_of_type (*ti)*/) {
if (!sp_ti_to_class->insert (std::make_pair (ti, c)).second) {
// Duplicate registration of this class
tl::error << "Duplicate registration of class " << c->name () << " (type " << ti->name () << ")";
@ -869,6 +872,7 @@ const ClassBase *class_by_typeinfo_no_assert (const std::type_info &ti)
sp_ti_to_class->insert (std::make_pair (&ti, cn->second));
return cn->second;
} else {
// @@@ tl::warn << "@@@ -> could not find ti with p=" << size_t((void*)&ti);
return 0;
}
}

View File

@ -445,6 +445,7 @@ public:
return false;
}
#if 0 // @@@
/**
* @brief Class implementation: check C++ type of object
*
@ -456,6 +457,7 @@ public:
tl_assert (false);
return false;
}
#endif
/**
* @brief Returns true, if the given object can be cast to this class