+
+ //===================================================================
+ /// Creates an instance of a black box of type <type> with name <name>
+ BlackBox::Pointer Factory::NewWidgetAdaptor(const DataInfo& typein,
+ const DataInfo& typeout,
+ const std::string& name) const
+ {
+ bbtkDebugMessageInc("Kernel",8,"Factory::NewWidgetAdaptor(<"
+ <<typein<<">,<"
+ <<typeout<<">,\""
+ <<name<<"\")"<<bbtkendl);
+
+
+ BlackBox::Pointer b;
+ PackageMapType::const_iterator i;
+ for (i = mPackageMap.begin(); i!=mPackageMap.end(); ++i )
+ {
+ b = i->second->NewWidgetAdaptor(typein,
+ typeout,
+ name);
+ if (b) break;
+ }
+ if (!b)
+ {
+ bbtkError("no "<<typein<<" to "<<typeout
+ <<"> widget adaptor available");
+ }
+
+ bbtkDebugDecTab("Kernel",7);
+ return b;
+ }
+ //===================================================================
+
+ //===================================================================
+ /// Creates an instance of a black box of type <type> with name <name>
+ bool Factory::FindAdaptor(const DataInfo& typein,
+ const DataInfo& typeout,
+ std::string& adaptor) const
+ {
+ bbtkDebugMessageInc("Kernel",8,"Factory::FindAdaptor(<"
+ <<typein<<">,<"
+ <<typeout<<">)"<<bbtkendl);
+
+ bool b = false;
+ PackageMapType::const_iterator i;
+ for (i = mPackageMap.begin(); i!=mPackageMap.end(); ++i )
+ {
+ b = i->second->FindAdaptor(typein,
+ typeout,
+ adaptor);
+ if (b) break;
+ }
+ /*
+ if (!b)
+ {
+ bbtkError("no "<<typein<<" to "<<typeout
+ <<"> widget adaptor available");
+ }
+ */
+
+ bbtkDebugDecTab("Kernel",7);
+ return b;
+ }
+ //===================================================================
+
+ //===================================================================
+ /// Creates an instance of a black box of type <type> with name <name>
+ bool Factory::FindWidgetAdaptor(const DataInfo& typein,
+ const DataInfo& typeout,
+ std::string& adaptor) const
+ {
+ bbtkDebugMessageInc("Kernel",8,"Factory::FindWidgetAdaptor(<"
+ <<typein<<">,<"
+ <<typeout<<">)"<<bbtkendl);
+
+ bool b = false;
+ PackageMapType::const_iterator i;
+ for (i = mPackageMap.begin(); i!=mPackageMap.end(); ++i )
+ {
+ b = i->second->FindWidgetAdaptor(typein,
+ typeout,
+ adaptor);
+ if (b) break;
+ }
+ bbtkDebugDecTab("Kernel",7);
+ return b;
+ }
+ //===================================================================
+
+ //===================================================================
+ /// Creates an instance of a black box of type <type> with name <name>
+ bool Factory::FindWidgetAdaptor2(const DataInfo& typein,
+ const DataInfo& typeout,
+ std::string& widget,
+ std::string& adaptor) const
+ {
+ bbtkDebugMessageInc("Kernel",8,"Factory::FindWidgetAdaptor(<"
+ <<typein<<">,<"
+ <<typeout<<">)"<<bbtkendl);
+
+ bool b = false;
+ adaptor = widget = "";
+ PackageMapType::const_iterator i;
+ for (i = mPackageMap.begin(); i!=mPackageMap.end(); ++i )
+ {
+ b = i->second->FindWidgetAdaptor(typein,
+ typeout,
+ widget);
+ if (b) break;
+ }
+ if (!b)
+ {
+ // Look for a widget adaptor with good nature out
+ bbtkMessage("Kernel",5,
+ "*** Looking for a two pieces widget adaptor for : "
+ << typein << "->"<<typeout<<std::endl);
+ for (i = mPackageMap.begin(); i!=mPackageMap.end(); ++i )
+ {
+ Package::AdaptorMapType::const_iterator j;
+ for (j=i->second->GetAdaptorMap().begin();
+ j!=i->second->GetAdaptorMap().end();
+ ++j)
+ {
+ if ( ( j->first.mKind ==
+ BlackBoxDescriptor::DEFAULT_GUI) &&
+ //(j->first.mTypeIn == typein) &&
+ (j->first.mTypeOut.GetNature() == typeout.GetNature() )
+ )
+ {
+ widget = j->second.lock()->GetTypeName();
+ bbtkMessage("Kernel",5,
+ "===> Found first part : "<<widget
+ << " "<<j->first.mTypeIn<<"->"
+ <<j->first.mTypeOut<<std::endl);
+ DataInfo ti( j->first.mTypeOut.GetType(), "");
+ DataInfo to( typeout.GetType(), "");
+ b = FindAdaptor( ti, to, adaptor );
+ if (b)
+ {
+ bbtkMessage("Kernel",5,
+ "===> Found second part : "<<adaptor
+ <<std::endl);
+ break;
+ }
+ else
+ {
+ bbtkMessage("Kernel",5,
+ "===> No second part found"<<std::endl);
+ }
+ }
+ }
+ if (b) break;
+ }
+ }
+ bbtkDebugDecTab("Kernel",7);
+ return b;
+ }
+ //===================================================================
+