2018-10-19 00:48:53 -04:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2018 Lawrence Livermore National Laboratory
|
|
|
|
|
*
|
2024-06-17 16:17:10 +02:00
|
|
|
* SPDX-License-Identifier: GPL-2.0-only
|
2018-10-19 00:48:53 -04:00
|
|
|
*
|
|
|
|
|
* Author: Peter D. Barnes, Jr. <pdbarnes@llnl.gov>
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include "node-printer.h"
|
2022-10-07 20:08:35 +00:00
|
|
|
|
|
|
|
|
#include "log.h"
|
|
|
|
|
#include "simulator.h" // GetContext()
|
2018-10-19 00:48:53 -04:00
|
|
|
|
|
|
|
|
#include <iomanip>
|
|
|
|
|
|
|
|
|
|
/**
|
2024-11-08 18:05:46 +00:00
|
|
|
* @file
|
|
|
|
|
* @ingroup simulator
|
2018-10-19 00:48:53 -04:00
|
|
|
* ns3::DefaultNodePrinter implementation.
|
|
|
|
|
*/
|
|
|
|
|
|
2022-10-07 20:08:35 +00:00
|
|
|
namespace ns3
|
|
|
|
|
{
|
2018-10-19 00:48:53 -04:00
|
|
|
|
2022-10-07 20:08:35 +00:00
|
|
|
NS_LOG_COMPONENT_DEFINE("NodePrinter");
|
2018-10-19 00:48:53 -04:00
|
|
|
|
|
|
|
|
void
|
2022-10-07 20:08:35 +00:00
|
|
|
DefaultNodePrinter(std::ostream& os)
|
2018-10-19 00:48:53 -04:00
|
|
|
{
|
2022-10-07 20:08:35 +00:00
|
|
|
if (Simulator::GetContext() == Simulator::NO_CONTEXT)
|
2018-10-19 00:48:53 -04:00
|
|
|
{
|
2022-10-07 20:08:35 +00:00
|
|
|
os << "-1";
|
2018-10-19 00:48:53 -04:00
|
|
|
}
|
2022-10-07 20:08:35 +00:00
|
|
|
else
|
2018-10-19 00:48:53 -04:00
|
|
|
{
|
2022-10-07 20:08:35 +00:00
|
|
|
os << Simulator::GetContext();
|
2018-10-19 00:48:53 -04:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} // namespace ns3
|