MCPcopy Create free account
hub / github.com/Gecode/gecode / branchWithPlugin

Method branchWithPlugin

gecode/flatzinc/flatzinc.cpp:1939–1966  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1937
1938#ifdef GECODE_HAS_QT
1939 void
1940 FlatZincSpace::branchWithPlugin(AST::Node* ann) {
1941 if (AST::Call* c = dynamic_cast<AST::Call*>(ann)) {
1942 QString pluginName(c->id.c_str());
1943 if (QLibrary::isLibrary(pluginName+".dll")) {
1944 pluginName += ".dll";
1945 } else if (QLibrary::isLibrary(pluginName+".dylib")) {
1946 pluginName = "lib" + pluginName + ".dylib";
1947 } else if (QLibrary::isLibrary(pluginName+".so")) {
1948 // Must check .so after .dylib so that Mac OS uses .dylib
1949 pluginName = "lib" + pluginName + ".so";
1950 }
1951 QPluginLoader pl(pluginName);
1952 QObject* plugin_o = pl.instance();
1953 if (!plugin_o) {
1954 throw FlatZinc::Error("FlatZinc",
1955 "Error loading plugin "+pluginName.toStdString()+
1956 ": "+pl.errorString().toStdString());
1957 }
1958 BranchPlugin* pb = qobject_cast<BranchPlugin*>(plugin_o);
1959 if (!pb) {
1960 throw FlatZinc::Error("FlatZinc",
1961 "Error loading plugin "+pluginName.toStdString()+
1962 ": does not contain valid PluginBrancher");
1963 }
1964 pb->branch(*this, c);
1965 }
1966 }
1967#else
1968 void
1969 FlatZincSpace::branchWithPlugin(AST::Node*) {

Callers

nothing calls this directly

Calls 3

ErrorFunction · 0.85
instanceMethod · 0.60
branchMethod · 0.45

Tested by

no test coverage detected