From ee510df4ec30b2c2e3f8b7fb22aa7abed7148216 Mon Sep 17 00:00:00 2001 From: Tom Janson Date: Fri, 17 Mar 2017 16:57:52 +0100 Subject: [PATCH] add Path stream print for debug / Python __str__ --- src/storm/utility/shortestPaths.cpp | 11 +++++++++++ src/storm/utility/shortestPaths.h | 3 +++ 2 files changed, 14 insertions(+) diff --git a/src/storm/utility/shortestPaths.cpp b/src/storm/utility/shortestPaths.cpp index 19ba70983..c2f6a97b9 100644 --- a/src/storm/utility/shortestPaths.cpp +++ b/src/storm/utility/shortestPaths.cpp @@ -1,3 +1,4 @@ +#include #include #include #include @@ -373,6 +374,16 @@ namespace storm { template class ShortestPathsGenerator; + + // only prints the info stored in the Path struct; + // does not traverse the actual path (see printKShortestPath for that) + template + std::ostream& operator<<(std::ostream& out, Path const& p) { + out << "Path with predecessorNode: " << ((p.predecessorNode) ? std::to_string(p.predecessorNode.get()) : "None"); + out << " predecessorK: " << p.predecessorK << " distance: " << p.distance; + return out; + } + template std::ostream& operator<<(std::ostream& out, Path const& p); } } } diff --git a/src/storm/utility/shortestPaths.h b/src/storm/utility/shortestPaths.h index 359a30c5e..ad344f1aa 100644 --- a/src/storm/utility/shortestPaths.h +++ b/src/storm/utility/shortestPaths.h @@ -55,6 +55,9 @@ namespace storm { } }; + template + std::ostream& operator<<(std::ostream& out, Path const& p); + // when using the raw matrix/vector invocation, this enum parameter // forces the caller to declare whether the matrix has the evil I-P // format, which requires back-conversion of the entries