This aggregator produces output used to make gnuplot plots. More...
#include "gnuplot-aggregator.h"
Public Types | |
enum | KeyLocation { NO_KEY , KEY_INSIDE , KEY_ABOVE , KEY_BELOW } |
The location of the key in the plot. More... | |
Public Member Functions | |
GnuplotAggregator (const std::string &outputFileNameWithoutExtension) | |
~GnuplotAggregator () override | |
void | Add2dDataset (const std::string &dataset, const std::string &title) |
Adds a 2D dataset to the plot. | |
void | AppendExtra (const std::string &extra) |
void | Set2dDatasetErrorBars (const std::string &dataset, Gnuplot2dDataset::ErrorBars errorBars) |
Set the error bars to use for this dataset. | |
void | Set2dDatasetExtra (const std::string &dataset, const std::string &extra) |
Add extra formatting parameters to this dataset. | |
void | Set2dDatasetStyle (const std::string &dataset, Gnuplot2dDataset::Style style) |
Set the style of plotting to use for this dataset. | |
void | SetExtra (const std::string &extra) |
void | SetKeyLocation (KeyLocation keyLocation) |
Set the location of the key in the plot. | |
void | SetLegend (const std::string &xLegend, const std::string &yLegend) |
void | SetTerminal (const std::string &terminal) |
void | SetTitle (const std::string &title) |
void | Write2d (std::string context, double x, double y) |
Writes a 2D value to a 2D gnuplot dataset. | |
void | Write2dDatasetEmptyLine (const std::string &dataset) |
Add an empty line in the data output sequence. | |
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. | |
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. | |
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. | |
Public Member Functions inherited from ns3::DataCollectionObject | |
DataCollectionObject () | |
~DataCollectionObject () override | |
void | Disable () |
Unset the status of an individual object. | |
void | Enable () |
Set the status of an individual object. | |
std::string | GetName () const |
Get the object's name. | |
virtual bool | IsEnabled () const |
Check the status of an individual object. | |
void | SetName (std::string name) |
Set the object's name. | |
Public Member Functions inherited from ns3::Object | |
Object () | |
Constructor. | |
~Object () override | |
Destructor. | |
void | AggregateObject (Ptr< Object > other) |
Aggregate two Objects together. | |
void | Dispose () |
Dispose of this Object. | |
AggregateIterator | GetAggregateIterator () const |
Get an iterator to the Objects aggregated to this one. | |
TypeId | GetInstanceTypeId () const override |
Get the most derived TypeId for this Object. | |
template<typename T > | |
Ptr< T > | GetObject () const |
Get a pointer to the requested aggregated Object. | |
template<> | |
Ptr< Object > | GetObject () const |
Specialization of () for objects of type ns3::Object. | |
template<typename T > | |
Ptr< T > | GetObject (TypeId tid) const |
Get a pointer to the requested aggregated Object by TypeId. | |
template<> | |
Ptr< Object > | GetObject (TypeId tid) const |
Specialization of (TypeId tid) for objects of type ns3::Object. | |
void | Initialize () |
Invoke DoInitialize on all Objects aggregated to this one. | |
bool | IsInitialized () const |
Check if the object has been initialized. | |
void | UnidirectionalAggregateObject (Ptr< Object > other) |
Aggregate an Object to another Object. | |
Public Member Functions inherited from ns3::SimpleRefCount< Object, ObjectBase, ObjectDeleter > | |
SimpleRefCount () | |
Default constructor. | |
SimpleRefCount (const SimpleRefCount &o) | |
Copy constructor. | |
uint32_t | GetReferenceCount () const |
Get the reference count of the object. | |
SimpleRefCount & | operator= (const SimpleRefCount &o) |
Assignment operator. | |
void | Ref () const |
Increment the reference count. | |
void | Unref () const |
Decrement the reference count. | |
Public Member Functions inherited from ns3::ObjectBase | |
virtual | ~ObjectBase () |
Virtual destructor. | |
void | GetAttribute (std::string name, AttributeValue &value, bool permissive=false) const |
Get the value of an attribute, raising fatal errors if unsuccessful. | |
bool | GetAttributeFailSafe (std::string name, AttributeValue &value) const |
Get the value of an attribute without raising errors. | |
void | SetAttribute (std::string name, const AttributeValue &value) |
Set a single attribute, raising fatal errors if unsuccessful. | |
bool | SetAttributeFailSafe (std::string name, const AttributeValue &value) |
Set a single attribute without raising errors. | |
bool | TraceConnect (std::string name, std::string context, const CallbackBase &cb) |
Connect a TraceSource to a Callback with a context. | |
bool | TraceConnectWithoutContext (std::string name, const CallbackBase &cb) |
Connect a TraceSource to a Callback without a context. | |
bool | TraceDisconnect (std::string name, std::string context, const CallbackBase &cb) |
Disconnect from a TraceSource a Callback previously connected with a context. | |
bool | TraceDisconnectWithoutContext (std::string name, const CallbackBase &cb) |
Disconnect from a TraceSource a Callback previously connected without a context. | |
Static Public Member Functions | |
static TypeId | GetTypeId () |
Get the type ID. | |
static void | Set2dDatasetDefaultErrorBars (Gnuplot2dDataset::ErrorBars errorBars) |
Change default errorbars style for all newly created objects. | |
static void | Set2dDatasetDefaultExtra (const std::string &extra) |
Change extra formatting style parameters for newly created objects. | |
static void | Set2dDatasetDefaultStyle (Gnuplot2dDataset::Style style) |
Change default style for all newly created objects. | |
Static Public Member Functions inherited from ns3::DataCollectionObject | |
static TypeId | GetTypeId () |
Get the type ID. | |
Static Public Member Functions inherited from ns3::Object | |
static TypeId | GetTypeId () |
Register this type. | |
Static Public Member Functions inherited from ns3::ObjectBase | |
static TypeId | GetTypeId () |
Get the type ID. | |
Private Attributes | |
std::map< std::string, Gnuplot2dDataset > | m_2dDatasetMap |
Maps context strings to 2D datasets. | |
std::string | m_extra |
The extra gnuplot command that will be added to the gnuplot control statements. | |
Gnuplot | m_gnuplot |
Used to create gnuplot files. | |
std::string | m_graphicsFileName |
The graphics file name with its extension. | |
std::string | m_outputFileNameWithoutExtension |
The output file name without any extension. | |
std::string | m_terminal |
The terminal. | |
std::string | m_title |
The title. | |
bool | m_titleSet |
Set equal to true after setting the title. | |
bool | m_xAndYLegendsSet |
Set equal to true after setting the x and y legends. | |
std::string | m_xLegend |
The x legend. | |
std::string | m_yLegend |
The y legend. | |
Additional Inherited Members | |
Protected Member Functions inherited from ns3::Object | |
Object (const Object &o) | |
Copy an Object. | |
virtual void | DoDispose () |
Destructor implementation. | |
virtual void | DoInitialize () |
Initialize() implementation. | |
virtual void | NotifyNewAggregate () |
Notify all Objects aggregated to this one of a new Object being aggregated. | |
Protected Member Functions inherited from ns3::ObjectBase | |
void | ConstructSelf (const AttributeConstructionList &attributes) |
Complete construction of ObjectBase; invoked by derived classes. | |
virtual void | NotifyConstructionCompleted () |
Notifier called once the ObjectBase is fully constructed. | |
Protected Attributes inherited from ns3::DataCollectionObject | |
bool | m_enabled |
Object's activation state. | |
std::string | m_name |
Name of the object within the data collection framework. | |
Related Symbols inherited from ns3::ObjectBase | |
static TypeId | GetObjectIid () |
Ensure the TypeId for ObjectBase gets fully configured to anchor the inheritance tree properly. | |
This aggregator produces output used to make gnuplot plots.
Definition at line 28 of file gnuplot-aggregator.h.
The location of the key in the plot.
Enumerator | |
---|---|
NO_KEY | |
KEY_INSIDE | |
KEY_ABOVE | |
KEY_BELOW |
Definition at line 32 of file gnuplot-aggregator.h.
ns3::GnuplotAggregator::GnuplotAggregator | ( | const std::string & | outputFileNameWithoutExtension | ) |
outputFileNameWithoutExtension | name of gnuplot related files to write with no extension |
Constructs a gnuplot file aggregator that will create a space separated gnuplot data file named outputFileNameWithoutExtension
Definition at line 34 of file gnuplot-aggregator.cc.
References NS_LOG_FUNCTION.
|
override |
Definition at line 47 of file gnuplot-aggregator.cc.
References ns3::Gnuplot::AppendExtra(), ns3::Gnuplot::GenerateOutput(), m_gnuplot, m_outputFileNameWithoutExtension, m_titleSet, m_xAndYLegendsSet, NS_LOG_FUNCTION, and NS_LOG_WARN.
void ns3::GnuplotAggregator::Add2dDataset | ( | const std::string & | dataset, |
const std::string & | title ) |
Adds a 2D dataset to the plot.
dataset | the gnuplot 2D dataset to be plotted. |
title | the title to be associated to this dataset. |
Creates an empty dataset. Usually, the dataset's title is displayed in the legend box.
The string in dataset should match the context for the Collector it is connected to.
Definition at line 212 of file gnuplot-aggregator.cc.
References ns3::Gnuplot::AddDataset(), m_2dDatasetMap, m_gnuplot, NS_ABORT_MSG, and NS_LOG_FUNCTION.
void ns3::GnuplotAggregator::AppendExtra | ( | const std::string & | extra | ) |
extra | append extra gnuplot directive for output. |
Definition at line 205 of file gnuplot-aggregator.cc.
References ns3::Gnuplot::AppendExtra(), m_gnuplot, and NS_LOG_FUNCTION.
|
static |
Get the type ID.
Definition at line 26 of file gnuplot-aggregator.cc.
References ns3::TypeId::SetParent().
|
static |
Change default errorbars style for all newly created objects.
errorBars | the style of errorbars to use for newly created datasets. |
Definition at line 286 of file gnuplot-aggregator.cc.
References NS_LOG_FUNCTION, and ns3::Gnuplot2dDataset::SetDefaultErrorBars().
|
static |
Change extra formatting style parameters for newly created objects.
extra | extra formatting |
Definition at line 230 of file gnuplot-aggregator.cc.
References NS_LOG_FUNCTION, and ns3::GnuplotDataset::SetDefaultExtra().
|
static |
Change default style for all newly created objects.
style | the style of plotting to use for newly created datasets. |
Definition at line 266 of file gnuplot-aggregator.cc.
References NS_LOG_FUNCTION, and ns3::Gnuplot2dDataset::SetDefaultStyle().
void ns3::GnuplotAggregator::Set2dDatasetErrorBars | ( | const std::string & | dataset, |
Gnuplot2dDataset::ErrorBars | errorBars ) |
Set the error bars to use for this dataset.
dataset | the gnuplot 2D dataset to be plotted. |
errorBars | the style of errorbars to display. |
If you use any style other than none, you need to make sure you store the delta information in this dataset with the right GnuplotDataset::Add method.
The string in dataset should match the context for the Collector it is connected to.
Definition at line 293 of file gnuplot-aggregator.cc.
References m_2dDatasetMap, NS_ABORT_MSG, and NS_LOG_FUNCTION.
void ns3::GnuplotAggregator::Set2dDatasetExtra | ( | const std::string & | dataset, |
const std::string & | extra ) |
Add extra formatting parameters to this dataset.
dataset | the gnuplot 2D dataset to be plotted. |
extra | extra formatting |
The string in dataset should match the context for the Collector it is connected to.
Definition at line 237 of file gnuplot-aggregator.cc.
References m_2dDatasetMap, NS_ABORT_MSG, and NS_LOG_FUNCTION.
void ns3::GnuplotAggregator::Set2dDatasetStyle | ( | const std::string & | dataset, |
Gnuplot2dDataset::Style | style ) |
Set the style of plotting to use for this dataset.
dataset | the gnuplot 2D dataset to be plotted. |
style | the style of plotting to use for this dataset. |
The string in dataset should match the context for the Collector it is connected to.
Definition at line 273 of file gnuplot-aggregator.cc.
References m_2dDatasetMap, NS_ABORT_MSG, and NS_LOG_FUNCTION.
void ns3::GnuplotAggregator::SetExtra | ( | const std::string & | extra | ) |
extra | set extra gnuplot directive for output. |
Definition at line 198 of file gnuplot-aggregator.cc.
References m_gnuplot, NS_LOG_FUNCTION, and ns3::Gnuplot::SetExtra().
void ns3::GnuplotAggregator::SetKeyLocation | ( | GnuplotAggregator::KeyLocation | keyLocation | ) |
Set the location of the key in the plot.
keyLocation | the location of the key in the plot. |
Definition at line 307 of file gnuplot-aggregator.cc.
References ns3::Gnuplot::AppendExtra(), KEY_ABOVE, KEY_BELOW, m_gnuplot, NO_KEY, and NS_LOG_FUNCTION.
void ns3::GnuplotAggregator::SetLegend | ( | const std::string & | xLegend, |
const std::string & | yLegend ) |
xLegend | the legend for the x horizontal axis |
yLegend | the legend for the y vertical axis |
Definition at line 190 of file gnuplot-aggregator.cc.
References m_gnuplot, m_xAndYLegendsSet, NS_LOG_FUNCTION, and ns3::Gnuplot::SetLegend().
void ns3::GnuplotAggregator::SetTerminal | ( | const std::string & | terminal | ) |
terminal | terminal setting string for output. The default terminal string is "png" |
Definition at line 171 of file gnuplot-aggregator.cc.
References m_gnuplot, m_graphicsFileName, m_outputFileNameWithoutExtension, ns3::Gnuplot::SetOutputFilename(), and ns3::Gnuplot::SetTerminal().
void ns3::GnuplotAggregator::SetTitle | ( | const std::string & | title | ) |
title | set new plot title string to use for this plot. |
Definition at line 182 of file gnuplot-aggregator.cc.
References m_gnuplot, m_titleSet, NS_LOG_FUNCTION, and ns3::Gnuplot::SetTitle().
Writes a 2D value to a 2D gnuplot dataset.
context | specifies the gnuplot 2D dataset for these values |
x | x coordinate for the new data point |
y | y coordinate for the new data point |
Use this method with error bar style NONE.
Definition at line 93 of file gnuplot-aggregator.cc.
References m_2dDatasetMap, ns3::DataCollectionObject::m_enabled, NS_ABORT_MSG, and NS_LOG_FUNCTION.
Referenced by ns3::GnuplotHelper::ConnectProbeToAggregator().
void ns3::GnuplotAggregator::Write2dDatasetEmptyLine | ( | const std::string & | dataset | ) |
Add an empty line in the data output sequence.
dataset | the gnuplot 2D dataset to be plotted. |
Writes an empty line in the plot data, which breaks continuous lines and does other things in the output.
The string in dataset should match the context for the Collector it is connected to.
Definition at line 250 of file gnuplot-aggregator.cc.
References m_2dDatasetMap, ns3::DataCollectionObject::m_enabled, NS_ABORT_MSG, and NS_LOG_FUNCTION.
void ns3::GnuplotAggregator::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.
context | specifies the gnuplot 2D dataset for these values |
x | x coordinate for the new data point |
y | y coordinate for the new data point |
errorDelta | x data point uncertainty |
Use this method with error bar style X.
Definition at line 110 of file gnuplot-aggregator.cc.
References m_2dDatasetMap, ns3::DataCollectionObject::m_enabled, NS_ABORT_MSG, and NS_LOG_FUNCTION.
void ns3::GnuplotAggregator::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.
context | specifies the gnuplot 2D dataset for these values |
x | x coordinate for the new data point |
y | y coordinate for the new data point |
xErrorDelta | x data point uncertainty |
yErrorDelta | y data point uncertainty |
Use this method with error bar style XY.
Definition at line 150 of file gnuplot-aggregator.cc.
References m_2dDatasetMap, ns3::DataCollectionObject::m_enabled, NS_ABORT_MSG, and NS_LOG_FUNCTION.
void ns3::GnuplotAggregator::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.
context | specifies the gnuplot 2D dataset for these values |
x | x coordinate for the new data point |
y | y coordinate for the new data point |
errorDelta | y data point uncertainty |
Use this method with error bar style Y.
Definition at line 130 of file gnuplot-aggregator.cc.
References m_2dDatasetMap, ns3::DataCollectionObject::m_enabled, NS_ABORT_MSG, and NS_LOG_FUNCTION.
|
private |
Maps context strings to 2D datasets.
Definition at line 278 of file gnuplot-aggregator.h.
Referenced by Add2dDataset(), Set2dDatasetErrorBars(), Set2dDatasetExtra(), Set2dDatasetStyle(), Write2d(), Write2dDatasetEmptyLine(), Write2dWithXErrorDelta(), Write2dWithXYErrorDelta(), and Write2dWithYErrorDelta().
|
private |
The extra gnuplot command that will be added to the gnuplot control statements.
Definition at line 266 of file gnuplot-aggregator.h.
|
private |
Used to create gnuplot files.
Definition at line 275 of file gnuplot-aggregator.h.
Referenced by ~GnuplotAggregator(), Add2dDataset(), AppendExtra(), SetExtra(), SetKeyLocation(), SetLegend(), SetTerminal(), and SetTitle().
|
private |
The graphics file name with its extension.
Definition at line 250 of file gnuplot-aggregator.h.
Referenced by SetTerminal().
|
private |
The output file name without any extension.
Definition at line 247 of file gnuplot-aggregator.h.
Referenced by ~GnuplotAggregator(), and SetTerminal().
|
private |
The terminal.
Definition at line 256 of file gnuplot-aggregator.h.
|
private |
The title.
Definition at line 253 of file gnuplot-aggregator.h.
|
private |
Set equal to true after setting the title.
Definition at line 269 of file gnuplot-aggregator.h.
Referenced by ~GnuplotAggregator(), and SetTitle().
|
private |
Set equal to true after setting the x and y legends.
Definition at line 272 of file gnuplot-aggregator.h.
Referenced by ~GnuplotAggregator(), and SetLegend().
|
private |
The x legend.
Definition at line 259 of file gnuplot-aggregator.h.
|
private |
The y legend.
Definition at line 262 of file gnuplot-aggregator.h.