forked from tkn-tub/ns3-gym
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
core: refactor LogTimePrinter, LogNodePrinter
- Loading branch information
Peter D. Barnes, Jr.
committed
Oct 19, 2018
1 parent
dff5692
commit 4ed3987
Showing
10 changed files
with
260 additions
and
95 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ | ||
/* | ||
* Copyright (c) 2018 Lawrence Livermore National Laboratory | ||
* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License version 2 as | ||
* published by the Free Software Foundation; | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program; if not, write to the Free Software | ||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
* | ||
* Author: Peter D. Barnes, Jr. <[email protected]> | ||
*/ | ||
|
||
#include "log.h" | ||
#include "node-printer.h" | ||
#include "simulator.h" // GetContext() | ||
|
||
#include <iomanip> | ||
|
||
/** | ||
* \file | ||
* \ingroup simulator | ||
* ns3::DefaultNodePrinter implementation. | ||
*/ | ||
|
||
namespace ns3 { | ||
|
||
NS_LOG_COMPONENT_DEFINE ("NodePrinter"); | ||
|
||
/** | ||
* \ingroup logging | ||
* Default node id printer implementation. | ||
* | ||
* \param [in,out] os The output stream to print the node id on. | ||
*/ | ||
void | ||
DefaultNodePrinter (std::ostream &os) | ||
{ | ||
if (Simulator::GetContext () == Simulator::NO_CONTEXT) | ||
{ | ||
os << "-1"; | ||
} | ||
else | ||
{ | ||
os << Simulator::GetContext (); | ||
} | ||
} | ||
|
||
|
||
|
||
} // namespace ns3 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ | ||
/* | ||
* Copyright (c) 2018 Lawrence Livermore National Laboratory | ||
* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License version 2 as | ||
* published by the Free Software Foundation; | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program; if not, write to the Free Software | ||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
* | ||
* Author: Peter D. Barnes, Jr. <[email protected]> | ||
*/ | ||
#ifndef NODE_PRINTER_H | ||
#define NODE_PRINTER_H | ||
|
||
#include <ostream> | ||
|
||
/** | ||
* \file | ||
* \ingroup logging | ||
* Declaration of ns3::NodePrinter function pointer type | ||
* and ns3::DefaultNodePrinter function. | ||
*/ | ||
|
||
namespace ns3 { | ||
|
||
/** | ||
* Function signature for prepending the node id | ||
* to a log message. | ||
* | ||
* \param [in,out] os The output stream to print on. | ||
*/ | ||
typedef void (*NodePrinter)(std::ostream &os); | ||
|
||
/** | ||
* Default Node printer. | ||
* | ||
* \param [in,out] os The output stream to print on. | ||
*/ | ||
void DefaultNodePrinter (std::ostream &os); | ||
|
||
} // namespace ns3 | ||
|
||
#endif /* NODE_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.