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) | |
virtual | ~GnuplotAggregator () |
void | Add2dDataset (const std::string &dataset, const std::string &title) |
Adds a 2D dataset to the plot. More... | |
void | AppendExtra (const std::string &extra) |
void | Set2dDatasetErrorBars (const std::string &dataset, enum Gnuplot2dDataset::ErrorBars errorBars) |
Set the error bars to use for this dataset. More... | |
void | Set2dDatasetExtra (const std::string &dataset, const std::string &extra) |
Add extra formatting parameters to this dataset. More... | |
void | Set2dDatasetStyle (const std::string &dataset, enum Gnuplot2dDataset::Style style) |
Set the style of plotting to use for this dataset. More... | |
void | SetExtra (const std::string &extra) |
void | SetKeyLocation (enum KeyLocation keyLocation) |
Set the location of the key in the plot. More... | |
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. More... | |
void | Write2dDatasetEmptyLine (const std::string &dataset) |
Add an empty line in the data output sequence. More... | |
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. More... | |
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. More... | |
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. More... | |
Public Member Functions inherited from ns3::DataCollectionObject | |
DataCollectionObject () | |
virtual | ~DataCollectionObject () |
void | Disable (void) |
Unset the status of an individual object. More... | |
void | Enable (void) |
Set the status of an individual object. More... | |
std::string | GetName (void) const |
Get the object's name. More... | |
virtual bool | IsEnabled (void) const |
Check the status of an individual object. More... | |
void | SetName (std::string name) |
Set the object's name. More... | |
Public Member Functions inherited from ns3::Object | |
Object () | |
Constructor. More... | |
virtual | ~Object () |
Destructor. More... | |
void | AggregateObject (Ptr< Object > other) |
Aggregate two Objects together. More... | |
void | Dispose (void) |
Dispose of this Object. More... | |
AggregateIterator | GetAggregateIterator (void) const |
Get an iterator to the Objects aggregated to this one. More... | |
virtual TypeId | GetInstanceTypeId (void) const |
Get the most derived TypeId for this Object. More... | |
template<> | |
Ptr< Object > | GetObject () const |
Specialization of () for objects of type ns3::Object. More... | |
template<typename T > | |
Ptr< T > | GetObject (TypeId tid) const |
Get a pointer to the requested aggregated Object by TypeId. More... | |
template<> | |
Ptr< Object > | GetObject (TypeId tid) const |
Specialization of (TypeId tid) for objects of type ns3::Object. More... | |
template<typename T > | |
Ptr< T > | GetObject (void) const |
Get a pointer to the requested aggregated Object. More... | |
void | Initialize (void) |
Invoke DoInitialize on all Objects aggregated to this one. More... | |
bool | IsInitialized (void) const |
Check if the object has been initialized. More... | |
Public Member Functions inherited from ns3::SimpleRefCount< Object, ObjectBase, ObjectDeleter > | |
SimpleRefCount () | |
Default constructor. More... | |
SimpleRefCount (const SimpleRefCount &o[[maybe_unused]]) | |
Copy constructor. More... | |
uint32_t | GetReferenceCount (void) const |
Get the reference count of the object. More... | |
SimpleRefCount & | operator= ([[maybe_unused]] const SimpleRefCount &o) |
Assignment operator. More... | |
void | Ref (void) const |
Increment the reference count. More... | |
void | Unref (void) const |
Decrement the reference count. More... | |
Public Member Functions inherited from ns3::ObjectBase | |
virtual | ~ObjectBase () |
Virtual destructor. More... | |
void | GetAttribute (std::string name, AttributeValue &value) const |
Get the value of an attribute, raising fatal errors if unsuccessful. More... | |
bool | GetAttributeFailSafe (std::string name, AttributeValue &value) const |
Get the value of an attribute without raising erros. More... | |
void | SetAttribute (std::string name, const AttributeValue &value) |
Set a single attribute, raising fatal errors if unsuccessful. More... | |
bool | SetAttributeFailSafe (std::string name, const AttributeValue &value) |
Set a single attribute without raising errors. More... | |
bool | TraceConnect (std::string name, std::string context, const CallbackBase &cb) |
Connect a TraceSource to a Callback with a context. More... | |
bool | TraceConnectWithoutContext (std::string name, const CallbackBase &cb) |
Connect a TraceSource to a Callback without a context. More... | |
bool | TraceDisconnect (std::string name, std::string context, const CallbackBase &cb) |
Disconnect from a TraceSource a Callback previously connected with a context. More... | |
bool | TraceDisconnectWithoutContext (std::string name, const CallbackBase &cb) |
Disconnect from a TraceSource a Callback previously connected without a context. More... | |
Static Public Member Functions | |
static TypeId | GetTypeId () |
Get the type ID. More... | |
static void | Set2dDatasetDefaultErrorBars (enum Gnuplot2dDataset::ErrorBars errorBars) |
Change default errorbars style for all newly created objects. More... | |
static void | Set2dDatasetDefaultExtra (const std::string &extra) |
Change extra formatting style parameters for newly created objects. More... | |
static void | Set2dDatasetDefaultStyle (enum Gnuplot2dDataset::Style style) |
Change default style for all newly created objects. More... | |
Static Public Member Functions inherited from ns3::DataCollectionObject | |
static TypeId | GetTypeId () |
Get the type ID. More... | |
Static Public Member Functions inherited from ns3::Object | |
static TypeId | GetTypeId (void) |
Register this type. More... | |
Static Public Member Functions inherited from ns3::ObjectBase | |
static TypeId | GetTypeId (void) |
Get the type ID. More... | |
Private Attributes | |
std::map< std::string, Gnuplot2dDataset > | m_2dDatasetMap |
Maps context strings to 2D datasets. More... | |
std::string | m_extra |
The extra gnuplot command that will be added to the gnuplot control statements. More... | |
Gnuplot | m_gnuplot |
Used to create gnuplot files. More... | |
std::string | m_graphicsFileName |
The graphics file name with its extension. More... | |
std::string | m_outputFileNameWithoutExtension |
The output file name without any extension. More... | |
std::string | m_terminal |
The terminal. More... | |
std::string | m_title |
The title. More... | |
bool | m_titleSet |
Set equal to true after setting the title. More... | |
bool | m_xAndYLegendsSet |
Set equal to true after setting the x and y legends. More... | |
std::string | m_xLegend |
The x legend. More... | |
std::string | m_yLegend |
The y legend. More... | |
Additional Inherited Members | |
Protected Member Functions inherited from ns3::Object | |
Object (const Object &o) | |
Copy an Object. More... | |
virtual void | DoDispose (void) |
Destructor implementation. More... | |
virtual void | DoInitialize (void) |
Initialize() implementation. More... | |
virtual void | NotifyNewAggregate (void) |
Notify all Objects aggregated to this one of a new Object being aggregated. More... | |
Protected Member Functions inherited from ns3::ObjectBase | |
void | ConstructSelf (const AttributeConstructionList &attributes) |
Complete construction of ObjectBase; invoked by derived classes. More... | |
virtual void | NotifyConstructionCompleted (void) |
Notifier called once the ObjectBase is fully constructed. More... | |
Protected Attributes inherited from ns3::DataCollectionObject | |
bool | m_enabled |
Object's activation state. More... | |
std::string | m_name |
Name of the object within the data collection framework. More... | |
Related Functions inherited from ns3::ObjectBase | |
static TypeId | GetObjectIid (void) |
Ensure the TypeId for ObjectBase gets fully configured to anchor the inheritance tree properly. More... | |
This aggregator produces output used to make gnuplot plots.
Introspection did not find any typical Config paths.
No Attributes are defined for this type.
No TraceSources are defined for this type.
Size of this type is 568 bytes (on a 64-bit architecture).
Definition at line 38 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 42 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 46 of file gnuplot-aggregator.cc.
References NS_LOG_FUNCTION.
|
virtual |
Definition at line 59 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 224 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 217 of file gnuplot-aggregator.cc.
References ns3::Gnuplot::AppendExtra(), m_gnuplot, and NS_LOG_FUNCTION.
|
static |
Get the type ID.
Definition at line 36 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 298 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 242 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 278 of file gnuplot-aggregator.cc.
References NS_LOG_FUNCTION, and ns3::Gnuplot2dDataset::SetDefaultStyle().
void ns3::GnuplotAggregator::Set2dDatasetErrorBars | ( | const std::string & | dataset, |
enum 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 305 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 249 of file gnuplot-aggregator.cc.
References m_2dDatasetMap, NS_ABORT_MSG, and NS_LOG_FUNCTION.
void ns3::GnuplotAggregator::Set2dDatasetStyle | ( | const std::string & | dataset, |
enum 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 285 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 210 of file gnuplot-aggregator.cc.
References m_gnuplot, NS_LOG_FUNCTION, and ns3::Gnuplot::SetExtra().
void ns3::GnuplotAggregator::SetKeyLocation | ( | enum KeyLocation | keyLocation | ) |
Set the location of the key in the plot.
keyLocation | the location of the key in the plot. |
Definition at line 318 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 202 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 183 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 194 of file gnuplot-aggregator.cc.
References m_gnuplot, m_titleSet, NS_LOG_FUNCTION, and ns3::Gnuplot::SetTitle().
void ns3::GnuplotAggregator::Write2d | ( | std::string | context, |
double | x, | ||
double | y | ||
) |
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 105 of file gnuplot-aggregator.cc.
References m_2dDatasetMap, ns3::DataCollectionObject::m_enabled, NS_ABORT_MSG, NS_LOG_FUNCTION, and sample-rng-plot::x.
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 262 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 122 of file gnuplot-aggregator.cc.
References m_2dDatasetMap, ns3::DataCollectionObject::m_enabled, NS_ABORT_MSG, NS_LOG_FUNCTION, and sample-rng-plot::x.
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 162 of file gnuplot-aggregator.cc.
References m_2dDatasetMap, ns3::DataCollectionObject::m_enabled, NS_ABORT_MSG, NS_LOG_FUNCTION, and sample-rng-plot::x.
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 142 of file gnuplot-aggregator.cc.
References m_2dDatasetMap, ns3::DataCollectionObject::m_enabled, NS_ABORT_MSG, NS_LOG_FUNCTION, and sample-rng-plot::x.
|
private |
Maps context strings to 2D datasets.
Definition at line 294 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 282 of file gnuplot-aggregator.h.
|
private |
Used to create gnuplot files.
Definition at line 291 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 266 of file gnuplot-aggregator.h.
Referenced by SetTerminal().
|
private |
The output file name without any extension.
Definition at line 263 of file gnuplot-aggregator.h.
Referenced by ~GnuplotAggregator(), and SetTerminal().
|
private |
The terminal.
Definition at line 272 of file gnuplot-aggregator.h.
|
private |
The title.
Definition at line 269 of file gnuplot-aggregator.h.
|
private |
Set equal to true after setting the title.
Definition at line 285 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 288 of file gnuplot-aggregator.h.
Referenced by ~GnuplotAggregator(), and SetLegend().
|
private |
The x legend.
Definition at line 275 of file gnuplot-aggregator.h.
|
private |
The y legend.
Definition at line 278 of file gnuplot-aggregator.h.