diff --git a/netkat/symbolic_packet.cc b/netkat/symbolic_packet.cc index 3f12450..b9b27e0 100644 --- a/netkat/symbolic_packet.cc +++ b/netkat/symbolic_packet.cc @@ -92,12 +92,12 @@ SymbolicPacket SymbolicPacketManager::NodeToPacket(DecisionNode&& node) { // expensive. #ifndef NDEBUG for (const auto& [value, branch] : node.branch_by_field_value) { - CHECK(branch != node.default_branch) << PrettyPrint(node); + CHECK(branch != node.default_branch) << ToString(node); if (!IsEmptySet(branch) && !IsFullSet(branch)) { auto& branch_node = GetNodeOrDie(branch); CHECK(branch_node.field > node.field) << absl::StreamFormat( "(%v > %v)\n---branch---\n%s\n---node---\n%s", branch_node.field, - node.field, PrettyPrint(branch), PrettyPrint(node)); + node.field, ToString(branch), ToString(node)); } } #endif @@ -297,7 +297,7 @@ SymbolicPacket SymbolicPacketManager::Xor(SymbolicPacket left, return Or(And(Not(left), right), And(left, Not(right))); } -std::string SymbolicPacketManager::PrettyPrint(SymbolicPacket packet) const { +std::string SymbolicPacketManager::ToString(SymbolicPacket packet) const { std::string result; std::queue work_list{{packet}}; absl::flat_hash_set visited{packet}; @@ -329,7 +329,7 @@ std::string SymbolicPacketManager::PrettyPrint(SymbolicPacket packet) const { return result; } -std::string SymbolicPacketManager::PrettyPrint(const DecisionNode& node) const { +std::string SymbolicPacketManager::ToString(const DecisionNode& node) const { std::string result; std::vector work_list; std::string field = @@ -346,7 +346,7 @@ std::string SymbolicPacketManager::PrettyPrint(const DecisionNode& node) const { } for (const SymbolicPacket& branch : work_list) { - absl::StrAppend(&result, PrettyPrint(branch)); + absl::StrAppend(&result, ToString(branch)); } return result; diff --git a/netkat/symbolic_packet.h b/netkat/symbolic_packet.h index ffd0a3c..f4d59d9 100644 --- a/netkat/symbolic_packet.h +++ b/netkat/symbolic_packet.h @@ -223,7 +223,7 @@ class SymbolicPacketManager { // Returns a human-readable string representation of the given `packet`, // intended for debugging. - [[nodiscard]] std::string PrettyPrint(SymbolicPacket packet) const; + [[nodiscard]] std::string ToString(SymbolicPacket packet) const; // Dynamically checks all class invariants. Exposed for testing only. absl::Status CheckInternalInvariants() const; @@ -332,7 +332,7 @@ class SymbolicPacketManager { // is NOT expected to be called with these special packets that crash. const DecisionNode& GetNodeOrDie(SymbolicPacket packet) const; - [[nodiscard]] std::string PrettyPrint(const DecisionNode& node) const; + [[nodiscard]] std::string ToString(const DecisionNode& node) const; // The page size of the `nodes_` vector: 64 MiB or ~ 67 MB. // Chosen large enough to reduce the cost of dynamic allocation, and small diff --git a/netkat/symbolic_packet_test.cc b/netkat/symbolic_packet_test.cc index 02afcc5..a65ff19 100644 --- a/netkat/symbolic_packet_test.cc +++ b/netkat/symbolic_packet_test.cc @@ -43,7 +43,7 @@ SymbolicPacketManager& Manager() { // // We define this much better override, which GoogleTest gives precedence to. void PrintTo(const SymbolicPacket& packet, std::ostream* os) { - *os << Manager().PrettyPrint(packet); + *os << Manager().ToString(packet); } namespace {