+
+
+ static bool bbmgSomeBoxExecuting = false;
+ static bool bbmgFreezeExecution = false;
+ static std::set<BlackBox::Pointer> bbmgExecutionList;
+
+ //=========================================================================
+ BlackBox::Deleter::Deleter()
+ {
+ }
+ //=========================================================================
+
+ //=========================================================================
+ void BlackBox::Deleter::Delete(Object* p)
+ {
+ BlackBox* b = dynamic_cast<BlackBox*>(p);
+ if (!b)
+ {
+ bbtkInternalError("BlackBox::Deleter::Delete("<<p->GetObjectName()
+ <<"["<<p<<"]) : "
+ <<"dynamic cast to BlackBox* failed !");
+ }
+ std::string name = p->GetObjectName();//b->bbGetNameWithParent();
+ bbtkDebugMessage("object",2,"##> BlackBox::Deleter(\""<<name<<"\")"<<std::endl);
+
+
+ BlackBoxDescriptor::WeakPointer desc = b->bbGetDescriptor();
+ bbtkDebugMessage("object",2,"##> BlackBox::Deleter(\""<<name<<"\") : deleting black box"<<std::endl);
+
+ b->bbDelete();
+
+ bbtkDebugMessage("object",2,"##> BlackBox::Deleter(\""<<name<<"\") : releasing descriptor ["<<desc.lock()<<"]"<<std::endl);
+
+ if (!desc.expired())
+ {
+ Package::WeakPointer pack = desc.lock()->GetPackage();
+ if (!pack.expired())
+ {
+ Package::ReleaseBlackBoxDescriptor(pack,desc);
+ }
+ else
+ {
+ bbtkDebugMessage("object",2,"##> BlackBox::Deleter(\""<<name<<"\") : descriptor package expired (was not held by a package and the box was the last instance)"<<std::endl);
+ }
+ }
+ else
+ {
+ bbtkDebugMessage("object",2,"##> BlackBox::Deleter(\""<<name<<"\") : descriptor expired : nothing to do (was not held by a package or the box is a complex black box prototype)"<<std::endl);
+ }
+ bbtkDebugMessage("object",2,"<## BlackBox::Deleter(\""<<name<<"\")"<<std::endl);
+ }
+ //=========================================================================
+