35 : m_outputFileNameWithoutExtension(outputFileNameWithoutExtension),
36 m_graphicsFileName(m_outputFileNameWithoutExtension +
".png"),
37 m_title(
"Data Values"),
38 m_xLegend(
"X Values"),
39 m_yLegend(
"Y Values"),
41 m_xAndYLegendsSet(false),
42 m_gnuplot(m_graphicsFileName)
52 NS_LOG_WARN(
"Warning: The plot title was not set for the gnuplot aggregator");
56 NS_LOG_WARN(
"Warning: The axis legends were not set for the gnuplot aggregator");
64 std::ofstream plotFile;
65 plotFile.open(plotFileName);
66 std::ofstream dataFile;
67 dataFile.open(dataFileName);
80 std::ofstream scriptFile;
81 scriptFile.open(scriptFileName);
84 scriptFile <<
"#!/bin/sh" << std::endl;
85 scriptFile << std::endl;
86 scriptFile <<
"gnuplot " << plotFileName << std::endl;
99 NS_ABORT_MSG(
"Dataset " << context <<
" has not been added");
119 NS_ABORT_MSG(
"Dataset " << context <<
" has not been added");
139 NS_ABORT_MSG(
"Dataset " << context <<
" has not been added");
156 NS_LOG_FUNCTION(
this << context << x << y << xErrorDelta << yErrorDelta);
160 NS_ABORT_MSG(
"Dataset " << context <<
" has not been added");
218 NS_ABORT_MSG(
"Dataset " << dataset <<
" has already been added");
242 NS_ABORT_MSG(
"Dataset " << dataset <<
" has not been added");
255 NS_ABORT_MSG(
"Dataset " << dataset <<
" has not been added");
278 NS_ABORT_MSG(
"Dataset " << dataset <<
" has not been added");
299 NS_ABORT_MSG(
"Dataset " << dataset <<
" has not been added");
Base class for data collection framework objects.
bool m_enabled
Object's activation state.
Class to represent a 2D points plot.
static void SetDefaultStyle(Style style)
Change default style for all newly created objects.
ErrorBars
Whether errorbars should be used for this dataset.
static void SetDefaultErrorBars(ErrorBars errorBars)
Change default errorbars style for all newly created objects.
Style
The plotting style to use for this dataset.
void Write2dDatasetEmptyLine(const std::string &dataset)
Add an empty line in the data output sequence.
GnuplotAggregator(const std::string &outputFileNameWithoutExtension)
void Write2dWithXErrorDelta(std::string context, double x, double y, double errorDelta)
Writes a 2D value to a 2D gnuplot dataset with error bars in the x direction.
static void Set2dDatasetDefaultExtra(const std::string &extra)
Change extra formatting style parameters for newly created objects.
Gnuplot m_gnuplot
Used to create gnuplot files.
void Write2d(std::string context, double x, double y)
Writes a 2D value to a 2D gnuplot dataset.
std::string m_graphicsFileName
The graphics file name with its extension.
bool m_xAndYLegendsSet
Set equal to true after setting the x and y legends.
void Set2dDatasetExtra(const std::string &dataset, const std::string &extra)
Add extra formatting parameters to this dataset.
void AppendExtra(const std::string &extra)
void Write2dWithYErrorDelta(std::string context, double x, double y, double errorDelta)
Writes a 2D value to a 2D gnuplot dataset with error bars in the y direction.
std::string m_outputFileNameWithoutExtension
The output file name without any extension.
static TypeId GetTypeId()
Get the type ID.
bool m_titleSet
Set equal to true after setting the title.
static void Set2dDatasetDefaultStyle(Gnuplot2dDataset::Style style)
Change default style for all newly created objects.
void Write2dWithXYErrorDelta(std::string context, double x, double y, double xErrorDelta, double yErrorDelta)
Writes a 2D value to a 2D gnuplot dataset with error bars in the x and y directions.
KeyLocation
The location of the key in the plot.
void SetTerminal(const std::string &terminal)
void Add2dDataset(const std::string &dataset, const std::string &title)
Adds a 2D dataset to the plot.
std::map< std::string, Gnuplot2dDataset > m_2dDatasetMap
Maps context strings to 2D datasets.
static void Set2dDatasetDefaultErrorBars(Gnuplot2dDataset::ErrorBars errorBars)
Change default errorbars style for all newly created objects.
void SetLegend(const std::string &xLegend, const std::string &yLegend)
void Set2dDatasetErrorBars(const std::string &dataset, Gnuplot2dDataset::ErrorBars errorBars)
Set the error bars to use for this dataset.
void Set2dDatasetStyle(const std::string &dataset, Gnuplot2dDataset::Style style)
Set the style of plotting to use for this dataset.
void SetKeyLocation(KeyLocation keyLocation)
Set the location of the key in the plot.
~GnuplotAggregator() override
void SetTitle(const std::string &title)
void SetExtra(const std::string &extra)
static void SetDefaultExtra(const std::string &extra)
Change extra formatting style parameters for newly created objects.
void AddDataset(const GnuplotDataset &dataset)
void SetLegend(const std::string &xLegend, const std::string &yLegend)
void SetTerminal(const std::string &terminal)
void AppendExtra(const std::string &extra)
void GenerateOutput(std::ostream &os)
Writes gnuplot commands and data values to a single output stream.
void SetExtra(const std::string &extra)
void SetTitle(const std::string &title)
void SetOutputFilename(const std::string &outputFilename)
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
#define NS_ABORT_MSG(msg)
Unconditional abnormal program termination with a message.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#define NS_LOG_WARN(msg)
Use NS_LOG to output a message of level LOG_WARN.
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Every class exported by the ns3 library is enclosed in the ns3 namespace.