A Discrete-Event Network Simulator
API
ns3::GnuplotAggregator Class Reference

This aggregator produces output used to make gnuplot plots. More...

#include "gnuplot-aggregator.h"

+ Inheritance diagram for ns3::GnuplotAggregator:
+ Collaboration diagram for ns3::GnuplotAggregator:

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< ObjectGetObject () 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< ObjectGetObject (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...
 
SimpleRefCountoperator= ([[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, Gnuplot2dDatasetm_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...
 

Detailed Description

This aggregator produces output used to make gnuplot plots.

Introspection did not find any typical Config paths.


No Attributes are defined for this type.

Attributes defined in parent class ns3::DataCollectionObject

  • Name: Object's name
    • Set with class: StringValue
    • Underlying type:
    • Initial value: unnamed
    • Flags: construct write read
  • Enabled: Object's enabled status
    • Set with class: BooleanValue
    • Underlying type: bool
    • Initial value: true
    • Flags: construct write read

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.

Member Enumeration Documentation

◆ KeyLocation

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.

Constructor & Destructor Documentation

◆ GnuplotAggregator()

ns3::GnuplotAggregator::GnuplotAggregator ( const std::string &  outputFileNameWithoutExtension)
Parameters
outputFileNameWithoutExtensionname 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

  • ".dat", a gnuplot control file named outputFileNameWithoutExtension + ".plt", and a shell script to generate the gnuplot named outputFileNameWithoutExtension + ".sh".

Definition at line 46 of file gnuplot-aggregator.cc.

References NS_LOG_FUNCTION.

◆ ~GnuplotAggregator()

ns3::GnuplotAggregator::~GnuplotAggregator ( )
virtual

Member Function Documentation

◆ Add2dDataset()

void ns3::GnuplotAggregator::Add2dDataset ( const std::string &  dataset,
const std::string &  title 
)

Adds a 2D dataset to the plot.

Parameters
datasetthe gnuplot 2D dataset to be plotted.
titlethe 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.

+ Here is the call graph for this function:

◆ AppendExtra()

void ns3::GnuplotAggregator::AppendExtra ( const std::string &  extra)
Parameters
extraappend extra gnuplot directive for output.

Definition at line 217 of file gnuplot-aggregator.cc.

References ns3::Gnuplot::AppendExtra(), m_gnuplot, and NS_LOG_FUNCTION.

+ Here is the call graph for this function:

◆ GetTypeId()

TypeId ns3::GnuplotAggregator::GetTypeId ( void  )
static

Get the type ID.

Returns
the object TypeId

Definition at line 36 of file gnuplot-aggregator.cc.

References ns3::TypeId::SetParent().

+ Here is the call graph for this function:

◆ Set2dDatasetDefaultErrorBars()

void ns3::GnuplotAggregator::Set2dDatasetDefaultErrorBars ( enum Gnuplot2dDataset::ErrorBars  errorBars)
static

Change default errorbars style for all newly created objects.

Parameters
errorBarsthe 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().

+ Here is the call graph for this function:

◆ Set2dDatasetDefaultExtra()

void ns3::GnuplotAggregator::Set2dDatasetDefaultExtra ( const std::string &  extra)
static

Change extra formatting style parameters for newly created objects.

Parameters
extraextra formatting

Definition at line 242 of file gnuplot-aggregator.cc.

References NS_LOG_FUNCTION, and ns3::GnuplotDataset::SetDefaultExtra().

+ Here is the call graph for this function:

◆ Set2dDatasetDefaultStyle()

void ns3::GnuplotAggregator::Set2dDatasetDefaultStyle ( enum Gnuplot2dDataset::Style  style)
static

Change default style for all newly created objects.

Parameters
stylethe 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().

+ Here is the call graph for this function:

◆ Set2dDatasetErrorBars()

void ns3::GnuplotAggregator::Set2dDatasetErrorBars ( const std::string &  dataset,
enum Gnuplot2dDataset::ErrorBars  errorBars 
)

Set the error bars to use for this dataset.

Parameters
datasetthe gnuplot 2D dataset to be plotted.
errorBarsthe 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.

◆ Set2dDatasetExtra()

void ns3::GnuplotAggregator::Set2dDatasetExtra ( const std::string &  dataset,
const std::string &  extra 
)

Add extra formatting parameters to this dataset.

Parameters
datasetthe gnuplot 2D dataset to be plotted.
extraextra 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.

◆ Set2dDatasetStyle()

void ns3::GnuplotAggregator::Set2dDatasetStyle ( const std::string &  dataset,
enum Gnuplot2dDataset::Style  style 
)

Set the style of plotting to use for this dataset.

Parameters
datasetthe gnuplot 2D dataset to be plotted.
stylethe 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.

◆ SetExtra()

void ns3::GnuplotAggregator::SetExtra ( const std::string &  extra)
Parameters
extraset extra gnuplot directive for output.

Definition at line 210 of file gnuplot-aggregator.cc.

References m_gnuplot, NS_LOG_FUNCTION, and ns3::Gnuplot::SetExtra().

+ Here is the call graph for this function:

◆ SetKeyLocation()

void ns3::GnuplotAggregator::SetKeyLocation ( enum KeyLocation  keyLocation)

Set the location of the key in the plot.

Parameters
keyLocationthe 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.

+ Here is the call graph for this function:

◆ SetLegend()

void ns3::GnuplotAggregator::SetLegend ( const std::string &  xLegend,
const std::string &  yLegend 
)
Parameters
xLegendthe legend for the x horizontal axis
yLegendthe 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().

+ Here is the call graph for this function:

◆ SetTerminal()

void ns3::GnuplotAggregator::SetTerminal ( const std::string &  terminal)
Parameters
terminalterminal 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().

+ Here is the call graph for this function:

◆ SetTitle()

void ns3::GnuplotAggregator::SetTitle ( const std::string &  title)
Parameters
titleset 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().

+ Here is the call graph for this function:

◆ Write2d()

void ns3::GnuplotAggregator::Write2d ( std::string  context,
double  x,
double  y 
)

Writes a 2D value to a 2D gnuplot dataset.

Parameters
contextspecifies the gnuplot 2D dataset for these values
xx coordinate for the new data point
yy 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().

+ Here is the caller graph for this function:

◆ Write2dDatasetEmptyLine()

void ns3::GnuplotAggregator::Write2dDatasetEmptyLine ( const std::string &  dataset)

Add an empty line in the data output sequence.

Parameters
datasetthe 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.

◆ Write2dWithXErrorDelta()

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.

Parameters
contextspecifies the gnuplot 2D dataset for these values
xx coordinate for the new data point
yy coordinate for the new data point
errorDeltax 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.

◆ Write2dWithXYErrorDelta()

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.

Parameters
contextspecifies the gnuplot 2D dataset for these values
xx coordinate for the new data point
yy coordinate for the new data point
xErrorDeltax data point uncertainty
yErrorDeltay 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.

◆ Write2dWithYErrorDelta()

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.

Parameters
contextspecifies the gnuplot 2D dataset for these values
xx coordinate for the new data point
yy coordinate for the new data point
errorDeltay 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.

Member Data Documentation

◆ m_2dDatasetMap

std::map<std::string, Gnuplot2dDataset> ns3::GnuplotAggregator::m_2dDatasetMap
private

◆ m_extra

std::string ns3::GnuplotAggregator::m_extra
private

The extra gnuplot command that will be added to the gnuplot control statements.

Definition at line 282 of file gnuplot-aggregator.h.

◆ m_gnuplot

Gnuplot ns3::GnuplotAggregator::m_gnuplot
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().

◆ m_graphicsFileName

std::string ns3::GnuplotAggregator::m_graphicsFileName
private

The graphics file name with its extension.

Definition at line 266 of file gnuplot-aggregator.h.

Referenced by SetTerminal().

◆ m_outputFileNameWithoutExtension

std::string ns3::GnuplotAggregator::m_outputFileNameWithoutExtension
private

The output file name without any extension.

Definition at line 263 of file gnuplot-aggregator.h.

Referenced by ~GnuplotAggregator(), and SetTerminal().

◆ m_terminal

std::string ns3::GnuplotAggregator::m_terminal
private

The terminal.

Definition at line 272 of file gnuplot-aggregator.h.

◆ m_title

std::string ns3::GnuplotAggregator::m_title
private

The title.

Definition at line 269 of file gnuplot-aggregator.h.

◆ m_titleSet

bool ns3::GnuplotAggregator::m_titleSet
private

Set equal to true after setting the title.

Definition at line 285 of file gnuplot-aggregator.h.

Referenced by ~GnuplotAggregator(), and SetTitle().

◆ m_xAndYLegendsSet

bool ns3::GnuplotAggregator::m_xAndYLegendsSet
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().

◆ m_xLegend

std::string ns3::GnuplotAggregator::m_xLegend
private

The x legend.

Definition at line 275 of file gnuplot-aggregator.h.

◆ m_yLegend

std::string ns3::GnuplotAggregator::m_yLegend
private

The y legend.

Definition at line 278 of file gnuplot-aggregator.h.


The documentation for this class was generated from the following files: