From 2c4866e6e6a6a0ba5dd822624461871df852734e Mon Sep 17 00:00:00 2001 From: Varun Agrawal Date: Wed, 31 Aug 2022 12:30:36 -0400 Subject: [PATCH] DiscreteKeys::print method --- gtsam/discrete/DiscreteKey.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/gtsam/discrete/DiscreteKey.h b/gtsam/discrete/DiscreteKey.h index dea00074d..297d5570d 100644 --- a/gtsam/discrete/DiscreteKey.h +++ b/gtsam/discrete/DiscreteKey.h @@ -69,6 +69,16 @@ namespace gtsam { push_back(key); return *this; } + + /// Print the keys and cardinalities. + void print(const std::string& s = "", + const KeyFormatter& keyFormatter = DefaultKeyFormatter) const { + for (auto&& dkey : *this) { + std::cout << DefaultKeyFormatter(dkey.first) << " " << dkey.second + << std::endl; + } + } + }; // DiscreteKeys /// Create a list from two keys