7 #include "TypeBoundRedispatch.h"
8 #include "Connection.h"
9 #include "TypeService.h"
11 #include "LogStream.h"
13 #include <Atlas/Objects/Operation.h>
14 #include <sigc++/slot.h>
15 #include <sigc++/bind.h>
17 using namespace Atlas::Objects::Operation;
18 using Atlas::Objects::Root;
19 using Atlas::Objects::Entity::RootEntity;
20 using Atlas::Objects::smart_dynamic_cast;
26 TypeBoundRedispatch::TypeBoundRedispatch(Connection& con,
32 m_unbound.insert(unbound);
34 assert(!unbound->isBound());
35 unbound->Bound.connect(sigc::bind(sigc::mem_fun(
this, &TypeBoundRedispatch::onBound), unbound));
37 con.getTypeService().BadType.connect(sigc::mem_fun(
this, &TypeBoundRedispatch::onBadType));
40 TypeBoundRedispatch::TypeBoundRedispatch(Connection& con,
42 TypeInfoSet unbound) :
45 m_unbound(std::move(unbound))
47 for (
auto& item : m_unbound) {
48 assert(!item->isBound());
49 item->Bound.connect(sigc::bind(sigc::mem_fun(
this, &TypeBoundRedispatch::onBound), item));
52 con.getTypeService().BadType.connect(sigc::mem_fun(
this, &TypeBoundRedispatch::onBadType));
55 void TypeBoundRedispatch::onBound(TypeInfo* bound)
57 assert(m_unbound.count(bound));
58 m_unbound.erase(bound);
60 if (m_unbound.empty()) {
65 void TypeBoundRedispatch::onBadType(TypeInfo* bad)
67 if (m_unbound.count(bad)) {
68 warning() <<
"TypeBoundRedispatch was waiting on bad type " << bad->getName();