1 #ifndef CPPAD_CG_DOT_UTIL_INCLUDED
2 #define CPPAD_CG_DOT_UTIL_INCLUDED
18 #include <cppad/cg/lang/c/lang_c_default_var_name_gen.hpp>
27 inline void printDotExpression(CG<Base>& dep,
28 std::ostream& out = std::cout) {
29 if (dep.getOperationNode() !=
nullptr) {
30 if (dep.getOperationNode()->getCodeHandler() ==
nullptr) {
31 throw CGException(
"Unable to print expression: found an operation node without a CodeHandler!");
34 CodeHandler<Base>& handler = *dep.getOperationNode()->getCodeHandler();
35 LanguageDot<double> langDot;
36 LangCDefaultVariableNameGenerator<double> nameGen;
38 std::vector<CG<Base> > depv(1);
41 std::ostringstream code;
42 handler.generateCode(code, langDot, depv, nameGen);
46 "\"" << dep.getValue() <<
"\" -> \"y[0]\"\n"
52 inline void printDotExpression(OperationNode<Base>& dep,
53 std::ostream& out = std::cout) {
54 printDotExpression(CG<Base>(dep), out);