Furthermore note that this should take several modes, similar to the discussion with `blockModel` / `getLearnedLiterals`. It is currently limited to a fixed print mode.
CVC5_API_TRY_CATCH_END;
}
-void Solver::printInstantiations(std::ostream& out) const
+std::string Solver::getInstantiations() const
{
CVC5_API_TRY_CATCH_BEGIN;
//////// all checks before this line
- d_slv->printInstantiations(out);
+ std::stringstream ss;
+ d_slv->printInstantiations(ss);
+ return ss.str();
////////
CVC5_API_TRY_CATCH_END;
}
void blockModelValues(const std::vector<Term>& terms) const;
/**
- * Print all instantiations made by the quantifiers module.
- * @param out the output stream
+ * @return a string that contains information about all instantiations made by
+ * the quantifiers module.
*/
- void printInstantiations(std::ostream& out) const;
+ std::string getInstantiations() const;
/**
* Push (a) level(s) to the assertion stack.
private native void blockModelValues(long pointer, long[] termPointers);
/**
- * Print all instantiations made by the quantifiers module.
- * @param out the output stream
+ * Return a string that contains information about all instantiations made by
+ * the quantifiers module.
*/
- // TODO: void printInstantiations(std::ostream& out)
+ public String getInstantiations()
+ {
+ return getInstantiations(pointer);
+ }
+
+ private native String getInstantiations(long pointer);
/**
* Push a level to the assertion stack.
CVC5_JAVA_API_TRY_CATCH_END(env);
}
+/*
+ * Class: io_github_cvc5_api_Solver
+ * Method: getInstantiations
+ * Signature: (J[J[J)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL
+Java_io_github_cvc5_api_Solver_getInstantiations(JNIEnv* env,
+ jobject,
+ jlong pointer)
+{
+ CVC5_JAVA_API_TRY_CATCH_BEGIN;
+ Solver* solver = reinterpret_cast<Solver*>(pointer);
+ std::string insts = solver->getInstantiations();
+ return env->NewStringUTF(insts.c_str());
+ CVC5_JAVA_API_TRY_CATCH_END_RETURN(env, 0);
+}
+
/*
* Class: io_github_cvc5_api_Solver
* Method: push
bint getAbductNext(const Term& conj) except +
void blockModel() except +
void blockModelValues(const vector[Term]& terms) except +
+ string getInstantiations() except +
cdef cppclass Grammar:
Grammar() except +
nts.push_back((<Term?> t).cterm)
self.csolver.blockModelValues(nts)
+ def getInstantiations(self):
+ """
+ Return a string that contains information about all instantiations made
+ by the quantifiers module.
+ """
+ return self.csolver.getInstantiations()
+
cdef class Sort:
"""
}
else
{
- d_solver->printInstantiations(out);
+ out << d_solver->getInstantiations();
}
}