From cc336017b124f61c9d0babaff02456e9e19a6edd Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Tue, 18 May 2021 01:23:08 +0200 Subject: [PATCH] WIP --- src/gsi/gsi/gsiClass.h | 8 ++++++-- src/gsi/gsi/gsiClassBase.cc | 6 +++++- src/gsi/gsi/gsiClassBase.h | 2 ++ 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/gsi/gsi/gsiClass.h b/src/gsi/gsi/gsiClass.h index ad52d9faa..6b24965ed 100644 --- a/src/gsi/gsi/gsiClass.h +++ b/src/gsi/gsi/gsiClass.h @@ -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 { diff --git a/src/gsi/gsi/gsiClassBase.cc b/src/gsi/gsi/gsiClassBase.cc index 7ee9acd8f..1cfed528b 100644 --- a/src/gsi/gsi/gsiClassBase.cc +++ b/src/gsi/gsi/gsiClassBase.cc @@ -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; } } diff --git a/src/gsi/gsi/gsiClassBase.h b/src/gsi/gsi/gsiClassBase.h index dcea483fe..d96d7887d 100644 --- a/src/gsi/gsi/gsiClassBase.h +++ b/src/gsi/gsi/gsiClassBase.h @@ -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